Found the rgba blending code!

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Found the rgba blending code!

by Vinnie-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>> Where is the stuff?
>agg_pixfmt_rgba.h

Looks like I must have accidentally deleted the file :-(

> There is a performance hit, but I forgot how bad it is.

I only need to calculate a transparency channel when the user initiates a drag operation, for an irregularly shaped drag image. As this happens only once when the drag begins, I am not particularly concerned with the performance of the blending.

I wrote my own agg_pixfmt_rgbx.h class for drawing into a 4-byte per pixel rgb image *without* transparency (for example, a windows BGRX DIB). Having 4 bytes per pixel incurs a small performance overhead, but that can be more than made up for by the ease which the data can be manipulated using SIMD instructions. Did agg already have this facility? It seemed that it did not.

Thanks to the templates it should be fairly easy to create a new blender that has the accurate formulas, and switch between them as desired. Has anyone done this?

Can anyone provide sources for drop-in replacements for the blenders? Perhaps ones with more accurate yet optimized blending formula?

Can anyone provide a SIMD optimized blender implementation?

Do any exist publicly?

Thanks,

V



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vector-agg-general mailing list
Vector-agg-general@...
https://lists.sourceforge.net/lists/listinfo/vector-agg-general

Re: Found the rgba blending code!

by Petr Kobalíček :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Vinnie,

I'm implementing graphics routines using SSE2 and MMX, but for
different library. It's MIT licenced, so anybody can use it and port
for example to antigrain. But I think that there is no problem to
write MMX or SSE2 code, there is problem to integrate that code into
antigrain or your application. Antigrain is set of templates, to
integrate SSE2 code with C fallback (if CPU don't support it) is quite
different task - you need cpu detection routines, you must create
pointers for span blitter functions, organize your code to be
replacable, etc.

Porter & Duff (and SVG) formulas for mixed pixel formats are here:

     http://code.google.com/p/fog/source/browse/trunk/Fog/Fog/Graphics/Constants.h

SSE2 code I wrote (currently there is only SRC, DST, SRC_OVER and
DST_OVER) is here:

     http://code.google.com/p/fog/source/browse/trunk/Fog/Fog/Graphics/Raster/Raster_SSE2_composite.cpp.h
     (currently it's 10.000 lines of SSE2 code, ready to port to
antigrain :-D ?)

All links points to Fog library project:

     http://code.google.com/p/fog/

I'm also looking for developers that can contribute to this project. I
want to write universal, very fast, library for raster based image
manipulation (vector graphics, image filters, color filters, svg,
...). It works currently in Windows and Linux, 32/64-bit powered.

Regards
- Petr

2009/8/5 Vinnie <thevinn@...>:

>
>>> Where is the stuff?
>>agg_pixfmt_rgba.h
>
> Looks like I must have accidentally deleted the file :-(
>
>> There is a performance hit, but I forgot how bad it is.
>
> I only need to calculate a transparency channel when the user initiates a drag operation, for an irregularly shaped drag image. As this happens only once when the drag begins, I am not particularly concerned with the performance of the blending.
>
> I wrote my own agg_pixfmt_rgbx.h class for drawing into a 4-byte per pixel rgb image *without* transparency (for example, a windows BGRX DIB). Having 4 bytes per pixel incurs a small performance overhead, but that can be more than made up for by the ease which the data can be manipulated using SIMD instructions. Did agg already have this facility? It seemed that it did not.
>
> Thanks to the templates it should be fairly easy to create a new blender that has the accurate formulas, and switch between them as desired. Has anyone done this?
>
> Can anyone provide sources for drop-in replacements for the blenders? Perhaps ones with more accurate yet optimized blending formula?
>
> Can anyone provide a SIMD optimized blender implementation?
>
> Do any exist publicly?
>
> Thanks,
>
> V
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Vector-agg-general mailing list
> Vector-agg-general@...
> https://lists.sourceforge.net/lists/listinfo/vector-agg-general
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vector-agg-general mailing list
Vector-agg-general@...
https://lists.sourceforge.net/lists/listinfo/vector-agg-general