Skip to content

Commit

Permalink
v0.6.4.3
Browse files Browse the repository at this point in the history
* (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
  • Loading branch information
sn4k3 committed Aug 6, 2020
1 parent fc3b789 commit f53dc03
Show file tree
Hide file tree
Showing 10 changed files with 667 additions and 96 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Changelog

## 05/07/2020 - v0.6.4.2
## 06/08/2020 - 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

## 05/08/2020 - v0.6.4.2

* (Add) Hold "ALT" key when double clicking over items to invert AutoZoom setting, prevent or do zoom in issues or pixels, this will behave as !AutoZoom as long key is held
* (Improvement) Partial island update speed, huge boost performance over large files

## 04/07/2020 - v0.6.4.1
## 04/08/2020 - v0.6.4.1

* (Add) Partial update islands from current working layer and next layer when using pixel editor or island remove
* (Add) Setting: To enable or disable partial update islands
Expand Down
15 changes: 11 additions & 4 deletions UVtools.Core/Layer/LayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,16 +1330,23 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
switch (operationDrawing.BrushShape)
{
case PixelDrawing.BrushShapeType.Rectangle:
CvInvoke.Rectangle(mat, operationDrawing.Rectangle, new MCvScalar(operationDrawing.Color), -1);
CvInvoke.Rectangle(mat, operationDrawing.Rectangle, new MCvScalar(operationDrawing.Color), operationDrawing.Thickness, operationDrawing.LineType);
break;
case PixelDrawing.BrushShapeType.Circle:
CvInvoke.Circle(mat, operation.Location, operationDrawing.BrushSize / 2,
new MCvScalar(operationDrawing.Color), -1);
new MCvScalar(operationDrawing.Color), operationDrawing.Thickness, operationDrawing.LineType);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
else if (operation.OperationType == PixelOperation.PixelOperationType.Text)
{
var operationText = (PixelText)operation;
var mat = modfiedLayers.GetOrAdd(operation.LayerIndex, u => this[operation.LayerIndex].LayerMat);

CvInvoke.PutText(mat, operationText.Text, operationText.Location, operationText.Font, operationText.FontScale, new MCvScalar(operationText.Color), operationText.Thickness, operationText.LineType, operationText.Mirror);
}
else if (operation.OperationType == PixelOperation.PixelOperationType.Supports)
{
var operationSupport = (PixelSupport)operation;
Expand Down Expand Up @@ -1371,7 +1378,7 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
break; // White area end supporting
}

CvInvoke.Circle(mat, operation.Location, radius, new MCvScalar(255), -1);
CvInvoke.Circle(mat, operation.Location, radius, new MCvScalar(255), -1, operationSupport.LineType);
drawnLayers++;
}
}
Expand Down Expand Up @@ -1408,7 +1415,7 @@ public void DrawModifications(PixelHistory pixelHistory, OperationProgress progr
break; // Stop drill drain found!
}

CvInvoke.Circle(mat, operation.Location, radius, new MCvScalar(0), -1);
CvInvoke.Circle(mat, operation.Location, radius, new MCvScalar(0), -1, operationDrainHole.LineType);
drawnLayers++;
}
}
Expand Down
10 changes: 9 additions & 1 deletion UVtools.Core/PixelEditor/PixelDrawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
using System;
using System.Drawing;
using Emgu.CV.CvEnum;

namespace UVtools.Core.PixelEditor
{
Expand All @@ -23,18 +24,25 @@ public enum BrushShapeType : byte
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, BrushShapeType brushShape, ushort brushSize, bool isAdd) : base(PixelOperationType.Drawing, layerIndex, location)
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);

Expand Down
11 changes: 9 additions & 2 deletions UVtools.Core/PixelEditor/PixelOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* of this license document, but changing it is not allowed.
*/
using System.Drawing;
using Emgu.CV.CvEnum;

namespace UVtools.Core.PixelEditor
{
Expand All @@ -14,6 +15,7 @@ public class PixelOperation
public enum PixelOperationType : byte
{
Drawing,
Text,
Supports,
DrainHole,
}
Expand All @@ -38,17 +40,22 @@ public enum PixelOperationType : byte
/// </summary>
public Point Location { get; }

/// <summary>
/// Gets the <see cref="LineType"/> for the draw operation
/// </summary>
public LineType LineType { get; }

/// <summary>
/// Gets the total size of the operation
/// </summary>
public Size Size { get; private protected set; } = Size.Empty;


public PixelOperation(PixelOperationType operationType, uint layerIndex, Point location)
public PixelOperation(PixelOperationType operationType, uint layerIndex, Point location, LineType lineType = LineType.AntiAlias)
{
OperationType = operationType;
Location = location;
LayerIndex = layerIndex;
LineType = lineType;
}
}
}
45 changes: 45 additions & 0 deletions UVtools.Core/PixelEditor/PixelText.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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);
}
}
}
6 changes: 3 additions & 3 deletions UVtools.Core/UVtools.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl>
<Description>MSLA/DLP, file analysis, repair, conversion and manipulation</Description>
<Version>0.6.4.2</Version>
<Version>0.6.4.3</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyVersion>0.6.4.2</AssemblyVersion>
<FileVersion>0.6.4.2</FileVersion>
<AssemblyVersion>0.6.4.3</AssemblyVersion>
<FileVersion>0.6.4.3</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Loading

0 comments on commit f53dc03

Please sign in to comment.