mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Moving back to trunk!
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1602 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
ad265b2c54
commit
8d458998a1
332 changed files with 17647 additions and 9466 deletions
|
@ -20,10 +20,8 @@
|
|||
*/
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
using Greenshot.Configuration;
|
||||
using Greenshot.Drawing.Fields;
|
||||
using Greenshot.Helpers;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
|
@ -38,7 +36,7 @@ namespace Greenshot.Drawing {
|
|||
AddField(GetType(), FieldType.LINE_THICKNESS, 2);
|
||||
AddField(GetType(), FieldType.LINE_COLOR, Color.Red);
|
||||
AddField(GetType(), FieldType.FILL_COLOR, Color.Transparent);
|
||||
AddField(GetType(), FieldType.SHADOW, false);
|
||||
AddField(GetType(), FieldType.SHADOW, true);
|
||||
}
|
||||
|
||||
public override void Draw(Graphics graphics, RenderMode renderMode) {
|
||||
|
@ -68,9 +66,10 @@ namespace Greenshot.Drawing {
|
|||
|
||||
//draw the original shape
|
||||
Rectangle rect = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height);
|
||||
|
||||
using (Brush brush = new SolidBrush(fillColor)) {
|
||||
graphics.FillEllipse(brush, rect);
|
||||
if (!Color.Transparent.Equals(fillColor)) {
|
||||
using (Brush brush = new SolidBrush(fillColor)) {
|
||||
graphics.FillEllipse(brush, rect);
|
||||
}
|
||||
}
|
||||
|
||||
using (Pen pen = new Pen(lineColor)) {
|
||||
|
@ -87,5 +86,30 @@ namespace Greenshot.Drawing {
|
|||
// ellipse: x^2/a^2 + y^2/b^2 = 1
|
||||
return Math.Pow(xDistanceFromCenter,2)/Math.Pow(Width/2,2) + Math.Pow(yDistanceFromCenter,2)/Math.Pow(Height/2,2) < 1;
|
||||
}
|
||||
|
||||
public override bool ClickableAt(int x, int y) {
|
||||
Rectangle rect = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height);
|
||||
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS) + 10;
|
||||
Color fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR);
|
||||
|
||||
// If we clicked inside the rectangle and it's visible we are clickable at.
|
||||
if (!Color.Transparent.Equals(fillColor)) {
|
||||
if (Contains(x,y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// check the rest of the lines
|
||||
if (lineThickness > 0) {
|
||||
using (Pen pen = new Pen(Color.White)) {
|
||||
pen.Width = lineThickness;
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddEllipse(rect);
|
||||
return path.IsOutlineVisible(x, y, pen);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue