How to apply a transformation?

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
Post Reply
User avatar
pongasoft
Posts: 77
Joined: Sun Mar 11, 2018 5:57 pm
Location: Las Vegas, USA
Contact:

How to apply a transformation?

Post by pongasoft » Wed Aug 14, 2019 3:02 pm

I am implementing a custom view and I would like to have a "rotation" attribute that would rotate the drawing.

So I would like to implement something like this:

Code: Select all

void MyCustomView::Draw(CDrawContext *ctx)
{
 if(fRotation != 0) {
   // save state
   // apply rotation
 }

 ctx->draw...
 ctx->draw...
 ctx->draw...
 ...
 
 if(fRotation != 0) {
   // restore saved state
 }
}
If I call ctx->getCurrentTransform() it returns a const object so I cannot modify it. There is no setCurrentTransform method. And the pushTransform method is protected.

How do I implement such a thing?

Thanks
Yan

Arne Scheffler
Posts: 282
Joined: Mon Jun 20, 2016 7:53 am

Re: How to apply a transformation?

Post by Arne Scheffler » Wed Aug 14, 2019 7:53 pm

Hi,
read through the CParamDisplay::drawPlatformText() implementation. There the text is being drawn rotated. This should give you enough pointers how to do it.

Cheers,
Arne

Post Reply