Sunday, 18 August 2013

usage of copy_Path after stroke() or fill()

usage of copy_Path after stroke() or fill()

How is it possible to copy a path after a call to stroke() or fill() ?
I've setup a caching mecanism which looks like that
high end visual object class:
override void DrawDirect(canvas aCanvas)
{
aCanvas.Line(...)
aCanvas.Rectangle(...)
// etc.
MyCache = aCanvas.GetPath(); // = canvas.Context.copy_Path()
IsCached = true;
}
override void DrawCache(canvas aCanvas)
{
aCanvas.DrawPath(MyCache); // = canvas.Context.appendPath...
}
and the super class has this method:
voidDraw(canvas aCanvas)
{
if(IsCached) DrawCache();
else DrawDirect;
}
the canvas defines this kind of methods:
void Line(...)
{
Context.moveTo(...)
Context.lineTo(...)
Context.stroke();
}
when I call GetPath, MyCache.numData is equal to 0 unless I comment the
calls to stroke() and to fill(). But as a side effect the DrawDirect
methods do (visually) nothing.
One other subsequent question would be: is calling appendPath (really)
faster than calling the basic "direct" methods ? (you can comment about
this, I'll only accept answers about the copy_Path stuff).

No comments:

Post a Comment