Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
AImageIndex parameter is not used, FImageIndex is used instead. I think this is either bug or little bit misleading. As the SVGIconItem function is not inherited, so there is no need from that way.
function TSVGIconImage.SVGIconItem(const AImageIndex: Integer): TSVGIconItem;
var
{$IFDEF D10_3+}
LVirtualImageList: TVirtualImageList;
LItem: TVirtualImageListItem;
{$ENDIF}
LSVGIconItems: TSVGIconItems;
begin
Result := nil;
if FImageList is TSVGIconImageListBase then
begin
LSVGIconItems := TSVGIconImageListBase(FImageList).SVGIconItems;
Result := LSVGIconItems[FImageIndex];
end;
{$IFDEF D10_3+}
if (FImageList is TVirtualImageList) then
begin
LVirtualImageList := TVirtualImageList(FImageList);
if LVirtualImageList.ImageCollection is TSVGIconImageCollection then
begin
LSVGIconItems := TSVGIconImageCollection(LVirtualImageList.ImageCollection).SVGIconItems;
LItem := LVirtualImageList.Images[FImageIndex];
if Assigned(LItem) then
Result := LSVGIconItems[LItem.Collectionindex];
end;
end;
{$ENDIF}
end;
AImageIndex parameter is not used, FImageIndex is used instead. I think this is either bug or little bit misleading. As the SVGIconItem function is not inherited, so there is no need from that way.
function TSVGIconImage.SVGIconItem(const AImageIndex: Integer): TSVGIconItem; var {$IFDEF D10_3+} LVirtualImageList: TVirtualImageList; LItem: TVirtualImageListItem; {$ENDIF} LSVGIconItems: TSVGIconItems; begin Result := nil; if FImageList is TSVGIconImageListBase then begin LSVGIconItems := TSVGIconImageListBase(FImageList).SVGIconItems; Result := LSVGIconItems[FImageIndex]; end; {$IFDEF D10_3+} if (FImageList is TVirtualImageList) then begin LVirtualImageList := TVirtualImageList(FImageList); if LVirtualImageList.ImageCollection is TSVGIconImageCollection then begin LSVGIconItems := TSVGIconImageCollection(LVirtualImageList.ImageCollection).SVGIconItems; LItem := LVirtualImageList.Images[FImageIndex]; if Assigned(LItem) then Result := LSVGIconItems[LItem.Collectionindex]; end; end; {$ENDIF} end;