propane 3.4.2-java → 3.5.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -1
- data/Gemfile +2 -0
- data/README.md +15 -3
- data/Rakefile +9 -10
- data/bin/propane +3 -1
- data/lib/propane.rb +2 -1
- data/lib/propane/app.rb +2 -1
- data/lib/propane/creators/sketch_class.rb +7 -1
- data/lib/propane/creators/sketch_factory.rb +4 -2
- data/lib/propane/creators/sketch_writer.rb +1 -0
- data/lib/propane/helper_methods.rb +22 -22
- data/lib/propane/helpers/numeric.rb +2 -0
- data/lib/propane/helpers/version_error.rb +1 -0
- data/lib/propane/library.rb +5 -1
- data/lib/propane/library_loader.rb +2 -0
- data/lib/propane/native_folder.rb +10 -9
- data/lib/propane/native_loader.rb +3 -0
- data/lib/propane/runner.rb +11 -5
- data/lib/propane/version.rb +2 -1
- data/library/boids/boids.rb +21 -11
- data/library/color_group/color_group.rb +2 -0
- data/library/control_panel/control_panel.rb +8 -5
- data/library/dxf/dxf.rb +2 -0
- data/library/file_chooser/chooser.rb +10 -9
- data/library/file_chooser/file_chooser.rb +10 -9
- data/library/library_proxy/library_proxy.rb +2 -0
- data/library/net/net.rb +2 -0
- data/library/simplex_noise/simplex_noise.rb +2 -0
- data/library/slider/slider.rb +23 -22
- data/library/vector_utils/vector_utils.rb +4 -0
- data/library/video_event/video_event.rb +2 -0
- data/pom.rb +46 -45
- data/pom.xml +4 -4
- data/propane.gemspec +8 -7
- data/src/main/java/monkstone/ColorUtil.java +1 -3
- data/src/main/java/monkstone/MathToolModule.java +1 -1
- data/src/main/java/monkstone/PropaneLibrary.java +2 -2
- data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
- data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
- data/src/main/java/monkstone/noise/SimplexNoise.java +2 -2
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SliderBar.java +1 -1
- data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
- data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
- data/src/main/java/monkstone/vecmath/package-info.java +1 -1
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -2
- data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
- data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
- data/src/main/java/monkstone/videoevent/package-info.java +1 -1
- data/src/main/java/processing/awt/PGraphicsJava2D.java +788 -283
- data/src/main/java/processing/awt/PImageAWT.java +260 -0
- data/src/main/java/processing/awt/PShapeJava2D.java +56 -53
- data/src/main/java/processing/awt/PSurfaceAWT.java +309 -211
- data/src/main/java/processing/awt/ShimAWT.java +580 -0
- data/src/main/java/processing/core/PApplet.java +2877 -2098
- data/src/main/java/processing/core/PConstants.java +477 -447
- data/src/main/java/processing/core/PFont.java +930 -884
- data/src/main/java/processing/core/PGraphics.java +337 -309
- data/src/main/java/processing/core/PImage.java +1689 -1689
- data/src/main/java/processing/core/PMatrix.java +172 -159
- data/src/main/java/processing/core/PMatrix2D.java +456 -410
- data/src/main/java/processing/core/PMatrix3D.java +755 -735
- data/src/main/java/processing/core/PShape.java +2910 -2656
- data/src/main/java/processing/core/PShapeOBJ.java +97 -94
- data/src/main/java/processing/core/PShapeSVG.java +1656 -1462
- data/src/main/java/processing/core/PStyle.java +40 -37
- data/src/main/java/processing/core/PSurface.java +134 -97
- data/src/main/java/processing/core/PSurfaceNone.java +292 -218
- data/src/main/java/processing/core/PVector.java +991 -966
- data/src/main/java/processing/core/ThinkDifferent.java +12 -8
- data/src/main/java/processing/data/DoubleDict.java +756 -710
- data/src/main/java/processing/data/DoubleList.java +749 -696
- data/src/main/java/processing/data/FloatDict.java +748 -702
- data/src/main/java/processing/data/FloatList.java +751 -697
- data/src/main/java/processing/data/IntDict.java +720 -673
- data/src/main/java/processing/data/IntList.java +699 -633
- data/src/main/java/processing/data/JSONArray.java +931 -873
- data/src/main/java/processing/data/JSONObject.java +1262 -1165
- data/src/main/java/processing/data/JSONTokener.java +351 -341
- data/src/main/java/processing/data/LongDict.java +710 -663
- data/src/main/java/processing/data/LongList.java +701 -635
- data/src/main/java/processing/data/Sort.java +37 -41
- data/src/main/java/processing/data/StringDict.java +525 -486
- data/src/main/java/processing/data/StringList.java +626 -580
- data/src/main/java/processing/data/Table.java +3693 -3513
- data/src/main/java/processing/data/TableRow.java +182 -183
- data/src/main/java/processing/data/XML.java +954 -880
- data/src/main/java/processing/event/Event.java +87 -67
- data/src/main/java/processing/event/KeyEvent.java +48 -41
- data/src/main/java/processing/event/MouseEvent.java +87 -113
- data/src/main/java/processing/event/TouchEvent.java +10 -6
- data/src/main/java/processing/javafx/PSurfaceFX.java +26 -0
- data/src/main/java/processing/net/Client.java +20 -20
- data/src/main/java/processing/net/Server.java +9 -9
- data/src/main/java/processing/opengl/FontTexture.java +286 -266
- data/src/main/java/processing/opengl/FrameBuffer.java +390 -376
- data/src/main/java/processing/opengl/LinePath.java +130 -91
- data/src/main/java/processing/opengl/LineStroker.java +593 -582
- data/src/main/java/processing/opengl/PGL.java +645 -579
- data/src/main/java/processing/opengl/PGraphics2D.java +408 -315
- data/src/main/java/processing/opengl/PGraphics3D.java +107 -72
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12287 -12030
- data/src/main/java/processing/opengl/PJOGL.java +1743 -1672
- data/src/main/java/processing/opengl/PShader.java +345 -416
- data/src/main/java/processing/opengl/PShapeOpenGL.java +4601 -4543
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +1113 -1029
- data/src/main/java/processing/opengl/Texture.java +1489 -1401
- data/src/main/java/processing/opengl/VertexBuffer.java +57 -55
- data/test/create_test.rb +21 -20
- data/test/deglut_spec_test.rb +4 -2
- data/test/helper_methods_test.rb +49 -20
- data/test/math_tool_test.rb +39 -32
- data/test/native_folder.rb +47 -0
- data/test/respond_to_test.rb +3 -2
- data/test/sketches/key_event.rb +2 -2
- data/test/sketches/library/my_library/my_library.rb +3 -0
- data/test/test_helper.rb +2 -0
- data/test/vecmath_spec_test.rb +35 -22
- data/vendors/Rakefile +28 -22
- metadata +13 -13
- data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
- data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
- data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
- data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
|
@@ -30,9 +30,11 @@ import java.awt.Color;
|
|
|
30
30
|
|
|
31
31
|
// Used for the 'image' object that's been here forever
|
|
32
32
|
import java.awt.Font;
|
|
33
|
+
import java.awt.FontFormatException;
|
|
33
34
|
import java.awt.Image;
|
|
34
35
|
|
|
35
36
|
import java.io.File;
|
|
37
|
+
import java.io.IOException;
|
|
36
38
|
import java.io.InputStream;
|
|
37
39
|
import java.util.Map;
|
|
38
40
|
import java.util.HashMap;
|
|
@@ -61,7 +63,7 @@ import processing.opengl.PShader;
|
|
|
61
63
|
* methods for this class are extensive. For a complete list, visit the <a
|
|
62
64
|
* href="http://processing.googlecode.com/svn/trunk/processing/build/javadoc/core/">developer's reference.</a>
|
|
63
65
|
*
|
|
64
|
-
*
|
|
66
|
+
*
|
|
65
67
|
*
|
|
66
68
|
* <h3>Advanced</h3>
|
|
67
69
|
* Main graphics and rendering context, as well as the base API implementation.
|
|
@@ -107,7 +109,7 @@ import processing.opengl.PShader;
|
|
|
107
109
|
* instance, imageImpl() handles drawing an image whose x/y/w/h and u/v coords
|
|
108
110
|
* have been specified, and screen placement (independent of imageMode) has
|
|
109
111
|
* been determined. There's no point in all renderers implementing the
|
|
110
|
-
* <
|
|
112
|
+
* <code>if (imageMode == BLAH)</code> placement/sizing logic, so that's handled
|
|
111
113
|
* by PGraphics, which then calls imageImpl() once all that is figured out.
|
|
112
114
|
*
|
|
113
115
|
* <h2>His brother PImage</h2>
|
|
@@ -134,7 +136,7 @@ import processing.opengl.PShader;
|
|
|
134
136
|
*
|
|
135
137
|
* <h2>What's in the PGraphics documentation, what ain't</h2>
|
|
136
138
|
* Some things are noted here, some things are not. For public API, always
|
|
137
|
-
* refer to the <a href="http://processing.org/reference">reference</
|
|
139
|
+
* refer to the <a href="http://processing.org/reference">reference</a>
|
|
138
140
|
* on Processing.org for proper explanations. <b>No attempt has been made to
|
|
139
141
|
* keep the javadoc up to date or complete.</b> It's an enormous task for
|
|
140
142
|
* which we simply do not have the time. That is, it's not something that
|
|
@@ -570,7 +572,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
570
572
|
|
|
571
573
|
// vertices
|
|
572
574
|
public static final int DEFAULT_VERTICES = 512;
|
|
573
|
-
protected float
|
|
575
|
+
protected float[][] vertices =
|
|
574
576
|
new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT];
|
|
575
577
|
protected int vertexCount; // total number of vertices
|
|
576
578
|
|
|
@@ -605,7 +607,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
605
607
|
|
|
606
608
|
// spline vertices
|
|
607
609
|
|
|
608
|
-
protected float
|
|
610
|
+
protected float[][] curveVertices;
|
|
609
611
|
protected int curveVertexCount;
|
|
610
612
|
|
|
611
613
|
// ........................................................
|
|
@@ -618,8 +620,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
618
620
|
// [toxi 031031]
|
|
619
621
|
// changed table's precision to 0.5 degree steps
|
|
620
622
|
// introduced new vars for more flexible code
|
|
621
|
-
static final protected float sinLUT
|
|
622
|
-
static final protected float cosLUT
|
|
623
|
+
static final protected float[] sinLUT;
|
|
624
|
+
static final protected float[] cosLUT;
|
|
623
625
|
static final protected float SINCOS_PRECISION = 0.5f;
|
|
624
626
|
static final protected int SINCOS_LENGTH = (int) (360f / SINCOS_PRECISION);
|
|
625
627
|
static {
|
|
@@ -702,7 +704,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
702
704
|
|
|
703
705
|
// [toxi031031] new & faster sphere code w/ support flexible resolutions
|
|
704
706
|
// will be set by sphereDetail() or 1st call to sphere()
|
|
705
|
-
protected float
|
|
707
|
+
protected float[] sphereX;
|
|
708
|
+
protected float[] sphereY;
|
|
709
|
+
protected float[] sphereZ;
|
|
706
710
|
|
|
707
711
|
/// Number of U steps (aka "theta") around longitudinally spanning 2*pi
|
|
708
712
|
public int sphereDetailU = 0;
|
|
@@ -891,7 +895,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
891
895
|
* Sets the default properties for a PGraphics object. It should be called
|
|
892
896
|
* before anything is drawn into the object.
|
|
893
897
|
*
|
|
894
|
-
*
|
|
898
|
+
*
|
|
895
899
|
* <h3>Advanced</h3>
|
|
896
900
|
* When creating your own PGraphics, you should call this before
|
|
897
901
|
* drawing anything.
|
|
@@ -908,7 +912,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
908
912
|
*
|
|
909
913
|
* Finalizes the rendering of a PGraphics object so that it can be shown on screen.
|
|
910
914
|
*
|
|
911
|
-
*
|
|
915
|
+
*
|
|
912
916
|
* <h3>Advanced</h3>
|
|
913
917
|
*
|
|
914
918
|
* When creating your own PGraphics, you should call this when
|
|
@@ -1152,7 +1156,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1152
1156
|
* prevents the double negatives, and also reinforces which hints can be
|
|
1153
1157
|
* enabled or disabled.
|
|
1154
1158
|
*
|
|
1155
|
-
*
|
|
1159
|
+
*
|
|
1156
1160
|
*
|
|
1157
1161
|
* @webref rendering
|
|
1158
1162
|
* @param which name of the hint to be enabled or disabled
|
|
@@ -1220,7 +1224,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1220
1224
|
* <b>strokeJoin()</b> cannot be changed while inside a
|
|
1221
1225
|
* <b>beginShape()</b>/<b>endShape()</b> block with any renderer.
|
|
1222
1226
|
*
|
|
1223
|
-
*
|
|
1227
|
+
*
|
|
1224
1228
|
* @webref shape:vertex
|
|
1225
1229
|
* @param kind Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP
|
|
1226
1230
|
* @see PShape
|
|
@@ -1253,7 +1257,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1253
1257
|
* imperfect, this is a better option when you want more control. This
|
|
1254
1258
|
* function is identical to glNormal3f() in OpenGL.
|
|
1255
1259
|
*
|
|
1256
|
-
*
|
|
1260
|
+
*
|
|
1257
1261
|
* @webref lights_camera:lights
|
|
1258
1262
|
* @param nx x direction
|
|
1259
1263
|
* @param ny y direction
|
|
@@ -1322,7 +1326,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1322
1326
|
* the points (0,0) (0,100) (100,200) (0,200). The same mapping in
|
|
1323
1327
|
* NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1).
|
|
1324
1328
|
*
|
|
1325
|
-
*
|
|
1329
|
+
*
|
|
1326
1330
|
* @webref image:textures
|
|
1327
1331
|
* @param mode either IMAGE or NORMAL
|
|
1328
1332
|
* @see PGraphics#texture(PImage)
|
|
@@ -1362,7 +1366,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1362
1366
|
* When textures are in use, the fill color is ignored. Instead, use tint()
|
|
1363
1367
|
* to specify the color of the texture as it is applied to the shape.
|
|
1364
1368
|
*
|
|
1365
|
-
*
|
|
1369
|
+
*
|
|
1366
1370
|
* @webref image:textures
|
|
1367
1371
|
* @param image reference to a PImage object
|
|
1368
1372
|
* @see PGraphics#textureMode(int)
|
|
@@ -1388,7 +1392,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1388
1392
|
|
|
1389
1393
|
protected void vertexCheck() {
|
|
1390
1394
|
if (vertexCount == vertices.length) {
|
|
1391
|
-
float
|
|
1395
|
+
float[][] temp = new float[vertexCount << 1][VERTEX_FIELD_COUNT];
|
|
1392
1396
|
System.arraycopy(vertices, 0, temp, 0, vertexCount);
|
|
1393
1397
|
vertices = temp;
|
|
1394
1398
|
}
|
|
@@ -1480,7 +1484,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1480
1484
|
// http://dev.processing.org/bugs/show_bug.cgi?id=444
|
|
1481
1485
|
if (shape == POLYGON) {
|
|
1482
1486
|
if (vertexCount > 0) {
|
|
1483
|
-
float
|
|
1487
|
+
float[] pvertex = vertices[vertexCount-1];
|
|
1484
1488
|
if ((Math.abs(pvertex[X] - x) < EPSILON) &&
|
|
1485
1489
|
(Math.abs(pvertex[Y] - y) < EPSILON) &&
|
|
1486
1490
|
(Math.abs(pvertex[Z] - z) < EPSILON)) {
|
|
@@ -1617,7 +1621,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1617
1621
|
* <b>v</b> are specified in relation to the image's size in pixels, but
|
|
1618
1622
|
* this relation can be changed with <b>textureMode()</b>.
|
|
1619
1623
|
*
|
|
1620
|
-
*
|
|
1624
|
+
*
|
|
1621
1625
|
* @webref shape:vertex
|
|
1622
1626
|
* @param x x-coordinate of the vertex
|
|
1623
1627
|
* @param y y-coordinate of the vertex
|
|
@@ -1718,7 +1722,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1718
1722
|
* as the value for the MODE parameter to close the shape (to connect the
|
|
1719
1723
|
* beginning and the end).
|
|
1720
1724
|
*
|
|
1721
|
-
*
|
|
1725
|
+
*
|
|
1722
1726
|
* @webref shape:vertex
|
|
1723
1727
|
* @param mode use CLOSE to close the shape
|
|
1724
1728
|
* @see PShape
|
|
@@ -1886,7 +1890,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1886
1890
|
*
|
|
1887
1891
|
* This is a new reference entry for Processing 2.0. It will be updated shortly.
|
|
1888
1892
|
*
|
|
1889
|
-
*
|
|
1893
|
+
*
|
|
1890
1894
|
*
|
|
1891
1895
|
* @webref rendering:shaders
|
|
1892
1896
|
* @param fragFilename name of fragment shader file
|
|
@@ -1911,7 +1915,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1911
1915
|
*
|
|
1912
1916
|
* This is a new reference entry for Processing 2.0. It will be updated shortly.
|
|
1913
1917
|
*
|
|
1914
|
-
*
|
|
1918
|
+
*
|
|
1915
1919
|
*
|
|
1916
1920
|
* @webref rendering:shaders
|
|
1917
1921
|
* @param shader name of shader file
|
|
@@ -1934,7 +1938,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1934
1938
|
*
|
|
1935
1939
|
* This is a new reference entry for Processing 2.0. It will be updated shortly.
|
|
1936
1940
|
*
|
|
1937
|
-
*
|
|
1941
|
+
*
|
|
1938
1942
|
*
|
|
1939
1943
|
* @webref rendering:shaders
|
|
1940
1944
|
*/
|
|
@@ -1971,7 +1975,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
1971
1975
|
* by the parameters. The boundaries are drawn based on the state
|
|
1972
1976
|
* of the <b>imageMode()</b> fuction, either CORNER, CORNERS, or CENTER.
|
|
1973
1977
|
*
|
|
1974
|
-
*
|
|
1978
|
+
*
|
|
1975
1979
|
*
|
|
1976
1980
|
* @webref rendering
|
|
1977
1981
|
* @param a x-coordinate of the rectangle, by default
|
|
@@ -2022,7 +2026,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2022
2026
|
*
|
|
2023
2027
|
* Disables the clipping previously started by the <b>clip()</b> function.
|
|
2024
2028
|
*
|
|
2025
|
-
*
|
|
2029
|
+
*
|
|
2026
2030
|
*
|
|
2027
2031
|
* @webref rendering
|
|
2028
2032
|
*/
|
|
@@ -2041,7 +2045,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2041
2045
|
*
|
|
2042
2046
|
* This is a new reference entry for Processing 2.0. It will be updated shortly.
|
|
2043
2047
|
*
|
|
2044
|
-
*
|
|
2048
|
+
*
|
|
2045
2049
|
*
|
|
2046
2050
|
* @webref rendering
|
|
2047
2051
|
* @param mode the blending mode to use
|
|
@@ -2123,7 +2127,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2123
2127
|
* 3D version requires rendering with P3D (see the Environment reference
|
|
2124
2128
|
* for more information).
|
|
2125
2129
|
*
|
|
2126
|
-
*
|
|
2130
|
+
*
|
|
2127
2131
|
* @webref shape:vertex
|
|
2128
2132
|
* @param x2 the x-coordinate of the 1st control point
|
|
2129
2133
|
* @param y2 the y-coordinate of the 1st control point
|
|
@@ -2256,7 +2260,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2256
2260
|
* version requires rendering with P3D (see the Environment reference for
|
|
2257
2261
|
* more information).
|
|
2258
2262
|
*
|
|
2259
|
-
*
|
|
2263
|
+
*
|
|
2260
2264
|
*
|
|
2261
2265
|
* @webref shape:vertex
|
|
2262
2266
|
* @param x the x-coordinate of the vertex
|
|
@@ -2407,7 +2411,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2407
2411
|
* requires the P3D parameter in combination with <b>size()</b> as shown in
|
|
2408
2412
|
* the above example.
|
|
2409
2413
|
*
|
|
2410
|
-
*
|
|
2414
|
+
*
|
|
2411
2415
|
*
|
|
2412
2416
|
* @webref shape:2d_primitives
|
|
2413
2417
|
* @param x x-coordinate of the point
|
|
@@ -2442,7 +2446,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2442
2446
|
* Drawing this shape in 3D with the <b>z</b> parameter requires the P3D
|
|
2443
2447
|
* parameter in combination with <b>size()</b> as shown in the above example.
|
|
2444
2448
|
*
|
|
2445
|
-
*
|
|
2449
|
+
*
|
|
2446
2450
|
* @webref shape:2d_primitives
|
|
2447
2451
|
* @param x1 x-coordinate of the first point
|
|
2448
2452
|
* @param y1 y-coordinate of the first point
|
|
@@ -2479,7 +2483,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2479
2483
|
* arguments specify the first point, the middle two arguments specify the
|
|
2480
2484
|
* second point, and the last two arguments specify the third point.
|
|
2481
2485
|
*
|
|
2482
|
-
*
|
|
2486
|
+
*
|
|
2483
2487
|
* @webref shape:2d_primitives
|
|
2484
2488
|
* @param x1 x-coordinate of the first point
|
|
2485
2489
|
* @param y1 y-coordinate of the first point
|
|
@@ -2508,7 +2512,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2508
2512
|
* vertex and the subsequent pairs should proceed clockwise or
|
|
2509
2513
|
* counter-clockwise around the defined shape.
|
|
2510
2514
|
*
|
|
2511
|
-
*
|
|
2515
|
+
*
|
|
2512
2516
|
* @webref shape:2d_primitives
|
|
2513
2517
|
* @param x1 x-coordinate of the first corner
|
|
2514
2518
|
* @param y1 y-coordinate of the first corner
|
|
@@ -2554,7 +2558,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2554
2558
|
* sensitive language. Note: In version 125, the mode named CENTER_RADIUS
|
|
2555
2559
|
* was shortened to RADIUS.
|
|
2556
2560
|
*
|
|
2557
|
-
*
|
|
2561
|
+
*
|
|
2558
2562
|
* @webref shape:attributes
|
|
2559
2563
|
* @param mode either CORNER, CORNERS, CENTER, or RADIUS
|
|
2560
2564
|
* @see PGraphics#rect(float, float, float, float)
|
|
@@ -2573,7 +2577,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2573
2577
|
* fourth sets the height. These parameters may be changed with the
|
|
2574
2578
|
* <b>rectMode()</b> function.
|
|
2575
2579
|
*
|
|
2576
|
-
*
|
|
2580
|
+
*
|
|
2577
2581
|
*
|
|
2578
2582
|
* @webref shape:2d_primitives
|
|
2579
2583
|
* @param a x-coordinate of the rectangle by default
|
|
@@ -2732,14 +2736,14 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2732
2736
|
/**
|
|
2733
2737
|
* ( begin auto-generated from square.xml )
|
|
2734
2738
|
*
|
|
2735
|
-
* Draws a square to the screen. A square is a four-sided shape with
|
|
2736
|
-
* every angle at ninety degrees and each side is the same length.
|
|
2737
|
-
* By default, the first two parameters set the location of the
|
|
2738
|
-
* upper-left corner, the third sets the width and height. The way
|
|
2739
|
-
* these parameters are interpreted, however, may be changed with the
|
|
2739
|
+
* Draws a square to the screen. A square is a four-sided shape with
|
|
2740
|
+
* every angle at ninety degrees and each side is the same length.
|
|
2741
|
+
* By default, the first two parameters set the location of the
|
|
2742
|
+
* upper-left corner, the third sets the width and height. The way
|
|
2743
|
+
* these parameters are interpreted, however, may be changed with the
|
|
2740
2744
|
* <b>rectMode()</b> function.
|
|
2741
2745
|
*
|
|
2742
|
-
*
|
|
2746
|
+
*
|
|
2743
2747
|
*
|
|
2744
2748
|
* @webref shape:2d_primitives
|
|
2745
2749
|
* @param x x-coordinate of the rectangle by default
|
|
@@ -2773,7 +2777,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2773
2777
|
* ellipse's bounding box. The parameter must be written in ALL CAPS
|
|
2774
2778
|
* because Processing is a case-sensitive language.
|
|
2775
2779
|
*
|
|
2776
|
-
*
|
|
2780
|
+
*
|
|
2777
2781
|
* @webref shape:attributes
|
|
2778
2782
|
* @param mode either CENTER, RADIUS, CORNER, or CORNERS
|
|
2779
2783
|
* @see PApplet#ellipse(float, float, float, float)
|
|
@@ -2792,7 +2796,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2792
2796
|
* the location, the third sets the width, and the fourth sets the height.
|
|
2793
2797
|
* The origin may be changed with the <b>ellipseMode()</b> function.
|
|
2794
2798
|
*
|
|
2795
|
-
*
|
|
2799
|
+
*
|
|
2796
2800
|
* @webref shape:2d_primitives
|
|
2797
2801
|
* @param a x-coordinate of the ellipse
|
|
2798
2802
|
* @param b y-coordinate of the ellipse
|
|
@@ -2807,19 +2811,23 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2807
2811
|
float w = c;
|
|
2808
2812
|
float h = d;
|
|
2809
2813
|
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2814
|
+
switch (ellipseMode) {
|
|
2815
|
+
case CORNERS:
|
|
2816
|
+
w = c - a;
|
|
2817
|
+
h = d - b;
|
|
2818
|
+
break;
|
|
2819
|
+
case RADIUS:
|
|
2820
|
+
x = a - c;
|
|
2821
|
+
y = b - d;
|
|
2822
|
+
w = c * 2;
|
|
2823
|
+
h = d * 2;
|
|
2824
|
+
break;
|
|
2825
|
+
case DIAMETER:
|
|
2826
|
+
x = a - c/2f;
|
|
2827
|
+
y = b - d/2f;
|
|
2828
|
+
break;
|
|
2829
|
+
default:
|
|
2830
|
+
break;
|
|
2823
2831
|
}
|
|
2824
2832
|
|
|
2825
2833
|
if (w < 0) { // undo negative width
|
|
@@ -2849,7 +2857,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2849
2857
|
* with the <b>ellipseMode()</b> function. The <b>start</b> and <b>stop</b>
|
|
2850
2858
|
* parameters specify the angles at which to draw the arc.
|
|
2851
2859
|
*
|
|
2852
|
-
*
|
|
2860
|
+
*
|
|
2853
2861
|
* @webref shape:2d_primitives
|
|
2854
2862
|
* @param a x-coordinate of the arc's ellipse
|
|
2855
2863
|
* @param b y-coordinate of the arc's ellipse
|
|
@@ -2877,19 +2885,23 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2877
2885
|
float w = c;
|
|
2878
2886
|
float h = d;
|
|
2879
2887
|
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2888
|
+
switch (ellipseMode) {
|
|
2889
|
+
case CORNERS:
|
|
2890
|
+
w = c - a;
|
|
2891
|
+
h = d - b;
|
|
2892
|
+
break;
|
|
2893
|
+
case RADIUS:
|
|
2894
|
+
x = a - c;
|
|
2895
|
+
y = b - d;
|
|
2896
|
+
w = c * 2;
|
|
2897
|
+
h = d * 2;
|
|
2898
|
+
break;
|
|
2899
|
+
case CENTER:
|
|
2900
|
+
x = a - c/2f;
|
|
2901
|
+
y = b - d/2f;
|
|
2902
|
+
break;
|
|
2903
|
+
default:
|
|
2904
|
+
break;
|
|
2893
2905
|
}
|
|
2894
2906
|
|
|
2895
2907
|
// make sure the loop will exit before starting while
|
|
@@ -2931,12 +2943,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2931
2943
|
/**
|
|
2932
2944
|
* ( begin auto-generated from circle.xml )
|
|
2933
2945
|
*
|
|
2934
|
-
* Draws a circle to the screen. By default, the first two parameters
|
|
2935
|
-
* set the location of the center, and the third sets the shape's width
|
|
2936
|
-
* and height. The origin may be changed with the <b>ellipseMode()</b>
|
|
2946
|
+
* Draws a circle to the screen. By default, the first two parameters
|
|
2947
|
+
* set the location of the center, and the third sets the shape's width
|
|
2948
|
+
* and height. The origin may be changed with the <b>ellipseMode()</b>
|
|
2937
2949
|
* function.
|
|
2938
2950
|
*
|
|
2939
|
-
*
|
|
2951
|
+
*
|
|
2940
2952
|
* @webref shape:2d_primitives
|
|
2941
2953
|
* @param x x-coordinate of the ellipse
|
|
2942
2954
|
* @param y y-coordinate of the ellipse
|
|
@@ -2959,7 +2971,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
2959
2971
|
* A box is an extruded rectangle. A box with equal dimension on all sides
|
|
2960
2972
|
* is a cube.
|
|
2961
2973
|
*
|
|
2962
|
-
*
|
|
2974
|
+
*
|
|
2963
2975
|
*
|
|
2964
2976
|
* @webref shape:3d_primitives
|
|
2965
2977
|
* @param size dimension of the box in all dimensions (creates a cube)
|
|
@@ -3052,7 +3064,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3052
3064
|
* and vertical resolution independently, use the version of the functions
|
|
3053
3065
|
* with two parameters.
|
|
3054
3066
|
*
|
|
3055
|
-
*
|
|
3067
|
+
*
|
|
3056
3068
|
*
|
|
3057
3069
|
* <h3>Advanced</h3>
|
|
3058
3070
|
* Code for sphereDetail() submitted by toxi [031031].
|
|
@@ -3118,7 +3130,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3118
3130
|
*
|
|
3119
3131
|
* A sphere is a hollow ball made from tessellated triangles.
|
|
3120
3132
|
*
|
|
3121
|
-
*
|
|
3133
|
+
*
|
|
3122
3134
|
*
|
|
3123
3135
|
* <h3>Advanced</h3>
|
|
3124
3136
|
* <P>
|
|
@@ -3225,7 +3237,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3225
3237
|
* second time with the y coordinates to get the location of a bezier curve
|
|
3226
3238
|
* at t.
|
|
3227
3239
|
*
|
|
3228
|
-
*
|
|
3240
|
+
*
|
|
3229
3241
|
*
|
|
3230
3242
|
* <h3>Advanced</h3>
|
|
3231
3243
|
* For instance, to convert the following example:<PRE>
|
|
@@ -3269,7 +3281,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3269
3281
|
* definition of <a href="http://en.wikipedia.org/wiki/Tangent"
|
|
3270
3282
|
* target="new"><em>tangent</em> on Wikipedia</a>.
|
|
3271
3283
|
*
|
|
3272
|
-
*
|
|
3284
|
+
*
|
|
3273
3285
|
*
|
|
3274
3286
|
* <h3>Advanced</h3>
|
|
3275
3287
|
* Code submitted by Dave Bollinger (davol) for release 0136.
|
|
@@ -3312,7 +3324,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3312
3324
|
* This function is only useful when using the P3D renderer as the default
|
|
3313
3325
|
* P2D renderer does not use this information.
|
|
3314
3326
|
*
|
|
3315
|
-
*
|
|
3327
|
+
*
|
|
3316
3328
|
*
|
|
3317
3329
|
* @webref shape:curves
|
|
3318
3330
|
* @param detail resolution of the curves
|
|
@@ -3360,7 +3372,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3360
3372
|
* Bezier. Using the 3D version requires rendering with P3D (see the
|
|
3361
3373
|
* Environment reference for more information).
|
|
3362
3374
|
*
|
|
3363
|
-
*
|
|
3375
|
+
*
|
|
3364
3376
|
*
|
|
3365
3377
|
* <h3>Advanced</h3>
|
|
3366
3378
|
* Draw a cubic bezier curve. The first and last points are
|
|
@@ -3424,17 +3436,17 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3424
3436
|
* ( begin auto-generated from curvePoint.xml )
|
|
3425
3437
|
*
|
|
3426
3438
|
* Evalutes the curve at point t for points a, b, c, d. The parameter t
|
|
3427
|
-
* varies between 0 and 1, a and d are
|
|
3428
|
-
* the
|
|
3439
|
+
* varies between 0 and 1, a and d are the control points, and b and c are
|
|
3440
|
+
* the points on the curve. This can be done once with the x coordinates and a
|
|
3429
3441
|
* second time with the y coordinates to get the location of a curve at t.
|
|
3430
3442
|
*
|
|
3431
|
-
*
|
|
3443
|
+
*
|
|
3432
3444
|
*
|
|
3433
3445
|
* @webref shape:curves
|
|
3434
|
-
* @param a coordinate of first point
|
|
3435
|
-
* @param b coordinate of
|
|
3436
|
-
* @param c coordinate of
|
|
3437
|
-
* @param d coordinate of
|
|
3446
|
+
* @param a coordinate of first control point
|
|
3447
|
+
* @param b coordinate of first point on the curve
|
|
3448
|
+
* @param c coordinate of second point on the curve
|
|
3449
|
+
* @param d coordinate of second control point
|
|
3438
3450
|
* @param t value between 0 and 1
|
|
3439
3451
|
* @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float)
|
|
3440
3452
|
* @see PGraphics#curveVertex(float, float)
|
|
@@ -3460,9 +3472,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3460
3472
|
*
|
|
3461
3473
|
* Calculates the tangent of a point on a curve. There's a good definition
|
|
3462
3474
|
* of <em><a href="http://en.wikipedia.org/wiki/Tangent"
|
|
3463
|
-
* target="new">tangent
|
|
3475
|
+
* target="new">tangent on Wikipedia</a></em>.
|
|
3464
3476
|
*
|
|
3465
|
-
*
|
|
3477
|
+
*
|
|
3466
3478
|
*
|
|
3467
3479
|
* <h3>Advanced</h3>
|
|
3468
3480
|
* Code thanks to Dave Bollinger (Bug #715)
|
|
@@ -3500,7 +3512,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3500
3512
|
* This function is only useful when using the P3D renderer as the default
|
|
3501
3513
|
* P2D renderer does not use this information.
|
|
3502
3514
|
*
|
|
3503
|
-
*
|
|
3515
|
+
*
|
|
3504
3516
|
*
|
|
3505
3517
|
* @webref shape:curves
|
|
3506
3518
|
* @param detail resolution of the curves
|
|
@@ -3525,7 +3537,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3525
3537
|
* within the range -5.0 and 5.0 will deform the curves but will leave them
|
|
3526
3538
|
* recognizable and as values increase in magnitude, they will continue to deform.
|
|
3527
3539
|
*
|
|
3528
|
-
*
|
|
3540
|
+
*
|
|
3529
3541
|
*
|
|
3530
3542
|
* @webref shape:curves
|
|
3531
3543
|
* @param tightness amount of deformation from the original vertices
|
|
@@ -3604,7 +3616,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3604
3616
|
* implementation of Catmull-Rom splines. Using the 3D version requires
|
|
3605
3617
|
* rendering with P3D (see the Environment reference for more information).
|
|
3606
3618
|
*
|
|
3607
|
-
*
|
|
3619
|
+
*
|
|
3608
3620
|
*
|
|
3609
3621
|
* <h3>Advanced</h3>
|
|
3610
3622
|
* As of revision 0070, this function no longer doubles the first
|
|
@@ -3751,7 +3763,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3751
3763
|
* The parameter to <b>imageMode()</b> must be written in ALL CAPS because
|
|
3752
3764
|
* Processing is a case-sensitive language.
|
|
3753
3765
|
*
|
|
3754
|
-
*
|
|
3766
|
+
*
|
|
3755
3767
|
*
|
|
3756
3768
|
* @webref image:loading_displaying
|
|
3757
3769
|
* @param mode either CORNER, CORNERS, or CENTER
|
|
@@ -3791,7 +3803,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3791
3803
|
* The color of an image may be modified with the <b>tint()</b> function.
|
|
3792
3804
|
* This function will maintain transparency for GIF and PNG images.
|
|
3793
3805
|
*
|
|
3794
|
-
*
|
|
3806
|
+
*
|
|
3795
3807
|
*
|
|
3796
3808
|
* <h3>Advanced</h3>
|
|
3797
3809
|
* Starting with release 0124, when using the default (JAVA2D) renderer,
|
|
@@ -3850,40 +3862,37 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3850
3862
|
// loadImageAsync() sets width and height to -1 when loading fails.
|
|
3851
3863
|
if (img.width == -1 || img.height == -1) return;
|
|
3852
3864
|
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
imageImpl(img,
|
|
3885
|
-
x1, y1, x1 + c, y1 + d,
|
|
3886
|
-
u1, v1, u2, v2);
|
|
3865
|
+
switch (imageMode) {
|
|
3866
|
+
case CORNER:
|
|
3867
|
+
if (c < 0) { // reset a negative width
|
|
3868
|
+
a += c; c = -c;
|
|
3869
|
+
} if (d < 0) { // reset a negative height
|
|
3870
|
+
b += d; d = -d;
|
|
3871
|
+
} imageImpl(img,
|
|
3872
|
+
a, b, a + c, b + d,
|
|
3873
|
+
u1, v1, u2, v2);
|
|
3874
|
+
break;
|
|
3875
|
+
case CORNERS:
|
|
3876
|
+
if (c < a) { // reverse because x2 < x1
|
|
3877
|
+
float temp = a; a = c; c = temp;
|
|
3878
|
+
} if (d < b) { // reverse because y2 < y1
|
|
3879
|
+
float temp = b; b = d; d = temp;
|
|
3880
|
+
} imageImpl(img,
|
|
3881
|
+
a, b, c, d,
|
|
3882
|
+
u1, v1, u2, v2);
|
|
3883
|
+
break;
|
|
3884
|
+
case CENTER:
|
|
3885
|
+
// c and d are width/height
|
|
3886
|
+
if (c < 0) c = -c;
|
|
3887
|
+
if (d < 0) d = -d;
|
|
3888
|
+
float x1 = a - c/2;
|
|
3889
|
+
float y1 = b - d/2;
|
|
3890
|
+
imageImpl(img,
|
|
3891
|
+
x1, y1, x1 + c, y1 + d,
|
|
3892
|
+
u1, v1, u2, v2);
|
|
3893
|
+
break;
|
|
3894
|
+
default:
|
|
3895
|
+
break;
|
|
3887
3896
|
}
|
|
3888
3897
|
}
|
|
3889
3898
|
|
|
@@ -3969,7 +3978,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
3969
3978
|
* and height. The parameter must be written in "ALL CAPS" because
|
|
3970
3979
|
* Processing is a case sensitive language.
|
|
3971
3980
|
*
|
|
3972
|
-
*
|
|
3981
|
+
*
|
|
3973
3982
|
*
|
|
3974
3983
|
* @webref shape:loading_displaying
|
|
3975
3984
|
* @param mode either CORNER, CORNERS, CENTER
|
|
@@ -4016,11 +4025,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4016
4025
|
* to <b>shapeMode(CORNERS)</b>, for example, will change the width and
|
|
4017
4026
|
* height parameters to define the x and y values of the opposite corner of
|
|
4018
4027
|
* the shape.
|
|
4019
|
-
|
|
4028
|
+
*
|
|
4020
4029
|
* Note complex shapes may draw awkwardly with P3D. This renderer does not
|
|
4021
4030
|
* yet support shapes that have holes or complicated breaks.
|
|
4022
4031
|
*
|
|
4023
|
-
*
|
|
4032
|
+
*
|
|
4024
4033
|
*
|
|
4025
4034
|
* @webref shape:loading_displaying
|
|
4026
4035
|
* @param shape the shape to display
|
|
@@ -4069,22 +4078,26 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4069
4078
|
|
|
4070
4079
|
pushMatrix();
|
|
4071
4080
|
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4081
|
+
switch (shapeMode) {
|
|
4082
|
+
case CENTER:
|
|
4083
|
+
// x and y are center, c and d refer to a diameter
|
|
4084
|
+
translate(a - c/2f, b - d/2f);
|
|
4085
|
+
scale(c / shape.getWidth(), d / shape.getHeight());
|
|
4086
|
+
break;
|
|
4087
|
+
case CORNER:
|
|
4088
|
+
translate(a, b);
|
|
4089
|
+
scale(c / shape.getWidth(), d / shape.getHeight());
|
|
4090
|
+
break;
|
|
4091
|
+
case CORNERS:
|
|
4092
|
+
// c and d are x2/y2, make them into width/height
|
|
4093
|
+
c -= a;
|
|
4094
|
+
d -= b;
|
|
4095
|
+
// then same as above
|
|
4096
|
+
translate(a, b);
|
|
4097
|
+
scale(c / shape.getWidth(), d / shape.getHeight());
|
|
4098
|
+
break;
|
|
4099
|
+
default:
|
|
4100
|
+
break;
|
|
4088
4101
|
}
|
|
4089
4102
|
shape.draw(this);
|
|
4090
4103
|
|
|
@@ -4137,9 +4150,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4137
4150
|
}
|
|
4138
4151
|
return createFont(baseFont, size, smooth, charset, stream != null);
|
|
4139
4152
|
|
|
4140
|
-
} catch (
|
|
4153
|
+
} catch (FontFormatException | IOException e) {
|
|
4141
4154
|
System.err.println("Problem with createFont(\"" + name + "\")");
|
|
4142
|
-
e.printStackTrace();
|
|
4143
4155
|
return null;
|
|
4144
4156
|
}
|
|
4145
4157
|
}
|
|
@@ -4186,7 +4198,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4186
4198
|
* <b>textAscent()</b> or <b>textDescent()</b> so that the hack works even
|
|
4187
4199
|
* if you change the size of the font.
|
|
4188
4200
|
*
|
|
4189
|
-
*
|
|
4201
|
+
*
|
|
4190
4202
|
*
|
|
4191
4203
|
* @webref typography:attributes
|
|
4192
4204
|
* @param alignX horizontal alignment, either LEFT, CENTER, or RIGHT
|
|
@@ -4212,7 +4224,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4212
4224
|
* example, adding the <b>textAscent()</b> and <b>textDescent()</b> values
|
|
4213
4225
|
* will give you the total height of the line.
|
|
4214
4226
|
*
|
|
4215
|
-
*
|
|
4227
|
+
*
|
|
4216
4228
|
*
|
|
4217
4229
|
* @webref typography:metrics
|
|
4218
4230
|
* @see PGraphics#textDescent()
|
|
@@ -4233,7 +4245,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4233
4245
|
* baseline. For example, adding the <b>textAscent()</b> and
|
|
4234
4246
|
* <b>textDescent()</b> values will give you the total height of the line.
|
|
4235
4247
|
*
|
|
4236
|
-
*
|
|
4248
|
+
*
|
|
4237
4249
|
*
|
|
4238
4250
|
* @webref typography:metrics
|
|
4239
4251
|
* @see PGraphics#textAscent()
|
|
@@ -4254,18 +4266,18 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4254
4266
|
* used. This font will be used in all subsequent calls to the
|
|
4255
4267
|
* <b>text()</b> function. If no <b>size</b> parameter is input, the font
|
|
4256
4268
|
* will appear at its original size (the size it was created at with the
|
|
4257
|
-
* "Create Font..." tool) until it is changed with <b>textSize()</b>.
|
|
4258
|
-
*
|
|
4269
|
+
* "Create Font..." tool) until it is changed with <b>textSize()</b>.
|
|
4270
|
+
* Because fonts are usually bitmaped, you should create fonts at
|
|
4259
4271
|
* the sizes that will be used most commonly. Using <b>textFont()</b>
|
|
4260
|
-
* without the size parameter will result in the cleanest-looking text.
|
|
4261
|
-
*
|
|
4272
|
+
* without the size parameter will result in the cleanest-looking text.
|
|
4273
|
+
* With the default (JAVA2D) and PDF renderers, it's also possible
|
|
4262
4274
|
* to enable the use of native fonts via the command
|
|
4263
4275
|
* <b>hint(ENABLE_NATIVE_FONTS)</b>. This will produce vector text in
|
|
4264
4276
|
* JAVA2D sketches and PDF output in cases where the vector data is
|
|
4265
4277
|
* available: when the font is still installed, or the font is created via
|
|
4266
4278
|
* the <b>createFont()</b> function (rather than the Create Font tool).
|
|
4267
4279
|
*
|
|
4268
|
-
*
|
|
4280
|
+
*
|
|
4269
4281
|
*
|
|
4270
4282
|
* @webref typography:loading_displaying
|
|
4271
4283
|
* @param which any variable of the type PFont
|
|
@@ -4352,7 +4364,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4352
4364
|
* Sets the spacing between lines of text in units of pixels. This setting
|
|
4353
4365
|
* will be used in all subsequent calls to the <b>text()</b> function.
|
|
4354
4366
|
*
|
|
4355
|
-
*
|
|
4367
|
+
*
|
|
4356
4368
|
*
|
|
4357
4369
|
* @webref typography:attributes
|
|
4358
4370
|
* @param leading the size in pixels for spacing between lines
|
|
@@ -4388,7 +4400,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4388
4400
|
* not currently optimized for <b>P3D</b>, so if recording shape data, use
|
|
4389
4401
|
* <b>textMode(MODEL)</b> until you're ready to capture the geometry with <b>beginRaw()</b>.
|
|
4390
4402
|
*
|
|
4391
|
-
*
|
|
4403
|
+
*
|
|
4392
4404
|
*
|
|
4393
4405
|
* @webref typography:attributes
|
|
4394
4406
|
* @param mode either MODEL or SHAPE
|
|
@@ -4434,7 +4446,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4434
4446
|
* Sets the current font size. This size will be used in all subsequent
|
|
4435
4447
|
* calls to the <b>text()</b> function. Font size is measured in units of pixels.
|
|
4436
4448
|
*
|
|
4437
|
-
*
|
|
4449
|
+
*
|
|
4438
4450
|
*
|
|
4439
4451
|
* @webref typography:attributes
|
|
4440
4452
|
* @param size the size of the letters in units of pixels
|
|
@@ -4498,7 +4510,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4498
4510
|
*
|
|
4499
4511
|
* Calculates and returns the width of any character or text string.
|
|
4500
4512
|
*
|
|
4501
|
-
*
|
|
4513
|
+
*
|
|
4502
4514
|
*
|
|
4503
4515
|
* @webref typography:attributes
|
|
4504
4516
|
* @param str the String of characters to measure
|
|
@@ -4551,7 +4563,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4551
4563
|
* Unlike the previous version that was inside PFont, this will
|
|
4552
4564
|
* return the size not of a 1 pixel font, but the actual current size.
|
|
4553
4565
|
*/
|
|
4554
|
-
protected float textWidthImpl(char buffer
|
|
4566
|
+
protected float textWidthImpl(char[] buffer, int start, int stop) {
|
|
4555
4567
|
float wide = 0;
|
|
4556
4568
|
for (int i = start; i < stop; i++) {
|
|
4557
4569
|
// could add kerning here, but it just ain't implemented
|
|
@@ -4575,13 +4587,13 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4575
4587
|
* with the <b>fill()</b> function. The text displays in relation to the
|
|
4576
4588
|
* <b>textAlign()</b> function, which gives the option to draw to the left,
|
|
4577
4589
|
* right, and center of the coordinates.
|
|
4578
|
-
|
|
4590
|
+
*
|
|
4579
4591
|
* The <b>x2</b> and <b>y2</b> parameters define a rectangular area to
|
|
4580
4592
|
* display within and may only be used with string data. For text drawn
|
|
4581
4593
|
* inside a rectangle, the coordinates are interpreted based on the current
|
|
4582
4594
|
* <b>rectMode()</b> setting.
|
|
4583
4595
|
*
|
|
4584
|
-
*
|
|
4596
|
+
*
|
|
4585
4597
|
*
|
|
4586
4598
|
* @webref typography:loading_displaying
|
|
4587
4599
|
* @param c the alphanumeric character to be displayed
|
|
@@ -4683,21 +4695,27 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4683
4695
|
high += textLeading;
|
|
4684
4696
|
}
|
|
4685
4697
|
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4698
|
+
switch (textAlignY) {
|
|
4699
|
+
case CENTER:
|
|
4700
|
+
// for a single line, this adds half the textAscent to y
|
|
4701
|
+
// for multiple lines, subtract half the additional height
|
|
4702
|
+
//y += (textAscent() - textDescent() - high)/2;
|
|
4703
|
+
y += (textAscent() - high)/2;
|
|
4704
|
+
break;
|
|
4705
|
+
case TOP:
|
|
4706
|
+
// for a single line, need to add textAscent to y
|
|
4707
|
+
// for multiple lines, no different
|
|
4708
|
+
y += textAscent();
|
|
4709
|
+
break;
|
|
4710
|
+
case BOTTOM:
|
|
4711
|
+
// for a single line, this is just offset by the descent
|
|
4712
|
+
// for multiple lines, subtract leading for each line
|
|
4713
|
+
y -= textDescent() + high;
|
|
4714
|
+
//} else if (textAlignY == BASELINE) {
|
|
4715
|
+
// do nothing
|
|
4716
|
+
break;
|
|
4717
|
+
default:
|
|
4718
|
+
break;
|
|
4701
4719
|
}
|
|
4702
4720
|
|
|
4703
4721
|
// int start = 0;
|
|
@@ -4848,27 +4866,33 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
4848
4866
|
int lineFitCount = 1 + PApplet.floor((boxHeight - topAndBottom) / textLeading);
|
|
4849
4867
|
int lineCount = Math.min(textBreakCount, lineFitCount);
|
|
4850
4868
|
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4869
|
+
switch (textAlignY) {
|
|
4870
|
+
case CENTER:
|
|
4871
|
+
{
|
|
4872
|
+
float lineHigh = textAscent() + textLeading * (lineCount - 1);
|
|
4873
|
+
float y = y1 + textAscent() + (boxHeight - lineHigh) / 2;
|
|
4874
|
+
for (int i = 0; i < lineCount; i++) {
|
|
4875
|
+
textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y);
|
|
4876
|
+
y += textLeading;
|
|
4877
|
+
} break;
|
|
4878
|
+
}
|
|
4879
|
+
case BOTTOM:
|
|
4880
|
+
{
|
|
4881
|
+
float y = y2 - textDescent() - textLeading * (lineCount - 1);
|
|
4882
|
+
for (int i = 0; i < lineCount; i++) {
|
|
4883
|
+
textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y);
|
|
4884
|
+
y += textLeading;
|
|
4885
|
+
} break;
|
|
4886
|
+
}
|
|
4887
|
+
default:
|
|
4888
|
+
{
|
|
4889
|
+
// TOP or BASELINE just go to the default
|
|
4890
|
+
float y = y1 + textAscent();
|
|
4891
|
+
for (int i = 0; i < lineCount; i++) {
|
|
4892
|
+
textLineAlignImpl(textBuffer, textBreakStart[i], textBreakStop[i], lineX, y);
|
|
4893
|
+
y += textLeading;
|
|
4894
|
+
} break;
|
|
4895
|
+
}
|
|
4872
4896
|
}
|
|
4873
4897
|
}
|
|
4874
4898
|
|
|
@@ -5019,7 +5043,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5019
5043
|
* Handles placement of a text line, then calls textLineImpl
|
|
5020
5044
|
* to actually render at the specific point.
|
|
5021
5045
|
*/
|
|
5022
|
-
protected void textLineAlignImpl(char buffer
|
|
5046
|
+
protected void textLineAlignImpl(char[] buffer, int start, int stop,
|
|
5023
5047
|
float x, float y) {
|
|
5024
5048
|
if (textAlign == CENTER) {
|
|
5025
5049
|
x -= textWidthImpl(buffer, start, stop) / 2f;
|
|
@@ -5035,7 +5059,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5035
5059
|
/**
|
|
5036
5060
|
* Implementation of actual drawing for a line of text.
|
|
5037
5061
|
*/
|
|
5038
|
-
protected void textLineImpl(char buffer
|
|
5062
|
+
protected void textLineImpl(char[] buffer, int start, int stop,
|
|
5039
5063
|
float x, float y) {
|
|
5040
5064
|
for (int index = start; index < stop; index++) {
|
|
5041
5065
|
textCharImpl(buffer[index], x, y);
|
|
@@ -5167,31 +5191,31 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5167
5191
|
/**
|
|
5168
5192
|
* ( begin auto-generated from push.xml )
|
|
5169
5193
|
*
|
|
5170
|
-
* The <b>push()</b> function saves the current drawing style
|
|
5171
|
-
* settings and transformations, while <b>pop()</b> restores these
|
|
5172
|
-
* settings. Note that these functions are always used together.
|
|
5173
|
-
* They allow you to change the style and transformation settings
|
|
5174
|
-
* and later return to what you had. When a new state is started
|
|
5175
|
-
* with push(), it builds on the current style and transform
|
|
5194
|
+
* The <b>push()</b> function saves the current drawing style
|
|
5195
|
+
* settings and transformations, while <b>pop()</b> restores these
|
|
5196
|
+
* settings. Note that these functions are always used together.
|
|
5197
|
+
* They allow you to change the style and transformation settings
|
|
5198
|
+
* and later return to what you had. When a new state is started
|
|
5199
|
+
* with push(), it builds on the current style and transform
|
|
5176
5200
|
* information.
|
|
5177
5201
|
*
|
|
5178
|
-
* <b>push()</b> stores information related to the current
|
|
5179
|
-
* transformation state and style settings controlled by the
|
|
5180
|
-
* following functions: <b>rotate()</b>, <b>translate()</b>,
|
|
5181
|
-
* <b>scale()</b>, <b>fill()</b>, <b>stroke()</b>, <b>tint()</b>,
|
|
5182
|
-
* <b>strokeWeight()</b>, <b>strokeCap()</b>, <b>strokeJoin()</b>,
|
|
5183
|
-
* <b>imageMode()</b>, <b>rectMode()</b>, <b>ellipseMode()</b>,
|
|
5184
|
-
* <b>colorMode()</b>, <b>textAlign()</b>, <b>textFont()</b>,
|
|
5202
|
+
* <b>push()</b> stores information related to the current
|
|
5203
|
+
* transformation state and style settings controlled by the
|
|
5204
|
+
* following functions: <b>rotate()</b>, <b>translate()</b>,
|
|
5205
|
+
* <b>scale()</b>, <b>fill()</b>, <b>stroke()</b>, <b>tint()</b>,
|
|
5206
|
+
* <b>strokeWeight()</b>, <b>strokeCap()</b>, <b>strokeJoin()</b>,
|
|
5207
|
+
* <b>imageMode()</b>, <b>rectMode()</b>, <b>ellipseMode()</b>,
|
|
5208
|
+
* <b>colorMode()</b>, <b>textAlign()</b>, <b>textFont()</b>,
|
|
5185
5209
|
* <b>textMode()</b>, <b>textSize()</b>, <b>textLeading()</b>.
|
|
5186
5210
|
*
|
|
5187
|
-
* The <b>push()</b> and <b>pop()</b> functions were added with
|
|
5188
|
-
* Processing 3.5. They can be used in place of <b>pushMatrix()</b>,
|
|
5189
|
-
* <b>popMatrix()</b>, <b>pushStyles()</b>, and <b>popStyles()</b>.
|
|
5190
|
-
* The difference is that push() and pop() control both the
|
|
5191
|
-
* transformations (rotate, scale, translate) and the drawing styles
|
|
5211
|
+
* The <b>push()</b> and <b>pop()</b> functions were added with
|
|
5212
|
+
* Processing 3.5. They can be used in place of <b>pushMatrix()</b>,
|
|
5213
|
+
* <b>popMatrix()</b>, <b>pushStyles()</b>, and <b>popStyles()</b>.
|
|
5214
|
+
* The difference is that push() and pop() control both the
|
|
5215
|
+
* transformations (rotate, scale, translate) and the drawing styles
|
|
5192
5216
|
* at the same time.
|
|
5193
5217
|
*
|
|
5194
|
-
*
|
|
5218
|
+
*
|
|
5195
5219
|
*
|
|
5196
5220
|
* @webref structure
|
|
5197
5221
|
* @see PGraphics#pop()
|
|
@@ -5204,31 +5228,31 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5204
5228
|
/**
|
|
5205
5229
|
* ( begin auto-generated from pop.xml )
|
|
5206
5230
|
*
|
|
5207
|
-
* The <b>pop()</b> function restores the previous drawing style
|
|
5208
|
-
* settings and transformations after <b>push()</b> has changed them.
|
|
5209
|
-
* Note that these functions are always used together. They allow
|
|
5210
|
-
* you to change the style and transformation settings and later
|
|
5211
|
-
* return to what you had. When a new state is started with push(),
|
|
5231
|
+
* The <b>pop()</b> function restores the previous drawing style
|
|
5232
|
+
* settings and transformations after <b>push()</b> has changed them.
|
|
5233
|
+
* Note that these functions are always used together. They allow
|
|
5234
|
+
* you to change the style and transformation settings and later
|
|
5235
|
+
* return to what you had. When a new state is started with push(),
|
|
5212
5236
|
* it builds on the current style and transform information.
|
|
5213
5237
|
*
|
|
5214
5238
|
*
|
|
5215
|
-
* <b>push()</b> stores information related to the current
|
|
5216
|
-
* transformation state and style settings controlled by the
|
|
5217
|
-
* following functions: <b>rotate()</b>, <b>translate()</b>,
|
|
5218
|
-
* <b>scale()</b>, <b>fill()</b>, <b>stroke()</b>, <b>tint()</b>,
|
|
5219
|
-
* <b>strokeWeight()</b>, <b>strokeCap()</b>, <b>strokeJoin()</b>,
|
|
5220
|
-
* <b>imageMode()</b>, <b>rectMode()</b>, <b>ellipseMode()</b>,
|
|
5221
|
-
* <b>colorMode()</b>, <b>textAlign()</b>, <b>textFont()</b>,
|
|
5239
|
+
* <b>push()</b> stores information related to the current
|
|
5240
|
+
* transformation state and style settings controlled by the
|
|
5241
|
+
* following functions: <b>rotate()</b>, <b>translate()</b>,
|
|
5242
|
+
* <b>scale()</b>, <b>fill()</b>, <b>stroke()</b>, <b>tint()</b>,
|
|
5243
|
+
* <b>strokeWeight()</b>, <b>strokeCap()</b>, <b>strokeJoin()</b>,
|
|
5244
|
+
* <b>imageMode()</b>, <b>rectMode()</b>, <b>ellipseMode()</b>,
|
|
5245
|
+
* <b>colorMode()</b>, <b>textAlign()</b>, <b>textFont()</b>,
|
|
5222
5246
|
* <b>textMode()</b>, <b>textSize()</b>, <b>textLeading()</b>.
|
|
5223
5247
|
*
|
|
5224
|
-
* The <b>push()</b> and <b>pop()</b> functions were added with
|
|
5225
|
-
* Processing 3.5. They can be used in place of <b>pushMatrix()</b>,
|
|
5226
|
-
* <b>popMatrix()</b>, <b>pushStyles()</b>, and <b>popStyles()</b>.
|
|
5227
|
-
* The difference is that push() and pop() control both the
|
|
5228
|
-
* transformations (rotate, scale, translate) and the drawing styles
|
|
5248
|
+
* The <b>push()</b> and <b>pop()</b> functions were added with
|
|
5249
|
+
* Processing 3.5. They can be used in place of <b>pushMatrix()</b>,
|
|
5250
|
+
* <b>popMatrix()</b>, <b>pushStyles()</b>, and <b>popStyles()</b>.
|
|
5251
|
+
* The difference is that push() and pop() control both the
|
|
5252
|
+
* transformations (rotate, scale, translate) and the drawing styles
|
|
5229
5253
|
* at the same time.
|
|
5230
5254
|
*
|
|
5231
|
-
*
|
|
5255
|
+
*
|
|
5232
5256
|
*
|
|
5233
5257
|
* @webref structure
|
|
5234
5258
|
* @see PGraphics#push()
|
|
@@ -5257,7 +5281,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5257
5281
|
* the other transformation functions and may be embedded to control the
|
|
5258
5282
|
* scope of the transformations.
|
|
5259
5283
|
*
|
|
5260
|
-
*
|
|
5284
|
+
*
|
|
5261
5285
|
*
|
|
5262
5286
|
* @webref transform
|
|
5263
5287
|
* @see PGraphics#popMatrix()
|
|
@@ -5284,7 +5308,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5284
5308
|
* in conjuction with the other transformation functions and may be
|
|
5285
5309
|
* embedded to control the scope of the transformations.
|
|
5286
5310
|
*
|
|
5287
|
-
*
|
|
5311
|
+
*
|
|
5288
5312
|
*
|
|
5289
5313
|
* @webref transform
|
|
5290
5314
|
* @see PGraphics#pushMatrix()
|
|
@@ -5316,7 +5340,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5316
5340
|
* transformation is reset when the loop begins again. This function can be
|
|
5317
5341
|
* further controlled by the <b>pushMatrix()</b> and <b>popMatrix()</b>.
|
|
5318
5342
|
*
|
|
5319
|
-
*
|
|
5343
|
+
*
|
|
5320
5344
|
*
|
|
5321
5345
|
* @webref transform
|
|
5322
5346
|
* @param x left/right translation
|
|
@@ -5361,7 +5385,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5361
5385
|
* matrix by a rotation matrix. This function can be further controlled by
|
|
5362
5386
|
* the <b>pushMatrix()</b> and <b>popMatrix()</b>.
|
|
5363
5387
|
*
|
|
5364
|
-
*
|
|
5388
|
+
*
|
|
5365
5389
|
*
|
|
5366
5390
|
* @webref transform
|
|
5367
5391
|
* @param angle angle of rotation specified in radians
|
|
@@ -5394,7 +5418,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5394
5418
|
* This function requires using P3D as a third parameter to <b>size()</b>
|
|
5395
5419
|
* as shown in the example above.
|
|
5396
5420
|
*
|
|
5397
|
-
*
|
|
5421
|
+
*
|
|
5398
5422
|
*
|
|
5399
5423
|
* @webref transform
|
|
5400
5424
|
* @param angle angle of rotation specified in radians
|
|
@@ -5427,7 +5451,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5427
5451
|
* This function requires using P3D as a third parameter to <b>size()</b>
|
|
5428
5452
|
* as shown in the examples above.
|
|
5429
5453
|
*
|
|
5430
|
-
*
|
|
5454
|
+
*
|
|
5431
5455
|
*
|
|
5432
5456
|
* @webref transform
|
|
5433
5457
|
* @param angle angle of rotation specified in radians
|
|
@@ -5460,7 +5484,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5460
5484
|
* This function requires using P3D as a third parameter to <b>size()</b>
|
|
5461
5485
|
* as shown in the examples above.
|
|
5462
5486
|
*
|
|
5463
|
-
*
|
|
5487
|
+
*
|
|
5464
5488
|
*
|
|
5465
5489
|
* @webref transform
|
|
5466
5490
|
* @param angle angle of rotation specified in radians
|
|
@@ -5506,7 +5530,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5506
5530
|
* parameter for <b>size()</b> as shown in the example above. This function
|
|
5507
5531
|
* can be further controlled by <b>pushMatrix()</b> and <b>popMatrix()</b>.
|
|
5508
5532
|
*
|
|
5509
|
-
*
|
|
5533
|
+
*
|
|
5510
5534
|
*
|
|
5511
5535
|
* @webref transform
|
|
5512
5536
|
* @param s percentage to scale the object
|
|
@@ -5564,7 +5588,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5564
5588
|
* matrix by a rotation matrix. This function can be further controlled by
|
|
5565
5589
|
* the <b>pushMatrix()</b> and <b>popMatrix()</b> functions.
|
|
5566
5590
|
*
|
|
5567
|
-
*
|
|
5591
|
+
*
|
|
5568
5592
|
*
|
|
5569
5593
|
* @webref transform
|
|
5570
5594
|
* @param angle angle of shear specified in radians
|
|
@@ -5598,7 +5622,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5598
5622
|
* matrix by a rotation matrix. This function can be further controlled by
|
|
5599
5623
|
* the <b>pushMatrix()</b> and <b>popMatrix()</b> functions.
|
|
5600
5624
|
*
|
|
5601
|
-
*
|
|
5625
|
+
*
|
|
5602
5626
|
*
|
|
5603
5627
|
* @webref transform
|
|
5604
5628
|
* @param angle angle of shear specified in radians
|
|
@@ -5625,7 +5649,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5625
5649
|
* Replaces the current matrix with the identity matrix. The equivalent
|
|
5626
5650
|
* function in OpenGL is glLoadIdentity().
|
|
5627
5651
|
*
|
|
5628
|
-
*
|
|
5652
|
+
*
|
|
5629
5653
|
*
|
|
5630
5654
|
* @webref transform
|
|
5631
5655
|
* @see PGraphics#pushMatrix()
|
|
@@ -5645,7 +5669,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5645
5669
|
* inverse of the transform, so avoid it whenever possible. The equivalent
|
|
5646
5670
|
* function in OpenGL is glMultMatrix().
|
|
5647
5671
|
*
|
|
5648
|
-
*
|
|
5672
|
+
*
|
|
5649
5673
|
*
|
|
5650
5674
|
* @webref transform
|
|
5651
5675
|
* @source
|
|
@@ -5776,7 +5800,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5776
5800
|
* Prints the current matrix to the Console (the text window at the bottom
|
|
5777
5801
|
* of Processing).
|
|
5778
5802
|
*
|
|
5779
|
-
*
|
|
5803
|
+
*
|
|
5780
5804
|
*
|
|
5781
5805
|
* @webref transform
|
|
5782
5806
|
* @see PGraphics#pushMatrix()
|
|
@@ -5799,21 +5823,21 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5799
5823
|
* The <b>beginCamera()</b> and <b>endCamera()</b> functions enable
|
|
5800
5824
|
* advanced customization of the camera space. The functions are useful if
|
|
5801
5825
|
* you want to more control over camera movement, however for most users,
|
|
5802
|
-
* the <b>camera()</b> function will be sufficient
|
|
5826
|
+
* the <b>camera()</b> function will be sufficient.The camera
|
|
5803
5827
|
* functions will replace any transformations (such as <b>rotate()</b> or
|
|
5804
5828
|
* <b>translate()</b>) that occur before them in <b>draw()</b>, but they
|
|
5805
5829
|
* will not automatically replace the camera transform itself. For this
|
|
5806
5830
|
* reason, camera functions should be placed at the beginning of
|
|
5807
5831
|
* <b>draw()</b> (so that transformations happen afterwards), and the
|
|
5808
5832
|
* <b>camera()</b> function can be used after <b>beginCamera()</b> if you
|
|
5809
|
-
* want to reset the camera before applying transformations
|
|
5810
|
-
|
|
5833
|
+
* want to reset the camera before applying transformations.
|
|
5834
|
+
This function sets the matrix mode to the camera matrix so calls such
|
|
5811
5835
|
* as <b>translate()</b>, <b>rotate()</b>, applyMatrix() and resetMatrix()
|
|
5812
5836
|
* affect the camera. <b>beginCamera()</b> should always be used with a
|
|
5813
5837
|
* following <b>endCamera()</b> and pairs of <b>beginCamera()</b> and
|
|
5814
5838
|
* <b>endCamera()</b> cannot be nested.
|
|
5815
5839
|
*
|
|
5816
|
-
*
|
|
5840
|
+
*
|
|
5817
5841
|
*
|
|
5818
5842
|
* @webref lights_camera:camera
|
|
5819
5843
|
* @see PGraphics#camera()
|
|
@@ -5834,7 +5858,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5834
5858
|
* advanced customization of the camera space. Please see the reference for
|
|
5835
5859
|
* <b>beginCamera()</b> for a description of how the functions are used.
|
|
5836
5860
|
*
|
|
5837
|
-
*
|
|
5861
|
+
*
|
|
5838
5862
|
*
|
|
5839
5863
|
* @webref lights_camera:camera
|
|
5840
5864
|
* @see PGraphics#beginCamera()
|
|
@@ -5857,7 +5881,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5857
5881
|
* 180.0), width/2.0, height/2.0, 0, 0, 1, 0)</b>. This function is similar
|
|
5858
5882
|
* to <b>gluLookAt()</b> in OpenGL, but it first clears the current camera settings.
|
|
5859
5883
|
*
|
|
5860
|
-
*
|
|
5884
|
+
*
|
|
5861
5885
|
*
|
|
5862
5886
|
* @webref lights_camera:camera
|
|
5863
5887
|
* @see PGraphics#beginCamera()
|
|
@@ -5891,7 +5915,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5891
5915
|
* Prints the current camera matrix to the Console (the text window at the
|
|
5892
5916
|
* bottom of Processing).
|
|
5893
5917
|
*
|
|
5894
|
-
*
|
|
5918
|
+
*
|
|
5895
5919
|
* @webref lights_camera:camera
|
|
5896
5920
|
* @see PGraphics#camera(float, float, float, float, float, float, float, float, float)
|
|
5897
5921
|
*/
|
|
@@ -5917,7 +5941,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5917
5941
|
* parameters are given, the default is used: ortho(0, width, 0, height,
|
|
5918
5942
|
* -10, 10).
|
|
5919
5943
|
*
|
|
5920
|
-
*
|
|
5944
|
+
*
|
|
5921
5945
|
*
|
|
5922
5946
|
* @webref lights_camera:camera
|
|
5923
5947
|
*/
|
|
@@ -5960,7 +5984,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5960
5984
|
* default values are: perspective(PI/3.0, width/height, cameraZ/10.0,
|
|
5961
5985
|
* cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0));
|
|
5962
5986
|
*
|
|
5963
|
-
*
|
|
5987
|
+
*
|
|
5964
5988
|
*
|
|
5965
5989
|
* @webref lights_camera:camera
|
|
5966
5990
|
*/
|
|
@@ -5985,7 +6009,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
5985
6009
|
* glFrustum, except it wipes out the current perspective matrix rather
|
|
5986
6010
|
* than muliplying itself with it.
|
|
5987
6011
|
*
|
|
5988
|
-
*
|
|
6012
|
+
*
|
|
5989
6013
|
*
|
|
5990
6014
|
* @webref lights_camera:camera
|
|
5991
6015
|
* @param left left coordinate of the clipping plane
|
|
@@ -6011,7 +6035,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6011
6035
|
* Prints the current projection matrix to the Console (the text window at
|
|
6012
6036
|
* the bottom of Processing).
|
|
6013
6037
|
*
|
|
6014
|
-
*
|
|
6038
|
+
*
|
|
6015
6039
|
*
|
|
6016
6040
|
* @webref lights_camera:camera
|
|
6017
6041
|
* @see PGraphics#camera(float, float, float, float, float, float, float, float, float)
|
|
@@ -6033,7 +6057,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6033
6057
|
* Takes a three-dimensional X, Y, Z position and returns the X value for
|
|
6034
6058
|
* where it will appear on a (two-dimensional) screen.
|
|
6035
6059
|
*
|
|
6036
|
-
*
|
|
6060
|
+
*
|
|
6037
6061
|
*
|
|
6038
6062
|
* @webref lights_camera:coordinates
|
|
6039
6063
|
* @param x 3D x-coordinate to be mapped
|
|
@@ -6053,7 +6077,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6053
6077
|
* Takes a three-dimensional X, Y, Z position and returns the Y value for
|
|
6054
6078
|
* where it will appear on a (two-dimensional) screen.
|
|
6055
6079
|
*
|
|
6056
|
-
*
|
|
6080
|
+
*
|
|
6057
6081
|
*
|
|
6058
6082
|
* @webref lights_camera:coordinates
|
|
6059
6083
|
* @param x 3D x-coordinate to be mapped
|
|
@@ -6092,7 +6116,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6092
6116
|
* Takes a three-dimensional X, Y, Z position and returns the Z value for
|
|
6093
6117
|
* where it will appear on a (two-dimensional) screen.
|
|
6094
6118
|
*
|
|
6095
|
-
*
|
|
6119
|
+
*
|
|
6096
6120
|
*
|
|
6097
6121
|
* @webref lights_camera:coordinates
|
|
6098
6122
|
* @param x 3D x-coordinate to be mapped
|
|
@@ -6123,7 +6147,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6123
6147
|
* (x, y, z) coordinate returned by the model functions is used to place
|
|
6124
6148
|
* another box in the same location.
|
|
6125
6149
|
*
|
|
6126
|
-
*
|
|
6150
|
+
*
|
|
6127
6151
|
*
|
|
6128
6152
|
* @webref lights_camera:coordinates
|
|
6129
6153
|
* @param x 3D x-coordinate to be mapped
|
|
@@ -6154,7 +6178,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6154
6178
|
* (x, y, z) coordinate returned by the model functions is used to place
|
|
6155
6179
|
* another box in the same location.
|
|
6156
6180
|
*
|
|
6157
|
-
*
|
|
6181
|
+
*
|
|
6158
6182
|
*
|
|
6159
6183
|
* @webref lights_camera:coordinates
|
|
6160
6184
|
* @param x 3D x-coordinate to be mapped
|
|
@@ -6185,7 +6209,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6185
6209
|
* (x, y, z) coordinate returned by the model functions is used to place
|
|
6186
6210
|
* another box in the same location.
|
|
6187
6211
|
*
|
|
6188
|
-
*
|
|
6212
|
+
*
|
|
6189
6213
|
*
|
|
6190
6214
|
* @webref lights_camera:coordinates
|
|
6191
6215
|
* @param x 3D x-coordinate to be mapped
|
|
@@ -6215,7 +6239,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6215
6239
|
* <b>pushStyle()</b>, it builds on the current style information. The
|
|
6216
6240
|
* <b>pushStyle()</b> and <b>popStyle()</b> functions can be embedded to
|
|
6217
6241
|
* provide more control (see the second example above for a demonstration.)
|
|
6218
|
-
|
|
6242
|
+
*
|
|
6219
6243
|
* The style information controlled by the following functions are included
|
|
6220
6244
|
* in the style:
|
|
6221
6245
|
* fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(),
|
|
@@ -6223,7 +6247,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6223
6247
|
* textAlign(), textFont(), textMode(), textSize(), textLeading(),
|
|
6224
6248
|
* emissive(), specular(), shininess(), ambient()
|
|
6225
6249
|
*
|
|
6226
|
-
*
|
|
6250
|
+
*
|
|
6227
6251
|
*
|
|
6228
6252
|
* @webref structure
|
|
6229
6253
|
* @see PGraphics#popStyle()
|
|
@@ -6250,7 +6274,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6250
6274
|
* <b>pushStyle()</b> and <b>popStyle()</b> functions can be embedded to
|
|
6251
6275
|
* provide more control (see the second example above for a demonstration.)
|
|
6252
6276
|
*
|
|
6253
|
-
*
|
|
6277
|
+
*
|
|
6254
6278
|
*
|
|
6255
6279
|
* @webref structure
|
|
6256
6280
|
* @see PGraphics#pushStyle()
|
|
@@ -6418,7 +6442,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6418
6442
|
* operating system's OpenGL implementation. For instance, the thickness
|
|
6419
6443
|
* may not go higher than 10 pixels.
|
|
6420
6444
|
*
|
|
6421
|
-
*
|
|
6445
|
+
*
|
|
6422
6446
|
*
|
|
6423
6447
|
* @webref shape:attributes
|
|
6424
6448
|
* @param weight the weight (in pixels) of the stroke
|
|
@@ -6443,7 +6467,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6443
6467
|
* Issue 123</a>). More information about the renderers can be found in the
|
|
6444
6468
|
* <b>size()</b> reference.
|
|
6445
6469
|
*
|
|
6446
|
-
*
|
|
6470
|
+
*
|
|
6447
6471
|
*
|
|
6448
6472
|
* @webref shape:attributes
|
|
6449
6473
|
* @param join either MITER, BEVEL, ROUND
|
|
@@ -6467,7 +6491,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6467
6491
|
* Issue 123</a>). More information about the renderers can be found in the
|
|
6468
6492
|
* <b>size()</b> reference.
|
|
6469
6493
|
*
|
|
6470
|
-
*
|
|
6494
|
+
*
|
|
6471
6495
|
*
|
|
6472
6496
|
* @webref shape:attributes
|
|
6473
6497
|
* @param cap either SQUARE, PROJECT, or ROUND
|
|
@@ -6493,7 +6517,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6493
6517
|
* Disables drawing the stroke (outline). If both <b>noStroke()</b> and
|
|
6494
6518
|
* <b>noFill()</b> are called, nothing will be drawn to the screen.
|
|
6495
6519
|
*
|
|
6496
|
-
*
|
|
6520
|
+
*
|
|
6497
6521
|
*
|
|
6498
6522
|
* @webref color:setting
|
|
6499
6523
|
* @see PGraphics#stroke(int, float)
|
|
@@ -6525,7 +6549,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6525
6549
|
* current maximum value as specified by <b>colorMode()</b>. The default
|
|
6526
6550
|
* maximum value is 255.
|
|
6527
6551
|
*
|
|
6528
|
-
*
|
|
6552
|
+
*
|
|
6529
6553
|
*
|
|
6530
6554
|
* @param rgb color value in hexadecimal notation
|
|
6531
6555
|
* @see PGraphics#noStroke()
|
|
@@ -6613,7 +6637,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6613
6637
|
* Removes the current fill value for displaying images and reverts to
|
|
6614
6638
|
* displaying images with their original hues.
|
|
6615
6639
|
*
|
|
6616
|
-
*
|
|
6640
|
+
*
|
|
6617
6641
|
*
|
|
6618
6642
|
* @webref image:loading_displaying
|
|
6619
6643
|
* @usage web_application
|
|
@@ -6651,7 +6675,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6651
6675
|
* The <b>tint()</b> function is also used to control the coloring of
|
|
6652
6676
|
* textures in 3D.
|
|
6653
6677
|
*
|
|
6654
|
-
*
|
|
6678
|
+
*
|
|
6655
6679
|
*
|
|
6656
6680
|
* @webref image:loading_displaying
|
|
6657
6681
|
* @usage web_application
|
|
@@ -6732,7 +6756,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6732
6756
|
* Disables filling geometry. If both <b>noStroke()</b> and <b>noFill()</b>
|
|
6733
6757
|
* are called, nothing will be drawn to the screen.
|
|
6734
6758
|
*
|
|
6735
|
-
*
|
|
6759
|
+
*
|
|
6736
6760
|
*
|
|
6737
6761
|
* @webref color:setting
|
|
6738
6762
|
* @usage web_application
|
|
@@ -6768,7 +6792,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6768
6792
|
*
|
|
6769
6793
|
* To change the color of an image (or a texture), use tint().
|
|
6770
6794
|
*
|
|
6771
|
-
*
|
|
6795
|
+
*
|
|
6772
6796
|
*
|
|
6773
6797
|
* @webref color:setting
|
|
6774
6798
|
* @usage web_application
|
|
@@ -6857,7 +6881,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6857
6881
|
* reflect. Used in combination with <b>emissive()</b>, <b>specular()</b>,
|
|
6858
6882
|
* and <b>shininess()</b> in setting the material properties of shapes.
|
|
6859
6883
|
*
|
|
6860
|
-
*
|
|
6884
|
+
*
|
|
6861
6885
|
*
|
|
6862
6886
|
* @webref lights_camera:material_properties
|
|
6863
6887
|
* @usage web_application
|
|
@@ -6915,7 +6939,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6915
6939
|
* with <b>emissive()</b>, <b>ambient()</b>, and <b>shininess()</b> in
|
|
6916
6940
|
* setting the material properties of shapes.
|
|
6917
6941
|
*
|
|
6918
|
-
*
|
|
6942
|
+
*
|
|
6919
6943
|
*
|
|
6920
6944
|
* @webref lights_camera:material_properties
|
|
6921
6945
|
* @usage web_application
|
|
@@ -6940,6 +6964,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6940
6964
|
|
|
6941
6965
|
/**
|
|
6942
6966
|
* gray number specifying value between white and black
|
|
6967
|
+
*
|
|
6968
|
+
* @param gray value between black and white, by default 0 to 255
|
|
6943
6969
|
*/
|
|
6944
6970
|
public void specular(float gray) {
|
|
6945
6971
|
colorCalc(gray);
|
|
@@ -6973,7 +6999,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6973
6999
|
* with <b>ambient()</b>, <b>specular()</b>, and <b>emissive()</b> in
|
|
6974
7000
|
* setting the material properties of shapes.
|
|
6975
7001
|
*
|
|
6976
|
-
*
|
|
7002
|
+
*
|
|
6977
7003
|
*
|
|
6978
7004
|
* @webref lights_camera:material_properties
|
|
6979
7005
|
* @usage web_application
|
|
@@ -6994,7 +7020,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
6994
7020
|
* <b>specular()</b>, and <b>shininess()</b> in setting the material
|
|
6995
7021
|
* properties of shapes.
|
|
6996
7022
|
*
|
|
6997
|
-
*
|
|
7023
|
+
*
|
|
6998
7024
|
*
|
|
6999
7025
|
* @webref lights_camera:material_properties
|
|
7000
7026
|
* @usage web_application
|
|
@@ -7017,6 +7043,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7017
7043
|
|
|
7018
7044
|
/**
|
|
7019
7045
|
* gray number specifying value between white and black
|
|
7046
|
+
*
|
|
7047
|
+
* @param gray value between black and white, by default 0 to 255
|
|
7020
7048
|
*/
|
|
7021
7049
|
public void emissive(float gray) {
|
|
7022
7050
|
colorCalc(gray);
|
|
@@ -7062,7 +7090,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7062
7090
|
* looping program will cause them to only have an effect the first time
|
|
7063
7091
|
* through the loop.
|
|
7064
7092
|
*
|
|
7065
|
-
*
|
|
7093
|
+
*
|
|
7066
7094
|
*
|
|
7067
7095
|
* @webref lights_camera:lights
|
|
7068
7096
|
* @usage web_application
|
|
@@ -7084,7 +7112,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7084
7112
|
* lighting so that 2D geometry (which does not require lighting) can be
|
|
7085
7113
|
* drawn after a set of lighted 3D geometry.
|
|
7086
7114
|
*
|
|
7087
|
-
*
|
|
7115
|
+
*
|
|
7088
7116
|
*
|
|
7089
7117
|
* @webref lights_camera:lights
|
|
7090
7118
|
* @usage web_application
|
|
@@ -7106,7 +7134,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7106
7134
|
* have an effect the first time through the loop. The effect of the
|
|
7107
7135
|
* parameters is determined by the current color mode.
|
|
7108
7136
|
*
|
|
7109
|
-
*
|
|
7137
|
+
*
|
|
7110
7138
|
*
|
|
7111
7139
|
* @webref lights_camera:lights
|
|
7112
7140
|
* @usage web_application
|
|
@@ -7147,7 +7175,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7147
7175
|
* direction the light is facing. For example, setting <b>ny</b> to -1 will
|
|
7148
7176
|
* cause the geometry to be lit from below (the light is facing directly upward).
|
|
7149
7177
|
*
|
|
7150
|
-
*
|
|
7178
|
+
*
|
|
7151
7179
|
*
|
|
7152
7180
|
* @webref lights_camera:lights
|
|
7153
7181
|
* @usage web_application
|
|
@@ -7178,7 +7206,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7178
7206
|
* mode. The <b>x</b>, <b>y</b>, and <b>z</b> parameters set the position
|
|
7179
7207
|
* of the light.
|
|
7180
7208
|
*
|
|
7181
|
-
*
|
|
7209
|
+
*
|
|
7182
7210
|
*
|
|
7183
7211
|
* @webref lights_camera:lights
|
|
7184
7212
|
* @usage web_application
|
|
@@ -7211,7 +7239,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7211
7239
|
* direction or light. The <b>angle</b> parameter affects angle of the
|
|
7212
7240
|
* spotlight cone.
|
|
7213
7241
|
*
|
|
7214
|
-
*
|
|
7242
|
+
*
|
|
7215
7243
|
*
|
|
7216
7244
|
* @webref lights_camera:lights
|
|
7217
7245
|
* @usage web_application
|
|
@@ -7243,9 +7271,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7243
7271
|
*
|
|
7244
7272
|
* Sets the falloff rates for point lights, spot lights, and ambient
|
|
7245
7273
|
* lights. The parameters are used to determine the falloff with the
|
|
7246
|
-
* following equation
|
|
7274
|
+
* following equation:d = distance from light position to
|
|
7247
7275
|
* vertex positionfalloff = 1 / (CONSTANT + d * LINEAR + (d*d) *
|
|
7248
|
-
* QUADRATIC)
|
|
7276
|
+
* QUADRATIC)Like <b>fill()</b>, it affects only the elements
|
|
7249
7277
|
* which are created after it in the code. The default value if
|
|
7250
7278
|
* <b>LightFalloff(1.0, 0.0, 0.0)</b>. Thinking about an ambient light with
|
|
7251
7279
|
* a falloff can be tricky. It is used, for example, if you wanted a region
|
|
@@ -7254,7 +7282,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7254
7282
|
* and falloff. You can think of it as a point light that doesn't care
|
|
7255
7283
|
* which direction a surface is facing.
|
|
7256
7284
|
*
|
|
7257
|
-
*
|
|
7285
|
+
*
|
|
7258
7286
|
*
|
|
7259
7287
|
* @webref lights_camera:lights
|
|
7260
7288
|
* @usage web_application
|
|
@@ -7282,7 +7310,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7282
7310
|
* specular material qualities set through the <b>specular()</b> and
|
|
7283
7311
|
* <b>shininess()</b> functions.
|
|
7284
7312
|
*
|
|
7285
|
-
*
|
|
7313
|
+
*
|
|
7286
7314
|
*
|
|
7287
7315
|
* @webref lights_camera:lights
|
|
7288
7316
|
* @usage web_application
|
|
@@ -7323,7 +7351,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7323
7351
|
* It is not possible to use transparency (alpha) in background colors with
|
|
7324
7352
|
* the main drawing surface, however they will work properly with <b>createGraphics()</b>.
|
|
7325
7353
|
*
|
|
7326
|
-
*
|
|
7354
|
+
*
|
|
7327
7355
|
*
|
|
7328
7356
|
* <h3>Advanced</h3>
|
|
7329
7357
|
* <p>Clear the background with a color that includes an alpha value. This can
|
|
@@ -7543,7 +7571,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7543
7571
|
* are specified between 0 and 1. The limits for defining colors are
|
|
7544
7572
|
* altered by setting the parameters range1, range2, range3, and range 4.
|
|
7545
7573
|
*
|
|
7546
|
-
*
|
|
7574
|
+
*
|
|
7547
7575
|
*
|
|
7548
7576
|
* @webref color:setting
|
|
7549
7577
|
* @usage web_application
|
|
@@ -7881,7 +7909,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7881
7909
|
*
|
|
7882
7910
|
* Extracts the alpha value from a color.
|
|
7883
7911
|
*
|
|
7884
|
-
*
|
|
7912
|
+
*
|
|
7885
7913
|
* @webref color:creating_reading
|
|
7886
7914
|
* @usage web_application
|
|
7887
7915
|
* @param rgb any value of the color datatype
|
|
@@ -7904,15 +7932,15 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7904
7932
|
*
|
|
7905
7933
|
* Extracts the red value from a color, scaled to match current
|
|
7906
7934
|
* <b>colorMode()</b>. This value is always returned as a float so be
|
|
7907
|
-
* careful not to assign it to an int value
|
|
7935
|
+
* careful not to assign it to an int value.The red() function
|
|
7908
7936
|
* is easy to use and undestand, but is slower than another technique. To
|
|
7909
7937
|
* achieve the same results when working in <b>colorMode(RGB, 255)</b>, but
|
|
7910
7938
|
* with greater speed, use the >> (right shift) operator with a bit
|
|
7911
|
-
* mask. For example, the following two lines of code are equivalent
|
|
7912
|
-
|
|
7939
|
+
* mask. For example, the following two lines of code are equivalent:
|
|
7940
|
+
<pre>float r1 = red(myColor);float r2 = myColor >> 16
|
|
7913
7941
|
* & 0xFF;</pre>
|
|
7914
7942
|
*
|
|
7915
|
-
*
|
|
7943
|
+
*
|
|
7916
7944
|
*
|
|
7917
7945
|
* @webref color:creating_reading
|
|
7918
7946
|
* @usage web_application
|
|
@@ -7937,7 +7965,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7937
7965
|
*
|
|
7938
7966
|
* Extracts the green value from a color, scaled to match current
|
|
7939
7967
|
* <b>colorMode()</b>. This value is always returned as a float so be
|
|
7940
|
-
* careful not to assign it to an int value
|
|
7968
|
+
* careful not to assign it to an int value.The <b>green()</b>
|
|
7941
7969
|
* function is easy to use and undestand, but is slower than another
|
|
7942
7970
|
* technique. To achieve the same results when working in <b>colorMode(RGB,
|
|
7943
7971
|
* 255)</b>, but with greater speed, use the >> (right shift)
|
|
@@ -7945,7 +7973,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7945
7973
|
* are equivalent:<pre>float r1 = green(myColor);float r2 =
|
|
7946
7974
|
* myColor >> 8 & 0xFF;</pre>
|
|
7947
7975
|
*
|
|
7948
|
-
*
|
|
7976
|
+
*
|
|
7949
7977
|
*
|
|
7950
7978
|
* @webref color:creating_reading
|
|
7951
7979
|
* @usage web_application
|
|
@@ -7970,7 +7998,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7970
7998
|
*
|
|
7971
7999
|
* Extracts the blue value from a color, scaled to match current
|
|
7972
8000
|
* <b>colorMode()</b>. This value is always returned as a float so be
|
|
7973
|
-
* careful not to assign it to an int value
|
|
8001
|
+
* careful not to assign it to an int value.The <b>blue()</b>
|
|
7974
8002
|
* function is easy to use and undestand, but is slower than another
|
|
7975
8003
|
* technique. To achieve the same results when working in <b>colorMode(RGB,
|
|
7976
8004
|
* 255)</b>, but with greater speed, use a bit mask to remove the other
|
|
@@ -7978,7 +8006,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
7978
8006
|
* equivalent:<pre>float r1 = blue(myColor);float r2 = myColor
|
|
7979
8007
|
* & 0xFF;</pre>
|
|
7980
8008
|
*
|
|
7981
|
-
*
|
|
8009
|
+
*
|
|
7982
8010
|
*
|
|
7983
8011
|
* @webref color:creating_reading
|
|
7984
8012
|
* @usage web_application
|
|
@@ -8003,7 +8031,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
8003
8031
|
*
|
|
8004
8032
|
* Extracts the hue value from a color.
|
|
8005
8033
|
*
|
|
8006
|
-
*
|
|
8034
|
+
*
|
|
8007
8035
|
* @webref color:creating_reading
|
|
8008
8036
|
* @usage web_application
|
|
8009
8037
|
* @param rgb any value of the color datatype
|
|
@@ -8029,7 +8057,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
8029
8057
|
*
|
|
8030
8058
|
* Extracts the saturation value from a color.
|
|
8031
8059
|
*
|
|
8032
|
-
*
|
|
8060
|
+
*
|
|
8033
8061
|
* @webref color:creating_reading
|
|
8034
8062
|
* @usage web_application
|
|
8035
8063
|
* @param rgb any value of the color datatype
|
|
@@ -8055,7 +8083,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
8055
8083
|
*
|
|
8056
8084
|
* Extracts the brightness value from a color.
|
|
8057
8085
|
*
|
|
8058
|
-
*
|
|
8086
|
+
*
|
|
8059
8087
|
*
|
|
8060
8088
|
* @webref color:creating_reading
|
|
8061
8089
|
* @usage web_application
|
|
@@ -8093,7 +8121,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
|
8093
8121
|
* values where 0.0 equal to the first point, 0.1 is very near the first
|
|
8094
8122
|
* point, 0.5 is half-way in between, etc.
|
|
8095
8123
|
*
|
|
8096
|
-
*
|
|
8124
|
+
*
|
|
8097
8125
|
*
|
|
8098
8126
|
* @webref color:creating_reading
|
|
8099
8127
|
* @usage web_application
|