Files
UVtools/UVtools.Core/PixelEditor/PixelText.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

46 lines
1.4 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;
using Emgu.CV.CvEnum;
namespace UVtools.Core.PixelEditor
{
public class PixelText : PixelOperation
{
public FontFace Font { get; }
public double FontScale { get; }
public ushort Thickness { get; }
public string Text { get; }
public bool Mirror { get; }
public bool IsAdd { get; }
public byte Color { get; }
public Rectangle Rectangle { get; }
public PixelText(uint layerIndex, Point location, LineType lineType, FontFace font, double fontScale, ushort thickness, string text, bool mirror, bool isAdd) : base(PixelOperationType.Text, layerIndex, location, lineType)
{
Font = font;
FontScale = fontScale;
Thickness = thickness;
Text = text;
Mirror = mirror;
IsAdd = isAdd;
Color = (byte) (isAdd ? 255 : 0);
int baseLine = 0;
Size = CvInvoke.GetTextSize(text, font, fontScale, thickness, ref baseLine);
Rectangle = new Rectangle(location, Size);
}
}
}