Atitit blend mode COLOR_DODGE 混合模式 「顏色減淡」模式

 

 Atitit blend mode COLOR_DODGE 混合模式  「顏色減淡」模式javascript

 

 

 

1.1. 混合模式是圖像處理技術中的一個技術名詞1java

1.2. 目錄1算法

1.3. 顏色減淡COLOR_DODGE的公式以下2ide

1.4. 詳細解釋及原理3工具

1.5. 使用javafx 類庫實現圖像疊加混合3ui

1.6. 代碼實現 /AtiPlatf_cms/src/com/attilax/img/ImageBlendFilter.java4spa

 

1.1. 混合模式是圖像處理技術中的一個技術名詞

,不只用於普遍使用的Photoshop中,也應用於AfterEffectllustrator DreamweaverFireworks等軟件。主要功效是能夠用不一樣的方法將對象顏色與底層對象的顏色混合。當您將一種混合模式應用於某一對象時,在此對象的圖層或組下方的任何對象上均可看到混合模式的效果。orm

1.2. 目錄

00001. 1 詳細解釋及原理htm

00002. 2 一般對象

00003.  正常模式(Normal

00004.  溶解模式(Dissolve)

00005.  背後模式(Behind)

00006.  清除模式(Clear)

00007. 3 變暗系

00008.  變暗模式(Darken)

00009.  正片疊底(Multiply)

00010.  顏色加深模式(Color Burn)

00011.  線性加深模式(Linear Burn)

00001.  深色模式(Darker Color)

00002. 4 變亮系

00003.  增長模式(Add)

00004.  變亮模式(Lighten)

00005.  濾色模式(Screen)

00006.  顏色減淡模式(Color Dodge)

00007.  線性減淡模式(Linear Dodge)

00008.  淺色模式(Lighter Color)

00009. 5 飽和度系

00010.  疊加模式(Overlay)

00001.  柔光模式(Soft Light)

00002.  強光模式(Hard Light)

00003.  亮光模式(Vivid Light)

00004.  線性光模式(Linear Light)

00005.  點光模式(Pin Light)

00006.  實色混合模式(Hard Mix)

00007. 6 差集系

00008.  差值模式(Difference)

00001.  排除模式(Exclusion)

00002.  減去模式(Subtract)

00003.  劃分模式(Divide)

00004. 7 顏色系

00005.  色相模式(Hue)

00006.  飽和度模式(Saturation)

00007.  顏色模式(Color)

00008.  亮度模式(Luminosity)

 

 

1.3. 顏色減淡COLOR_DODGE的公式以下

P(x,y) = Pb(x,y) + (Pb(x,y)* Pc(x,y)) / (256 - Pc(x,y));

 

C =MIN( A +(A×B)/(255-B),255)

255-B)就是獲得b的反相

既然知道了算法,如今開始代碼:

A爲原圖gray圖, b爲上層圖片,便是灰度圖反相底片高斯模糊後的圖片

C的最大值爲255,若是超出要截取到255,不然會臉部變黑色。。若是b255,則除磷錯誤,須要直接返回255便可

 

 

1.4. 詳細解釋及原理

編輯

以畫筆工具爲例說明其原理。

任意打開一幅圖,選擇畫筆工具,選擇合適的筆刷。設定不一樣的模式在圖像上繪畫,便可獲得不一樣的效果。

爲了敘述方便,暫且將原圖像中的顏色稱之爲底色A畫筆的顏色爲繪圖色B,將經過混合模式獲得的最後顏色稱爲最終色

 

 

 

「顏色減淡」模式的公式是:基色+(基色*混合色)/255-混合色)= 結果色,其中(255-混合色)當於混合色的反相。

1、若混合色爲0(黑色),則因爲(基色*混合色)這項爲0,則結果色等於基色,圖像不發生變化;基混合色爲128(50%的黑),狀況分爲兩種:

1)當基色小於128時,結果色等於2基色,因爲這個數值小於255因此呈某種階調的灰。

2)而當基色大於128(50%的黑)時,結果色等於2基色,這個值是大於255值,255(白色)

2、若混合色爲255(白色),則混合色的反相爲0,不管基色爲什麼值,結果色都大於255,歸爲255(白色)。

 

1.5. 使用javafx 類庫實現圖像疊加混合

public static BufferedImage blend_COLOR_DODGE(String topImg,

 

String lowImg) {

javafx.scene.image.Image topimg_jfxfmt = toImg(topImg);

 

javafx.scene.image.Image lowImg_jfxFmt = toImg(lowImg);

 

Blend blend = new Blend(BlendMode.COLOR_DODGE);

blend.setTopInput(new ImageInput(topimg_jfxfmt));

blend.setBottomInput(new ImageInput(lowImg_jfxFmt));

 

Group grp = new Group();

 

grp.setEffect(blend);

 

//WritableImage img = new WritableImage((int) topimg_jfxfmt.getWidth(),

//(int) topimg_jfxfmt.getHeight());

// scene.snapshot(img);

WritableImage img2 = grp.snapshot(new SnapshotParameters(), null);

 

//StackPane root = javafxUtil.getStackPaneFrmImg(img2);

 

BufferedImage copy2 =  SwingFXUtils.fromFXImage(img2, null);

copy2 = imgx.Remove_alpha_channel(copy2);

return copy2;

}

1.6. 代碼實現 /AtiPlatf_cms/src/com/attilax/img/ImageBlendFilter.java

 BufferedImage copy2=new ImageBlendFilter().setBlendMode(ImageBlendFilter.COLOR_DODGE)

 .setSecondImage(Gaussiancopy ).filter( gray_copy     , null);

 

Guass avbove on gray pic..gray pic is blow lev..

 

// 暫且將原圖像中的顏色稱之爲「底色A」畫筆的顏色爲「繪圖色B」,將

//base ori is a, push pen is b

//yaosi fangfe ,zo div zeor ex..

//  ,公式爲:

//C =MIN( A +(A×B)/(255-B),255)

/**

 * b = guassBlur[index];

                a = gray[index];

                。顏色減淡的算法是這樣的:C =MIN( A +(A×B)/(255-B),255),其中C爲混合結果,A爲源像素點,B爲目標像素點。

 * @param b

 * @param a

 * @return  其中(255-混合色)當於混合色的反相。

 */

private int modeCOLOR_DODGE(int a, int b) {

if (b >= 255)

return 255;

//if (b < 128)

//System.out.println("Dbg");

if(a<128)

System.out.println("dg");

//try {

float rzt = (float)a + (float)(a * b) /(float) (255 - b);

int clr = (int) rzt;

if (clr > 255)

return 255;

return clr;

 

 

// MIN(clr,255);

}

 

做者:: 綽號:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿爾 拉帕努伊 ) 

漢字名:艾提拉(艾龍)   EMAIL:1466519819@qq.com

轉載請註明來源: http://www.cnblogs.com/attilax/

Atiend

相關文章
相關標籤/搜索