首页 > 文档 > blend()混合 ()
2017
08-09

blend()混合 ()

Name

blend()混合 ()

   

Examples

blend()混合 () - 第1张  | Processing编程艺术blend()混合 () - 第2张  | Processing编程艺术blend()混合 () - 第3张  | Processing编程艺术

background(loadImage(“rockies.jpg”));

PImage img = loadImage(“bricks.jpg”);

image(img, 0, 0);

blend(img, 0, 0, 33, 100, 67, 0, 33, 100, ADD);

blend()混合 () - 第4张  | Processing编程艺术blend()混合 () - 第5张  | Processing编程艺术blend()混合 () - 第6张  | Processing编程艺术

background(loadImage(“rockies.jpg”));

PImage img = loadImage(“bricks.jpg”);

image(img, 0, 0);

blend(img, 0, 0, 33, 100, 67, 0, 33, 100, SUBTRACT);

blend()混合 () - 第7张  | Processing编程艺术blend()混合 () - 第8张  | Processing编程艺术blend()混合 () - 第9张  | Processing编程艺术

background(loadImage(“rockies.jpg”));

PImage img = loadImage(“bricks.jpg”);

image(img, 0, 0);

blend(img, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);

blend()混合 () - 第10张  | Processing编程艺术blend()混合 () - 第11张  | Processing编程艺术blend()混合 () - 第12张  | Processing编程艺术

background(loadImage(“rockies.jpg”));

PImage img = loadImage(“bricks.jpg”);

image(img, 0, 0);

blend(img, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);

Description

Blends a region of pixels from one image into another (or in itself again) with full alpha channel support. There is a choice of the following modes to blend the source pixels (A) with the ones of pixels in the destination image (B):

BLEND – linear interpolation of colours: C = A*factor + B

ADD – additive blending with white clip: C = min(A*factor + B, 255)

SUBTRACT – subtractive blending with black clip: C = max(B – A*factor, 0)

DARKEST – only the darkest colour succeeds: C = min(A*factor, B)

LIGHTEST – only the lightest colour succeeds: C = max(A*factor, B)

DIFFERENCE – subtract colors from underlying image.

EXCLUSION – similar to DIFFERENCE, but less extreme.

MULTIPLY – Multiply the colors, result will always be darker.

SCREEN – Opposite multiply, uses inverse values of the colors.

OVERLAY – A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens light values.

HARD_LIGHT – SCREEN when greater than 50% gray, MULTIPLY when lower.

SOFT_LIGHT – Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as harsh.

DODGE – Lightens light tones and increases contrast, ignores darks. Called “Color Dodge” in Illustrator and Photoshop.

BURN – Darker areas are applied, increasing contrast, ignores lights. Called “Color Burn” in Illustrator and Photoshop.

All modes use the alpha information (highest byte) of source image pixels as the blending factor. If the source and destination regions are different sizes, the image will be automatically resized to match the destination size. If the src parameter is not used, the display window is used as the source image.

As of release 0149, this function ignores imageMode().

用完整的 alpha 通道支持将一个像素区域从一个图像混合到另一个 (或本身)。可以选择以下模式将源像素 (a) 与目标图像中的像素 (B) 混合:

 

混合线性插值颜色: C = A * 因子 + B

 

添加加性混合与白色剪辑: C = min (A * 因子 + B, 255)

 

减减法混合与黑夹子: C = 最大 (B a * 因素, 0)

 

最黑暗的只有最黑暗的颜色成功: C = min (A * 因子, B)

 

最轻只有最轻的颜色成功: C = 最大 (A * 因素, B)

 

差分从基础图像中减去颜色。

 

排斥类似的区别, 但不太极端。

 

乘以颜色, 结果将始终是较暗的。

 

屏幕相反倍增, 使用颜色的逆值。

 

叠加混合的乘法和屏幕。将暗值相乘, 并筛选光值。

 

HARD_LIGHT 当大于50% 灰度时, 在较低时相乘。

 

SOFT_LIGHT-混合最黑暗和最轻。工作, 如覆盖, 但不太苛刻。

 

道奇减轻光色调和增加对比度, 忽略深色。在插画和 Photoshop 中被称为颜色道奇

 

烧伤深色区域被应用, 增加对比度, 忽略光。在插画和 Photoshop 中被称为颜色烧伤

 

所有模式都使用源图像像素的 alpha 信息 (最高字节) 作为混合因子。如果源和目标区域的大小不同, 则会自动调整图像大小以匹配目标大小。如果未使用 src 参数, 则将显示窗口用作源图像。

 

0149版中, 此函数忽略 imageMode ()

Syntax

blend(sx, sy, sw, sh, dx, dy, dw, dh, mode)

blend(src, sx, sy, sw, sh, dx, dy, dw, dh, mode)

Parameters

src

PImage: an image variable referring to the source image

引用源图像的图像变量

sx

int: X coordinate of the source’s upper left corner

源左上角的 X 坐标

sy

int: Y coordinate of the source’s upper left corner

源左上角的 Y 坐标

sw

int: source image width

源图像宽度

sh

int: source image height

源图像高度

dx

int: X coordinate of the destinations’s upper left corner

目标左上角的 X 坐标

dy

int: Y coordinate of the destinations’s upper left corner

目标左上角的 y 坐标

dw

int: destination image width

目标图像宽度

dh

int: destination image height

目标图像高度

mode

int: Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN

混合, , , 最轻, 最黑暗, 不同, 排斥, 乘法, 屏幕, 叠加, HARD_LIGHT, SOFT_LIGHT, 道奇, 烧伤

Returns

void

Related

alpha()
copy()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。