If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
-
mael15
- Super wx Problem Solver

- Posts: 280
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Post
by mael15 » Tue Feb 05, 2019 10:13 am
Hello everyone,
I rotate a wxImage using a wxGCDC. Now I need the position of the left top corner of that rotated wxImage on screen. How can I get that?
I have a hunch it might work using the wxGraphicsMatrix?
Thank you!
Code: Select all
auto degreeToRadians = [](double degree) {
return (degree * 3.1415926535897932384626433832795) / 180;
};
gcdc = static_cast<wxGCDC*>(dc);
gcdc->SetDeviceOrigin(500, 500);
gcdc->GetGraphicsContext()->Rotate(degreeToRadians(37));
-
Manolo
- Ultimate wxWidgets Guru

- Posts: 653
- Joined: Mon Apr 30, 2012 11:07 pm
Post
by Manolo » Tue Feb 05, 2019 1:41 pm
I suppose you know the coordinates [cx, cy] of that corner before the rotation.
Then the new coordinates after the rotation can be obtained by
Code: Select all
gcdc->GetGraphicsContext()->GetTransform().TransformPoint(&cx, &cy);