1

I'm a developing soft-light algorithm from scratch for Android base on the docs from Adobe: http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_archives/blend_modes.pdf http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/shaderClasses/SoftLight.pbk

Can anyone explain for me the algorithm or at least dst, src, cb, cs, sampleNearest() function and how to calculate them? Thanks you!

input image4 dst;
input image4 src;
output pixel4 result;

void
evaluatePixel()
{
    pixel4 a = sampleNearest(dst,outCoord()); // cb
    pixel4 b = sampleNearest(src,outCoord()); // cs
    ....
}
Wayne
  • 6,361
  • 10
  • 46
  • 69

1 Answers1

1

See this answer for the blending formula:

     ChannelBlend_SoftLight(A,B)  ((uint8)((B < 128)?(2*((A>>1)+64))*((float)B/255):(255-(2*(255-((A>>1)+64))*(float)(255-B)/255))))

Your code above calculates the blending for one pixel.

a, b are the 2 different pixels, the aampleNearest function gets the 2 pixels from the input images.

dst,src are the 2 input images.

Community
  • 1
  • 1
thumbmunkeys
  • 20,606
  • 8
  • 62
  • 110
  • I'm trying to blend an image of a flower and a white image as SoftLight and I get a white image as result. In the GIMP or photoshop it works ok... what am I doing wrong? – Rafael Ruiz Muñoz Apr 22 '15 at 15:20