wxPdfDocument: Plotting a Rotated Rectangle

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
rsb
I live to help wx-kind
I live to help wx-kind
Posts: 156
Joined: Fri May 29, 2015 7:26 pm

wxPdfDocument: Plotting a Rotated Rectangle

Post by rsb » Tue Jul 14, 2020 3:45 pm

Hello,

In wxWidgets, we're using the wxAffineMatrix2D class to display a rotated rectangle. Below is a small sample of the
code we use. This code works great on a panel but when we use the wxPdfDC class, the rectangle disappears.
Is this the correct way to display a rotated rectangle in this library or is there another way.

Thanks,
RSB

We're using:
wxWidgets: 3.1.0
wxpdfdoc 0.9.5
Compiler: MSVC 14
Platform: Windows 10 (2004).

Code: Select all

        double radians = degree__convert_to_radian(360 - orientation) ;
        
        wxAffineMatrix2D mat = dc->GetTransformMatrix() ;
        mat.Translate(origin_position.x_coord, origin_position.y_coord);
        mat.Rotate(radians) ;
        dc->SetTransformMatrix(mat);
        dc->DrawRoundedRectangle(-width / 2, -height / 2, width, height, radius)  ;
        dc->ResetTransformMatrix();
Last edited by doublemax on Tue Jul 14, 2020 4:05 pm, edited 1 time in total.
Reason: make title more specific

utelle
Moderator
Moderator
Posts: 949
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDocument: Plotting a Rotated Rectangle

Post by utelle » Tue Jul 14, 2020 11:07 pm

rsb wrote:
Tue Jul 14, 2020 3:45 pm
In wxWidgets, we're using the wxAffineMatrix2D class to display a rotated rectangle. Below is a small sample of the
code we use. This code works great on a panel but when we use the wxPdfDC class, the rectangle disappears.
Is this the correct way to display a rotated rectangle in this library or is there another way.
Unfortunately, wxPdfDC currently does not support the use of a transformation matrix - although the wxPdfDocument class itself does support transformations.

In principle it shouldn't be too hard to add this functionality to wxPdfDC. I will look into this, but I can't predict how long it will take to implement this feature.

Regards,

Ulrich

Post Reply