How to use drawEntity function API ? Tough problems

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use drawEntity function API ? Tough problems

Johnson
I want to update the color of selected entity in current graphic view.  so I firstly set the new color for that entity then I need redraw that.

There are two APIs for that
1 void RS_GraphicView::drawEntity(RS_Entity* /*e*/, double& /*patternOffset*/)
2 void RS_GraphicView::drawEntity(RS_Painter *painter, RS_Entity* e)

For API 1, it is just a fake API which actually redraw all entity rather than redraw the specific entity e in parameters. It's not suitable for me because I found the performance is very bad!!!

For API 2, I don't know how to define a RS_Painter . for the current graphic view,is there any existed painter already created ?

Reply | Threaded
Open this post in threaded view
|

Re: How to use drawEntity function API ? Tough problems

dxli
Hi,

If you are still wondering:

RS_Painter is only an abstract class, and you actually need RS_PainterQt( QPaintDevice* pd) derived from QPainter and RS_Painter.

For example, you can draw to a pixmap by something like:

QPixmap pixmap(1920, 1080);
RS_PainterQt painter(&pixmap);

gv->drawEntity(&painter, e);