1

How To flip a TPath shape component data ? i have loaded a path data from an SVG image, but the shape is flipped, i want to flip it horizontally.

i tried to do the Canvas.CopyRec method but that is a VCL method i suppose.

var src, dest: TRect;
begin
  dest:=bounds(0, 0, image1.Picture.Width, image1.Picture.Height);
  //src:=rect(0, image1.Picture.Height-1, image1.Picture.Width-1, 0); // Vertical flip
  //src:=rect(image1.Picture.Width-1, 0, 0, image1.Picture.Height-1); // Horizontal 
  flip
  src:=rect(image1.Picture.Width-1, image1.Picture.Height-1, 0, 0); // Both flip
  image1.Picture.Bitmap.Canvas.CopyRect(dest, image1.Picture.Bitmap.Canvas, src);

i'm using Firemonkey and Delphi 10.3.2

Ken White
  • 123,280
  • 14
  • 225
  • 444
Delphier
  • 65
  • 5

1 Answers1

2

A simple solution for a horizontal flip can be made via a negative value in the property Scale.X of the component TPath.

Path1.Scale.X := -1; 

For a vertical flip use path1.Scale.Y := -1;