Files
UVtools/UVtools.Core/PixelEditor/PixelDrawing.cs
T
Tiago Conceição f53dc03881 v0.6.4.3
* (Add) Pixel Editor - Supports and Drain holes: AntiAliasing
* (Add) Pixel Editor - Drawing: Line type and defaults to AntiAliasing
* (Add) Pixel Editor - Drawing: Line thickness to allow hollow shapes
* (Add) Pixel Editor - Drawing: Layer depth, to add pixels at multiple layers at once
* (Add) Pixel Editor: Text writing
2020-08-06 03:43:56 +01:00

55 lines
1.7 KiB
C#

/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
using System.Drawing;
using Emgu.CV.CvEnum;
namespace UVtools.Core.PixelEditor
{
public class PixelDrawing : PixelOperation
{
public const byte MinRectangleBrush = 1;
public const byte MinCircleBrush = 7;
public enum BrushShapeType : byte
{
Rectangle = 0,
Circle
}
public BrushShapeType BrushShape { get; }
public ushort BrushSize { get; }
public short Thickness { get; }
//public ushort LayersBelow { get; }
//public ushort LayersAbove { get; }
public bool IsAdd { get; }
public byte Color { get; }
public Rectangle Rectangle { get; }
public PixelDrawing(uint layerIndex, Point location, LineType lineType, BrushShapeType brushShape, ushort brushSize, short thickness, bool isAdd) : base(PixelOperationType.Drawing, layerIndex, location, lineType)
{
BrushShape = brushShape;
BrushSize = brushSize;
Thickness = thickness;
IsAdd = isAdd;
Color = (byte) (isAdd ? 255 : 0);
int shiftPos = brushSize / 2;
Rectangle = new Rectangle(Math.Max(0, location.X - shiftPos), Math.Max(0, location.Y - shiftPos), brushSize-1, brushSize-1);
Size = new Size(BrushSize, BrushSize);
}
}
}