This may be more of a "working with drawing matrix's" than a wx question.
If i want to have multiple images drawn in my wxGraphicsContext and give them seperate rotations, how can I achive that?
When i rotate the second image, image 1 is rotated again as well. How can we make their rotation attributes apply separately?
Code: Select all
wxAutoBufferedPaintDC dc(this);
wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
gc.Translate(img1.posX + img1.GetWidth()/2.0, img1.posY + img1.GetHeight()/2.0);
gc.Rotate(img1.rotation);
gc.Scale(img1.xScale, img1.yScale);
gc.Translate(-img1.pos.x + img1.GetWidth()/2.0, -img1.pos.y + img1.GetHeight()/2.0);
gc.DrawBitmap(img1, img1.posX, img1.posY, img1.GetWidth(), img1.GetHeight());
gc.Translate(img2.posX + img2.GetWidth()/2.0, img2.posY + img2.GetHeight()/2.0);
gc.Rotate(img2.rotation);
gc.Scale(img2.xScale, img2.yScale);
gc.Translate(-img2.pos.x + img2.GetWidth()/2.0, -img2.pos.y + img2.GetHeight()/2.0);
gc.DrawBitmap(img2, img2.posX, img2.posY, img2.GetWidth(), img2.GetHeight());