Ok habe das Ganze meiner Meinung nach auf das notwendige Minimum reduziert.
Bekomme aber immer noch die vollen Hintergrund Flächen möchte alles was clFuchsia ist transparent haben.
Delphi-Quellcode:
Function tMarkerUtils.GenerateTriMarker(aColor: tColor): string;
var MarkerImage: TImage;
TransparentColor: TColor;
Points: array of TPoint;
begin
MarkerImage:= TImage.Create(nil);
try
MarkerImage.Width:= 55;
MarkerImage.Height:= 30;
MarkerImage.Picture:=nil;
TransparentColor := clFuchsia; // Background color
MarkerImage.Canvas.Brush.Style := bsClear;
MarkerImage.Canvas.Brush.Color:= TransparentColor;
MarkerImage.Picture.Bitmap.TransparentColor := TransparentColor;
MarkerImage.Picture.Bitmap.Transparent:= true;
MarkerImage.Canvas.FillRect(Rect(0, 0, MarkerImage.Width, MarkerImage.Height));
SetLength(Points, 3);
Points[0] := Point(5, 5);
Points[1] := Point(35, 5);
Points[2] := Point(20, 20);
MarkerImage.Canvas.Pen.Width := 2;
MarkerImage.Canvas.Pen.Color := clBlack;
MarkerImage.Canvas.Brush.Color := aColor;
MarkerImage.Canvas.Polygon(Points);
Result:= GetBase64Image(MarkerImage);
finally
MarkerImage.Free;
end;
end;