mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
Simplified code by better utilising DrawEllipse
The only downside of this simplification is that it no longer produces the 'glow' around the step label.
This commit is contained in:
parent
c374cd91d3
commit
a60139d91d
2 changed files with 6 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2010
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Greenshot", "Greenshot\Greenshot.csproj", "{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}"
|
||||
EndProject
|
||||
|
@ -181,7 +181,6 @@ Global
|
|||
{9C0ECC4C-7807-4111-916A-4F57BB29788A}.Release|x86.Build.0 = Release|x86
|
||||
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9801F62C-540F-4BFE-9211-6405DEDE563B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -193,4 +192,7 @@ Global
|
|||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1D6A3118-38AE-46C7-BEDA-FF399F001344}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -213,37 +213,8 @@ namespace Greenshot.Drawing {
|
|||
int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
|
||||
bool shadow = GetFieldValueAsBool(FieldType.SHADOW);
|
||||
|
||||
if (shadow)
|
||||
{
|
||||
const int basealpha = 100;
|
||||
Rectangle dropShadowRect = rect;
|
||||
EllipseContainer.DrawEllipse(rect, graphics, rm, lineThickness, lineColor, fillColor, shadow);
|
||||
|
||||
// Draw glow around step label
|
||||
dropShadowRect.Inflate(1, 1);
|
||||
EllipseContainer.DrawEllipse(dropShadowRect, graphics, rm, 0, Color.Transparent, Color.FromArgb(basealpha, 100, 100, 100), false);
|
||||
|
||||
// Draw drop shadow
|
||||
dropShadowRect = rect;
|
||||
int steps = 4;
|
||||
int alpha = basealpha;
|
||||
for (int currentStep = 0; currentStep <= steps; currentStep++)
|
||||
{
|
||||
dropShadowRect.Offset(1, 1);
|
||||
EllipseContainer.DrawEllipse(dropShadowRect, graphics, rm, 0, Color.Transparent, Color.FromArgb(alpha, 100, 100, 100), false);
|
||||
alpha = alpha - basealpha / steps;
|
||||
}
|
||||
}
|
||||
|
||||
if (_drawAsRectangle) {
|
||||
RectangleContainer.DrawRectangle(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
|
||||
} else {
|
||||
if (lineThickness > 0)
|
||||
{
|
||||
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, lineColor, false);
|
||||
rect.Inflate(lineThickness * -2, lineThickness * -2);
|
||||
}
|
||||
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
|
||||
}
|
||||
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
|
||||
using (Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) {
|
||||
TextContainer.DrawText(graphics, rect, 0, textColor, false, _stringFormat, text, font);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue