Recent

Author Topic: [SOLVED] Rotation with affine  (Read 690 times)

Phoenix

  • Full Member
  • ***
  • Posts: 146
[SOLVED] Rotation with affine
« on: December 20, 2025, 09:28:22 pm »
Hi,
I need to apply some geometric elements (in the example, a "focus" rectangle, but it could also be a polyline made up of a rectangle and anchors) externally to the image I want to rotate. I was wondering if there's a way to combine everything in the rotation using affine without having to alter the image.

Thanks
« Last Edit: December 21, 2025, 03:59:27 pm by Phoenix »

circular

  • Hero Member
  • *****
  • Posts: 4471
    • Personal webpage
Re: Rotation with affine
« Reply #1 on: December 21, 2025, 07:15:31 am »
Hi Phoenix,

Yes, you can use Canvas2d for this, with the following steps:
- call save()
- define the transformation with translate() and rotate()
- do the drawing as if it were not rotated/translated
- call restore()

Regards
Conscience is the debugger of the mind

Phoenix

  • Full Member
  • ***
  • Posts: 146
Re: Rotation with affine
« Reply #2 on: December 21, 2025, 03:59:03 pm »
Canvas2D is interesting  :)
 thanks

 

TinyPortal © 2005-2018