picrate 1.3.0-java → 2.1.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
- data/CHANGELOG.md +10 -1
- data/Gemfile +3 -1
- data/README.md +9 -6
- data/Rakefile +8 -3
- data/bin/picrate +3 -1
- data/docs/_config.yml +1 -1
- data/docs/_editors/geany.md +1 -0
- data/docs/_gems/gems/gems.md +1 -1
- data/docs/_methods/alternative_methods.md +2 -1
- data/docs/_posts/2018-05-06-getting_started.md +4 -4
- data/docs/_posts/2018-05-06-install_jruby.md +5 -11
- data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -11
- data/docs/_posts/2018-11-18-building-gem.md +2 -2
- data/docs/_posts/2018-11-27-getting_started_geany.md +1 -1
- data/docs/_posts/2019-11-11-getting_started_buster.md +3 -6
- data/docs/_posts/{2018-06-26-auto_install_picrate.md → 2020-03-09-auto_install_picrate.md} +9 -6
- data/docs/_posts/2020-05-11-getting_started_manjaro.md +106 -0
- data/docs/about.md +1 -1
- data/lib/picrate.rb +3 -2
- data/lib/picrate/app.rb +11 -3
- data/lib/picrate/creators/parameters.rb +8 -8
- data/lib/picrate/creators/sketch_factory.rb +5 -3
- data/lib/picrate/helper_methods.rb +22 -22
- data/lib/picrate/helpers/numeric.rb +2 -0
- data/lib/picrate/library.rb +5 -1
- data/lib/picrate/library_loader.rb +2 -0
- data/lib/picrate/native_folder.rb +2 -1
- data/lib/picrate/native_loader.rb +3 -0
- data/lib/picrate/runner.rb +5 -4
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +17 -8
- data/library/chooser/chooser.rb +10 -9
- data/library/color_group/color_group.rb +2 -0
- data/library/control_panel/control_panel.rb +7 -4
- data/library/dxf/dxf.rb +2 -0
- data/library/jcomplex/jcomplex.rb +1 -0
- data/library/library_proxy/library_proxy.rb +2 -0
- data/library/net/net.rb +2 -0
- data/library/slider/slider.rb +24 -23
- data/library/vector_utils/vector_utils.rb +4 -0
- data/library/video_event/video_event.rb +2 -0
- data/mvnw +2 -2
- data/mvnw.cmd +2 -2
- data/picrate.gemspec +13 -13
- data/pom.rb +26 -23
- data/pom.xml +19 -7
- data/src/main/java/monkstone/ColorUtil.java +1 -1
- data/src/main/java/monkstone/MathToolModule.java +1 -1
- data/src/main/java/monkstone/PicrateLibrary.java +8 -8
- data/src/main/java/monkstone/complex/JComplex.java +252 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +16 -16
- data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
- data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
- 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 +12 -12
- 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 -1
- 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 +33 -36
- data/src/main/java/processing/awt/PImageAWT.java +377 -0
- data/src/main/java/processing/awt/PSurfaceAWT.java +0 -20
- data/src/main/java/processing/awt/ShimAWT.java +545 -0
- data/src/main/java/processing/core/PApplet.java +699 -1523
- data/src/main/java/processing/core/PConstants.java +180 -180
- data/src/main/java/processing/core/PFont.java +2 -2
- data/src/main/java/processing/core/PGraphics.java +190 -176
- data/src/main/java/processing/core/PImage.java +1536 -1721
- data/src/main/java/processing/core/PMatrix.java +39 -39
- data/src/main/java/processing/core/PSurface.java +69 -103
- data/src/main/java/processing/core/PSurfaceNone.java +29 -0
- data/src/main/java/processing/core/PVector.java +2 -2
- data/src/main/java/processing/data/FloatDict.java +251 -284
- data/src/main/java/processing/data/TableRow.java +32 -32
- data/src/main/java/processing/dxf/RawDXF.java +3 -3
- data/src/main/java/processing/net/Client.java +1 -1
- data/src/main/java/processing/opengl/PGL.java +1016 -4132
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +232 -176
- data/src/main/java/processing/opengl/PJOGL.java +374 -1526
- data/src/main/java/processing/opengl/PShapeOpenGL.java +5 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +262 -147
- data/test/color_group_test.rb +4 -4
- data/test/deglut_spec_test.rb +2 -0
- data/test/helper_methods_test.rb +41 -13
- data/test/math_tool_test.rb +46 -37
- data/test/respond_to_test.rb +5 -3
- 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 +30 -19
- data/vendors/Rakefile +33 -21
- data/vendors/{picrate_sketches.geany → geany.rb} +32 -7
- metadata +27 -46
- 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
@@ -384,7 +384,7 @@ public class PFont implements PConstants {
|
|
384
384
|
// not a roman font, so throw an error and ask to re-build.
|
385
385
|
// that way can avoid a bunch of error checking hacks in here.
|
386
386
|
if ((ascent == 0) && (descent == 0)) {
|
387
|
-
throw new RuntimeException("Please use \"
|
387
|
+
throw new RuntimeException("Please use \"create_font\" to "
|
388
388
|
+ "re-create this font.");
|
389
389
|
}
|
390
390
|
|
@@ -945,7 +945,7 @@ public class PFont implements PConstants {
|
|
945
945
|
readHeader(is);
|
946
946
|
}
|
947
947
|
|
948
|
-
protected void readHeader(DataInputStream is) throws IOException {
|
948
|
+
protected final void readHeader(DataInputStream is) throws IOException {
|
949
949
|
value = is.readInt();
|
950
950
|
height = is.readInt();
|
951
951
|
width = is.readInt();
|
@@ -207,12 +207,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
207
207
|
/**
|
208
208
|
* Array of hint[] items. These are hacks to get around various
|
209
209
|
* temporary workarounds inside the environment.
|
210
|
-
*
|
210
|
+
*
|
211
211
|
* Note that this array cannot be static, as a hint() may result in a
|
212
212
|
* runtime change specific to a renderer. For instance, calling
|
213
213
|
* hint(DISABLE_DEPTH_TEST) has to call glDisable() right away on an
|
214
214
|
* instance of PGraphicsOpenGL.
|
215
|
-
*
|
215
|
+
*
|
216
216
|
* The hints[] array is allocated early on because it might
|
217
217
|
* be used inside beginDraw(), allocate(), etc.
|
218
218
|
*/
|
@@ -570,7 +570,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
570
570
|
|
571
571
|
// vertices
|
572
572
|
public static final int DEFAULT_VERTICES = 512;
|
573
|
-
protected float
|
573
|
+
protected float[][] vertices =
|
574
574
|
new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT];
|
575
575
|
protected int vertexCount; // total number of vertices
|
576
576
|
|
@@ -605,7 +605,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
605
605
|
|
606
606
|
// spline vertices
|
607
607
|
|
608
|
-
protected float
|
608
|
+
protected float[][] curveVertices;
|
609
609
|
protected int curveVertexCount;
|
610
610
|
|
611
611
|
// ........................................................
|
@@ -618,16 +618,16 @@ public class PGraphics extends PImage implements PConstants {
|
|
618
618
|
// [toxi 031031]
|
619
619
|
// changed table's precision to 0.5 degree steps
|
620
620
|
// introduced new vars for more flexible code
|
621
|
-
static final protected float
|
622
|
-
static final protected float
|
621
|
+
static final protected float[] sinLUT;
|
622
|
+
static final protected float[] cosLUT;
|
623
623
|
static final protected float SINCOS_PRECISION = 0.5f;
|
624
624
|
static final protected int SINCOS_LENGTH = (int) (360f / SINCOS_PRECISION);
|
625
625
|
static {
|
626
|
-
|
627
|
-
|
626
|
+
sinLUT = new float[SINCOS_LENGTH];
|
627
|
+
cosLUT = new float[SINCOS_LENGTH];
|
628
628
|
for (int i = 0; i < SINCOS_LENGTH; i++) {
|
629
|
-
|
630
|
-
|
629
|
+
sinLUT[i] = (float) Math.sin(i * DEG_TO_RAD * SINCOS_PRECISION);
|
630
|
+
cosLUT[i] = (float) Math.cos(i * DEG_TO_RAD * SINCOS_PRECISION);
|
631
631
|
}
|
632
632
|
}
|
633
633
|
|
@@ -702,7 +702,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
702
702
|
|
703
703
|
// [toxi031031] new & faster sphere code w/ support flexible resolutions
|
704
704
|
// will be set by sphereDetail() or 1st call to sphere()
|
705
|
-
protected float
|
705
|
+
protected float[] sphereX;
|
706
|
+
protected float[] sphereY;
|
707
|
+
protected float[] sphereZ;
|
706
708
|
|
707
709
|
/// Number of U steps (aka "theta") around longitudinally spanning 2*pi
|
708
710
|
public int sphereDetailU = 0;
|
@@ -765,15 +767,14 @@ public class PGraphics extends PImage implements PConstants {
|
|
765
767
|
|
766
768
|
|
767
769
|
/**
|
768
|
-
* The final step in setting up a renderer, set its size of this renderer.
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
*
|
775
|
-
*
|
776
|
-
* animation thread.
|
770
|
+
* The final step in setting up a renderer, set its size of this renderer.This was formerly handled by the constructor, but instead it's been broken
|
771
|
+
out so that setParent/setPrimary/setPath can be handled differently.Important: this is ignored by the Methods task because otherwise it will
|
772
|
+
override setSize() in PApplet/Applet/Component, which will 1) not call
|
773
|
+
super.setSize(), and 2) will cause the renderer to be resized from the
|
774
|
+
event thread (EDT), causing a nasty crash as it collides with the
|
775
|
+
animation thread.
|
776
|
+
* @param w
|
777
|
+
* @param h
|
777
778
|
*/
|
778
779
|
public void setSize(int w, int h) { // ignore
|
779
780
|
width = w;
|
@@ -842,10 +843,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
842
843
|
|
843
844
|
|
844
845
|
/**
|
845
|
-
* Get cache storage data for the specified renderer.
|
846
|
-
|
847
|
-
|
848
|
-
|
846
|
+
* Get cache storage data for the specified renderer.Because each renderer
|
847
|
+
will cache data in different formats, it's necessary to store cache data
|
848
|
+
keyed by the renderer object. Otherwise, attempting to draw the same
|
849
|
+
image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
|
850
|
+
* @param image
|
849
851
|
* @return metadata stored for the specified renderer
|
850
852
|
*/
|
851
853
|
public Object getCache(PImage image) { // ignore
|
@@ -911,7 +913,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
911
913
|
*
|
912
914
|
* ( end auto-generated )
|
913
915
|
* <h3>Advanced</h3>
|
914
|
-
*
|
916
|
+
*
|
915
917
|
* When creating your own PGraphics, you should call this when
|
916
918
|
* you're finished drawing.
|
917
919
|
*
|
@@ -1088,7 +1090,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
1088
1090
|
* obscure rendering features that cannot be implemented in a consistent
|
1089
1091
|
* manner across renderers. Many options will often graduate to standard
|
1090
1092
|
* features instead of hints over time.
|
1091
|
-
*
|
1093
|
+
*
|
1092
1094
|
* hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This
|
1093
1095
|
* can help force anti-aliasing if it has not been enabled by the user. On
|
1094
1096
|
* some graphics cards, this can also be set by the graphics driver's
|
@@ -1096,13 +1098,13 @@ public class PGraphics extends PImage implements PConstants {
|
|
1096
1098
|
* be called immediately after the size() command because it resets the
|
1097
1099
|
* renderer, obliterating any settings and anything drawn (and like size(),
|
1098
1100
|
* re-running the code that came before it again).
|
1099
|
-
*
|
1101
|
+
*
|
1100
1102
|
* hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always
|
1101
1103
|
* enables 2x smoothing when the P3D renderer is used. This hint disables
|
1102
1104
|
* the default 2x smoothing and returns the smoothing behavior found in
|
1103
1105
|
* earlier releases, where smooth() and noSmooth() could be used to enable
|
1104
1106
|
* and disable smoothing, though the quality was inferior.
|
1105
|
-
*
|
1107
|
+
*
|
1106
1108
|
* hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are
|
1107
1109
|
* installed, rather than the bitmapped version from a .vlw file. This is
|
1108
1110
|
* useful with the default (or JAVA2D) renderer setting, as it will improve
|
@@ -1111,7 +1113,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
1111
1113
|
* machine (because you have the font installed) but lousy on others'
|
1112
1114
|
* machines if the identical font is unavailable. This option can only be
|
1113
1115
|
* set per-sketch, and must be called before any use of textFont().
|
1114
|
-
*
|
1116
|
+
*
|
1115
1117
|
* hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on
|
1116
1118
|
* top of everything at will. When depth testing is disabled, items will be
|
1117
1119
|
* drawn to the screen sequentially, like a painting. This hint is most
|
@@ -1121,14 +1123,14 @@ public class PGraphics extends PImage implements PConstants {
|
|
1121
1123
|
* hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared,
|
1122
1124
|
* any 3D drawing that happens later in draw() will ignore existing shapes
|
1123
1125
|
* on the screen.
|
1124
|
-
*
|
1126
|
+
*
|
1125
1127
|
* hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and
|
1126
1128
|
* lines in P3D and OPENGL. This can slow performance considerably, and the
|
1127
1129
|
* algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT).
|
1128
|
-
*
|
1130
|
+
*
|
1129
1131
|
* hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting
|
1130
1132
|
* by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT).
|
1131
|
-
*
|
1133
|
+
*
|
1132
1134
|
* hint(ENABLE_BUFFER_READING) - Depth and stencil buffers in P2D/P3D will be
|
1133
1135
|
* downsampled to make PGL#readPixels work with multisampling. Enabling this
|
1134
1136
|
* introduces some overhead, so if you experience bad performance, disable
|
@@ -1137,17 +1139,17 @@ public class PGraphics extends PImage implements PConstants {
|
|
1137
1139
|
* creating your PGraphics2D/3D. You can restore the default with
|
1138
1140
|
* hint(DISABLE_BUFFER_READING) if you don't plan to read depth from
|
1139
1141
|
* this PGraphics anymore.
|
1140
|
-
*
|
1142
|
+
*
|
1141
1143
|
* hint(ENABLE_KEY_REPEAT) - Auto-repeating key events are discarded
|
1142
1144
|
* by default (works only in P2D/P3D); use this hint to get all the key events
|
1143
1145
|
* (including auto-repeated). Call hint(DISABLE_KEY_REPEAT) to get events
|
1144
1146
|
* only when the key goes physically up or down.
|
1145
|
-
*
|
1147
|
+
*
|
1146
1148
|
* hint(DISABLE_ASYNC_SAVEFRAME) - P2D/P3D only - save() and saveFrame()
|
1147
1149
|
* will not use separate threads for saving and will block until the image
|
1148
1150
|
* is written to the drive. This was the default behavior in 3.0b7 and before.
|
1149
1151
|
* To enable, call hint(ENABLE_ASYNC_SAVEFRAME).
|
1150
|
-
*
|
1152
|
+
*
|
1151
1153
|
* As of release 0149, unhint() has been removed in favor of adding
|
1152
1154
|
* additional ENABLE/DISABLE constants to reset the default behavior. This
|
1153
1155
|
* prevents the double negatives, and also reinforces which hints can be
|
@@ -1209,12 +1211,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
1209
1211
|
* specifies a position in 2D and the <b>vertex()</b> function with three
|
1210
1212
|
* parameters specifies a position in 3D. Each shape will be outlined with
|
1211
1213
|
* the current stroke color and filled with the fill color.
|
1212
|
-
*
|
1214
|
+
*
|
1213
1215
|
* Transformations such as <b>translate()</b>, <b>rotate()</b>, and
|
1214
1216
|
* <b>scale()</b> do not work within <b>beginShape()</b>. It is also not
|
1215
1217
|
* possible to use other shapes, such as <b>ellipse()</b> or <b>rect()</b>
|
1216
1218
|
* within <b>beginShape()</b>.
|
1217
|
-
*
|
1219
|
+
*
|
1218
1220
|
* The P3D renderer settings allow <b>stroke()</b> and <b>fill()</b>
|
1219
1221
|
* settings to be altered per-vertex, however the default P2D renderer does
|
1220
1222
|
* not. Settings such as <b>strokeWeight()</b>, <b>strokeCap()</b>, and
|
@@ -1236,8 +1238,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
1236
1238
|
|
1237
1239
|
|
1238
1240
|
/**
|
1239
|
-
* Sets whether the upcoming vertex is part of an edge.
|
1240
|
-
*
|
1241
|
+
* Sets whether the upcoming vertex is part of an edge.Equivalent to glEdgeFlag(), for people familiar with OpenGL.
|
1242
|
+
* @param edge
|
1241
1243
|
*/
|
1242
1244
|
public void edge(boolean edge) {
|
1243
1245
|
this.edge = edge;
|
@@ -1359,7 +1361,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
1359
1361
|
* Sets a texture to be applied to vertex points. The <b>texture()</b>
|
1360
1362
|
* function must be called between <b>beginShape()</b> and
|
1361
1363
|
* <b>endShape()</b> and before any calls to <b>vertex()</b>.
|
1362
|
-
*
|
1364
|
+
*
|
1363
1365
|
* When textures are in use, the fill color is ignored. Instead, use tint()
|
1364
1366
|
* to specify the color of the texture as it is applied to the shape.
|
1365
1367
|
*
|
@@ -1389,7 +1391,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
1389
1391
|
|
1390
1392
|
protected void vertexCheck() {
|
1391
1393
|
if (vertexCount == vertices.length) {
|
1392
|
-
float
|
1394
|
+
float[][] temp = new float[vertexCount << 1][VERTEX_FIELD_COUNT];
|
1393
1395
|
System.arraycopy(vertices, 0, temp, 0, vertexCount);
|
1394
1396
|
vertices = temp;
|
1395
1397
|
}
|
@@ -1481,7 +1483,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
1481
1483
|
// http://dev.processing.org/bugs/show_bug.cgi?id=444
|
1482
1484
|
if (shape == POLYGON) {
|
1483
1485
|
if (vertexCount > 0) {
|
1484
|
-
float
|
1486
|
+
float[] pvertex = vertices[vertexCount-1];
|
1485
1487
|
if ((Math.abs(pvertex[X] - x) < EPSILON) &&
|
1486
1488
|
(Math.abs(pvertex[Y] - y) < EPSILON) &&
|
1487
1489
|
(Math.abs(pvertex[Z] - z) < EPSILON)) {
|
@@ -1606,11 +1608,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
1606
1608
|
* All shapes are constructed by connecting a series of vertices.
|
1607
1609
|
* <b>vertex()</b> is used to specify the vertex coordinates for points,
|
1608
1610
|
* lines, triangles, quads, and polygons and is used exclusively within the
|
1609
|
-
* <b>beginShape()</b> and <b>endShape()</b> function
|
1610
|
-
*
|
1611
|
+
* <b>beginShape()</b> and <b>endShape()</b> function.
|
1612
|
+
*
|
1611
1613
|
* Drawing a vertex in 3D using the <b>z</b> parameter requires the P3D
|
1612
|
-
* parameter in combination with size as shown in the above example
|
1613
|
-
*
|
1614
|
+
* parameter in combination with size as shown in the above example.
|
1615
|
+
*
|
1614
1616
|
* This function is also used to map a texture onto the geometry. The
|
1615
1617
|
* <b>texture()</b> function declares the texture to apply to the geometry
|
1616
1618
|
* and the <b>u</b> and <b>v</b> coordinates set define the mapping of this
|
@@ -1648,18 +1650,18 @@ public class PGraphics extends PImage implements PConstants {
|
|
1648
1650
|
|
1649
1651
|
|
1650
1652
|
/**
|
1651
|
-
* Set (U, V) coords for the next vertex in the current shape.
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
* param of and overloaded vertex().
|
1656
|
-
*
|
1653
|
+
* Set (U, V) coords for the next vertex in the current shape.This is ugly as its own function, and will (almost?) always be
|
1654
|
+
coincident with a call to vertex.As of beta, this was moved to
|
1655
|
+
the protected method you see here, and called from an optional
|
1656
|
+
param of and overloaded vertex().
|
1657
1657
|
* The parameters depend on the current textureMode. When using
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1658
|
+
textureMode(IMAGE), the coordinates will be relative to the size
|
1659
|
+
of the image texture, when used with textureMode(NORMAL),
|
1660
|
+
they'll be in the range 0..1.
|
1661
|
+
|
1662
|
+
Used by both PGraphics2D (for images) and PGraphics3D.
|
1663
|
+
* @param u
|
1664
|
+
* @param v
|
1663
1665
|
*/
|
1664
1666
|
protected void vertexTexture(float u, float v) {
|
1665
1667
|
if (textureImage == null) {
|
@@ -1725,7 +1727,6 @@ public class PGraphics extends PImage implements PConstants {
|
|
1725
1727
|
* @see PShape
|
1726
1728
|
* @see PGraphics#beginShape(int)
|
1727
1729
|
*/
|
1728
|
-
|
1729
1730
|
public void endShape(int mode) {
|
1730
1731
|
}
|
1731
1732
|
|
@@ -1737,6 +1738,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
1737
1738
|
|
1738
1739
|
|
1739
1740
|
/**
|
1741
|
+
* @return
|
1740
1742
|
* @webref shape
|
1741
1743
|
* @param filename name of file to load, can be .svg or .obj
|
1742
1744
|
* @see PShape
|
@@ -3083,8 +3085,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
3083
3085
|
float[] cz = new float[ures];
|
3084
3086
|
// calc unit circle in XZ plane
|
3085
3087
|
for (int i = 0; i < ures; i++) {
|
3086
|
-
cx[i] =
|
3087
|
-
cz[i] =
|
3088
|
+
cx[i] = cosLUT[(int) (i*delta) % SINCOS_LENGTH];
|
3089
|
+
cz[i] = sinLUT[(int) (i*delta) % SINCOS_LENGTH];
|
3088
3090
|
}
|
3089
3091
|
// computing vertexlist
|
3090
3092
|
// vertexlist starts at south pole
|
@@ -3101,8 +3103,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
3101
3103
|
|
3102
3104
|
// step along Y axis
|
3103
3105
|
for (int i = 1; i < vres; i++) {
|
3104
|
-
float curradius =
|
3105
|
-
float currY =
|
3106
|
+
float curradius = sinLUT[(int) angle % SINCOS_LENGTH];
|
3107
|
+
float currY = cosLUT[(int) angle % SINCOS_LENGTH];
|
3106
3108
|
for (int j = 0; j < ures; j++) {
|
3107
3109
|
sphereX[currVert] = cx[j] * curradius;
|
3108
3110
|
sphereY[currVert] = currY;
|
@@ -3426,17 +3428,17 @@ public class PGraphics extends PImage implements PConstants {
|
|
3426
3428
|
* ( begin auto-generated from curvePoint.xml )
|
3427
3429
|
*
|
3428
3430
|
* Evalutes the curve at point t for points a, b, c, d. The parameter t
|
3429
|
-
* varies between 0 and 1, a and d are
|
3430
|
-
* the
|
3431
|
+
* varies between 0 and 1, a and d are the control points, and b and c are
|
3432
|
+
* the points on the curve. This can be done once with the x coordinates and a
|
3431
3433
|
* second time with the y coordinates to get the location of a curve at t.
|
3432
3434
|
*
|
3433
3435
|
* ( end auto-generated )
|
3434
3436
|
*
|
3435
3437
|
* @webref shape:curves
|
3436
|
-
* @param a coordinate of first point
|
3437
|
-
* @param b coordinate of
|
3438
|
-
* @param c coordinate of
|
3439
|
-
* @param d coordinate of
|
3438
|
+
* @param a coordinate of first control point
|
3439
|
+
* @param b coordinate of first point on the curve
|
3440
|
+
* @param c coordinate of second point on the curve
|
3441
|
+
* @param d coordinate of second control point
|
3440
3442
|
* @param t value between 0 and 1
|
3441
3443
|
* @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float)
|
3442
3444
|
* @see PGraphics#curveVertex(float, float)
|
@@ -3462,7 +3464,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
3462
3464
|
*
|
3463
3465
|
* Calculates the tangent of a point on a curve. There's a good definition
|
3464
3466
|
* of <em><a href="http://en.wikipedia.org/wiki/Tangent"
|
3465
|
-
* target="new">tangent
|
3467
|
+
* target="new">tangent on Wikipedia</a></em>.
|
3466
3468
|
*
|
3467
3469
|
* ( end auto-generated )
|
3468
3470
|
*
|
@@ -3748,8 +3750,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
3748
3750
|
* <b>image()</b> to set the location of one corner of the image and uses
|
3749
3751
|
* the fourth and fifth parameters to set the opposite corner. Use
|
3750
3752
|
* <b>imageMode(CENTER)</b> to draw images centered at the given x and y
|
3751
|
-
* position
|
3752
|
-
*
|
3753
|
+
* position.
|
3754
|
+
*
|
3753
3755
|
* The parameter to <b>imageMode()</b> must be written in ALL CAPS because
|
3754
3756
|
* Processing is a case-sensitive language.
|
3755
3757
|
*
|
@@ -3783,13 +3785,13 @@ public class PGraphics extends PImage implements PConstants {
|
|
3783
3785
|
* <b>x</b> and <b>y</b> parameters define the location of the image from
|
3784
3786
|
* its upper-left corner. The image is displayed at its original size
|
3785
3787
|
* unless the <b>width</b> and <b>height</b> parameters specify a different
|
3786
|
-
* size
|
3787
|
-
*
|
3788
|
+
* size.
|
3789
|
+
*
|
3788
3790
|
* The <b>imageMode()</b> function changes the way the parameters work. For
|
3789
3791
|
* example, a call to <b>imageMode(CORNERS)</b> will change the
|
3790
3792
|
* <b>width</b> and <b>height</b> parameters to define the x and y values
|
3791
|
-
* of the opposite corner of the image
|
3792
|
-
*
|
3793
|
+
* of the opposite corner of the image.
|
3794
|
+
*
|
3793
3795
|
* The color of an image may be modified with the <b>tint()</b> function.
|
3794
3796
|
* This function will maintain transparency for GIF and PNG images.
|
3795
3797
|
*
|
@@ -3893,7 +3895,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
3893
3895
|
/**
|
3894
3896
|
* Expects x1, y1, x2, y2 coordinates where (x2 >= x1) and (y2 >= y1).
|
3895
3897
|
* If tint() has been called, the image will be colored.
|
3896
|
-
*
|
3898
|
+
*
|
3897
3899
|
* The default implementation draws an image as a textured quad.
|
3898
3900
|
* The (u, v) coordinates are in image space (they're ints, after all..)
|
3899
3901
|
*/
|
@@ -4018,7 +4020,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
4018
4020
|
* to <b>shapeMode(CORNERS)</b>, for example, will change the width and
|
4019
4021
|
* height parameters to define the x and y values of the opposite corner of
|
4020
4022
|
* the shape.
|
4021
|
-
*
|
4023
|
+
*
|
4022
4024
|
* Note complex shapes may draw awkwardly with P3D. This renderer does not
|
4023
4025
|
* yet support shapes that have holes or complicated breaks.
|
4024
4026
|
*
|
@@ -4167,7 +4169,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
4167
4169
|
* CENTER, and RIGHT set the display characteristics of the letters in
|
4168
4170
|
* relation to the values for the <b>x</b> and <b>y</b> parameters of the
|
4169
4171
|
* <b>text()</b> function.
|
4170
|
-
*
|
4172
|
+
*
|
4171
4173
|
* In Processing 0125 and later, an optional second parameter can be used
|
4172
4174
|
* to vertically align the text. BASELINE is the default, and the vertical
|
4173
4175
|
* alignment will be reset to BASELINE if the second parameter is not used.
|
@@ -4175,12 +4177,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
4175
4177
|
* offsets the line based on the current <b>textDescent()</b>. For multiple
|
4176
4178
|
* lines, the final line will be aligned to the bottom, with the previous
|
4177
4179
|
* lines appearing above it.
|
4178
|
-
*
|
4180
|
+
*
|
4179
4181
|
* When using <b>text()</b> with width and height parameters, BASELINE is
|
4180
4182
|
* ignored, and treated as TOP. (Otherwise, text would by default draw
|
4181
4183
|
* outside the box, since BASELINE is the default setting. BASELINE is not
|
4182
4184
|
* a useful drawing mode for text drawn in a rectangle.)
|
4183
|
-
*
|
4185
|
+
*
|
4184
4186
|
* The vertical alignment is based on the value of <b>textAscent()</b>,
|
4185
4187
|
* which many fonts do not specify correctly. It may be necessary to use a
|
4186
4188
|
* hack and offset by a few pixels by hand so that the offset looks
|
@@ -4257,10 +4259,10 @@ public class PGraphics extends PImage implements PConstants {
|
|
4257
4259
|
* <b>text()</b> function. If no <b>size</b> parameter is input, the font
|
4258
4260
|
* will appear at its original size (the size it was created at with the
|
4259
4261
|
* "Create Font..." tool) until it is changed with <b>textSize()</b>. <br
|
4260
|
-
* />
|
4262
|
+
* /> Because fonts are usually bitmaped, you should create fonts at
|
4261
4263
|
* the sizes that will be used most commonly. Using <b>textFont()</b>
|
4262
4264
|
* without the size parameter will result in the cleanest-looking text. <br
|
4263
|
-
*
|
4265
|
+
* /> With the default (JAVA2D) and PDF renderers, it's also possible
|
4264
4266
|
* to enable the use of native fonts via the command
|
4265
4267
|
* <b>hint(ENABLE_NATIVE_FONTS)</b>. This will produce vector text in
|
4266
4268
|
* JAVA2D sketches and PDF output in cases where the vector data is
|
@@ -4374,16 +4376,16 @@ public class PGraphics extends PImage implements PConstants {
|
|
4374
4376
|
*
|
4375
4377
|
* Sets the way text draws to the screen. In the default configuration, the
|
4376
4378
|
* <b>MODEL</b> mode, it's possible to rotate, scale, and place letters in
|
4377
|
-
* two and three dimensional space
|
4378
|
-
*
|
4379
|
+
* two and three dimensional space.
|
4380
|
+
*
|
4379
4381
|
* The <b>SHAPE</b> mode draws text using the the glyph outlines of
|
4380
4382
|
* individual characters rather than as textures. This mode is only
|
4381
4383
|
* supported with the <b>PDF</b> and <b>P3D</b> renderer settings. With the
|
4382
4384
|
* <b>PDF</b> renderer, you must call <b>textMode(SHAPE)</b> before any
|
4383
4385
|
* other drawing occurs. If the outlines are not available, then
|
4384
4386
|
* <b>textMode(SHAPE)</b> will be ignored and <b>textMode(MODEL)</b> will
|
4385
|
-
* be used instead
|
4386
|
-
*
|
4387
|
+
* be used instead.
|
4388
|
+
*
|
4387
4389
|
* The <b>textMode(SHAPE)</b> option in <b>P3D</b> can be combined with
|
4388
4390
|
* <b>beginRaw()</b> to write vector-accurate text to 2D and 3D output
|
4389
4391
|
* files, for instance <b>DXF</b> or <b>PDF</b>. The <b>SHAPE</b> mode is
|
@@ -4553,7 +4555,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
4553
4555
|
* Unlike the previous version that was inside PFont, this will
|
4554
4556
|
* return the size not of a 1 pixel font, but the actual current size.
|
4555
4557
|
*/
|
4556
|
-
protected float textWidthImpl(char buffer
|
4558
|
+
protected float textWidthImpl(char[] buffer, int start, int stop) {
|
4557
4559
|
float wide = 0;
|
4558
4560
|
for (int i = start; i < stop; i++) {
|
4559
4561
|
// could add kerning here, but it just ain't implemented
|
@@ -4577,7 +4579,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
4577
4579
|
* with the <b>fill()</b> function. The text displays in relation to the
|
4578
4580
|
* <b>textAlign()</b> function, which gives the option to draw to the left,
|
4579
4581
|
* right, and center of the coordinates.
|
4580
|
-
*
|
4582
|
+
*
|
4581
4583
|
* The <b>x2</b> and <b>y2</b> parameters define a rectangular area to
|
4582
4584
|
* display within and may only be used with string data. For text drawn
|
4583
4585
|
* inside a rectangle, the coordinates are interpreted based on the current
|
@@ -4747,11 +4749,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
4747
4749
|
* Draw text in a box that is constrained to a particular size.
|
4748
4750
|
* The current rectMode() determines what the coordinates mean
|
4749
4751
|
* (whether x1/y1/x2/y2 or x/y/w/h).
|
4750
|
-
*
|
4752
|
+
*
|
4751
4753
|
* Note that the x,y coords of the start of the box
|
4752
4754
|
* will align with the *ascent* of the text, not the baseline,
|
4753
4755
|
* as is the case for the other text() functions.
|
4754
|
-
*
|
4756
|
+
*
|
4755
4757
|
* Newlines that are \n (Unix newline or linefeed char, ascii 10)
|
4756
4758
|
* are honored, and \r (carriage return, Windows and Mac OS) are
|
4757
4759
|
* ignored.
|
@@ -5021,7 +5023,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
5021
5023
|
* Handles placement of a text line, then calls textLineImpl
|
5022
5024
|
* to actually render at the specific point.
|
5023
5025
|
*/
|
5024
|
-
protected void textLineAlignImpl(char buffer
|
5026
|
+
protected void textLineAlignImpl(char[] buffer, int start, int stop,
|
5025
5027
|
float x, float y) {
|
5026
5028
|
if (textAlign == CENTER) {
|
5027
5029
|
x -= textWidthImpl(buffer, start, stop) / 2f;
|
@@ -5037,7 +5039,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
5037
5039
|
/**
|
5038
5040
|
* Implementation of actual drawing for a line of text.
|
5039
5041
|
*/
|
5040
|
-
protected void textLineImpl(char buffer
|
5042
|
+
protected void textLineImpl(char[] buffer, int start, int stop,
|
5041
5043
|
float x, float y) {
|
5042
5044
|
for (int index = start; index < stop; index++) {
|
5043
5045
|
textCharImpl(buffer[index], x, y);
|
@@ -5175,8 +5177,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
5175
5177
|
* They allow you to change the style and transformation settings
|
5176
5178
|
* and later return to what you had. When a new state is started
|
5177
5179
|
* with push(), it builds on the current style and transform
|
5178
|
-
* information
|
5179
|
-
*
|
5180
|
+
* information.
|
5181
|
+
*
|
5180
5182
|
* <b>push()</b> stores information related to the current
|
5181
5183
|
* transformation state and style settings controlled by the
|
5182
5184
|
* following functions: <b>rotate()</b>, <b>translate()</b>,
|
@@ -5184,8 +5186,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
5184
5186
|
* <b>strokeWeight()</b>, <b>strokeCap()</b>, <b>strokeJoin()</b>,
|
5185
5187
|
* <b>imageMode()</b>, <b>rectMode()</b>, <b>ellipseMode()</b>,
|
5186
5188
|
* <b>colorMode()</b>, <b>textAlign()</b>, <b>textFont()</b>,
|
5187
|
-
* <b>textMode()</b>, <b>textSize()</b>, <b>textLeading()</b
|
5188
|
-
*
|
5189
|
+
* <b>textMode()</b>, <b>textSize()</b>, <b>textLeading()</b>.
|
5190
|
+
*
|
5189
5191
|
* The <b>push()</b> and <b>pop()</b> functions were added with
|
5190
5192
|
* Processing 3.5. They can be used in place of <b>pushMatrix()</b>,
|
5191
5193
|
* <b>popMatrix()</b>, <b>pushStyles()</b>, and <b>popStyles()</b>.
|
@@ -5211,9 +5213,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
5211
5213
|
* Note that these functions are always used together. They allow
|
5212
5214
|
* you to change the style and transformation settings and later
|
5213
5215
|
* return to what you had. When a new state is started with push(),
|
5214
|
-
* it builds on the current style and transform information
|
5215
|
-
*
|
5216
|
-
*
|
5216
|
+
* it builds on the current style and transform information.
|
5217
|
+
*
|
5218
|
+
*
|
5217
5219
|
* <b>push()</b> stores information related to the current
|
5218
5220
|
* transformation state and style settings controlled by the
|
5219
5221
|
* following functions: <b>rotate()</b>, <b>translate()</b>,
|
@@ -5221,8 +5223,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
5221
5223
|
* <b>strokeWeight()</b>, <b>strokeCap()</b>, <b>strokeJoin()</b>,
|
5222
5224
|
* <b>imageMode()</b>, <b>rectMode()</b>, <b>ellipseMode()</b>,
|
5223
5225
|
* <b>colorMode()</b>, <b>textAlign()</b>, <b>textFont()</b>,
|
5224
|
-
* <b>textMode()</b>, <b>textSize()</b>, <b>textLeading()</b
|
5225
|
-
*
|
5226
|
+
* <b>textMode()</b>, <b>textSize()</b>, <b>textLeading()</b>.
|
5227
|
+
*
|
5226
5228
|
* The <b>push()</b> and <b>pop()</b> functions were added with
|
5227
5229
|
* Processing 3.5. They can be used in place of <b>pushMatrix()</b>,
|
5228
5230
|
* <b>popMatrix()</b>, <b>pushStyles()</b>, and <b>popStyles()</b>.
|
@@ -5350,7 +5352,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
5350
5352
|
* Rotates a shape the amount specified by the <b>angle</b> parameter.
|
5351
5353
|
* Angles should be specified in radians (values from 0 to TWO_PI) or
|
5352
5354
|
* converted to radians with the <b>radians()</b> function.
|
5353
|
-
*
|
5355
|
+
*
|
5354
5356
|
* Objects are always rotated around their relative position to the origin
|
5355
5357
|
* and positive numbers rotate objects in a clockwise direction.
|
5356
5358
|
* Transformations apply to everything that happens after and subsequent
|
@@ -5358,7 +5360,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
5358
5360
|
* <b>rotate(HALF_PI)</b> and then <b>rotate(HALF_PI)</b> is the same as
|
5359
5361
|
* <b>rotate(PI)</b>. All tranformations are reset when <b>draw()</b>
|
5360
5362
|
* begins again.
|
5361
|
-
*
|
5363
|
+
*
|
5362
5364
|
* Technically, <b>rotate()</b> multiplies the current transformation
|
5363
5365
|
* matrix by a rotation matrix. This function can be further controlled by
|
5364
5366
|
* the <b>pushMatrix()</b> and <b>popMatrix()</b>.
|
@@ -5561,7 +5563,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
5561
5563
|
* <b>shearX(PI/2)</b> and then <b>shearX(PI/2)</b> is the same as
|
5562
5564
|
* <b>shearX(PI)</b>. If <b>shearX()</b> is called within the
|
5563
5565
|
* <b>draw()</b>, the transformation is reset when the loop begins again.
|
5564
|
-
*
|
5566
|
+
*
|
5565
5567
|
* Technically, <b>shearX()</b> multiplies the current transformation
|
5566
5568
|
* matrix by a rotation matrix. This function can be further controlled by
|
5567
5569
|
* the <b>pushMatrix()</b> and <b>popMatrix()</b> functions.
|
@@ -5595,7 +5597,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
5595
5597
|
* <b>shearY(PI/2)</b> and then <b>shearY(PI/2)</b> is the same as
|
5596
5598
|
* <b>shearY(PI)</b>. If <b>shearY()</b> is called within the
|
5597
5599
|
* <b>draw()</b>, the transformation is reset when the loop begins again.
|
5598
|
-
*
|
5600
|
+
*
|
5599
5601
|
* Technically, <b>shearY()</b> multiplies the current transformation
|
5600
5602
|
* matrix by a rotation matrix. This function can be further controlled by
|
5601
5603
|
* the <b>pushMatrix()</b> and <b>popMatrix()</b> functions.
|
@@ -5801,15 +5803,15 @@ public class PGraphics extends PImage implements PConstants {
|
|
5801
5803
|
* The <b>beginCamera()</b> and <b>endCamera()</b> functions enable
|
5802
5804
|
* advanced customization of the camera space. The functions are useful if
|
5803
5805
|
* you want to more control over camera movement, however for most users,
|
5804
|
-
* the <b>camera()</b> function will be sufficient
|
5806
|
+
* the <b>camera()</b> function will be sufficient.The camera
|
5805
5807
|
* functions will replace any transformations (such as <b>rotate()</b> or
|
5806
5808
|
* <b>translate()</b>) that occur before them in <b>draw()</b>, but they
|
5807
5809
|
* will not automatically replace the camera transform itself. For this
|
5808
5810
|
* reason, camera functions should be placed at the beginning of
|
5809
5811
|
* <b>draw()</b> (so that transformations happen afterwards), and the
|
5810
5812
|
* <b>camera()</b> function can be used after <b>beginCamera()</b> if you
|
5811
|
-
* want to reset the camera before applying transformations
|
5812
|
-
*
|
5813
|
+
* want to reset the camera before applying transformations.
|
5814
|
+
* This function sets the matrix mode to the camera matrix so calls such
|
5813
5815
|
* as <b>translate()</b>, <b>rotate()</b>, applyMatrix() and resetMatrix()
|
5814
5816
|
* affect the camera. <b>beginCamera()</b> should always be used with a
|
5815
5817
|
* following <b>endCamera()</b> and pairs of <b>beginCamera()</b> and
|
@@ -6071,6 +6073,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6071
6073
|
|
6072
6074
|
/**
|
6073
6075
|
* @param z 3D z-coordinate to be mapped
|
6076
|
+
* @return
|
6074
6077
|
*/
|
6075
6078
|
public float screenX(float x, float y, float z) {
|
6076
6079
|
showMissingWarning("screenX");
|
@@ -6092,10 +6095,10 @@ public class PGraphics extends PImage implements PConstants {
|
|
6092
6095
|
* ( begin auto-generated from screenZ.xml )
|
6093
6096
|
*
|
6094
6097
|
* Takes a three-dimensional X, Y, Z position and returns the Z value for
|
6095
|
-
* where it will appear on a (two-dimensional) screen.
|
6098
|
+
* where it will appear on a (two-dimensional) screen.( end auto-generated )
|
6096
6099
|
*
|
6097
|
-
* ( end auto-generated )
|
6098
6100
|
*
|
6101
|
+
* @return
|
6099
6102
|
* @webref lights_camera:coordinates
|
6100
6103
|
* @param x 3D x-coordinate to be mapped
|
6101
6104
|
* @param y 3D y-coordinate to be mapped
|
@@ -6112,13 +6115,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
6112
6115
|
/**
|
6113
6116
|
* ( begin auto-generated from modelX.xml )
|
6114
6117
|
*
|
6115
|
-
* Returns the three-dimensional X, Y, Z position in model space.
|
6116
|
-
|
6117
|
-
|
6118
|
-
|
6119
|
-
|
6120
|
-
* <br/> <br/>
|
6121
|
-
* In the example, the <b>modelX()</b>, <b>modelY()</b>, and
|
6118
|
+
* Returns the three-dimensional X, Y, Z position in model space.This
|
6119
|
+
returns the X value for a given coordinate based on the current set of
|
6120
|
+
transformations (scale, rotate, translate, etc.) The X value can be used
|
6121
|
+
to place an object in space relative to the location of the original
|
6122
|
+
point once the transformations are no longer in use. In the example, the <b>modelX()</b>, <b>modelY()</b>, and
|
6122
6123
|
* <b>modelZ()</b> functions record the location of a box in space after
|
6123
6124
|
* being placed using a series of translate and rotate commands. After
|
6124
6125
|
* popMatrix() is called, those transformations no longer apply, but the
|
@@ -6127,6 +6128,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6127
6128
|
*
|
6128
6129
|
* ( end auto-generated )
|
6129
6130
|
*
|
6131
|
+
* @return
|
6130
6132
|
* @webref lights_camera:coordinates
|
6131
6133
|
* @param x 3D x-coordinate to be mapped
|
6132
6134
|
* @param y 3D y-coordinate to be mapped
|
@@ -6143,13 +6145,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
6143
6145
|
/**
|
6144
6146
|
* ( begin auto-generated from modelY.xml )
|
6145
6147
|
*
|
6146
|
-
* Returns the three-dimensional X, Y, Z position in model space.
|
6147
|
-
|
6148
|
-
|
6149
|
-
|
6150
|
-
|
6151
|
-
* <br />
|
6152
|
-
* In the example, the <b>modelX()</b>, <b>modelY()</b>, and
|
6148
|
+
* Returns the three-dimensional X, Y, Z position in model space.This
|
6149
|
+
returns the Y value for a given coordinate based on the current set of
|
6150
|
+
transformations (scale, rotate, translate, etc.) The Y value can be used
|
6151
|
+
to place an object in space relative to the location of the original
|
6152
|
+
point once the transformations are no longer in use. In the example, the <b>modelX()</b>, <b>modelY()</b>, and
|
6153
6153
|
* <b>modelZ()</b> functions record the location of a box in space after
|
6154
6154
|
* being placed using a series of translate and rotate commands. After
|
6155
6155
|
* popMatrix() is called, those transformations no longer apply, but the
|
@@ -6158,6 +6158,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6158
6158
|
*
|
6159
6159
|
* ( end auto-generated )
|
6160
6160
|
*
|
6161
|
+
* @return
|
6161
6162
|
* @webref lights_camera:coordinates
|
6162
6163
|
* @param x 3D x-coordinate to be mapped
|
6163
6164
|
* @param y 3D y-coordinate to be mapped
|
@@ -6174,13 +6175,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
6174
6175
|
/**
|
6175
6176
|
* ( begin auto-generated from modelZ.xml )
|
6176
6177
|
*
|
6177
|
-
* Returns the three-dimensional X, Y, Z position in model space.
|
6178
|
-
|
6179
|
-
|
6180
|
-
|
6181
|
-
|
6182
|
-
* <br />
|
6183
|
-
* In the example, the <b>modelX()</b>, <b>modelY()</b>, and
|
6178
|
+
* Returns the three-dimensional X, Y, Z position in model space.This
|
6179
|
+
returns the Z value for a given coordinate based on the current set of
|
6180
|
+
transformations (scale, rotate, translate, etc.) The Z value can be used
|
6181
|
+
to place an object in space relative to the location of the original
|
6182
|
+
point once the transformations are no longer in use. In the example, the <b>modelX()</b>, <b>modelY()</b>, and
|
6184
6183
|
* <b>modelZ()</b> functions record the location of a box in space after
|
6185
6184
|
* being placed using a series of translate and rotate commands. After
|
6186
6185
|
* popMatrix() is called, those transformations no longer apply, but the
|
@@ -6189,6 +6188,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6189
6188
|
*
|
6190
6189
|
* ( end auto-generated )
|
6191
6190
|
*
|
6191
|
+
* @return
|
6192
6192
|
* @webref lights_camera:coordinates
|
6193
6193
|
* @param x 3D x-coordinate to be mapped
|
6194
6194
|
* @param y 3D y-coordinate to be mapped
|
@@ -6217,7 +6217,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6217
6217
|
* <b>pushStyle()</b>, it builds on the current style information. The
|
6218
6218
|
* <b>pushStyle()</b> and <b>popStyle()</b> functions can be embedded to
|
6219
6219
|
* provide more control (see the second example above for a demonstration.)
|
6220
|
-
*
|
6220
|
+
*
|
6221
6221
|
* The style information controlled by the following functions are included
|
6222
6222
|
* in the style:
|
6223
6223
|
* fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(),
|
@@ -6410,7 +6410,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6410
6410
|
*
|
6411
6411
|
* Sets the width of the stroke used for lines, points, and the border
|
6412
6412
|
* around shapes. All widths are set in units of pixels.
|
6413
|
-
*
|
6413
|
+
*
|
6414
6414
|
* When drawing with P3D, series of connected lines (such as the stroke
|
6415
6415
|
* around a polygon, triangle, or ellipse) produce unattractive results
|
6416
6416
|
* when a thick stroke weight is set (<a
|
@@ -6439,7 +6439,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6439
6439
|
* are either mitered, beveled, or rounded and specified with the
|
6440
6440
|
* corresponding parameters MITER, BEVEL, and ROUND. The default joint is
|
6441
6441
|
* MITER.
|
6442
|
-
*
|
6442
|
+
*
|
6443
6443
|
* This function is not available with the P3D renderer, (<a
|
6444
6444
|
* href="http://code.google.com/p/processing/issues/detail?id=123">see
|
6445
6445
|
* Issue 123</a>). More information about the renderers can be found in the
|
@@ -6463,7 +6463,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6463
6463
|
* Sets the style for rendering line endings. These ends are either
|
6464
6464
|
* squared, extended, or rounded and specified with the corresponding
|
6465
6465
|
* parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND.
|
6466
|
-
*
|
6466
|
+
*
|
6467
6467
|
* This function is not available with the P3D renderer (<a
|
6468
6468
|
* href="http://code.google.com/p/processing/issues/detail?id=123">see
|
6469
6469
|
* Issue 123</a>). More information about the renderers can be found in the
|
@@ -6514,7 +6514,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6514
6514
|
* is either specified in terms of the RGB or HSB color depending on the
|
6515
6515
|
* current <b>colorMode()</b> (the default color space is RGB, with each
|
6516
6516
|
* value in the range from 0 to 255).
|
6517
|
-
*
|
6517
|
+
*
|
6518
6518
|
* When using hexadecimal notation to specify a color, use "#" or "0x"
|
6519
6519
|
* before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six
|
6520
6520
|
* digits to specify a color (the way colors are specified in HTML and
|
@@ -6522,7 +6522,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6522
6522
|
* hexadecimal value must be specified with eight characters; the first two
|
6523
6523
|
* characters define the alpha component and the remainder the red, green,
|
6524
6524
|
* and blue components.
|
6525
|
-
*
|
6525
|
+
*
|
6526
6526
|
* The value for the parameter "gray" must be less than or equal to the
|
6527
6527
|
* current maximum value as specified by <b>colorMode()</b>. The default
|
6528
6528
|
* maximum value is 255.
|
@@ -6631,25 +6631,25 @@ public class PGraphics extends PImage implements PConstants {
|
|
6631
6631
|
* ( begin auto-generated from tint.xml )
|
6632
6632
|
*
|
6633
6633
|
* Sets the fill value for displaying images. Images can be tinted to
|
6634
|
-
* specified colors or made transparent by setting the alpha
|
6635
|
-
*
|
6634
|
+
* specified colors or made transparent by setting the alpha.
|
6635
|
+
*
|
6636
6636
|
* To make an image transparent, but not change it's color, use white as
|
6637
6637
|
* the tint color and specify an alpha value. For instance, tint(255, 128)
|
6638
6638
|
* will make an image 50% transparent (unless <b>colorMode()</b> has been
|
6639
|
-
* used)
|
6640
|
-
*
|
6639
|
+
* used).
|
6640
|
+
*
|
6641
6641
|
* When using hexadecimal notation to specify a color, use "#" or "0x"
|
6642
6642
|
* before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six
|
6643
6643
|
* digits to specify a color (the way colors are specified in HTML and
|
6644
6644
|
* CSS). When using the hexadecimal notation starting with "0x", the
|
6645
6645
|
* hexadecimal value must be specified with eight characters; the first two
|
6646
6646
|
* characters define the alpha component and the remainder the red, green,
|
6647
|
-
* and blue components
|
6648
|
-
*
|
6647
|
+
* and blue components.
|
6648
|
+
*
|
6649
6649
|
* The value for the parameter "gray" must be less than or equal to the
|
6650
6650
|
* current maximum value as specified by <b>colorMode()</b>. The default
|
6651
|
-
* maximum value is 255
|
6652
|
-
*
|
6651
|
+
* maximum value is 255.
|
6652
|
+
*
|
6653
6653
|
* The <b>tint()</b> function is also used to control the coloring of
|
6654
6654
|
* textures in 3D.
|
6655
6655
|
*
|
@@ -6755,7 +6755,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
6755
6755
|
* color is either specified in terms of the RGB or HSB color depending on
|
6756
6756
|
* the current <b>colorMode()</b> (the default color space is RGB, with
|
6757
6757
|
* each value in the range from 0 to 255).
|
6758
|
-
*
|
6758
|
+
*
|
6759
6759
|
* When using hexadecimal notation to specify a color, use "#" or "0x"
|
6760
6760
|
* before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six
|
6761
6761
|
* digits to specify a color (the way colors are specified in HTML and
|
@@ -6763,11 +6763,11 @@ public class PGraphics extends PImage implements PConstants {
|
|
6763
6763
|
* hexadecimal value must be specified with eight characters; the first two
|
6764
6764
|
* characters define the alpha component and the remainder the red, green,
|
6765
6765
|
* and blue components.
|
6766
|
-
*
|
6766
|
+
*
|
6767
6767
|
* The value for the parameter "gray" must be less than or equal to the
|
6768
6768
|
* current maximum value as specified by <b>colorMode()</b>. The default
|
6769
6769
|
* maximum value is 255.
|
6770
|
-
*
|
6770
|
+
*
|
6771
6771
|
* To change the color of an image (or a texture), use tint().
|
6772
6772
|
*
|
6773
6773
|
* ( end auto-generated )
|
@@ -6942,6 +6942,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
6942
6942
|
|
6943
6943
|
/**
|
6944
6944
|
* gray number specifying value between white and black
|
6945
|
+
*
|
6946
|
+
* @param gray value between black and white, by default 0 to 255
|
6945
6947
|
*/
|
6946
6948
|
public void specular(float gray) {
|
6947
6949
|
colorCalc(gray);
|
@@ -7019,6 +7021,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
7019
7021
|
|
7020
7022
|
/**
|
7021
7023
|
* gray number specifying value between white and black
|
7024
|
+
*
|
7025
|
+
* @param gray value between black and white, by default 0 to 255
|
7022
7026
|
*/
|
7023
7027
|
public void emissive(float gray) {
|
7024
7028
|
colorCalc(gray);
|
@@ -7245,9 +7249,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
7245
7249
|
*
|
7246
7250
|
* Sets the falloff rates for point lights, spot lights, and ambient
|
7247
7251
|
* lights. The parameters are used to determine the falloff with the
|
7248
|
-
* following equation
|
7249
|
-
* vertex
|
7250
|
-
* QUADRATIC)
|
7252
|
+
* following equation:d = distance from light position to
|
7253
|
+
* vertex positionfalloff = 1 / (CONSTANT + d * LINEAR + (d*d) *
|
7254
|
+
* QUADRATIC)Like <b>fill()</b>, it affects only the elements
|
7251
7255
|
* which are created after it in the code. The default value if
|
7252
7256
|
* <b>LightFalloff(1.0, 0.0, 0.0)</b>. Thinking about an ambient light with
|
7253
7257
|
* a falloff can be tricky. It is used, for example, if you wanted a region
|
@@ -7315,13 +7319,13 @@ public class PGraphics extends PImage implements PConstants {
|
|
7315
7319
|
* of the Processing window. The default background is light gray. In the
|
7316
7320
|
* <b>draw()</b> function, the background color is used to clear the
|
7317
7321
|
* display window at the beginning of each frame.
|
7318
|
-
*
|
7322
|
+
*
|
7319
7323
|
* An image can also be used as the background for a sketch, however its
|
7320
7324
|
* width and height must be the same size as the sketch window. To resize
|
7321
7325
|
* an image 'b' to the size of the sketch window, use b.resize(width, height).
|
7322
|
-
*
|
7326
|
+
*
|
7323
7327
|
* Images used as background will ignore the current <b>tint()</b> setting.
|
7324
|
-
*
|
7328
|
+
*
|
7325
7329
|
* It is not possible to use transparency (alpha) in background colors with
|
7326
7330
|
* the main drawing surface, however they will work properly with <b>createGraphics()</b>.
|
7327
7331
|
*
|
@@ -7452,13 +7456,13 @@ public class PGraphics extends PImage implements PConstants {
|
|
7452
7456
|
/**
|
7453
7457
|
* Takes an RGB or ARGB image and sets it as the background.
|
7454
7458
|
* The width and height of the image must be the same size as the sketch.
|
7455
|
-
* Use image.resize(width, height) to make short work of such a task
|
7456
|
-
*
|
7459
|
+
* Use image.resize(width, height) to make short work of such a task.
|
7460
|
+
*
|
7457
7461
|
* Note that even if the image is set as RGB, the high 8 bits of each pixel
|
7458
7462
|
* should be set opaque (0xFF000000) because the image data will be copied
|
7459
7463
|
* directly to the screen, and non-opaque background images may have strange
|
7460
|
-
* behavior. Use image.filter(OPAQUE) to handle this easily
|
7461
|
-
*
|
7464
|
+
* behavior. Use image.filter(OPAQUE) to handle this easily.
|
7465
|
+
*
|
7462
7466
|
* When using 3D, this will also clear the zbuffer (if it exists).
|
7463
7467
|
*
|
7464
7468
|
* @param image PImage to set as background (must be same size as the sketch window)
|
@@ -7906,12 +7910,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
7906
7910
|
*
|
7907
7911
|
* Extracts the red value from a color, scaled to match current
|
7908
7912
|
* <b>colorMode()</b>. This value is always returned as a float so be
|
7909
|
-
* careful not to assign it to an int value
|
7913
|
+
* careful not to assign it to an int value.The red() function
|
7910
7914
|
* is easy to use and undestand, but is slower than another technique. To
|
7911
7915
|
* achieve the same results when working in <b>colorMode(RGB, 255)</b>, but
|
7912
7916
|
* with greater speed, use the >> (right shift) operator with a bit
|
7913
7917
|
* mask. For example, the following two lines of code are equivalent:<br
|
7914
|
-
* /><pre>float r1 = red(myColor)
|
7918
|
+
* /><pre>float r1 = red(myColor);float r2 = myColor >> 16
|
7915
7919
|
* & 0xFF;</pre>
|
7916
7920
|
*
|
7917
7921
|
* ( end auto-generated )
|
@@ -7939,12 +7943,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
7939
7943
|
*
|
7940
7944
|
* Extracts the green value from a color, scaled to match current
|
7941
7945
|
* <b>colorMode()</b>. This value is always returned as a float so be
|
7942
|
-
* careful not to assign it to an int value
|
7946
|
+
* careful not to assign it to an int value.The <b>green()</b>
|
7943
7947
|
* function is easy to use and undestand, but is slower than another
|
7944
7948
|
* technique. To achieve the same results when working in <b>colorMode(RGB,
|
7945
7949
|
* 255)</b>, but with greater speed, use the >> (right shift)
|
7946
7950
|
* operator with a bit mask. For example, the following two lines of code
|
7947
|
-
* are equivalent:<
|
7951
|
+
* are equivalent:<pre>float r1 = green(myColor);float r2 =
|
7948
7952
|
* myColor >> 8 & 0xFF;</pre>
|
7949
7953
|
*
|
7950
7954
|
* ( end auto-generated )
|
@@ -7972,12 +7976,12 @@ public class PGraphics extends PImage implements PConstants {
|
|
7972
7976
|
*
|
7973
7977
|
* Extracts the blue value from a color, scaled to match current
|
7974
7978
|
* <b>colorMode()</b>. This value is always returned as a float so be
|
7975
|
-
* careful not to assign it to an int value
|
7979
|
+
* careful not to assign it to an int value.The <b>blue()</b>
|
7976
7980
|
* function is easy to use and undestand, but is slower than another
|
7977
7981
|
* technique. To achieve the same results when working in <b>colorMode(RGB,
|
7978
7982
|
* 255)</b>, but with greater speed, use a bit mask to remove the other
|
7979
7983
|
* color components. For example, the following two lines of code are
|
7980
|
-
* equivalent:<
|
7984
|
+
* equivalent:<pre>float r1 = blue(myColor);float r2 = myColor
|
7981
7985
|
* & 0xFF;</pre>
|
7982
7986
|
*
|
7983
7987
|
* ( end auto-generated )
|
@@ -8003,9 +8007,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
8003
8007
|
/**
|
8004
8008
|
* ( begin auto-generated from hue.xml )
|
8005
8009
|
*
|
8006
|
-
* Extracts the hue value from a color.
|
8010
|
+
* Extracts the hue value from a color.( end auto-generated )
|
8007
8011
|
*
|
8008
|
-
*
|
8012
|
+
* @return
|
8009
8013
|
* @webref color:creating_reading
|
8010
8014
|
* @usage web_application
|
8011
8015
|
* @param rgb any value of the color datatype
|
@@ -8029,9 +8033,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
8029
8033
|
/**
|
8030
8034
|
* ( begin auto-generated from saturation.xml )
|
8031
8035
|
*
|
8032
|
-
* Extracts the saturation value from a color.
|
8036
|
+
* Extracts the saturation value from a color.( end auto-generated )
|
8033
8037
|
*
|
8034
|
-
*
|
8038
|
+
* @return
|
8035
8039
|
* @webref color:creating_reading
|
8036
8040
|
* @usage web_application
|
8037
8041
|
* @param rgb any value of the color datatype
|
@@ -8055,10 +8059,10 @@ public class PGraphics extends PImage implements PConstants {
|
|
8055
8059
|
/**
|
8056
8060
|
* ( begin auto-generated from brightness.xml )
|
8057
8061
|
*
|
8058
|
-
* Extracts the brightness value from a color.
|
8062
|
+
* Extracts the brightness value from a color.( end auto-generated )
|
8059
8063
|
*
|
8060
|
-
* ( end auto-generated )
|
8061
8064
|
*
|
8065
|
+
* @return
|
8062
8066
|
* @webref color:creating_reading
|
8063
8067
|
* @usage web_application
|
8064
8068
|
* @param rgb any value of the color datatype
|
@@ -8194,6 +8198,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
8194
8198
|
|
8195
8199
|
/**
|
8196
8200
|
* Record individual lines and triangles by echoing them to another renderer.
|
8201
|
+
* @param rawGraphics
|
8197
8202
|
*/
|
8198
8203
|
public void beginRaw(PGraphics rawGraphics) { // ignore
|
8199
8204
|
this.raw = rawGraphics;
|
@@ -8251,6 +8256,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
8251
8256
|
|
8252
8257
|
/**
|
8253
8258
|
* Version of showWarning() that takes a parsed String.
|
8259
|
+
* @param msg
|
8260
|
+
* @param args
|
8254
8261
|
*/
|
8255
8262
|
static public void showWarning(String msg, Object... args) { // ignore
|
8256
8263
|
showWarning(String.format(msg, args));
|
@@ -8282,6 +8289,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
8282
8289
|
|
8283
8290
|
/**
|
8284
8291
|
* Display a warning that the specified method is simply unavailable.
|
8292
|
+
* @param method
|
8285
8293
|
*/
|
8286
8294
|
static public void showMethodWarning(String method) {
|
8287
8295
|
showWarning(method + "() is not available with this renderer.");
|
@@ -8290,8 +8298,9 @@ public class PGraphics extends PImage implements PConstants {
|
|
8290
8298
|
|
8291
8299
|
/**
|
8292
8300
|
* Error that a particular variation of a method is unavailable (even though
|
8293
|
-
* other variations are).
|
8294
|
-
|
8301
|
+
* other variations are).For instance, if vertex(x, y, u, v) is not
|
8302
|
+
available, but vertex(x, y) is just fine.
|
8303
|
+
* @param str
|
8295
8304
|
*/
|
8296
8305
|
static public void showVariationWarning(String str) {
|
8297
8306
|
showWarning(str + " is not available with this renderer.");
|
@@ -8302,6 +8311,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
8302
8311
|
* Display a warning that the specified method is not implemented, meaning
|
8303
8312
|
* that it could be either a completely missing function, although other
|
8304
8313
|
* variations of it may still work properly.
|
8314
|
+
* @param method
|
8305
8315
|
*/
|
8306
8316
|
static public void showMissingWarning(String method) {
|
8307
8317
|
showWarning(method + "(), or this particular variation of it, " +
|
@@ -8310,9 +8320,10 @@ public class PGraphics extends PImage implements PConstants {
|
|
8310
8320
|
|
8311
8321
|
|
8312
8322
|
/**
|
8313
|
-
* Show an renderer-related exception that halts the program.
|
8314
|
-
|
8315
|
-
|
8323
|
+
* Show an renderer-related exception that halts the program.Currently just
|
8324
|
+
wraps the message as a RuntimeException and throws it, but might do
|
8325
|
+
something more specific might be used in the future.
|
8326
|
+
* @param msg
|
8316
8327
|
*/
|
8317
8328
|
static public void showException(String msg) { // ignore
|
8318
8329
|
throw new RuntimeException(msg);
|
@@ -8321,6 +8332,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
8321
8332
|
|
8322
8333
|
/**
|
8323
8334
|
* Same as below, but defaults to a 12 point font, just as MacWrite intended.
|
8335
|
+
* @param method
|
8324
8336
|
*/
|
8325
8337
|
protected void defaultFontOrDeath(String method) {
|
8326
8338
|
defaultFontOrDeath(method, 12);
|
@@ -8331,6 +8343,8 @@ public class PGraphics extends PImage implements PConstants {
|
|
8331
8343
|
* First try to create a default font, but if that's not possible, throw
|
8332
8344
|
* an exception that halts the program because textFont() has not been used
|
8333
8345
|
* prior to the specified method.
|
8346
|
+
* @param method
|
8347
|
+
* @param size
|
8334
8348
|
*/
|
8335
8349
|
protected void defaultFontOrDeath(String method, float size) {
|
8336
8350
|
if (parent != null) {
|
@@ -8351,7 +8365,7 @@ public class PGraphics extends PImage implements PConstants {
|
|
8351
8365
|
* Return true if this renderer should be drawn to the screen. Defaults to
|
8352
8366
|
* returning true, since nearly all renderers are on-screen beasts. But can
|
8353
8367
|
* be overridden for subclasses like PDF so that a window doesn't open up.
|
8354
|
-
*
|
8368
|
+
*
|
8355
8369
|
* A better name? showFrame, displayable, isVisible, visible, shouldDisplay,
|
8356
8370
|
* what to call this?
|
8357
8371
|
*/
|