|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: I've been infected by templates!Hi Vinnie,
you are right only partially. Agg is template based, but you can write your own pixfmt where you can select everything at runtime. For example I'm using AGG, but I'm not using any pixfmt template, because I don't need them. To be more exact, I'm using BlitJit to render everything. Supporting more pixel formats is always developer nightmare, because it will slowdown rendering (if it's not well designed and checked every time something wan't to be rendered) and complicate your code. Ideal design is to use pointer to functions (or C++ class with virtual methods). Anyway, there will be always other things you must worry about. For example how to calculate correct position in raster for your pixel format (1bpp vs 3bpp vs 4bpp - differences) and if destination, source and result values are premultiplied or not. Another big problem while supporting more pixel formats is with using textures (or blitting images), you must convert them and this can take some CPU time too. Hope that helps - Petr 2009/4/28 Vinnie <thevinn@...>: > > Someone pointed out that I can switch the underlying pixfmt from pixfmt_bgr24 to pixfmt_bgra32 in order to perform off-screen drawing while accumulating a suitable transparency channel (in the alpha channel of the pixmap). > > I've been looking at my code and unless I am mistaken, this means I have to convert my entire class to a giant template! > > All of my drawing routine wrappers instantiate pixfmt-specific (or templatized classes whose template arguments are pixfmt-specific) on the stack. Renderers, rasterizers,scanline-a-mabobs, etc... > > None of these objects can be selected at run time it seems, they have to be known at compile time since they are implemented using templates on top of templates. > > So for every one of my wrapper functions, I will need a templatized version (or templatize the wrapping class). When my executable is built, I will have N copies of my code where N= the number of supported pixmaps (two in my case, bgr24 and bgra32). > > If this is true then it not possible to design a single wrapping class that you can "select" different types of pixfmt into for destination drawing purposes and have it work correctly, unless I am missing something. > > Does this all sound right? > > > ------------------------------------------------------------------------------ > Register Now & Save for Velocity, the Web Performance & Operations > Conference from O'Reilly Media. Velocity features a full day of > expert-led, hands-on workshops and two days of sessions from industry > leaders in dedicated Performance & Operations tracks. Use code vel09scf > and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf > _______________________________________________ > Vector-agg-general mailing list > Vector-agg-general@... > https://lists.sourceforge.net/lists/listinfo/vector-agg-general > ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ 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 |