Fixed and optimized some drawing routines, still didn't find a solution for shadowing when target format has transparency.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1648 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-10 11:55:21 +00:00
commit dede5cf292
16 changed files with 275 additions and 161 deletions

View file

@ -41,7 +41,12 @@ namespace Greenshot.Drawing {
}
public override void Draw(Graphics g, RenderMode rm) {
public override void Draw(Graphics graphics, RenderMode rm) {
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
Color fillColor = GetFieldValueAsColor(FieldType.FILL_COLOR);
@ -61,7 +66,7 @@ namespace Greenshot.Drawing {
this.Top + currentStep,
this.Width,
this.Height);
g.DrawRectangle(shadowPen, shadowRect);
graphics.DrawRectangle(shadowPen, shadowRect);
currentStep++;
alpha = alpha - (basealpha / steps);
}
@ -72,14 +77,14 @@ namespace Greenshot.Drawing {
if (!Color.Transparent.Equals(fillColor)) {
using (Brush brush = new SolidBrush(fillColor)) {
g.FillRectangle(brush, rect);
graphics.FillRectangle(brush, rect);
}
}
if (lineThickness > 0) {
using (Pen pen = new Pen(lineColor)) {
pen.Width = lineThickness;
g.DrawRectangle(pen, rect);
graphics.DrawRectangle(pen, rect);
}
}
}