From 8cddc67816b99036cdf9cbaa66bce99d3a3aa74b Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Fri, 25 Nov 2022 11:47:42 -0500 Subject: [PATCH] updates and clarifications for the size() reference --- core/src/processing/core/PApplet.java | 79 +++++++++++++-------------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 946aa0882..bb810610b 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -1627,7 +1627,6 @@ public class PApplet implements PConstants { /** - * * Defines the dimension of the display window width and height in units of * pixels. In a program that has the setup() function, the * size() function must be the first line of code inside @@ -1641,11 +1640,45 @@ public class PApplet implements PConstants { * default size of 100 x 100 pixels.
*
* The size() function can only be used once inside a sketch, and it - * cannot be used for resizing.
+ * cannot be used for resizing. Use windowResize() instead.
*
- * As of Processing 3, to run a sketch at the full dimensions of a screen, use - * the fullScreen() function, rather than the older way of using - * size(displayWidth, displayHeight).
+ * To run a sketch that fills the screen, use the fullScreen() function, + * rather than using size(displayWidth, displayHeight).
+ *
+ * The renderer parameter selects which rendering engine to use. For + * example, if you will be drawing 3D shapes, use P3D. The default + * renderer is slower for some situations (for instance large or + * high-resolution displays) but generally has higher quality than the + * other renderers for 2D drawing.
+ *
+ * In addition to the default renderer, other renderers are:
+ *
+ * P2D (Processing 2D): 2D graphics renderer that makes use of + * OpenGL-compatible graphics hardware.
+ *
+ * P3D (Processing 3D): 3D graphics renderer that makes use of + * OpenGL-compatible graphics hardware.
+ *
+ * FX2D (JavaFX 2D): A 2D renderer that uses JavaFX, which may be + * faster for some applications, but has some compatibility quirks. + * Use “Manage Libraries” to download and install the JavaFX library.
+ *
+ * PDF: The PDF renderer draws 2D graphics directly to an Acrobat PDF + * file. This produces excellent results when you need vector shapes for + * high-resolution output or printing. You must first use Import Library + * → PDF to make use of the library. More information can be found in the + * PDF library reference.
+ *
+ * SVG: The SVG renderer draws 2D graphics directly to an SVG file. + * This is great for importing into other vector programs or using for + * digital fabrication. It is not as feature-complete as other renderers. + * Like PDF, you must first use Import Library → SVG Export to + * make use the SVG library.
+ *
+ * As of Processing 3.0, to use variables as the parameters to size() + * function, place the size() function within the settings() + * function (instead of setup()). There is more information about this + * on the settings() reference page.
*
* The maximum width and height is limited by your operating system, and is * usually the width and height of your actual screen. On some machines it may @@ -1660,43 +1693,7 @@ public class PApplet implements PConstants { * is the smallest that is supported across Windows, macOS, and Linux. We * enforce the minimum size so that sketches will run identically on different * machines.
- * The renderer parameter selects which rendering engine to use. For - * example, if you will be drawing 3D shapes, use P3D. In addition to - * the default renderer, other renderers are:
*
- * P2D (Processing 2D): 2D graphics renderer that makes use of - * OpenGL-compatible graphics hardware.
- *
- * P3D (Processing 3D): 3D graphics renderer that makes use of - * OpenGL-compatible graphics hardware.
- *
- * FX2D (JavaFX 2D): A 2D renderer that uses JavaFX, which may be - * faster for some applications, but has some compatibility quirks.
- * PDF: The PDF renderer draws 2D graphics directly to an Acrobat PDF - * file. This produces excellent results when you need vector shapes for - * high-resolution output or printing. You must first use Import Library - * → PDF to make use of the library. More information can be found in the - * PDF library reference.
- *
- * SVG: The SVG renderer draws 2D graphics directly to an SVG file. - * This is great for importing into other vector programs or using for digital - * fabrication. You must first use Import Library → SVG Export to make - * use of the library.
- *
- * As of Processing 3.0, to use variables as the parameters to size() - * function, place the size() function within the settings() - * function (instead of setup()). There is more information about this - * on the settings() reference page.
- *
- * - *

Advanced

If using Java 1.3 or later, this will default to using - * PGraphics2, the Java2D-based renderer. If using Java 1.1, or if PGraphics2 - * is not available, then PGraphics will be used. To set your own renderer, - * use the other version of the size() method that takes a renderer as its - * last parameter. - *

- * If called once a renderer has already been set, this will use the previous - * renderer and simply resize it. * * @webref environment * @webBrief Defines the dimension of the display window in units of pixels