forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblend.xml
More file actions
executable file
·154 lines (133 loc) · 4.77 KB
/
Copy pathblend.xml
File metadata and controls
executable file
·154 lines (133 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>blend()</name>
<category>Image</category>
<subcategory>Pixels</subcategory>
<usage>Web & Application</usage>
<example>
<image>blend_add.jpg</image>
<code><![CDATA[
background(loadImage("rockies.jpg"));
PImage img = loadImage("degaul.jpg");
image(img, 0, 0);
blend(img, 0, 0, 33, 100, 67, 0, 33, 100, ADD);
]]></code>
</example>
<example>
<image>blend_subtract.jpg</image>
<code><![CDATA[
background(loadImage("rockies.jpg"));
PImage img = loadImage("degaul.jpg");
image(img, 0, 0);
blend(img, 0, 0, 33, 100, 67, 0, 33, 100, SUBTRACT);
]]></code>
</example>
<example>
<image>blend_darkest.jpg</image>
<code><![CDATA[
background(loadImage("rockies.jpg"));
PImage img = loadImage("degaul.jpg");
image(img, 0, 0);
blend(img, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);
]]></code>
</example>
<example>
<image>blend_lightest.jpg</image>
<code><![CDATA[
background(loadImage("rockies.jpg"));
PImage img = loadImage("degaul.jpg");
image(img, 0, 0);
blend(img, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);
]]></code>
</example>
<description><![CDATA[
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):<br />
<br />
BLEND - linear interpolation of colours: C = A*factor + B<br />
<br />
ADD - additive blending with white clip: C = min(A*factor + B, 255)<br />
<br />
SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)<br />
<br />
DARKEST - only the darkest colour succeeds: C = min(A*factor, B)<br />
<br />
LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)<br />
<br />
DIFFERENCE - subtract colors from underlying image.<br />
<br />
EXCLUSION - similar to DIFFERENCE, but less extreme.<br />
<br />
MULTIPLY - Multiply the colors, result will always be darker.<br />
<br />
SCREEN - Opposite multiply, uses inverse values of the colors.<br />
<br />
OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values,
and screens light values.<br />
<br />
HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower.<br />
<br />
SOFT_LIGHT - Mix of DARKEST and LIGHTEST.
Works like OVERLAY, but not as harsh.<br />
<br />
DODGE - Lightens light tones and increases contrast, ignores darks.
Called "Color Dodge" in Illustrator and Photoshop.<br />
<br />
BURN - Darker areas are applied, increasing contrast, ignores lights.
Called "Color Burn" in Illustrator and Photoshop.<br />
<br />
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 <b>srcImg</b> parameter is not used, the display window is used as the source image.<br />
<br />
As of release 0149, this function ignores <b>imageMode()</b>.
]]></description>
<syntax><![CDATA[
blend(<kbd>x</kbd>, <kbd>y</kbd>, <kbd>width</kbd>, <kbd>height</kbd>, <kbd>dx</kbd>, <kbd>dy</kbd>, <kbd>dwidth</kbd>, <kbd>dheight</kbd>, <kbd>MODE</kbd>)
blend(<kbd>srcImg</kbd>, <kbd>x</kbd>, <kbd>y</kbd>, <kbd>width</kbd>, <kbd>height</kbd>, <kbd>dx</kbd>, <kbd>dy</kbd>, <kbd>dwidth</kbd>, <kbd>dheight</kbd>, <kbd>MODE</kbd>)
]]></syntax>
<parameter>
<label>x</label>
<description><![CDATA[int: X coordinate of the source's upper left corner]]></description>
</parameter>
<parameter>
<label>y</label>
<description><![CDATA[int: Y coordinate of the source's upper left corner]]></description>
</parameter>
<parameter>
<label>width</label>
<description><![CDATA[int: source image width]]></description>
</parameter>
<parameter>
<label>height</label>
<description><![CDATA[int: source image height]]></description>
</parameter>
<parameter>
<label>dx</label>
<description><![CDATA[int: X coordinate of the destinations's upper left corner]]></description>
</parameter>
<parameter>
<label>dy</label>
<description><![CDATA[int: Y coordinate of the destinations's upper left corner]]></description>
</parameter>
<parameter>
<label>dwidth</label>
<description><![CDATA[int: destination image width]]></description>
</parameter>
<parameter>
<label>dheight</label>
<description><![CDATA[int: destination image height]]></description>
</parameter>
<parameter>
<label>srcImg</label>
<description><![CDATA[PImage: a image variable referring to the source image]]></description>
</parameter>
<parameter>
<label>MODE</label>
<description><![CDATA[Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN]]></description>
</parameter>
<returns>None</returns>
<related>
filter()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>