|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Perspective projected stroked path with variable widthHi,
I'm pretty new to AGG and I'm trying to use to render lines with variable width in order to produce a "perspective effect" where the line width gets lower as it goes far away. What I have in the input is only vertices defining the line. So my goal would be to transform these vertices into a polygon representing the contour of the stroked line with a variable width. I tried to use a pipeline like path -> conv_stroke -> conv_stroke (in order to get the border of stroke) However it doesn't give me a polygon on the output so applying a perspective transform to it will not change the stroke width accordingly. What solution could I use? Thanks a lot in advance. Best regards, Mathieu Monney ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthHi,
Mathieu Monney schrieb: > I'm pretty new to AGG and I'm trying to use to render lines with > variable width in order to produce a "perspective effect" where the > line width gets lower as it goes far away. What I have in the input is > only vertices defining the line. So my goal would be to transform > these vertices into a polygon representing the contour of the stroked > line with a variable width. I tried to use a pipeline like path -> > conv_stroke -> conv_stroke (in order to get the border of stroke) > However it doesn't give me a polygon on the output so applying a > perspective transform to it will not change the stroke width > accordingly. What solution could I use? Hm, but when you apply a perspective transform to the last step of your pipeline, your entire shape should be transformed. I don't know what you mean by "it doesn't give me a polygon". The stroke output is also a polygon in the sense of AGG, but the perspective transformation does not care about that. It simply transforms any coordinates. How do you configure the perspective transformation? In any case, I can confirm you this is possible with AGG, we just need to figure out where you are doing something wrong or where you have a misunderstanding. :-) Best regards, -Stephan ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthHi Mathieu,
you need to do this: - convert curves to polygons - apply transform - render hope that helps - Petr 2009/9/16 Mathieu Monney <mathieu.monney@...>: > Hi, > > I'm pretty new to AGG and I'm trying to use to render lines with > variable width in order to produce a "perspective effect" where the > line width gets lower as it goes far away. What I have in the input is > only vertices defining the line. So my goal would be to transform > these vertices into a polygon representing the contour of the stroked > line with a variable width. I tried to use a pipeline like path -> > conv_stroke -> conv_stroke (in order to get the border of stroke) > However it doesn't give me a polygon on the output so applying a > perspective transform to it will not change the stroke width > accordingly. What solution could I use? > > Thanks a lot in advance. > > Best regards, > > Mathieu Monney > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthHi,
Thanks for your answer. Actually I didn't really how to set the perspective transformation. What does the matrix terms mean? In order to set up my perspective matrix to test, I used the image_perspective demo and set up the quad of the image in order to have the perspective I want. Then I used the produced matrix to put it in my program. Dirty but I thought it should work :-). So can you explain a little more what the perspective matrix means? I should have the sufficient knowledge to understand the affine matrix but this perspective matrix sounds awkward for me. Is there any documentation somewhere about that? Actually I just found out that I mixed up my pipeline and I applied the perspective transformation directly to the path and then stroke it. So I reverse that and now it works :-). However I still don't know how to set up this perspective matrix :-). So I have the following pipeline: transform < stroke< stroke<path> > , perspective >. Is that optimal or is there any more optimal way to convert the thick lines to polygons? Thanks a lot. Best regards, Mathieu Le 16 sept. 2009 à 17:05, Stephan Aßmus a écrit : > Hi, > > Mathieu Monney schrieb: >> I'm pretty new to AGG and I'm trying to use to render lines with >> variable width in order to produce a "perspective effect" where the >> line width gets lower as it goes far away. What I have in the input >> is >> only vertices defining the line. So my goal would be to transform >> these vertices into a polygon representing the contour of the stroked >> line with a variable width. I tried to use a pipeline like path -> >> conv_stroke -> conv_stroke (in order to get the border of stroke) >> However it doesn't give me a polygon on the output so applying a >> perspective transform to it will not change the stroke width >> accordingly. What solution could I use? > > Hm, but when you apply a perspective transform to the last step of > your > pipeline, your entire shape should be transformed. I don't know what > you > mean by "it doesn't give me a polygon". The stroke output is also a > polygon in the sense of AGG, but the perspective transformation does > not > care about that. It simply transforms any coordinates. How do you > configure the perspective transformation? In any case, I can confirm > you > this is possible with AGG, we just need to figure out where you are > doing something wrong or where you have a misunderstanding. :-) > > Best regards, > -Stephan > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthHi Mathieu,
I think that you must first understand how rasterization in antigrain works. The pipeline in antigrain is something like middleware between your final image and your vector data. Antigrain rasterizer can only rasterize polygons, so here the pipeline is to create set (or one) of closed polygons from your vector data. For example, you have some vector data: 1. you need to convert curves to lines (curve pipeline) 2. you need to stroke (stroke pipeline) 3. you need to apply transform (here your perspective matrix is used - transform pipeline) 4. you are ready to rasterize if you swap step 2 and 3 it's logical that stroke width will be constant in are places. Antigrain gives you ability to swap various steps in the pipeline. About perspective matrix: - it's like affine matrix but contains another fields. It's sometimes called as transform matrix. For detailed description look at QTransform class in qt: http://doc.trolltech.com/4.5/qtransform.html . Regards - Petr 2009/9/16 Mathieu Monney <mathieu.monney@...>: > Hi, > > Thanks for your answer. > > Actually I didn't really how to set the perspective transformation. > What does the matrix terms mean? In order to set up my perspective > matrix to test, I used the image_perspective demo and set up the quad > of the image in order to have the perspective I want. Then I used the > produced matrix to put it in my program. Dirty but I thought it should > work :-). > > So can you explain a little more what the perspective matrix means? I > should have the sufficient knowledge to understand the affine matrix > but this perspective matrix sounds awkward for me. Is there any > documentation somewhere about that? > > Actually I just found out that I mixed up my pipeline and I applied > the perspective transformation directly to the path and then stroke > it. So I reverse that and now it works :-). However I still don't know > how to set up this perspective matrix :-). > So I have the following pipeline: transform < stroke< stroke<path> > , > perspective >. Is that optimal or is there any more optimal way to > convert the thick lines to polygons? > > Thanks a lot. > > Best regards, > > Mathieu > > > > Le 16 sept. 2009 à 17:05, Stephan Aßmus a écrit : > >> Hi, >> >> Mathieu Monney schrieb: >>> I'm pretty new to AGG and I'm trying to use to render lines with >>> variable width in order to produce a "perspective effect" where the >>> line width gets lower as it goes far away. What I have in the input >>> is >>> only vertices defining the line. So my goal would be to transform >>> these vertices into a polygon representing the contour of the stroked >>> line with a variable width. I tried to use a pipeline like path -> >>> conv_stroke -> conv_stroke (in order to get the border of stroke) >>> However it doesn't give me a polygon on the output so applying a >>> perspective transform to it will not change the stroke width >>> accordingly. What solution could I use? >> >> Hm, but when you apply a perspective transform to the last step of >> your >> pipeline, your entire shape should be transformed. I don't know what >> you >> mean by "it doesn't give me a polygon". The stroke output is also a >> polygon in the sense of AGG, but the perspective transformation does >> not >> care about that. It simply transforms any coordinates. How do you >> configure the perspective transformation? In any case, I can confirm >> you >> this is possible with AGG, we just need to figure out where you are >> doing something wrong or where you have a misunderstanding. :-) >> >> Best regards, >> -Stephan >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry® Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart >> your >> developing skills, take BlackBerry mobile applications to market and >> stay >> ahead of the curve. Join us from November 9-12, 2009. Register >> now! >> http://p.sf.net/sfu/devconf >> _______________________________________________ >> Vector-agg-general mailing list >> Vector-agg-general@... >> https://lists.sourceforge.net/lists/listinfo/vector-agg-general > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthHi,
Mathieu Monney schrieb: > Actually I just found out that I mixed up my pipeline and I applied > the perspective transformation directly to the path and then stroke > it. So I reverse that and now it works :-). However I still don't know > how to set up this perspective matrix :-). > So I have the following pipeline: transform < stroke< stroke<path> > , > perspective >. Is that optimal or is there any more optimal way to > convert the thick lines to polygons? Good to know you figured it out. Sorry, but I cannot help explain the perspective matrix, but this is probably a subject that you can google. When I used the persepective transformation, I've always used the quad to quad utility methods to produce the matrix I wanted. Best regards, -Stephan ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthHi Petr,
Thanks for your complete response. It really helps. However I still have two questions: - What do you mean by converting curves to lines ? In the input I have already points defining the segments of my lines. So it is already ok, isn't it ? - Is there any performance speed up which can be made in order to draw the same lines under a different perspective. I mean I want to draw my lines using one perspective matrix and then later draw the same lines again with another perspective matrix. What kind of things should I be aware of in order AGG not to recompute all the vectors data again? Thanks a lot. Best, Mathieu Le 17 sept. 2009 à 06:36, Petr Kobalíček a écrit : > Hi Mathieu, > > I think that you must first understand how rasterization in antigrain > works. The pipeline in antigrain is something like middleware between > your final image and your vector data. Antigrain rasterizer can only > rasterize polygons, so here the pipeline is to create set (or one) of > closed polygons from your vector data. > > For example, you have some vector data: > 1. you need to convert curves to lines (curve pipeline) > 2. you need to stroke (stroke pipeline) > 3. you need to apply transform (here your perspective matrix is used - > transform pipeline) > 4. you are ready to rasterize > > if you swap step 2 and 3 it's logical that stroke width will be > constant in are places. Antigrain gives you ability to swap various > steps in the pipeline. > > About perspective matrix: > - it's like affine matrix but contains another fields. It's sometimes > called as transform matrix. For detailed description look at > QTransform class in qt: http://doc.trolltech.com/4.5/qtransform.html . > > Regards > - Petr > > 2009/9/16 Mathieu Monney <mathieu.monney@...>: >> Hi, >> >> Thanks for your answer. >> >> Actually I didn't really how to set the perspective transformation. >> What does the matrix terms mean? In order to set up my perspective >> matrix to test, I used the image_perspective demo and set up the quad >> of the image in order to have the perspective I want. Then I used the >> produced matrix to put it in my program. Dirty but I thought it >> should >> work :-). >> >> So can you explain a little more what the perspective matrix means? I >> should have the sufficient knowledge to understand the affine matrix >> but this perspective matrix sounds awkward for me. Is there any >> documentation somewhere about that? >> >> Actually I just found out that I mixed up my pipeline and I applied >> the perspective transformation directly to the path and then stroke >> it. So I reverse that and now it works :-). However I still don't >> know >> how to set up this perspective matrix :-). >> So I have the following pipeline: transform < stroke< stroke<path> >> > , >> perspective >. Is that optimal or is there any more optimal way to >> convert the thick lines to polygons? >> >> Thanks a lot. >> >> Best regards, >> >> Mathieu >> >> >> >> Le 16 sept. 2009 à 17:05, Stephan Aßmus a écrit : >> >>> Hi, >>> >>> Mathieu Monney schrieb: >>>> I'm pretty new to AGG and I'm trying to use to render lines with >>>> variable width in order to produce a "perspective effect" where the >>>> line width gets lower as it goes far away. What I have in the input >>>> is >>>> only vertices defining the line. So my goal would be to transform >>>> these vertices into a polygon representing the contour of the >>>> stroked >>>> line with a variable width. I tried to use a pipeline like path -> >>>> conv_stroke -> conv_stroke (in order to get the border of stroke) >>>> However it doesn't give me a polygon on the output so applying a >>>> perspective transform to it will not change the stroke width >>>> accordingly. What solution could I use? >>> >>> Hm, but when you apply a perspective transform to the last step of >>> your >>> pipeline, your entire shape should be transformed. I don't know what >>> you >>> mean by "it doesn't give me a polygon". The stroke output is also a >>> polygon in the sense of AGG, but the perspective transformation does >>> not >>> care about that. It simply transforms any coordinates. How do you >>> configure the perspective transformation? In any case, I can confirm >>> you >>> this is possible with AGG, we just need to figure out where you are >>> doing something wrong or where you have a misunderstanding. :-) >>> >>> Best regards, >>> -Stephan >>> >>> ------------------------------------------------------------------------------ >>> Come build with us! The BlackBerry® Developer Conference in >>> SF, CA >>> is the only developer event you need to attend this year. Jumpstart >>> your >>> developing skills, take BlackBerry mobile applications to market and >>> stay >>> ahead of the curve. Join us from November 9-12, 2009. Register >>> now! >>> http://p.sf.net/sfu/devconf >>> _______________________________________________ >>> Vector-agg-general mailing list >>> Vector-agg-general@... >>> https://lists.sourceforge.net/lists/listinfo/vector-agg-general >> >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry® Developer Conference in SF, >> CA >> is the only developer event you need to attend this year. Jumpstart >> your >> developing skills, take BlackBerry mobile applications to market >> and stay >> ahead of the curve. Join us from November 9-12, 2009. Register >> now! >> http://p.sf.net/sfu/devconf >> _______________________________________________ >> Vector-agg-general mailing list >> Vector-agg-general@... >> https://lists.sourceforge.net/lists/listinfo/vector-agg-general >> > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
|
|
Re: Perspective projected stroked path with variable widthMathieu Monney schrieb:
> Hi Petr, > > Thanks for your complete response. It really helps. > > However I still have two questions: > > - What do you mean by converting curves to lines ? In the input I have > already points defining the segments of my lines. So it is already ok, > isn't it ? > - Is there any performance speed up which can be made in order to draw > the same lines under a different perspective. I mean I want to draw my > lines using one perspective matrix and then later draw the same lines > again with another perspective matrix. What kind of things should I be > aware of in order AGG not to recompute all the vectors data again? The stroker works on the fly. It does not cache the computed coordinates if I am not mistaken. If you needed to use a curve converter (doesn't seem to be the case), it would also generate points on the fly. So you cannot do anything, except record the output in another agg::path_storage and use that as a cache. But once you use more sophisticated fills, you will quickly notice that the vector calculations are not usually any performance problem. That is my own experience, though, it depends on the complexity of your vector data. Best regards, -Stephan ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Vector-agg-general mailing list Vector-agg-general@... https://lists.sourceforge.net/lists/listinfo/vector-agg-general |
| Free embeddable forum powered by Nabble | Forum Help |