Name |
blend()混合 () |
||||||||||||||||||||
Examples |
background(loadImage(“rockies.jpg”)); PImage img = loadImage(“bricks.jpg”); image(img, 0, 0); blend(img, 0, 0, 33, 100, 67, 0, 33, 100, ADD);
background(loadImage(“rockies.jpg”)); PImage img = loadImage(“bricks.jpg”); image(img, 0, 0); blend(img, 0, 0, 33, 100, 67, 0, 33, 100, SUBTRACT);
background(loadImage(“rockies.jpg”)); PImage img = loadImage(“bricks.jpg”); image(img, 0, 0); blend(img, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);
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 |
|
||||||||||||||||||||
Returns |
void |
||||||||||||||||||||
Related |
alpha() |
- 本文固定链接: http://iprocessing.cn/2017/08/09/blend混合/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表