mirror of
https://github.com/greenshot/greenshot
synced 2025-08-13 02:07:07 -07:00
zoom crosshair optimizations for dark backgrounds
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2329 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
f6b944048b
commit
8b0f4a75ed
1 changed files with 28 additions and 17 deletions
|
@ -526,24 +526,35 @@ namespace Greenshot.Forms {
|
||||||
}
|
}
|
||||||
|
|
||||||
int pixelThickness = destinationRectangle.Width / sourceRectangle.Width;
|
int pixelThickness = destinationRectangle.Width / sourceRectangle.Width;
|
||||||
using (Pen pen = new Pen(Color.Black, pixelThickness)) {
|
using (Pen pen = new Pen(Color.White, 1)) {
|
||||||
int halfWidth = destinationRectangle.Width / 2;
|
using(Brush brush = new SolidBrush(Color.Black)) {
|
||||||
int halfWidthEnd = (destinationRectangle.Width / 2) - (pixelThickness / 2);
|
int halfWidth = destinationRectangle.Width / 2;
|
||||||
int halfHeight = destinationRectangle.Height / 2;
|
int halfWidthEnd = (destinationRectangle.Width / 2) - (pixelThickness / 2);
|
||||||
int halfHeightEnd = (destinationRectangle.Height / 2) - (pixelThickness / 2);
|
int halfHeight = destinationRectangle.Height / 2;
|
||||||
|
int halfHeightEnd = (destinationRectangle.Height / 2) - (pixelThickness / 2);
|
||||||
int drawAtHeight = destinationRectangle.Y + halfHeight;
|
|
||||||
int drawAtWidth = destinationRectangle.X + halfWidth;
|
int drawAtHeight = destinationRectangle.Y + halfHeight - (pixelThickness / 2);
|
||||||
|
int drawAtWidth = destinationRectangle.X + halfWidth - (pixelThickness / 2);
|
||||||
// Vertical top to middle
|
int padding = pixelThickness;
|
||||||
graphics.DrawLine(pen, drawAtWidth, destinationRectangle.Y, drawAtWidth, destinationRectangle.Y + halfHeightEnd);
|
|
||||||
// Vertical middle + 1 to bottom
|
// Vertical top to middle
|
||||||
graphics.DrawLine(pen, drawAtWidth, destinationRectangle.Y + halfHeightEnd + pixelThickness, drawAtWidth, destinationRectangle.Y + destinationRectangle.Height);
|
graphics.FillRectangle(brush, drawAtWidth, destinationRectangle.Y + padding, pixelThickness, halfHeightEnd - 2*padding);
|
||||||
// Horizontal left to middle
|
graphics.DrawRectangle(pen, drawAtWidth, destinationRectangle.Y + padding, pixelThickness, halfHeightEnd - 2*padding);
|
||||||
graphics.DrawLine(pen, destinationRectangle.X, drawAtHeight, destinationRectangle.X + halfWidthEnd, drawAtHeight);
|
// Vertical middle + 1 to bottom
|
||||||
// Horizontal middle + 1 to right
|
graphics.FillRectangle(brush, drawAtWidth, destinationRectangle.Y + halfHeightEnd + pixelThickness + padding, pixelThickness, halfHeightEnd - 2*padding);
|
||||||
graphics.DrawLine(pen, destinationRectangle.X + halfWidthEnd + pixelThickness, drawAtHeight, destinationRectangle.X + destinationRectangle.Width, drawAtHeight);
|
graphics.DrawRectangle(pen, drawAtWidth, destinationRectangle.Y + halfHeightEnd + pixelThickness + padding, pixelThickness, halfHeightEnd - 2*padding);
|
||||||
|
// Horizontal left to middle
|
||||||
|
graphics.FillRectangle(brush, destinationRectangle.X + padding, drawAtHeight, halfWidthEnd - 2*padding, pixelThickness);
|
||||||
|
graphics.DrawRectangle(pen, destinationRectangle.X + padding, drawAtHeight, halfWidthEnd - 2*padding, pixelThickness);
|
||||||
|
// Horizontal middle + 1 to right
|
||||||
|
graphics.FillRectangle(brush, destinationRectangle.X + halfWidthEnd + pixelThickness + padding, drawAtHeight, halfWidthEnd - 2*padding, pixelThickness);
|
||||||
|
graphics.DrawRectangle(pen, destinationRectangle.X + halfWidthEnd + pixelThickness + padding, drawAtHeight, halfWidthEnd - 2*padding, pixelThickness);
|
||||||
|
|
||||||
|
pen.Width = 2;
|
||||||
|
graphics.DrawEllipse(pen, destinationRectangle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue