mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
816898836b
- **File formats:** - (Add) File extension: .gktwo.ctb to `ChituboxFile` to be able to convert files for UniFormation GKtwo under special CTB format - (Add) UniFormation GKtwo compatibility under CTB format, if exporting JXS rename to CTB before open - (Fix) CTB, CBDDLP, PHOTON, FDG, PHZ: Read and write files larger then 4GB (#608) - **PCB Exposure:** - (Add) Offset X/Y to offset the PCB from it origin - (Add) Allow to toggle between "Show preview image cropped by it bounds" and "Show full preview image (The final result)" - (Improvement) Use rectangle instead of line for center line primitive (#607) - (Fix) Implement rotation to polygon and center line primitives (#607) - (Fix) Macros in a single line was not being parsed (#607) - (Fix) Invert color per file was not affecting primitives - **Network printers:** - (Add) Socket requests with TCP and UDP - (Add) AnyCubic printer preset (However it can't upload a file) - (Add) Scripts in request path to allow a first request to fetch data to the final request: - A script starts with **<\?** and ends with **?>** - First parameter is the first request to get response content from - Second parameter is the regex pattern to match content with - Third parameter is the final request that supports a parameter from regex matching group, eg: **{#1}** is match Group[1] value - **Example:** <\? getfiles > {0}\/(\d+\.[\da-zA-Z]+), > printfile,{#1} ?> - (Change) Allow to print a filename without send it when upload request path is empty - (Fix) Do not show printers with empty requests - (Change) Default layer compression to Lz4 instead of Png - (Improvement) Application is now culture aware but set part of `NumberFormat` to the `InvariantCulture.NumberFormat` - (Improvement) Material cost now show with the current culture currency symbol due previous change - (Improvement) Better submit of bug reports using sections and forms - (Improvement) Linux: AppImage now have a help manual with possible arguments and parameters - (Improvement) macOS: Codesign app on auto-installer and auto-upgrade to bypass arm64 run restriction (#431) - (Improvement) macOS: Rebuilt arm64 libcvextern.dylib to run with less dependencies (#431) - (Improvement) macOS: Try to show missing dependencies from openCV (if any) on the error message - (Fix) UI: layers sorted lexicographically instead of numerically in the issues list view (#611) - (Fix) PrusaSlicer printer parameters: UniFormation GKtwo
111 lines
3.2 KiB
C#
111 lines
3.2 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 Emgu.CV.CvEnum;
|
|
using System;
|
|
using System.Drawing;
|
|
|
|
namespace UVtools.Core.PixelEditor;
|
|
|
|
public class PixelDrawing : PixelOperation
|
|
{
|
|
private BrushShapeType _brushShape = BrushShapeType.Square;
|
|
private ushort _brushSize = 1;
|
|
private short _thickness = -1;
|
|
private byte _removePixelBrightness;
|
|
private double _rotationAngle;
|
|
public const byte MinRectangleBrush = 1;
|
|
public const byte MinCircleBrush = 7;
|
|
public enum BrushShapeType : byte
|
|
{
|
|
//Mask = 0,
|
|
Line = 1,
|
|
Triangle = 3,
|
|
Square = 4,
|
|
Pentagon = 5,
|
|
Hexagon = 6,
|
|
Heptagon = 7,
|
|
Octagon = 8,
|
|
Nonagon = 9,
|
|
Decagon = 10,
|
|
Hendecagon = 11,
|
|
Dodecagon = 12,
|
|
Circle = 100,
|
|
}
|
|
|
|
public override PixelOperationType OperationType => PixelOperationType.Drawing;
|
|
|
|
public BrushShapeType BrushShape
|
|
{
|
|
get => _brushShape;
|
|
set
|
|
{
|
|
if (!RaiseAndSetIfChanged(ref _brushShape, value)) return;
|
|
if (_brushShape == BrushShapeType.Circle)
|
|
{
|
|
BrushSize = Math.Max(MinCircleBrush, BrushSize);
|
|
}
|
|
}
|
|
}
|
|
|
|
public double RotationAngle
|
|
{
|
|
get => _rotationAngle;
|
|
set => RaiseAndSetIfChanged(ref _rotationAngle, Math.Round(value, 2));
|
|
}
|
|
|
|
public ushort BrushSize
|
|
{
|
|
get => _brushSize;
|
|
set => RaiseAndSetIfChanged(ref _brushSize, value);
|
|
}
|
|
|
|
public short Thickness
|
|
{
|
|
get => _thickness;
|
|
set => RaiseAndSetIfChanged(ref _thickness, value);
|
|
}
|
|
|
|
public byte RemovePixelBrightness
|
|
{
|
|
get => _removePixelBrightness;
|
|
set
|
|
{
|
|
if (!RaiseAndSetIfChanged(ref _removePixelBrightness, value)) return;
|
|
RaisePropertyChanged(nameof(RemovePixelBrightnessPercent));
|
|
}
|
|
}
|
|
|
|
public decimal RemovePixelBrightnessPercent => Math.Round(_removePixelBrightness * 100M / 255M, 2);
|
|
|
|
public bool IsAdd { get; }
|
|
|
|
public byte Brightness => IsAdd ? _pixelBrightness : _removePixelBrightness;
|
|
|
|
public Rectangle Rectangle { get; }
|
|
|
|
public PixelDrawing()
|
|
{
|
|
|
|
}
|
|
|
|
public PixelDrawing(uint layerIndex, Point location, LineType lineType, BrushShapeType brushShape, double rotationAngle, ushort brushSize, short thickness, byte removePixelBrightness, byte pixelBrightness, bool isAdd) : base(layerIndex, location, lineType, pixelBrightness)
|
|
{
|
|
_brushShape = brushShape;
|
|
_rotationAngle = rotationAngle;
|
|
_brushSize = brushSize;
|
|
_thickness = thickness;
|
|
_removePixelBrightness = removePixelBrightness;
|
|
IsAdd = isAdd;
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
} |