Discussion:
Cool strings example
Stuart Axon
2010-10-10 18:42:10 UTC
Permalink
I found this strings example:
http://www.siafoo.net/snippet/173

from here:
http://nodebox.net/code/index.php/Strings

I've only tested it in -dq where it shows up a couple of problems: the output
doesn't appear to be stroked, also sometimes it seems to get the matrix is not
invertible error.

S++
Sebastian Oliva
2010-10-11 17:49:42 UTC
Permalink
Post by Stuart Axon
http://www.siafoo.net/snippet/173
http://nodebox.net/code/index.php/Strings
I've only tested it in -dq where it shows up a couple of problems:  the output
doesn't appear to be stroked, also sometimes it seems to get the matrix is not
invertible error.
 S++
Fixed the textpath function, using a temporary CairoContext, it's
probably quite inefficient, but it works with this example and the one
with the Sewing.
Did not fixed the matrix non invertible error.
Stuart Axon
2010-10-11 18:26:30 UTC
Permalink
Subject: Re: [shoebot-devel] Cool strings example
Date: Monday, October 11, 2010, 6:49 PM
On Sun, Oct 10, 2010 at 12:42 PM,
Post by Stuart Axon
http://www.siafoo.net/snippet/173
http://nodebox.net/code/index.php/Strings
I've only tested it in -dq where it shows up a couple
of problems:  the output
Post by Stuart Axon
doesn't appear to be stroked, also sometimes it seems
to get the matrix is not
Post by Stuart Axon
invertible error.
 S++
Fixed the textpath function, using a temporary
CairoContext, it's
probably quite inefficient, but it works with this example
and the one
with the Sewing.
Did not fixed the matrix non invertible error.
I haven't had a chance to look at the code yet, but:

Does it work when stroke is alpha and fill is set, or do you get a double outline?

If you get the double outline, have a look at how bezierpath does it's drawing - note it has special cases for if only stroke or fill are set that use fast paths (don't call pushgroup/popgroup which creates an intermediate context).

This is from memory, so I might be wrong. RecordingSurface also gives an intermediate surface quite quickly, bit I think pushgroup/popgroup is the more Cairo way to do it.
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Sebastian Oliva
2010-10-12 00:48:51 UTC
Permalink
Post by Stuart Axon
Subject: Re: [shoebot-devel] Cool strings example
Date: Monday, October 11, 2010, 6:49 PM
On Sun, Oct 10, 2010 at 12:42 PM,
Post by Stuart Axon
http://www.siafoo.net/snippet/173
http://nodebox.net/code/index.php/Strings
I've only tested it in -dq where it shows up a couple
of problems:  the output
Post by Stuart Axon
doesn't appear to be stroked, also sometimes it seems
to get the matrix is not
Post by Stuart Axon
invertible error.
 S++
Fixed the textpath function, using a temporary
CairoContext, it's
probably quite inefficient, but it works with this example
and the one
with the Sewing.
Did not fixed the matrix non invertible error.
Does it work when stroke is alpha and fill is set, or do you get a double outline?
If you get the double outline, have a look at how bezierpath does it's drawing - note it has special cases for if only stroke or fill are set that use fast paths (don't call pushgroup/popgroup which creates an intermediate context).
This is from memory, so I might be wrong.  RecordingSurface also gives an intermediate surface quite quickly, bit I think pushgroup/popgroup is the more Cairo way to do it.
Yes, it works with alpha strokes and alpha fills, as I just return the
path object for drawpath to render.
I'm sure it could be more efficient, I'll look onto the
"RecordingSurface" method, or at least for a way to use the same
context used for the pre_rendering, as the current one works properly
and though I haven't had any performance issues yet, i think it can be
done faster.
Sebastian Oliva
2010-10-12 03:17:30 UTC
Permalink
Post by Sebastian Oliva
Post by Stuart Axon
Subject: Re: [shoebot-devel] Cool strings example
Date: Monday, October 11, 2010, 6:49 PM
On Sun, Oct 10, 2010 at 12:42 PM,
Post by Stuart Axon
http://www.siafoo.net/snippet/173
http://nodebox.net/code/index.php/Strings
I've only tested it in -dq where it shows up a couple
of problems:  the output
Post by Stuart Axon
doesn't appear to be stroked, also sometimes it seems
to get the matrix is not
Post by Stuart Axon
invertible error.
 S++
Fixed the textpath function, using a temporary
CairoContext, it's
probably quite inefficient, but it works with this example
and the one
with the Sewing.
Did not fixed the matrix non invertible error.
Does it work when stroke is alpha and fill is set, or do you get a double outline?
If you get the double outline, have a look at how bezierpath does it's drawing - note it has special cases for if only stroke or fill are set that use fast paths (don't call pushgroup/popgroup which creates an intermediate context).
This is from memory, so I might be wrong.  RecordingSurface also gives an intermediate surface quite quickly, bit I think pushgroup/popgroup is the more Cairo way to do it.
Yes, it works with alpha strokes and alpha fills, as I just return the
path object for drawpath to render.
I'm sure it could be more efficient, I'll look onto the
"RecordingSurface" method, or at least for a way to use the same
context used for the pre_rendering, as the current one works properly
and though I haven't had any performance issues yet, i think it can be
done faster.
Noticed a small oddity with the ones rendered by shoebot-dq, I was
missing the traslations, just fixed it now.
I'm starting to think on using the same context used for the
pre-rendering in order to measure all of the metrics (and path) and
then just changing the context in order to draw the text.

Continue reading on narkive:
Loading...