ShareX/ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs

71 lines
2.6 KiB
C#
Raw Normal View History

2015-07-17 03:21:02 +12:00
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
2022-01-12 05:32:17 +13:00
Copyright (c) 2007-2022 ShareX Team
2015-07-17 03:21:02 +12:00
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
*/
#endregion License Information (GPL v3)
2016-05-03 22:06:58 +12:00
using System.Drawing;
2015-07-17 03:21:02 +12:00
namespace ShareX.ScreenCaptureLib
{
2016-05-03 22:06:58 +12:00
public abstract class BaseDrawingShape : BaseShape
2015-07-17 03:21:02 +12:00
{
2016-09-02 19:09:24 +12:00
public override ShapeCategory ShapeCategory { get; } = ShapeCategory.Drawing;
2016-05-04 05:58:18 +12:00
public Color BorderColor { get; set; }
public int BorderSize { get; set; }
2020-12-06 12:05:36 +13:00
public BorderStyle BorderStyle { get; set; }
public Color FillColor { get; set; }
2016-05-03 22:06:58 +12:00
2016-12-01 02:01:12 +13:00
public bool Shadow { get; set; }
2018-01-31 06:14:28 +13:00
public Color ShadowColor { get; set; }
public Point ShadowOffset { get; set; }
public bool IsShapeVisible => IsBorderVisible || IsFillVisible;
public bool IsBorderVisible => BorderSize > 0 && BorderColor.A > 0;
public bool IsFillVisible => FillColor.A > 0;
public override void OnConfigLoad()
{
2016-05-21 05:34:45 +12:00
BorderColor = AnnotationOptions.BorderColor;
BorderSize = AnnotationOptions.BorderSize;
BorderStyle = AnnotationOptions.BorderStyle;
2016-05-21 05:34:45 +12:00
FillColor = AnnotationOptions.FillColor;
Shadow = AnnotationOptions.Shadow;
2018-01-31 06:14:28 +13:00
ShadowColor = AnnotationOptions.ShadowColor;
ShadowOffset = AnnotationOptions.ShadowOffset;
}
public override void OnConfigSave()
{
AnnotationOptions.BorderColor = BorderColor;
AnnotationOptions.BorderSize = BorderSize;
AnnotationOptions.BorderStyle = BorderStyle;
AnnotationOptions.FillColor = FillColor;
AnnotationOptions.Shadow = Shadow;
2018-01-31 06:14:28 +13:00
AnnotationOptions.ShadowColor = ShadowColor;
AnnotationOptions.ShadowOffset = ShadowOffset;
}
public abstract void OnDraw(Graphics g);
2015-07-17 03:21:02 +12:00
}
}