Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
The Pascal Svg factory also suffers from the issue in #171. It replaces gradients with the FixedColor. The following replacement for TSVGBasc.UpdateStyle fixes that.
procedure TSVGBasic.UpdateStyle;
var
LRoot: TSVG;
C: Integer;
Style: TStyle;
S: string;
begin
LRoot := GetRoot;
for C := -2 to Length(FClasses) do
begin
case C of
-2: Style := LRoot.FStyles.GetStyleByName(FObjectName);
-1: Style := LRoot.FStyles.GetStyleByName('#' + FID);
else
begin
if C < Length(FClasses) then
begin
if Assigned(LRoot) then
begin
Style := LRoot.FStyles.GetStyleByName(FObjectName + '.' + FClasses[C]);
if Style = nil then
begin
Style := LRoot.FStyles.GetStyleByName('.' + FClasses[C]);
if Style = nil then
Style := LRoot.FStyles.GetStyleByName(FClasses[C]);
end;
end else
Style := nil;
end else
Style := FStyle;
end;
end;
if Assigned(Style) then
ReadStyle(Style);
end;
if FFillURI <> '' then
begin
S := FFillURI;
FFillURI := ParseURI(FFillURI);
if FFillURI = '' then
begin
if LRoot.Grayscale then
FFillColor := GetSVGGrayscale(GetSVGColor(S))
else
begin
FFillColor := GetSVGColor(S);
if (LRoot.FixedColor <> SVG_INHERIT_COLOR) and
(FFillColor <> SVG_INHERIT_COLOR) and (FFillColor <> SVG_NONE_COLOR)
and ((LRoot = Self) or not LRoot.ApplyFixedColorToRootOnly)
then
FFillColor := LRoot.FixedColor;
end;
end;
end;
if FStrokeURI <> '' then
begin
S := FStrokeURI;
FStrokeURI := ParseURI(FStrokeURI);
if FStrokeURI = '' then
begin
if LRoot.Grayscale then
FStrokeColor := GetSVGGrayscale(GetSVGColor(S))
else
begin
FStrokeColor := GetSVGColor(S);
if (LRoot.FixedColor <> SVG_INHERIT_COLOR) and
(FStrokeColor <> SVG_INHERIT_COLOR) and (FStrokeColor <> SVG_NONE_COLOR)
and ((LRoot = Self) or not LRoot.ApplyFixedColorToRootOnly)
then
FStrokeColor := LRoot.FixedColor;
end;
end;
end;
FStyleChanged := False;
end;
The Pascal Svg factory also suffers from the issue in #171. It replaces gradients with the FixedColor. The following replacement for TSVGBasc.UpdateStyle fixes that.