Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Assertion fails in BufferPainter::TransformOp() with rotated text
Assertion fails in BufferPainter::TransformOp() with rotated text [message #47288] |
Tue, 03 January 2017 09:55 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
When calling Painter::DrawText (for rotated text output):
...
painter.DrawText(x,y,rotation,text,font,Black());
...
The following assertion triggers in DEBUG mode:
void BufferPainter::TransformOp(const Xform2D& m)
{
ASSERT_(IsNull(current), "Cannot change transformation during path definition");
pathattr.mtx = attr.mtx = m * attr.mtx;
}
In RELEASE mode DrawText works just as it should, allowing rotation of text about its insertion point while retaining original transformation in the background (because of Begin()/End() pair involved). Similar temporary transformations are needed when rendering constant blocks of vector graphics at different locations with different scaling and rotation attributes. I guess Begin()/End() pairs should be used there too to preserve original transformation.
Is this assertion really needed for something?
Best regards,
Tom
|
|
|
Re: Assertion fails in BufferPainter::TransformOp() with rotated text [message #47293 is a reply to message #47288] |
Tue, 03 January 2017 11:41 |
|
mirek
Messages: 13976 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Tue, 03 January 2017 09:55Hi,
When calling Painter::DrawText (for rotated text output):
...
painter.DrawText(x,y,rotation,text,font,Black());
...
The following assertion triggers in DEBUG mode:
void BufferPainter::TransformOp(const Xform2D& m)
{
ASSERT_(IsNull(current), "Cannot change transformation during path definition");
pathattr.mtx = attr.mtx = m * attr.mtx;
}
In RELEASE mode DrawText works just as it should, allowing rotation of text about its insertion point while retaining original transformation in the background (because of Begin()/End() pair involved). Similar temporary transformations are needed when rendering constant blocks of vector graphics at different locations with different scaling and rotation attributes. I guess Begin()/End() pairs should be used there too to preserve original transformation.
Is this assertion really needed for something?
Best regards,
Tom
Can you provide more context please? If I just do
void HelloWorld::Paint(Draw& w)
{
ImagePainter iw(GetSize());
iw.Clear(White());
iw.DrawText(500, 500, 20, "Hello World !", Arial(100));
w.DrawImage(0, 0, iw);
}
it works just fine...
|
|
|
Re: Assertion fails in BufferPainter::TransformOp() with rotated text [message #47299 is a reply to message #47293] |
Tue, 03 January 2017 12:53 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi Mirek,
I found that I have likely unconsumed Move(x,y) statement(s) left over in the queue from previous optimized polyline rendering. It's just like placing an "iw.Move(10,10);" just before DrawText in your sample. This causes the assertion.
So it's all my mistake. I interpreted the symptoms all wrong from the beginning. Sorry for bothering you with this.
Thanks and best regards,
Tom
|
|
|
Goto Forum:
Current Time: Sat May 11 12:16:01 CEST 2024
Total time taken to generate the page: 0.03189 seconds
|