forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateGraphics.xml
More file actions
executable file
·84 lines (60 loc) · 2.48 KB
/
Copy pathcreateGraphics.xml
File metadata and controls
executable file
·84 lines (60 loc) · 2.48 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>createGraphics()</name>
<category>Rendering</category>
<subcategory></subcategory>
<usage>Web & Application</usage>
<example>
<image>pgraphics.jpg</image>
<code><![CDATA[
PGraphics pg;
void setup() {
size(100, 100);
pg = createGraphics(80, 80, P3D);
}
void draw() {
pg.beginDraw();
pg.background(102);
pg.stroke(255);
pg.line(40, 40, mouseX, mouseY);
pg.endDraw();
image(pg, 10, 10);
}
]]></code>
</example>
<description><![CDATA[
Creates and returns a new <b>PGraphics</b> object of the types P2D, P3D, and JAVA2D. Use this class if you need to draw into an off-screen graphics buffer. It's not possible to use <b>createGraphics()</b> with OPENGL, because it doesn't allow offscreen use. The DXF and PDF renderers require the filename parameter.
<br/> <br/>
It's important to call any drawing commands between beginDraw() and endDraw() statements. This is also true for any commands that affect drawing, such as smooth() or colorMode().
<br/> <br/>
Unlike the main drawing surface which is completely opaque, surfaces created with createGraphics() can have transparency. This makes it possible to draw into a graphics and maintain the alpha channel. By using save() to write a PNG or TGA file, the transparency of the graphics object will be honored. Note that transparency levels are binary: pixels are either complete opaque or transparent. For the time being (as of release 0127), this means that text characters will be opaque blocks. This will be fixed in a future release (<A HREF="http://dev.processing.org/bugs/show_bug.cgi?id=641">Bug 641</A>).
]]></description>
<syntax><![CDATA[
createGraphics(<kbd>width</kbd>, <kbd>height</kbd>, <kbd>renderer</kbd>)
createGraphics(<kbd>width</kbd>, <kbd>height</kbd>, <kbd>renderer</kbd>, <kbd>filename</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>renderer</label>
<description><![CDATA[Either P2D (not yet implemented), P3D, JAVA2D, PDF, DXF]]></description>
</parameter>
<parameter>
<label>filename</label>
<description><![CDATA[String: the name of the file]]></description>
</parameter>
<returns>PImage or null</returns>
<related>
PGraphics
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
<level>Extended</level>
</root>