Posts

Showing posts with the label affine

How can you draw an image with an affine transformation applied in FireMonkey? I would like to take a rectangular bitmap, and draw that (in a 2D form) stretched to a not-quite-arbitrary four-sided polygon, the corner points of which I calculate. It happens that the polygon will result in a shape that could be implemented via a simple affine transformation. I hoped for a way to use TCanvas.Matrix to achieve this, or for a Draw method that took a target polygon instead of a rectangle, or to be able to use TImage3D in a 2D form, or something similar. I can't find one. Any ideas?

How can you draw an image with an affine transformation applied in FireMonkey?  I would like to take a rectangular bitmap, and draw that (in a 2D form) stretched to a not-quite-arbitrary four-sided polygon, the corner points of which I calculate. It happens that the polygon will result in a shape that could be implemented via a simple affine transformation. I hoped for a way to use TCanvas.Matrix to achieve this, or for a Draw method that took a target polygon instead of a rectangle, or to be able to use TImage3D in a 2D form, or something similar.  I can't find one. Any ideas? I'm aware of TAffineTransformEffect but can't see how to go from the four quad points to the rotation/scale values it requires (and it seems to give different results in XE6 than the screenshots in the documentation.) Any ideas? #fmx   #firemonkey  #transformation #affine