Overview Examples Screenshots Comparisons Applications Download Documentation Tutorials Bazaar Status & Roadmap FAQ Authors & License Forums Funding Ultimate++
Search on this site
Search in forums

Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » how to convert view point to logic point (Painter point convert)
how to convert view point to logic point Sun, 20 December 2020 08:45
 zouql Messages: 15Registered: December 2020 Location: China Promising Member
Hi all:
when using Painter's scale/translate/rotate, it convert the user's
point to view point. So when mouse event LeftDown(Point p,dword flags),
the Point p is view point, Is there any way to convert this viewpoint
to user point for user's comparison and judgment logic?
Re: how to convert view point to logic point [message #55838 is a reply to message #55837] Sun, 20 December 2020 09:43
 mirek Messages: 13986Registered: November 2005 Ultimate Member
zouql wrote on Sun, 20 December 2020 08:45
Hi all:
when using Painter's scale/translate/rotate, it convert the user's
point to view point. So when mouse event LeftDown(Point p,dword flags),
the Point p is view point, Is there any way to convert this viewpoint
to user point for user's comparison and judgment logic?

If you need to handle this in really generic way, I think the best is to use the transformation matrix - Xform2D.

I would probably stopped using scale/translate/rotate and instead created a method that creates Xform2D (by multiplying with Xform2D::Scale, Rotate, Translate), then assign this whole matrix to Painter (using Transform method). Then, to convert view point back, compute Inverse matrix and use Xform2D::Transform...
Re: how to convert view point to logic point [message #55839 is a reply to message #55838] Sun, 20 December 2020 09:54
 zouql Messages: 15Registered: December 2020 Location: China Promising Member
Thank you, mirek,
The response was quick.
Looking forward to your improvement.
Re: how to convert view point to logic point [message #55840 is a reply to message #55839] Sun, 20 December 2020 13:09
 mirek Messages: 13986Registered: November 2005 Ultimate Member
zouql wrote on Sun, 20 December 2020 09:54
Thank you, mirek,
The response was quick.
Looking forward to your improvement.

Eh, just to be clear, while there are multitudes of improvements of U++ happening now, there is none planned for this particular case - there is a clear solution with existing U++.

By "I would" I mean how I would do it if I was in your place...

Mirek
 Previous Topic: Draw linker errors with freetype 2.10.4 Next Topic: [PATCH READY] New plugin/icons/silk
Goto Forum:

Current Time: Mon Jun 24 23:45:47 CEST 2024

Total time taken to generate the page: 0.01491 seconds