Skip to content

Commit

Permalink
ver.3.5.2
Browse files Browse the repository at this point in the history
Fixed EtheaDev#218 render not smooth
  • Loading branch information
carloBarazzetta committed Feb 26, 2022
1 parent 253c8fb commit 9cb9f3a
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 63 deletions.
27 changes: 13 additions & 14 deletions Image32/source/Img32.Clipper.pas
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
interface

uses
Clipper.Core, Clipper.Engine, Clipper.Offset,
Clipper, Clipper.Core, Clipper.Engine, Clipper.Offset,
Img32, Img32.Draw, Img32.Vector;

//nb: InflatePath assumes that there's consistent winding where
Expand Down Expand Up @@ -84,17 +84,16 @@ function InflatePaths(const paths: TPathsD;
esRound: et := etRound;
else et := etPolygon;
end;
Result := TPathsD(Clipper.Offset.InflatePaths(
Clipper.Core.TPathsD(paths), delta,
jt, et, miterLimit, arcTolerance, minEdgeLength));
Result := Img32.TPathsD(Clipper.InflatePaths(
Clipper.Core.TPathsD(paths), delta, jt, et));
end;
//------------------------------------------------------------------------------

function UnionPolygon(const polygon: TPathD; fillRule: TFillRule): TPathsD;
begin
with TClipperD.Create do
try
AddPath(Clipper.Core.TPathD(polygon));
AddSubject(Clipper.Core.TPathD(polygon));
Execute(ctUnion,
Clipper.Core.TFillRule(fillRule), Clipper.Core.TPathsD(result));
finally
Expand All @@ -108,7 +107,7 @@ function UnionPolygons(const polygons: TPathsD;
begin
with TClipperD.Create do
try
AddPaths(Clipper.Core.TPathsD(polygons));
AddSubject(Clipper.Core.TPathsD(polygons));
Execute(ctUnion,
Clipper.Core.TFillRule(fillRule), Clipper.Core.TPathsD(result));
finally
Expand All @@ -122,8 +121,8 @@ function UnionPolygons(const polygon1, polygon2: TPathD;
begin
with TClipperD.Create do
try
AddPath(Clipper.Core.TPathD(polygon1), ptSubject);
AddPath(Clipper.Core.TPathD(polygon2), ptClip);
AddSubject(Clipper.Core.TPathD(polygon1));
AddClip(Clipper.Core.TPathD(polygon2));
Execute(ctUnion,
Clipper.Core.TFillRule(fillRule), Clipper.Core.TPathsD(result));
finally
Expand All @@ -137,8 +136,8 @@ function UnionPolygons(const polygons1, polygons2: TPathsD;
begin
with TClipperD.Create do
try
AddPaths(Clipper.Core.TPathsD(polygons1), ptSubject);
AddPaths(Clipper.Core.TPathsD(polygons2), ptClip);
AddSubject(Clipper.Core.TPathsD(polygons1));
AddClip(Clipper.Core.TPathsD(polygons2));
Execute(ctUnion,
Clipper.Core.TFillRule(fillRule), Clipper.Core.TPathsD(result));
finally
Expand All @@ -152,8 +151,8 @@ function IntersectPolygons(const polygons1, polygons2: TPathsD;
begin
with TClipperD.Create do
try
AddPaths(Clipper.Core.TPathsD(polygons1), ptSubject);
AddPaths(Clipper.Core.TPathsD(polygons2), ptClip);
AddSubject(Clipper.Core.TPathsD(polygons1));
AddClip(Clipper.Core.TPathsD(polygons2));
Execute(ctIntersection,
Clipper.Core.TFillRule(fillRule), Clipper.Core.TPathsD(result));
finally
Expand All @@ -167,8 +166,8 @@ function DifferencePolygons(const polygons1, polygons2: TPathsD;
begin
with TClipperD.Create do
try
AddPaths(Clipper.Core.TPathsD(polygons1), ptSubject);
AddPaths(Clipper.Core.TPathsD(polygons2), ptClip);
AddSubject(Clipper.Core.TPathsD(polygons1));
AddClip(Clipper.Core.TPathsD(polygons2));
Execute(ctDifference,
Clipper.Core.TFillRule(fillRule), Clipper.Core.TPathsD(result));
finally
Expand Down
4 changes: 2 additions & 2 deletions Image32/source/Img32.Extra.pas
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ procedure DrawEdge(img: TImage32; const rec: TRectD;
begin
with rec do
begin
p := Img32.Vector.MakePathD([left, bottom, left, top, right, top]);
p := Img32.Vector.MakePath([left, bottom, left, top, right, top]);
DrawLine(img, p, penWidth, topLeftColor, esButt);
p := Img32.Vector.MakePathD([right, top, right, bottom, left, bottom]);
p := Img32.Vector.MakePath([right, top, right, bottom, left, bottom]);
DrawLine(img, p, penWidth, bottomRightColor, esButt);
end;
end else
Expand Down
2 changes: 1 addition & 1 deletion Image32/source/Img32.FMX.pas
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ procedure AssignImage32ToFmxBitmap(img: TImage32; bmp: TBitmap);
src, dst: TBitmapData; //TBitmapData is a record.
begin
if not Assigned(img) or not Assigned(bmp) then Exit;
src := TBitMapData.Create(img.Width, img.Height, TPixelFormat.BGRA);
src := TBitmapData.Create(img.Width, img.Height, TPixelFormat.BGRA);
src.Data := img.PixelBase;
src.Pitch := img.Width * 4;
bmp.SetSize(img.Width, img.Height);
Expand Down
2 changes: 1 addition & 1 deletion Image32/source/Img32.SVG.Path.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ function TSvgSubPath.GetSimplePath: TPathD;
var
i: integer;
begin
Result := MakePathD([GetFirstPt.X, GetFirstPt.Y]);
Result := MakePath([GetFirstPt.X, GetFirstPt.Y]);
for i := 0 to High(fSegs) do
AppendPath(Result, fSegs[i].GetOnPathCtrlPts);
end;
Expand Down
10 changes: 3 additions & 7 deletions Image32/source/Img32.SVG.Writer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ implementation

const
indentSize = 2;
// nullfontInfo: TSVGFontInfo = (family: ttfUnknown; size: 0;
// spacing: 0.0; textLength: 0; italic: sfsUndefined; weight: -1;
// align: staUndefined; decoration: fdUndefined;
// baseShift: (rawVal: InvalidD; unitType: utUnknown));

//------------------------------------------------------------------------------
// Miscellaneous routines
Expand Down Expand Up @@ -616,7 +612,7 @@ procedure TSvgPathWriter.LineHTo(X: double);
begin
currPath := GetCurrentPath;
lastSeg := currPath.GetLastSeg;
path := MakePathD([X, fLastPt.Y]);
path := MakePath([X, fLastPt.Y]);
if Assigned(lastSeg) and (lastSeg is TSvgHSegment) then
lastSeg.ExtendSeg(path) else
currPath.AddHSeg(fLastPt, path);
Expand All @@ -632,7 +628,7 @@ procedure TSvgPathWriter.LineVTo(Y: double);
begin
currPath := GetCurrentPath;
lastSeg := currPath.GetLastSeg;
path := MakePathD([fLastPt.X, Y]);
path := MakePath([fLastPt.X, Y]);
if Assigned(lastSeg) and (lastSeg is TSvgVSegment) then
lastSeg.ExtendSeg(path) else
currPath.AddVSeg(fLastPt, path);
Expand All @@ -648,7 +644,7 @@ procedure TSvgPathWriter.LineTo(X,Y: double);
begin
currPath := GetCurrentPath;
lastSeg := currPath.GetLastSeg;
path := MakePathD([X, Y]);
path := MakePath([X, Y]);
if Assigned(lastSeg) and (lastSeg is TSvgLSegment) then
lastSeg.ExtendSeg(path) else
currPath.AddLSeg(fLastPt, path);
Expand Down
12 changes: 2 additions & 10 deletions Image32/source/Img32.Storage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ TStorageInfo = class(TStorage)
end;
function GetIntProp(const str: string; out success: Boolean): integer;
function GetBoolProp(const str: string; out success: Boolean): Boolean;
{$IF COMPILERVERSION > 31}
function GetCardProp(const str: string; out success: Boolean): Cardinal;
{$IFEND}
function GetDoubleProp(const str: string; out success: Boolean): Double;
function GetStringProp(const str: string; out success: Boolean): string;
function GetStorageProp(const str: string; out success: Boolean): TStorage;
Expand Down Expand Up @@ -173,7 +171,7 @@ TLoadPtrRec = record
tab = #9;
spacesPerLevel = 2;

{$IF COMPILERVERSION < 18}
{.$IF COMPILERVERSION < 18}
function UIntToStr(value: Cardinal): string;
begin
Result := Format('%d', [value]);
Expand All @@ -198,7 +196,7 @@ function TryStrToUInt64(const S: string; out Value: UInt64): Boolean;
Val(S, Value, E);
Result := E = 0;
end;
{$IFEND}
{.$IFEND}

//------------------------------------------------------------------------------
// Read from XML string functions
Expand Down Expand Up @@ -444,12 +442,10 @@ function GetIntProp(const str: string; out success: Boolean): integer;
end;
//------------------------------------------------------------------------------

{$IF COMPILERVERSION > 31}
function GetCardProp(const str: string; out success: Boolean): Cardinal;
begin
success := TryStrToUInt(str, Result);
end;
{$IFEND}
//------------------------------------------------------------------------------

function GetDoubleProp(const str: string; out success: Boolean): Double;
Expand Down Expand Up @@ -483,11 +479,7 @@ function GetColorProp(const str: string; out success: Boolean): TColor32;
begin
success := ConvertColorConst(str, Result);
end else
{$IF COMPILERVERSION > 31}
success := TryStrToUInt('$'+str, Cardinal(Result));
{$ELSE}
success := TryStrToInt('$'+str, Integer(Result));
{$IFEND}
end;
//------------------------------------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions Image32/source/Img32.Vector.pas
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ interface
const focalPoint: TPointD; angleRads: double): TPathD; overload;
function RotatePath(const paths: TPathsD;
const focalPoint: TPointD; angleRads: double): TPathsD; overload;
function MakePathI(const pts: array of integer): TPathD;
function MakePathD(const pts: array of double): TPathD;
function MakePath(const pts: array of integer): TPathD; overload;
function MakePath(const pts: array of double): TPathD; overload;
function GetBounds(const path: TPathD): TRect; overload;
function GetBounds(const paths: TPathsD): TRect; overload;
function GetBoundsD(const path: TPathD): TRectD; overload;
Expand Down Expand Up @@ -3388,7 +3388,7 @@ function FlattenQSpline(const pts: TPathD; tolerance: double = 0.0): TPathD;
end;
//------------------------------------------------------------------------------

function MakePathI(const pts: array of integer): TPathD;
function MakePath(const pts: array of integer): TPathD;
var
i,j, x,y, len: Integer;
begin
Expand All @@ -3411,7 +3411,7 @@ function MakePathI(const pts: array of integer): TPathD;
end;
//------------------------------------------------------------------------------

function MakePathD(const pts: array of double): TPathD;
function MakePath(const pts: array of double): TPathD;
var
i, j, len: Integer;
x,y: double;
Expand Down
1 change: 1 addition & 0 deletions Packages/D10_3/SVGIconImageListFMX.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ requires
SVGIconPackage;

contains
FMX.ImageSVG in '..\..\Source\FMX.ImageSVG.pas',
FMX.Image32SVG in '..\..\Source\FMX.Image32SVG.pas',
FMX.SVGIconImageList in '..\..\Source\FMX.SVGIconImageList.pas',
FMX.SVGIconImage in '..\..\Source\FMX.SVGIconImage.pas';
Expand Down
1 change: 1 addition & 0 deletions Packages/D10_3/SVGIconImageListFMX.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<DCCReference Include="fmx.dcp"/>
<DCCReference Include="SVGImage32Package.dcp"/>
<DCCReference Include="SVGIconPackage.dcp"/>
<DCCReference Include="..\..\Source\FMX.ImageSVG.pas"/>
<DCCReference Include="..\..\Source\FMX.Image32SVG.pas"/>
<DCCReference Include="..\..\Source\FMX.SVGIconImageList.pas"/>
<DCCReference Include="..\..\Source\FMX.SVGIconImage.pas"/>
Expand Down
1 change: 1 addition & 0 deletions Packages/D10_4/SVGIconImageListFMX.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ requires
SVGIconPackage;

contains
Img32.FMX in '..\..\Image32\Source\Img32.FMX.pas',
FMX.ImageSVG in '..\..\Source\FMX.ImageSVG.pas',
FMX.Image32SVG in '..\..\Source\FMX.Image32SVG.pas',
FMX.SVGIconImageList in '..\..\Source\FMX.SVGIconImageList.pas',
Expand Down
1 change: 1 addition & 0 deletions Packages/D10_4/SVGIconImageListFMX.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<DCCReference Include="fmx.dcp"/>
<DCCReference Include="SVGImage32Package.dcp"/>
<DCCReference Include="SVGIconPackage.dcp"/>
<DCCReference Include="..\..\Image32\Source\Img32.FMX.pas"/>
<DCCReference Include="..\..\Source\FMX.ImageSVG.pas"/>
<DCCReference Include="..\..\Source\FMX.Image32SVG.pas"/>
<DCCReference Include="..\..\Source\FMX.SVGIconImageList.pas"/>
Expand Down
1 change: 1 addition & 0 deletions Packages/D11_0/SVGIconImageListFMX.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ requires
SVGIconPackage;

contains
Img32.FMX in '..\..\Image32\Source\Img32.FMX.pas',
FMX.ImageSVG in '..\..\Source\FMX.ImageSVG.pas',
FMX.Image32SVG in '..\..\Source\FMX.Image32SVG.pas',
FMX.SVGIconImageList in '..\..\Source\FMX.SVGIconImageList.pas',
Expand Down
1 change: 1 addition & 0 deletions Packages/D11_0/SVGIconImageListFMX.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<DCCReference Include="fmx.dcp"/>
<DCCReference Include="SVGImage32Package.dcp"/>
<DCCReference Include="SVGIconPackage.dcp"/>
<DCCReference Include="..\..\Image32\Source\Img32.FMX.pas"/>
<DCCReference Include="..\..\Source\FMX.ImageSVG.pas"/>
<DCCReference Include="..\..\Source\FMX.Image32SVG.pas"/>
<DCCReference Include="..\..\Source\FMX.SVGIconImageList.pas"/>
Expand Down
17 changes: 10 additions & 7 deletions Packages/D11_0/dclSVGIconImageListFMX.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
<DCCReference Include="..\FMX.SVGIconImageListEditorUnit.pas">
<Form>SVGIconImageListEditorFMX</Form>
</DCCReference>
<DCCReference Include="..\FMX.SVGTextPropertyEditorUnit.pas">
<Form>SVGTextPropertyEditorFormFMX</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
Expand All @@ -141,8 +144,9 @@
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="3">
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\dclSVGIconImageListFMX_D10_3.bpl" Configuration="Release" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>dclSVGIconImageListFMX.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
Expand All @@ -157,14 +161,13 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl\dclSVGIconImageListFMX_D10_3.bpl" Configuration="Release" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>dclSVGIconImageListFMX.bpl</RemoteName>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Five engines to render SVG (Delphi Image32, Delphi TSVG, SKIA4Delphi, Direct2D wrapper or Cairo wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)

### Actual official version 3.5.1 (VCL+FMX)
### Actual official version 3.5.2 (VCL+FMX)

| Component | Description |
| - | - |
Expand Down Expand Up @@ -82,6 +82,9 @@ You can use [SVG Shell Extensions](https://github.com/EtheaDev/SVGShellExtension
Follow the [guide in Wiki section](https://github.com/EtheaDev/SVGIconImageList/wiki) to known how to use those components to modernize your Delphi VCL or FMX Windows applications scalable, colored and beautiful with few lines of code.

### RELEASE NOTES
26 Feb 2022: version 3.5.2 (VCL+FMX)
- Fixed rendering with FMX-Image32

23 Feb 2022: version 3.5.1 (VCL+FMX)
- Updated Image32 Library to 4.1.0 version
- Updated support to SKIA4Delphi 3.1.0
Expand Down
Loading

0 comments on commit 9cb9f3a

Please sign in to comment.