问题描述
我从头就从Adobe的文档的Android基地发展软光算法:
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
能否给我任何解释的算法或者至少 DST,SRC,CB,CS
,是sampleNearest()
功能以及如何计算呢?
谢谢你!
输入图片4 DST;
输入图片4 SRC;
输出pixel4结果;空虚
evaluatePixel()
{
pixel4一个=是sampleNearest(DST,outCoord()); // CB
pixel4 B =是sampleNearest(SRC,outCoord()); // CS
....
}
:
ChannelBlend_SoftLight(A,B)((UINT8)((B< 128)(2 *((A>> 1)+64))*((浮点) B / 255):( 255-(2 *(255 - ((A>→1)+64))*(浮点)(255-B)/ 255))))
以上您的code计算混合的一个像素。
A,B
是2个不同的像素, aampleNearest
函数从输入图像得到2个像素。
DST,SRC
是2输入图像。
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.pdfhttp://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
....
}
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.
这篇关于图像处理:软光算法,如Photoshop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!