Skip to content

Commit 829e1f3

Browse files
ver. 3.3.0
- Added "Wordwrap option" for the editor (active by default) - Updated the latest Image32 library - Added Color options in Viewer GUI (Grayscale, FixedColor, ApplyFixedColorToRootOnly) - Added Color options in Editor GUI - Updated to Image32 4.6 Released Feb 2025 to fix some drawing issue
1 parent ad7544f commit 829e1f3

File tree

309 files changed

+57433
-65729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+57433
-65729
lines changed

Debug/Preview Handlers/PreviewHandler Host/PreviewHost.dproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
33
<ProjectGuid>{4BBCE26D-2844-4147-BD21-3D736FC10602}</ProjectGuid>
4-
<ProjectVersion>19.5</ProjectVersion>
4+
<ProjectVersion>20.2</ProjectVersion>
55
<FrameworkType>VCL</FrameworkType>
66
<MainSource>PreviewHost.dpr</MainSource>
77
<Base>True</Base>
88
<Config Condition="'$(Config)'==''">Debug</Config>
99
<Platform Condition="'$(Platform)'==''">Win32</Platform>
1010
<TargetedPlatforms>3</TargetedPlatforms>
1111
<AppType>Application</AppType>
12+
<ProjectName Condition="'$(ProjectName)'==''">PreviewHost</ProjectName>
1213
</PropertyGroup>
1314
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
1415
<Base>true</Base>
41.5 KB
Binary file not shown.

Ext/SVGIconImageList/Image32/source/Clipper.Core.pas

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
(*******************************************************************************
44
* Author : Angus Johnson *
5-
* Date : 12 August 2024 *
6-
* Website : http://www.angusj.com *
5+
* Date : 22 November 2024 *
6+
* Website : https://www.angusj.com *
77
* Copyright : Angus Johnson 2010-2024 *
88
* Purpose : Core Clipper Library module *
99
* Contains structures and functions used throughout the library *
10-
* License : http://www.boost.org/LICENSE_1_0.txt *
10+
* License : https://www.boost.org/LICENSE_1_0.txt *
1111
*******************************************************************************)
1212

1313
{$I Clipper.inc}
@@ -19,23 +19,22 @@ interface
1919

2020
type
2121
{$IFDEF USINGZ}
22-
Ztype = type double;//Int64;//
23-
PZtype = ^Ztype;
22+
ZType = Int64; // or alternatively, ZType = double
2423
{$ENDIF}
2524

2625
PPoint64 = ^TPoint64;
2726
TPoint64 = record
2827
X, Y: Int64;
2928
{$IFDEF USINGZ}
30-
Z: Ztype;
29+
Z: ZType;
3130
{$ENDIF}
3231
end;
3332

3433
PPointD = ^TPointD;
3534
TPointD = record
3635
X, Y: double;
3736
{$IFDEF USINGZ}
38-
Z: Ztype;
37+
Z: ZType;
3938
{$ENDIF}
4039
end;
4140

@@ -125,6 +124,7 @@ TListEx = class
125124
fCount : integer;
126125
fCapacity : integer;
127126
fList : TPointerList;
127+
fSorted : Boolean;
128128
protected
129129
function UnsafeGet(idx: integer): Pointer; // no range checking
130130
procedure UnsafeSet(idx: integer; val: Pointer);
@@ -134,14 +134,16 @@ TListEx = class
134134
destructor Destroy; override;
135135
procedure Clear; virtual;
136136
function Add(item: Pointer): integer;
137+
procedure DeleteLast;
137138
procedure Swap(idx1, idx2: integer);
138-
procedure Sort(Compare: TListSortCompare);
139+
procedure Sort(Compare: TListSortCompareFunc);
139140
procedure Resize(count: integer);
140141
property Count: integer read fCount;
142+
property Sorted: Boolean read fSorted;
141143
property Item[idx: integer]: Pointer read UnsafeGet; default;
142144
end;
143145

144-
TClipType = (ctNone, ctIntersection, ctUnion, ctDifference, ctXor);
146+
TClipType = (ctNoClip, ctIntersection, ctUnion, ctDifference, ctXor);
145147

146148
TPointInPolygonResult = (pipOn, pipInside, pipOutside);
147149

@@ -544,6 +546,7 @@ procedure TListEx.Clear;
544546
fList := nil;
545547
fCount := 0;
546548
fCapacity := 0;
549+
fSorted := false;
547550
end;
548551
//------------------------------------------------------------------------------
549552

@@ -559,6 +562,13 @@ function TListEx.Add(item: Pointer): integer;
559562
fList[fCount] := item;
560563
Result := fCount;
561564
inc(fCount);
565+
fSorted := false;
566+
end;
567+
//------------------------------------------------------------------------------
568+
569+
procedure TListEx.DeleteLast;
570+
begin
571+
dec(fCount);
562572
end;
563573
//------------------------------------------------------------------------------
564574

@@ -615,10 +625,11 @@ procedure QuickSort(SortList: TPointerList; L, R: Integer;
615625
end;
616626
//------------------------------------------------------------------------------
617627

618-
procedure TListEx.Sort(Compare: TListSortCompare);
628+
procedure TListEx.Sort(Compare: TListSortCompareFunc);
619629
begin
620630
if fCount < 2 then Exit;
621631
QuickSort(FList, 0, fCount - 1, Compare);
632+
fSorted := true;
622633
end;
623634
//------------------------------------------------------------------------------
624635

@@ -658,6 +669,7 @@ procedure TListEx.Swap(idx1, idx2: integer);
658669
p := fList[idx1];
659670
fList[idx1] := fList[idx2];
660671
fList[idx2] := p;
672+
fSorted := false;
661673
end;
662674

663675
//------------------------------------------------------------------------------

Ext/SVGIconImageList/Image32/source/Clipper.Engine.pas

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
(*******************************************************************************
44
* Author : Angus Johnson *
5-
* Date : 12 August 2024 *
6-
* Website : http://www.angusj.com *
5+
* Date : 22 November 2024 *
6+
* Website : https://www.angusj.com *
77
* Copyright : Angus Johnson 2010-2024 *
88
* Purpose : This is the main polygon clipping module *
9-
* License : http://www.boost.org/LICENSE_1_0.txt *
9+
* License : https://www.boost.org/LICENSE_1_0.txt *
1010
*******************************************************************************)
1111

1212
interface
@@ -899,7 +899,7 @@ function PointInOpPolygon(const pt: TPoint64; op: POutPt): TPointInPolygonResult
899899
while (op2 <> op) and (op2.pt.Y > pt.Y) do op2 := op2.next;
900900
if (op2 = op) then break;
901901

902-
// must have touched or crossed the pt.Y horizonal
902+
// must have touched or crossed the pt.Y horizontal
903903
// and this must happen an even number of times
904904

905905
if (op2.pt.Y = pt.Y) then // touching the horizontal
@@ -2690,7 +2690,7 @@ procedure TClipperBase.IntersectEdges(e1, e2: PActive; pt: TPoint64);
26902690
end else if IsFront(e1) or (e1.outrec = e2.outrec) then
26912691
begin
26922692
// this 'else if' condition isn't strictly needed but
2693-
// it's sensible to split polygons that ony touch at
2693+
// it's sensible to split polygons that only touch at
26942694
// a common vertex (not at common edges).
26952695
op := AddLocalMaxPoly(e1, e2, pt);
26962696
{$IFDEF USINGZ}
@@ -2845,7 +2845,7 @@ procedure TClipperBase.ExecuteInternal(clipType: TClipType;
28452845
Y: Int64;
28462846
e: PActive;
28472847
begin
2848-
if clipType = ctNone then Exit;
2848+
if clipType = ctNoClip then Exit;
28492849
FFillRule := fillRule;
28502850
FClipType := clipType;
28512851
Reset;
@@ -3528,7 +3528,7 @@ procedure TClipperBase.DoHorizontal(horzEdge: PActive);
35283528
end;
35293529
if IsHotEdge(horzEdge) then
35303530
begin
3531-
//nb: The outrec containining the op returned by IntersectEdges
3531+
//nb: The outrec containing the op returned by IntersectEdges
35323532
//above may no longer be associated with horzEdge.
35333533
FHorzSegList.Add(GetLastOp(horzEdge));
35343534
end;

Ext/SVGIconImageList/Image32/source/Clipper.Minkowski.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Date : 21 December 2023 *
66
* Copyright : Angus Johnson 2010-2022 *
77
* Purpose : Minkowski Addition and Difference *
8-
* License : http://www.boost.org/LICENSE_1_0.txt *
8+
* License : https://www.boost.org/LICENSE_1_0.txt *
99
*******************************************************************************)
1010

1111
{$I Clipper.inc}

Ext/SVGIconImageList/Image32/source/Clipper.Offset.pas

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
(*******************************************************************************
44
* Author : Angus Johnson *
5-
* Date : 12 August 2024 *
6-
* Website : http://www.angusj.com *
7-
* Copyright : Angus Johnson 2010-2024 *
5+
* Date : 22 January 2025 *
6+
* Website : https://www.angusj.com *
7+
* Copyright : Angus Johnson 2010-2025 *
88
* Purpose : Path Offset (Inflate/Shrink) *
9-
* License : http://www.boost.org/LICENSE_1_0.txt *
9+
* License : https://www.boost.org/LICENSE_1_0.txt *
1010
*******************************************************************************)
1111

1212
{$I Clipper.inc}
@@ -142,6 +142,20 @@ implementation
142142
TwoPi : Double = 2 * PI;
143143
InvTwoPi : Double = 1/(2 * PI);
144144

145+
// Clipper2 approximates arcs by using series of relatively short straight
146+
//line segments. And logically, shorter line segments will produce better arc
147+
// approximations. But very short segments can degrade performance, usually
148+
// with little or no discernable improvement in curve quality. Very short
149+
// segments can even detract from curve quality, due to the effects of integer
150+
// rounding. Since there isn't an optimal number of line segments for any given
151+
// arc radius (that perfectly balances curve approximation with performance),
152+
// arc tolerance is user defined. Nevertheless, when the user doesn't define
153+
// an arc tolerance (ie leaves alone the 0 default value), the calculated
154+
// default arc tolerance (offset_radius / 500) generally produces good (smooth)
155+
// arc approximations without producing excessively small segment lengths.
156+
// See also: https://www.angusj.com/clipper2/Docs/Trigonometry.htm
157+
const arc_const = 0.002; // <-- 1/500
158+
145159
//------------------------------------------------------------------------------
146160
// Miscellaneous offset support functions
147161
//------------------------------------------------------------------------------
@@ -364,13 +378,12 @@ procedure TClipperOffset.DoGroupOffset(group: TGroup);
364378
if (group.joinType = jtRound) or (group.endType = etRound) then
365379
begin
366380
// calculate the number of steps required to approximate a circle
367-
// (see http://www.angusj.com/clipper2/Docs/Trigonometry.htm)
381+
// (see https://www.angusj.com/clipper2/Docs/Trigonometry.htm)
368382
// arcTol - when arc_tolerance_ is undefined (0) then curve imprecision
369383
// will be relative to the size of the offset (delta). Obviously very
370384
//large offsets will almost always require much less precision.
371-
arcTol := Iif(fArcTolerance > 0.01,
372-
Min(absDelta, fArcTolerance),
373-
Log10(2 + absDelta) * 0.25); // empirically derived
385+
arcTol := Iif(fArcTolerance > 0.0,
386+
Min(absDelta, fArcTolerance), absDelta * arc_const);
374387

375388
stepsPer360 := Pi / ArcCos(1 - arcTol / absDelta);
376389
if (stepsPer360 > absDelta * Pi) then
@@ -745,7 +758,7 @@ function IntersectPoint(const ln1a, ln1b, ln2a, ln2b: TPointD): TPointD;
745758
m1,b1,m2,b2: double;
746759
begin
747760
result := NullPointD;
748-
//see http://astronomy.swin.edu.au/~pbourke/geometry/lineline2d/
761+
//see https://paulbourke.net/geometry/pointlineplane/#i2l
749762
if (ln1B.X = ln1A.X) then
750763
begin
751764
if (ln2B.X = ln2A.X) then exit; //parallel lines
@@ -917,10 +930,8 @@ procedure TClipperOffset.DoRound(j, k: Integer; angle: double);
917930
// when fDeltaCallback64 is assigned, fGroupDelta won't be constant,
918931
// so we'll need to do the following calculations for *every* vertex.
919932
absDelta := Abs(fGroupDelta);
920-
arcTol := Iif(fArcTolerance > 0.01,
921-
Min(absDelta, fArcTolerance),
922-
Log10(2 + absDelta) * 0.25); // empirically derived
923-
//http://www.angusj.com/clipper2/Docs/Trigonometry.htm
933+
arcTol := Iif(fArcTolerance > 0.0,
934+
Min(absDelta, fArcTolerance), absDelta * arc_const);
924935
stepsPer360 := Pi / ArcCos(1 - arcTol / absDelta);
925936
if (stepsPer360 > absDelta * Pi) then
926937
stepsPer360 := absDelta * Pi; // avoid excessive precision
@@ -997,15 +1008,11 @@ procedure TClipperOffset.DoRound(j, k: Integer; angle: double);
9971008
// (ie over-shrunk paths) are removed.
9981009
{$IFDEF USINGZ}
9991010
AddPoint(GetPerpendic(fInPath[j], fNorms[k], fGroupDelta), fInPath[j].Z);
1000-
{$ELSE}
1001-
AddPoint(GetPerpendic(fInPath[j], fNorms[k], fGroupDelta));
1002-
{$ENDIF}
1003-
// when the angle is almost flat (cos_a ~= 1),
1004-
// it's safe to skip inserting this middle point
1005-
if (cosA < 0.999) then AddPoint(fInPath[j]); // (#405, #873)
1006-
{$IFDEF USINGZ}
1011+
AddPoint(fInPath[j]); // (#405, #873)
10071012
AddPoint(GetPerpendic(fInPath[j], fNorms[j], fGroupDelta), fInPath[j].Z);
10081013
{$ELSE}
1014+
AddPoint(GetPerpendic(fInPath[j], fNorms[k], fGroupDelta));
1015+
AddPoint(fInPath[j]); // (#405, #873)
10091016
AddPoint(GetPerpendic(fInPath[j], fNorms[j], fGroupDelta));
10101017
{$ENDIF}
10111018
end

Ext/SVGIconImageList/Image32/source/Clipper.RectClip.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
(*******************************************************************************
44
* Author : Angus Johnson *
55
* Date : 5 July 2024 *
6-
* Website : http://www.angusj.com *
6+
* Website : https://www.angusj.com *
77
* Copyright : Angus Johnson 2010-2024 *
88
* Purpose : FAST rectangular clipping *
9-
* License : http://www.boost.org/LICENSE_1_0.txt *
9+
* License : https://www.boost.org/LICENSE_1_0.txt *
1010
*******************************************************************************)
1111

1212
interface

Ext/SVGIconImageList/Image32/source/Clipper.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{.$DEFINE USINGZ}
88

99
///////////////////////////////////////////////////////////////////////////////
10-
//COMPILER DIFINED PREPROCESSOR DIRECTIVES (ie. do not touch ;))
10+
//COMPILER DEFINED PREPROCESSOR DIRECTIVES (ie. do not touch ;))
1111
///////////////////////////////////////////////////////////////////////////////
1212

1313
{$IFDEF FPC}

Ext/SVGIconImageList/Image32/source/Clipper.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
(*******************************************************************************
44
* Author : Angus Johnson *
55
* Date : 7 May 2024 *
6-
* Website : http://www.angusj.com *
6+
* Website : https://www.angusj.com *
77
* Copyright : Angus Johnson 2010-2024 *
88
* Purpose : This module provides a simple interface to the Clipper Library *
9-
* License : http://www.boost.org/LICENSE_1_0.txt *
9+
* License : https://www.boost.org/LICENSE_1_0.txt *
1010
*******************************************************************************)
1111

1212
interface
@@ -52,7 +52,7 @@ interface
5252
etSquare = Clipper.Offset.etSquare;
5353
etRound = Clipper.Offset.etRound;
5454

55-
ctNone = Clipper.Core.ctNone;
55+
ctNone = Clipper.Core.ctNoClip;
5656
ctIntersection = Clipper.Core.ctIntersection;
5757
ctUnion = Clipper.Core.ctUnion;
5858
ctDifference = Clipper.Core.ctDifference;
@@ -821,7 +821,7 @@ function DistanceSqrd(const pt1, pt2: TPoint64): double;
821821
var
822822
x1,y1,x2,y2: double;
823823
begin
824-
// nb: older versions of Delphi don't allow explicit typcasting
824+
// nb: older versions of Delphi don't allow explicit typecasting
825825
x1 := pt1.X; y1 := pt1.Y;
826826
x2 := pt2.X; y2 := pt2.Y;
827827
result := Sqr(x1 - x2) + Sqr(y1 - y2);

0 commit comments

Comments
 (0)