Hi!
all the blending functions that I proudly ported to a template to be used
on Color as well as CairoColor are wrong! ^___^''
The won't work for CairoColors!
First, the alpha value used for scale up the rest of channels has to be a
float betwen 1.0 and 0.0 and so it needs to be scaled down by the color
channel range.
Second the blending operations are needed to be done in a float space and
only convert the final value to the type of the channel because if we keep
converting to the color channel type in the middle of the operations we
will get precision loose.

So hands on work!

Cheers!

2012/9/18 Carlos López González <genet...@gmail.com>

> Hi!
> I've been working to be able to render gaussian blurs using Cairo
> surfaces.
> I needed to do some changes as you can see in the commits list. It seems
> to work but for some reason the alpha is washed out. It is like if the
> alpha value were not accumulated properly... Still don't know the reason. :(
> Time for gaussian blur is far larger in Cairo render than in Software that
> makes it unusable.
> For that type of layers that doesn't have similar API in Cairo I'm
> considering to directly convert the CairoSurface to Surface, do the
> operations and then convert back to CairoSurface.
> Possibly it is not so slow than now.
> So far that's my last commit with Blur layer.
> Cheers!
>
> 2012/9/17 Carlos López González <genet...@gmail.com>
>
>> Hi!
>> After the Warp layer bug hiatus I'm back on the Cairo render road. ^__^
>> I've been working on implement the Blur layer. Very interesting! This is
>> the summary of changes:
>>
>> 1) I've needed to add a new member function to the etl::surface:
>>
>> void etl::surface::copy(const etl::surface &rhs);
>>
>> to allow to copy one surface to other when both are already with the data
>> memory allocated. This would prevent to allocate memory for the receiving
>> surface (as the operator=() does) and so it can be used to copy one surface
>> to other when it is CairoSurface type.
>>
>> 2) CairoColor has an unsigned char value per channel. This makes
>> CairoColor unusable for accumulate values of colors like in a pixel
>> subsampling or a blur filter. I've created a CairoColorAccumulator class
>> that is simply a float color with interface to convert from and to
>> CairoColor. From now on, all the etl::surfaces and etl::generic_pen and
>> derivatives must use CairoColorAccumulator as Accumulator type when a
>> CairoSurface is needed. It is needed for the blur operations. Possibly it
>> would improve some other subsamplig areas.
>>
>> 3) I've added Cairo render support for the Blur layer. The gaussian blur
>> doesn't work yet because it needs some changes on the etl::gaussian*
>> templates. Currently gaussians templates expect to receive pointers to the
>> value_type of the etl::generic_pen class for further calculations on each
>> gaussian blur template. It is perfect for Color class but not for
>> CairoColor due to its value range limitation. Instead of expect a pointer
>> to the value_type, it should expect a pointer to the accumulator_type, that
>> is not typedefined yet. It will be my next commits.
>>
>> For the performance results, in general, Cairo render is slower than
>> Software (as expected), basically because the calculations are the same
>> plus the needed operations to convert between CairoColorAccumulator and
>> CairoColor. Only Boxblur looks to be slightly faster in Cairo. Results are
>> very good in any case.
>>
>> One thing that I particularly liked from this coding session is that I've
>> learned a lot of how the blurs operations are performed. This would allow
>> me to implement in the future a new blur type that would use variable size
>> on each pixel and so it could be possible to emulate differential blur in
>> one scene.
>>
>> Well, that's all for today!
>>
>> Cheers!
>>
>> --
>> Carlos
>> http://synfig.org
>>
>>
>
>
> --
> Carlos
> http://synfig.org
>
>


-- 
Carlos
http://synfig.org
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to