Small fixes in GraphicsPath usage, making sure they are disposed. Also making sure Anti-Aliasing is used when drawing the shadow.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1644 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-09 08:52:58 +00:00
commit 8374aa5fb6
7 changed files with 100 additions and 78 deletions

View file

@ -102,11 +102,12 @@ namespace Greenshot.Drawing {
using (Pen pen = new Pen(Color.White)) {
pen.Width = lineThickness;
SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen);
GraphicsPath path = new GraphicsPath();
path.AddLine(this.Left, this.Top, this.Left + this.Width, this.Top + this.Height);
Rectangle drawingBounds = Rectangle.Round(path.GetBounds(new Matrix(), pen));
drawingBounds.Inflate(2,2);
return drawingBounds;
using (GraphicsPath path = new GraphicsPath()) {
path.AddLine(this.Left, this.Top, this.Left + this.Width, this.Top + this.Height);
Rectangle drawingBounds = Rectangle.Round(path.GetBounds(new Matrix(), pen));
drawingBounds.Inflate(2, 2);
return drawingBounds;
}
}
} else {
return Rectangle.Empty;
@ -120,9 +121,10 @@ namespace Greenshot.Drawing {
using (Pen pen = new Pen(Color.White)) {
pen.Width = lineThickness;
SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen);
GraphicsPath path = new GraphicsPath();
path.AddLine(this.Left, this.Top, this.Left + this.Width, this.Top + this.Height);
return path.IsOutlineVisible(x,y, pen);
using (GraphicsPath path = new GraphicsPath()) {
path.AddLine(this.Left, this.Top, this.Left + this.Width, this.Top + this.Height);
return path.IsOutlineVisible(x, y, pen);
}
}
} else {
return false;