mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:19:24 +02:00
fpvectorial: Support writing gradient opacity in svg.
This commit is contained in:
parent
0e8088ef64
commit
c051f85d6f
@ -135,7 +135,7 @@ end;
|
|||||||
function TvSVGVectorialWriter.GetGradientBrushAsXML(ABrush: TvBrush): String;
|
function TvSVGVectorialWriter.GetGradientBrushAsXML(ABrush: TvBrush): String;
|
||||||
var
|
var
|
||||||
gradientCol: TvGradientColor;
|
gradientCol: TvGradientColor;
|
||||||
colorStr, gradientColors, gradientParams: String;
|
colorStr, opacityStr, gradientColors, gradientParams: String;
|
||||||
x1Str, y1Str, x2Str, y2Str: String;
|
x1Str, y1Str, x2Str, y2Str: String;
|
||||||
cxstr, cystr, rstr, fxstr, fystr: String;
|
cxstr, cystr, rstr, fxstr, fystr: String;
|
||||||
gradientTag: String;
|
gradientTag: String;
|
||||||
@ -189,8 +189,12 @@ begin
|
|||||||
gradientColors := '';
|
gradientColors := '';
|
||||||
for gradientCol in ABrush.Gradient_colors do begin
|
for gradientCol in ABrush.Gradient_colors do begin
|
||||||
colorStr := '#' + FPColorToRGBHexString(gradientCol.Color);
|
colorStr := '#' + FPColorToRGBHexString(gradientCol.Color);
|
||||||
gradientColors := gradientColors + Format('<stop offset="%f%%" stop-color="%s" />', [
|
if gradientCol.Color.Alpha <> alphaOpaque then
|
||||||
gradientCol.Position*100, colorStr], FPointSeparator);
|
opacityStr := Format('stop-opacity="%f" ', [gradientCol.Color.Alpha/alphaOpaque], FPointSeparator)
|
||||||
|
else
|
||||||
|
opacityStr := '';
|
||||||
|
gradientColors := gradientColors + Format('<stop offset="%f%%" stop-color="%s" %s/>', [
|
||||||
|
gradientCol.Position*100, colorStr, opacityStr], FPointSeparator);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result := Format(
|
Result := Format(
|
||||||
|
Loading…
Reference in New Issue
Block a user