forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateImage.xml
More file actions
executable file
·83 lines (63 loc) · 1.95 KB
/
Copy pathcreateImage.xml
File metadata and controls
executable file
·83 lines (63 loc) · 1.95 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>createImage()</name>
<category>Image</category>
<subcategory></subcategory>
<usage>Web & Application</usage>
<example>
<image>createImage.jpg</image>
<code><![CDATA[
PImage img = createImage(66, 66, RGB);
img.loadPixels();
for (int i = 0; i < img.pixels.length; i++) {
img.pixels[i] = color(0, 90, 102);
}
img.updatePixels();
image(img, 17, 17);
]]></code>
</example>
<example>
<image>createImage_2.jpg</image>
<code><![CDATA[
PImage img = createImage(66, 66, ARGB);
img.loadPixels();
for (int i = 0; i < img.pixels.length; i++) {
img.pixels[i] = color(0, 90, 102, i % img.width * 2);
}
img.updatePixels();
image(img, 17, 17);
image(img, 34, 34);
]]></code>
</example>
<description><![CDATA[
Creates a new PImage (the datatype for storing images). This provides a fresh buffer of pixels to play with. Set the size of the buffer with the <b>width</b> and <b>height</b> parameters. The <b>format</b> parameter defines how the pixels are stored. See the PImage reference for more information.
<br/> <br/>
Be sure to include all three parameters, specifying only the width and height (but no format) will produce a strange error.
<br/> <br/>
Advanced users please note that createImage() should be used instead of the syntax <tt>new PImage()</tt>.
]]></description>
<syntax><![CDATA[
createImage(<kbd>width</kbd>, <kbd>height</kbd>, <kbd>format</kbd>)
]]></syntax>
<parameter>
<label>width</label>
<description><![CDATA[int: width in pixels]]></description>
</parameter>
<parameter>
<label>height</label>
<description><![CDATA[int: height in pixels]]></description>
</parameter>
<parameter>
<label>format</label>
<description><![CDATA[Either RGB, ARGB, ALPHA (grayscale alpha channel)]]></description>
</parameter>
<returns>PImage or null</returns>
<related>
PImage
PGraphics
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
<level>Extended</level>
</root>