'''What steps will reproduce the problem?'''
* 1.Create two images with fully transparent areas that can be combined
* 2.the first image blends properly
* 3.the second images alpha channel is blended in. if its fully transparent
those bits should not copy
'''What is the expected output? What do you see instead?'''
100% transparent bits should not blend int
'''What version of the product are you using? On what operating system?'''
Accord 2.1.4
'''Please provide any additional information below:'''
Attached code fixes for 100% alpha, but doesn't attempt anything fancy for
partial transparency
{{{
// validate source pixel's coordinates
if ((ox >= 0) && (oy >= 0) && (ox < width) && (oy < height))
{
int c = oy * srcStride + ox * srcPixelSize;
// fill destination image with pixel from source image
if (srcPixelSize == 4 && src[c + 3] == 0)
{
// nothing to copy in
//NOP
}
else if (dst[3] > 0)
{
// there is a pixel from the other image here, blend
double d1 = distance(ox, oy, center1.X, center1.Y);
double d2 = distance(ox, oy, center2.X, center2.Y);
double f = Accord.Math.Tools.Scale(0, dmax, 0, 1, d1 - d2);
if (f < 0) f = 0;
if (f > 1) f = 1;
double f2 = (1.0 - f);
dst[0] = (byte)(src[c] * f2 + dst[0] * f);
}}}
Original issue reported on code.google.com by cesarso...@gmail.com on 5 Apr 2012 at 8:46
Original issue reported on code.google.com by
cesarso...@gmail.com
on 5 Apr 2012 at 8:46