diff --git a/.github/lock.yml b/.github/lock.yml new file mode 100644 index 000000000..14e31af72 --- /dev/null +++ b/.github/lock.yml @@ -0,0 +1,39 @@ +# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app + +# Number of days of inactivity before a closed issue or pull request is locked +daysUntilLock: 30 + +# Skip issues and pull requests created before a given timestamp. Timestamp must +# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable +skipCreatedBefore: false + +# Issues and pull requests with these labels will be ignored. Set to `[]` to disable +exemptLabels: [] + +# Label to add before locking, such as `outdated`. Set to `false` to disable +lockLabel: false + +# Comment to post before locking. Set to `false` to disable +lockComment: > + This thread has been automatically locked since there has not been + any recent activity after it was closed. Please open a new issue for + related bugs. + +# Assign `resolved` as the reason for locking. Set to `false` to disable +# setLockReason: true +setLockReason: false + +# Limit to only `issues` or `pulls` +# only: issues + +# Optionally, specify configuration settings just for `issues` or `pulls` +# issues: +# exemptLabels: +# - help-wanted +# lockLabel: outdated + +# pulls: +# daysUntilLock: 30 + +# Repository to extend settings from +# _extends: repo diff --git a/README.md b/README.md index 47c04277d..437863c39 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Processing 4 makes important updates to the code to prepare the platform for its ## Roadmap -We don't have a schedule for a final release. This work is being done by a [tiny number of volunteers](https://github.com/processing/processing4/graphs/contributors?from=2019-10-01&to=2021-01-01&type=c) working in their personal free time. +We don't have a schedule for a final release. This work is being done by a [tiny number of volunteers](https://github.com/processing/processing4/graphs/contributors?from=2019-10-01&to=2021-06-14&type=c) working in their personal free time. * We're currently using JDK 11, which is a “Long Term Support” (LTS) release. Java 17 is the next LTS, and we'll switch to that when it arrives in September 2021. @@ -82,4 +82,4 @@ If you're using Eclipse, it'll complain about the lack of `jogl-all-src.jar`. St git checkout 0779f229b0e9538c640b18b9a4e095af1f5a35b3 zip -r ../jogl-all-src.jar src -Then copy that `jogl-all-src.jar` file to sit next to the `jogl-all.jar` folder inside `/path/to/processing/core/library`. \ No newline at end of file +Then copy that `jogl-all-src.jar` file to sit next to the `jogl-all.jar` folder inside `/path/to/processing/core/library`. diff --git a/app/.gitignore b/app/.gitignore index 81e75864d..3456289ed 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1,2 +1,5 @@ bin pde.jar + +jna.jar +jna-platform.jar diff --git a/app/build.xml b/app/build.xml index 464181fc4..d73bb513d 100644 --- a/app/build.xml +++ b/app/build.xml @@ -9,14 +9,69 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/lib/jna-platform.jar b/app/lib/jna-platform.jar deleted file mode 100644 index 472268182..000000000 Binary files a/app/lib/jna-platform.jar and /dev/null differ diff --git a/app/lib/jna.jar b/app/lib/jna.jar deleted file mode 100644 index 0b5fabdd8..000000000 Binary files a/app/lib/jna.jar and /dev/null differ diff --git a/app/lib/jna.txt b/app/lib/jna.txt deleted file mode 100644 index 4dbac83c2..000000000 --- a/app/lib/jna.txt +++ /dev/null @@ -1,4 +0,0 @@ -The JAR file is JNA 4.2.0 - -You can find the corresponding file for Maven here: -https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/4.2.0/ diff --git a/app/src/processing/app/Platform.java b/app/src/processing/app/Platform.java index 1e12dc733..51ac0bab6 100644 --- a/app/src/processing/app/Platform.java +++ b/app/src/processing/app/Platform.java @@ -385,12 +385,20 @@ public class Platform { * @throws IOException */ static public boolean deleteFile(File file) throws IOException { - FileUtils fu = FileUtils.getInstance(); - if (fu.hasTrash()) { - fu.moveToTrash(new File[] { file }); - return true; + try { + FileUtils fu = FileUtils.getInstance(); + if (fu.hasTrash()) { + fu.moveToTrash(new File[]{file}); + return true; + } + } catch (Throwable t) { + // On macOS getting NoClassDefFoundError inside JNA on Big Sur. + // (Can't find com.sun.jna.platform.mac.MacFileUtils$FileManager) + // Just adding a catch-all here so that it does the fall-through below. + System.err.println(t.getMessage()); + } - } else if (file.isDirectory()) { + if (file.isDirectory()) { Util.removeDir(file); return true; diff --git a/app/src/processing/app/RunnerListenerEdtAdapter.java b/app/src/processing/app/RunnerListenerEdtAdapter.java index a436eefbc..2984cf9bf 100644 --- a/app/src/processing/app/RunnerListenerEdtAdapter.java +++ b/app/src/processing/app/RunnerListenerEdtAdapter.java @@ -10,6 +10,11 @@ public class RunnerListenerEdtAdapter implements RunnerListener { this.wrapped = wrapped; } + /** Need the original object so we can see if it's a JavaEditor */ + public RunnerListener getWrapped() { + return wrapped; + } + @Override public void statusError(String message) { EventQueue.invokeLater(() -> wrapped.statusError(message)); diff --git a/app/src/processing/app/SketchCode.java b/app/src/processing/app/SketchCode.java index 59ed06652..e66fe7a88 100644 --- a/app/src/processing/app/SketchCode.java +++ b/app/src/processing/app/SketchCode.java @@ -25,6 +25,7 @@ package processing.app; import java.io.*; +import java.util.Stack; import javax.swing.text.BadLocationException; import javax.swing.text.Document; @@ -64,7 +65,15 @@ public class SketchCode { * Editor.undo will be set to this object when this code is the tab * that's currently the front. */ - private UndoManager undo = new UndoManager(); + private final UndoManager undo = new UndoManager(); + + /** + * Caret positions for this tab. + * Editor.caretUndoStack and Editor.caretRedoStack will be set to these + * when this code is the tab that's currently the front. + */ + private final Stack caretUndoStack = new Stack<>(); + private final Stack caretRedoStack = new Stack<>(); /** What was on top of the undo stack when last saved. */ // private UndoableEdit lastEdit; @@ -238,6 +247,13 @@ public class SketchCode { return undo; } + public Stack getCaretRedoStack() { + return caretRedoStack; + } + + public Stack getCaretUndoStack() { + return caretUndoStack; + } // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index 6f35ca3fd..6bcb50868 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -513,14 +513,16 @@ public class ContributionListing { count++; } } - for (Library lib : base.getActiveEditor().getMode().contribLibraries) { - if (hasUpdates(lib)) { - count++; + if (base.getActiveEditor() != null) { + for (Library lib : base.getActiveEditor().getMode().contribLibraries) { + if (hasUpdates(lib)) { + count++; + } } - } - for (Library lib : base.getActiveEditor().getMode().coreLibraries) { - if (hasUpdates(lib)) { - count++; + for (Library lib : base.getActiveEditor().getMode().coreLibraries) { + if (hasUpdates(lib)) { + count++; + } } } for (ToolContribution tc : base.getToolContribs()) { diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 832be571b..9e4ce8cb8 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -138,8 +138,11 @@ public abstract class Editor extends JFrame implements RunnerListener { /** Menu Actions updated on the opening of the edit menu. */ protected List editMenuUpdatable = new ArrayList<>(); - /** The currently selected tab's undo manager */ + /** The currently selected tab's undo manager and caret positions*/ private UndoManager undo; + // maintain caret position during undo operations + private Stack caretUndoStack = new Stack<>(); + private Stack caretRedoStack = new Stack<>(); // used internally for every edit. Groups hotkey-event text manipulations and // groups multi-character inputs into a single undos. private CompoundEdit compoundEdit; @@ -148,9 +151,6 @@ public abstract class Editor extends JFrame implements RunnerListener { private TimerTask endUndoEvent; // true if inserting text, false if removing text private boolean isInserting; - // maintain caret position during undo operations - private final Stack caretUndoStack = new Stack<>(); - private final Stack caretRedoStack = new Stack<>(); private FindReplace find; JMenu toolsMenu; @@ -1904,7 +1904,12 @@ public abstract class Editor extends JFrame implements RunnerListener { // textarea.requestFocus(); // get the caret blinking textarea.requestFocusInWindow(); // required for caret blinking + // end edits in the previous tab + endTextEditHistory(); + // update the UndoManager and caret positions to the selected tab this.undo = code.getUndo(); + caretUndoStack = code.getCaretUndoStack(); + caretRedoStack = code.getCaretRedoStack(); undoAction.updateUndoState(); redoAction.updateRedoState(); } diff --git a/app/src/processing/app/ui/EditorFooter.java b/app/src/processing/app/ui/EditorFooter.java index 81b16fc68..deb0da718 100644 --- a/app/src/processing/app/ui/EditorFooter.java +++ b/app/src/processing/app/ui/EditorFooter.java @@ -289,12 +289,16 @@ public class EditorFooter extends Box { FontRenderContext frc = g2.getFontRenderContext(); final int GAP = Toolkit.zoom(5); final String updateLabel = "Updates"; - String updatesStr = "" + updateCount; + //String updatesStr = " " + updateCount + " "; + String updatesStr = " " + ((int) (Math.random() * 25)) + " "; double countWidth = font.getStringBounds(updatesStr, frc).getWidth(); + double countHeight = font.getStringBounds(updatesStr, frc).getHeight(); if (fontAscent > countWidth) { countWidth = fontAscent; } - float diameter = (float) (countWidth * 1.65f); + // Using a variant of https://github.com/processing/processing/pull/4097 + final float CIRCULAR_PADDING = 1.5f; + float diameter = (float) (2 * (Math.max(countHeight, countWidth)/2 + CIRCULAR_PADDING)); float ex = getWidth() - Editor.RIGHT_GUTTER - diameter; float ey = (getHeight() - diameter) / 2; g2.setColor(updateColor); diff --git a/build/README.md b/build/README.md index 517df7697..fbe97d019 100644 --- a/build/README.md +++ b/build/README.md @@ -30,13 +30,13 @@ You can choose to install these yourself or use the following guides below: One will also need to clone the repository for Processing itself. Some users who are simply building Processing but not contributing to it may prefer a "shallow" clone which does not copy the full history of the repository: ``` -git clone --depth 1 https://github.com/processing/processing.git +git clone --depth 1 https://github.com/processing/processing4.git ``` Users that are developing for the project may require a full clone: ``` -git clone https://github.com/processing/processing.git +git clone https://github.com/processing/processing4.git ```
diff --git a/build/build.xml b/build/build.xml index f95331690..fc572a348 100644 --- a/build/build.xml +++ b/build/build.xml @@ -79,15 +79,13 @@ - - - - + + diff --git a/core/build.xml b/core/build.xml index fc1069ab5..35e743596 100644 --- a/core/build.xml +++ b/core/build.xml @@ -126,6 +126,7 @@ + diff --git a/core/src/font/ProcessingSansPro-LICENSE.txt b/core/src/font/ProcessingSansPro-LICENSE.txt new file mode 100644 index 000000000..caaf34973 --- /dev/null +++ b/core/src/font/ProcessingSansPro-LICENSE.txt @@ -0,0 +1,98 @@ +"Processing Sans" fonts are just "Source Sans", but renamed to +prevent conflicts on Windows with other versions of Source Sans. +https://github.com/processing/processing/issues/4747 + + +Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/core/src/font/ProcessingSansPro-Regular.ttf b/core/src/font/ProcessingSansPro-Regular.ttf new file mode 100644 index 000000000..c7862f39a Binary files /dev/null and b/core/src/font/ProcessingSansPro-Regular.ttf differ diff --git a/core/src/processing/awt/PGraphicsJava2D.java b/core/src/processing/awt/PGraphicsJava2D.java index 4064c24f2..6c3bbafac 100644 --- a/core/src/processing/awt/PGraphicsJava2D.java +++ b/core/src/processing/awt/PGraphicsJava2D.java @@ -1029,7 +1029,7 @@ public class PGraphicsJava2D extends PGraphics { * * * @webref Rendering - * @webBrief Blends the pixels in the display window according to a defined mode. + * @webBrief Blends the pixels in the display window according to a defined mode * @param mode the blending mode to use */ @Override diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index c117e50d0..f019fb66d 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -30,11 +30,7 @@ import java.net.*; import java.nio.charset.StandardCharsets; import java.text.*; import java.util.*; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; +import java.util.concurrent.*; import java.util.regex.*; import java.util.zip.*; @@ -219,7 +215,7 @@ public class PApplet implements PConstants { * * * @webref image:pixels - * @webBrief Array containing the values for all the pixels in the display window. + * @webBrief Array containing the values for all the pixels in the display window * @see PApplet#loadPixels() * @see PApplet#updatePixels() * @see PApplet#get(int, int, int, int) @@ -240,7 +236,7 @@ public class PApplet implements PConstants { * size() is not used in a program. * * @webref environment - * @webBrief System variable which stores the width of the display window. + * @webBrief System variable which stores the width of the display window * @see PApplet#height * @see PApplet#size(int, int) */ @@ -255,7 +251,7 @@ public class PApplet implements PConstants { * size() is not used in a program. * * @webref environment - * @webBrief System variable which stores the height of the display window. + * @webBrief System variable which stores the height of the display window * @see PApplet#width * @see PApplet#size(int, int) */ @@ -276,7 +272,7 @@ public class PApplet implements PConstants { * * * @webref environment - * @webBrief The actual pixel width when using high resolution display. + * @webBrief The actual pixel width when using high resolution display * @see PApplet#pixelHeight * @see #pixelDensity(int) * @see #displayDensity() @@ -298,7 +294,7 @@ public class PApplet implements PConstants { * be pixelWidth*pixelHeight, not width*height. * * @webref environment - * @webBrief The actual pixel heigh when using high resolution display. + * @webBrief The actual pixel heigh when using high resolution display * @see PApplet#pixelWidth * @see #pixelDensity(int) * @see #displayDensity() @@ -323,7 +319,7 @@ public class PApplet implements PConstants { * its most recent position. * * @webref input:mouse - * @webBrief The system variable that always contains the current horizontal coordinate of the mouse. + * @webBrief The system variable that always contains the current horizontal coordinate of the mouse * @see PApplet#mouseY * @see PApplet#pmouseX * @see PApplet#pmouseY @@ -353,7 +349,7 @@ public class PApplet implements PConstants { * its most recent position. * * @webref input:mouse - * @webBrief The system variable that always contains the current vertical coordinate of the mouse. + * @webBrief The system variable that always contains the current vertical coordinate of the mouse * @see PApplet#mouseX * @see PApplet#pmouseX * @see PApplet#pmouseY @@ -392,7 +388,7 @@ public class PApplet implements PConstants { * * @webref input:mouse * @webBrief The system variable that always contains the horizontal - * position of the mouse in the frame previous to the current frame. + * position of the mouse in the frame previous to the current frame * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseY @@ -416,7 +412,7 @@ public class PApplet implements PConstants { * * @webref input:mouse * @webBrief The system variable that always contains the vertical position - * of the mouse in the frame previous to the current frame. + * of the mouse in the frame previous to the current frame * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -477,7 +473,7 @@ public class PApplet implements PConstants { * If running on Mac OS, a ctrl-click will be interpreted as the right-hand * mouse button (unlike Java, which reports it as the left mouse). * @webref input:mouse - * @webBrief Shows which mouse button is pressed. + * @webBrief Shows which mouse button is pressed * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -504,7 +500,7 @@ public class PApplet implements PConstants { * listening for events. * * @webref input:mouse - * @webBrief Variable storing if a mouse button is pressed. + * @webBrief Variable storing if a mouse button is pressed * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -559,7 +555,7 @@ public class PApplet implements PConstants { * * @webref input:keyboard * @webBrief The system variable that always contains the value of the most - * recent key on the keyboard that was used (either pressed or released). + * recent key on the keyboard that was used (either pressed or released) * @see PApplet#keyCode * @see PApplet#keyPressed * @see PApplet#keyPressed() @@ -607,7 +603,7 @@ public class PApplet implements PConstants { * can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables. * * @webref input:keyboard - * @webBrief Used to detect special keys such as the UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT. + * @webBrief Used to detect special keys such as the UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT * @see PApplet#key * @see PApplet#keyPressed * @see PApplet#keyPressed() @@ -625,7 +621,7 @@ public class PApplet implements PConstants { * * @webref input:keyboard * @webBrief The boolean system variable that is true if any key - * is pressed and false if no keys are pressed. + * is pressed and false if no keys are pressed * @see PApplet#key * @see PApplet#keyCode * @see PApplet#keyPressed() @@ -644,11 +640,11 @@ public class PApplet implements PConstants { /** * * Confirms if a Processing program is "focused", meaning that it is active - * and will accept input from mouse or keyboard. This variable is "true" if - * it is focused and "false" if not. + * and will accept input from mouse or keyboard. This variable is true if + * it is focused and false if not. * * @webref environment - * @webBrief Confirms if a Processing program is "focused". + * @webBrief Confirms if a Processing program is "focused" */ public boolean focused = false; @@ -679,7 +675,7 @@ public class PApplet implements PConstants { * * @webref environment * @webBrief The system variable that contains the approximate frame rate - * of the software as it executes. + * of the software as it executes * @see PApplet#frameRate(float) * @see PApplet#frameCount */ @@ -698,7 +694,7 @@ public class PApplet implements PConstants { * * @webref environment * @webBrief The system variable that contains the number of frames - * displayed since the program started. + * displayed since the program started * @see PApplet#frameRate(float) * @see PApplet#frameRate */ @@ -944,7 +940,7 @@ public class PApplet implements PConstants { * * @webref environment * @webBrief Used when absolutely necessary to define the parameters to size() - * with a variable. + * with a variable * @see PApplet#fullScreen() * @see PApplet#setup() * @see PApplet#size(int,int) @@ -1019,7 +1015,7 @@ public class PApplet implements PConstants { * * * @webref environment - * @webBrief Returns "2" if the screen is high-density and "1" if not. + * @webBrief Returns "2" if the screen is high-density and "1" if not * @see PApplet#pixelDensity(int) * @see PApplet#size(int,int) */ @@ -1077,23 +1073,23 @@ public class PApplet implements PConstants { * pixels on high resolutions screens like Apple Retina * displays and Windows High-DPI displays. This function * can only be run once within a program and it must be - * used right after size() in a program without a setup() - * and used within setup() when a program has one. The - * pixelDensity() should only be used with hardcoded + * used right after size() in a program without a setup() + * and used within setup() when a program has one. The + * pixelDensity() should only be used with hardcoded * numbers (in almost all cases this number will be 2) - * or in combination with displayDensity() as in the + * or in combination with displayDensity() as in the * third example above. * * When the pixel density is set to more than 1, it * changes all of the pixel operations including the way - * get(), set(), blend(), copy(), and updatePixels() - * all work. See the reference for pixelWidth and + * get(), set(), blend(), copy(), and updatePixels() + * all work. See the reference for pixelWidth and * pixelHeight for more information. * - * To use variables as the arguments to pixelDensity() - * function, place the pixelDensity() function within - * the settings() function. There is more information - * about this on the settings() reference page. + * To use variables as the arguments to pixelDensity() + * function, place the pixelDensity() function within + * the settings() function. There is more information + * about this on the settings() reference page. * * @webref environment * @webBrief It makes it possible for Processing to render using all of the @@ -1151,40 +1147,40 @@ public class PApplet implements PConstants { /** * Draws all geometry with smooth (anti-aliased) edges. - * This behavior is the default, so smooth() only needs + * This behavior is the default, so smooth() only needs * to be used when a program needs to set the smoothing * in a different way. The level parameter increases * the amount of smoothness. This is the level of over * sampling applied to the graphics buffer. * - * With the P2D and P3D renderers, smooth(2) is the + * With the P2D and P3D renderers, smooth(2) is the * default, this is called "2x anti-aliasing." The code - * smooth(4) is used for 4x anti-aliasing and smooth(8) + * smooth(4) is used for 4x anti-aliasing and smooth(8) * is specified for "8x anti-aliasing." The maximum * anti-aliasing level is determined by the hardware of - * the machine that is running the software, so smooth(4) - * and smooth(8) will not work with every computer. + * the machine that is running the software, so smooth(4) + * and smooth(8) will not work with every computer. * - * The default renderer uses smooth(3) by default. This + * The default renderer uses smooth(3) by default. This * is bicubic smoothing. The other option for the default - * renderer is smooth(2), which is bilinear smoothing. + * renderer is smooth(2), which is bilinear smoothing. * - * With Processing 3.0, smooth() is different than before. - * It was common to use smooth() and noSmooth() to turn on + * With Processing 3.0, smooth() is different than before. + * It was common to use smooth() and noSmooth() to turn on * and off antialiasing within a sketch. Now, because of - * how the software has changed, smooth() can only be set + * how the software has changed, smooth() can only be set * once within a sketch. It can be used either at the top - * of a sketch without a setup(), or after the size() - * function when used in a sketch with setup(). The - * noSmooth() function also follows the same rules. + * of a sketch without a setup(), or after the size() + * function when used in a sketch with setup(). The + * noSmooth() function also follows the same rules. * - * When smooth() is used with a PGraphics object, it should + * When smooth() is used with a PGraphics object, it should * be run right after the object is created with - * createGraphics(), as shown in the Reference in the third + * createGraphics(), as shown in the Reference in the third * example. * * @webref environment - * @webBrief Draws all geometry with smooth (anti-aliased) edges. + * @webBrief Draws all geometry with smooth (anti-aliased) edges * @param level either 2, 3, 4, or 8 depending on the renderer */ public void smooth(int level) { @@ -1200,18 +1196,18 @@ public class PApplet implements PConstants { * Draws all geometry and fonts with jagged (aliased) * edges and images with hard edges between the pixels * when enlarged rather than interpolating pixels. Note - * that smooth() is active by default, so it is necessary - * to call noSmooth() to disable smoothing of geometry, + * that smooth() is active by default, so it is necessary + * to call noSmooth() to disable smoothing of geometry, * fonts, and images. Since the release of Processing 3.0, - * the noSmooth() function can only be run once for each - * sketch, either at the top of a sketch without a setup(), - * or after the size() function when used in a sketch with - * setup(). See the examples above for both scenarios. + * the noSmooth() function can only be run once for each + * sketch, either at the top of a sketch without a setup(), + * or after the size() function when used in a sketch with + * setup(). See the examples above for both scenarios. * * @webref environment * @webBrief Draws all geometry and fonts with jagged (aliased) * edges and images with hard edges between the pixels - * when enlarged rather than interpolating pixels. + * when enlarged rather than interpolating pixels */ public void noSmooth() { if (insideSettings) { @@ -1342,33 +1338,41 @@ public class PApplet implements PConstants { ////////////////////////////////////////////////////////////// - /** Map of registered methods, stored by name. */ - HashMap registerMap = - new HashMap<>(); + /** Map of registered methods, stored by method name. */ + Map registerMap = new ConcurrentHashMap<>(); - /** Lock when un/registering from multiple threads */ - private final Object registerLock = new Object[0]; + + class RegisteredMethod { + Object object; + Method method; + + RegisteredMethod(Object object, Method method) { + this.object = object; + this.method = method; + } + } class RegisteredMethods { - int count; - Object[] objects; - // Because the Method comes from the class being called, - // it will be unique for most, if not all, objects. - Method[] methods; - Object[] emptyArgs = new Object[] { }; - + Queue entries = new ConcurrentLinkedQueue<>(); + Set removals = null; + final Object[] emptyArgs = new Object[] { }; @SuppressWarnings("unused") void handle() { handle(emptyArgs); } - void handle(Object[] args) { - for (int i = 0; i < count; i++) { + // Queue removed entries until done iterating, i.e. so the Video Library + // can call unregisterMethod("dispose") from inside its dispose() method + // https://github.com/processing/processing4/pull/199 + removals = ConcurrentHashMap.newKeySet(); + + for (RegisteredMethod entry : entries) { try { - methods[i].invoke(objects[i], args); + //methods[i].invoke(objects[i], args); + entry.method.invoke(entry.object, args); } catch (Exception e) { // check for wrapped exception, get root exception Throwable t; @@ -1388,22 +1392,17 @@ public class PApplet implements PConstants { } } } + // Clear the entries queued for removal (if any) + for (Object object : removals) { + entries.remove(object); + } + removals = null; // clear this out } void add(Object object, Method method) { - if (findIndex(object) == -1) { - if (objects == null) { - objects = new Object[5]; - methods = new Method[5]; - - } else if (count == objects.length) { - objects = (Object[]) PApplet.expand(objects); - methods = (Method[]) PApplet.expand(methods); - } - objects[count] = object; - methods[count] = method; - count++; + if (!entries.contains(object)) { + entries.add(new RegisteredMethod(object, method)); } else { die(method.getName() + "() already added for this instance of " + object.getClass().getName()); @@ -1416,38 +1415,14 @@ public class PApplet implements PConstants { * must be called multiple times if object is registered multiple times). * Does not shrink array afterwards, silently returns if method not found. */ -// public void remove(Object object, Method method) { -// int index = findIndex(object, method); public void remove(Object object) { - int index = findIndex(object); - if (index != -1) { - // shift remaining methods by one to preserve ordering - count--; - for (int i = index; i < count; i++) { - objects[i] = objects[i+1]; - methods[i] = methods[i+1]; - } - // clean things out for the gc's sake - objects[count] = null; - methods[count] = null; + if (removals == null) { + entries.remove(object); + } else { + // Currently iterating the list of methods, remove this afterwards + removals.add(object); } } - - -// protected int findIndex(Object object, Method method) { - protected int findIndex(Object object) { - for (int i = 0; i < count; i++) { - if (objects[i] == object) { -// if (objects[i] == object && methods[i].equals(method)) { - //objects[i].equals() might be overridden, so use == for safety - // since here we do care about actual object identity - //methods[i]==method is never true even for same method, so must use - // equals(), this should be safe because of object identity - return i; - } - } - return -1; - } } @@ -1494,14 +1469,12 @@ public class PApplet implements PConstants { Class c = o.getClass(); try { Method method = c.getMethod(name); - synchronized (registerLock) { - RegisteredMethods meth = registerMap.get(name); - if (meth == null) { - meth = new RegisteredMethods(); - registerMap.put(name, meth); - } - meth.add(o, method); + RegisteredMethods meth = registerMap.get(name); + if (meth == null) { + meth = new RegisteredMethods(); + registerMap.put(name, meth); } + meth.add(o, method); } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); @@ -1516,14 +1489,12 @@ public class PApplet implements PConstants { Class c = o.getClass(); try { Method method = c.getMethod(name, cargs); - synchronized (registerLock) { - RegisteredMethods meth = registerMap.get(name); - if (meth == null) { - meth = new RegisteredMethods(); - registerMap.put(name, meth); - } - meth.add(o, method); + RegisteredMethods meth = registerMap.get(name); + if (meth == null) { + meth = new RegisteredMethods(); + registerMap.put(name, meth); } + meth.add(o, method); } catch (NoSuchMethodException nsme) { die("There is no public " + name + "() method in the class " + o.getClass().getName()); @@ -1534,185 +1505,28 @@ public class PApplet implements PConstants { } -// public void registerMethod(String methodName, Object target, Object... args) { -// registerWithArgs(methodName, target, args); -// } - - public void unregisterMethod(String name, Object target) { - synchronized (registerLock) { - RegisteredMethods meth = registerMap.get(name); - if (meth == null) { - die("No registered methods with the name " + name + "() were found."); + RegisteredMethods meth = registerMap.get(name); + if (meth == null) { + die("No registered methods with the name " + name + "() were found."); - } else { - try { - meth.remove(target); - } catch (Exception e) { - die("Could not unregister " + name + "() for " + target, e); - } + } else { + try { + meth.remove(target); + } catch (Exception e) { + die("Could not unregister " + name + "() for " + target, e); } } } protected void handleMethods(String methodName, Object...args) { - synchronized (registerLock) { - RegisteredMethods meth = registerMap.get(methodName); - if (meth != null) { - meth.handle(args); - } + RegisteredMethods meth = registerMap.get(methodName); + if (meth != null) { + meth.handle(args); } } - /* - @Deprecated - public void registerSize(Object o) { - System.err.println("The registerSize() command is no longer supported."); -// Class methodArgs[] = new Class[] { Integer.TYPE, Integer.TYPE }; -// registerWithArgs(sizeMethods, "size", o, methodArgs); - } - - - @Deprecated - public void registerPre(Object o) { - registerNoArgs("pre", o); - } - - - @Deprecated - public void registerDraw(Object o) { - registerNoArgs("draw", o); - } - - - @Deprecated - public void registerPost(Object o) { - registerNoArgs("post", o); - } - - - @Deprecated - public void registerDispose(Object o) { - registerNoArgs("dispose", o); - } - - - @Deprecated - public void unregisterSize(Object o) { - System.err.println("The unregisterSize() command is no longer supported."); -// Class methodArgs[] = new Class[] { Integer.TYPE, Integer.TYPE }; -// unregisterWithArgs(sizeMethods, "size", o, methodArgs); - } - - - @Deprecated - public void unregisterPre(Object o) { - unregisterMethod("pre", o); - } - - - @Deprecated - public void unregisterDraw(Object o) { - unregisterMethod("draw", o); - } - - - @Deprecated - public void unregisterPost(Object o) { - unregisterMethod("post", o); - } - - - @Deprecated - public void unregisterDispose(Object o) { - unregisterMethod("dispose", o); - } - - - // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - // Old methods with AWT API that should not be used. - // These were never implemented on Android so they're stored separately. - - RegisteredMethods mouseEventMethods, keyEventMethods; - - - protected void reportDeprecation(Class c, boolean mouse) { - if (g != null) { - PGraphics.showWarning("The class " + c.getName() + - " is incompatible with Processing 2.0."); - PGraphics.showWarning("A library (or other code) is using register" + - (mouse ? "Mouse" : "Key") + "Event() " + - "which is no longer available."); - // This will crash with OpenGL, so quit anyway - if (g instanceof PGraphicsOpenGL) { - PGraphics.showWarning("Stopping the sketch because this code will " + - "not work correctly with OpenGL."); - throw new RuntimeException("This sketch uses a library that " + - "needs to be updated for Processing 2.0."); - } - } - } - - - @Deprecated - public void registerMouseEvent(Object o) { - Class c = o.getClass(); - reportDeprecation(c, true); - try { - Method method = c.getMethod("mouseEvent", new Class[] { java.awt.event.MouseEvent.class }); - if (mouseEventMethods == null) { - mouseEventMethods = new RegisteredMethods(); - } - mouseEventMethods.add(o, method); - } catch (Exception e) { - die("Could not register mouseEvent() for " + o, e); - } - } - - - @Deprecated - public void unregisterMouseEvent(Object o) { - try { -// Method method = o.getClass().getMethod("mouseEvent", new Class[] { MouseEvent.class }); -// mouseEventMethods.remove(o, method); - mouseEventMethods.remove(o); - } catch (Exception e) { - die("Could not unregister mouseEvent() for " + o, e); - } - } - - - @Deprecated - public void registerKeyEvent(Object o) { - Class c = o.getClass(); - reportDeprecation(c, false); - try { - Method method = c.getMethod("keyEvent", new Class[] { java.awt.event.KeyEvent.class }); - if (keyEventMethods == null) { - keyEventMethods = new RegisteredMethods(); - } - keyEventMethods.add(o, method); - } catch (Exception e) { - die("Could not register keyEvent() for " + o, e); - } - } - - - @Deprecated - public void unregisterKeyEvent(Object o) { - try { -// Method method = o.getClass().getMethod("keyEvent", new Class[] { KeyEvent.class }); -// keyEventMethods.remove(o, method); - keyEventMethods.remove(o); - } catch (Exception e) { - die("Could not unregister keyEvent() for " + o, e); - } - } - */ - - ////////////////////////////////////////////////////////////// @@ -1733,7 +1547,7 @@ public class PApplet implements PConstants { * * * @webref structure - * @webBrief The setup() function is called once when the program starts. + * @webBrief The setup() function is called once when the program starts * @usage web_application * @see PApplet#size(int, int) * @see PApplet#loop() @@ -1774,7 +1588,7 @@ public class PApplet implements PConstants { * @webref structure * @webBrief Called directly after setup() and continuously executes the lines * of code contained inside its block until the program is stopped or - * noLoop() is called. + * noLoop() is called * @usage web_application * @see PApplet#setup() * @see PApplet#loop() @@ -1847,7 +1661,7 @@ public class PApplet implements PConstants { * size(displayWidth, displayHeight). * * @webref environment - * @webBrief Opens a sketch using the full size of the computer's display. + * @webBrief Opens a sketch using the full size of the computer's display * @param renderer the renderer to use, e.g. P2D, P3D, JAVA2D (default) * @see PApplet#settings() * @see PApplet#setup() @@ -1955,7 +1769,7 @@ public class PApplet implements PConstants { * renderer and simply resize it. * * @webref environment - * @webBrief Defines the dimension of the display window in units of pixels. + * @webBrief Defines the dimension of the display window in units of pixels * @param width * width of the display window in units of pixels * @param height @@ -2172,7 +1986,7 @@ public class PApplet implements PConstants { * * @webref rendering * @webBrief Creates and returns a new PGraphics object of the types - * P2D or P3D. + * P2D or P3D * @param w * width in pixels * @param h @@ -2345,7 +2159,7 @@ public class PApplet implements PConstants { * without needing an absolute path. * * @webref image - * @webBrief Creates a new PImage (the datatype for storing images). + * @webBrief Creates a new PImage (the datatype for storing images) * @param w width in pixels * @param h height in pixels * @param format Either RGB, ARGB, ALPHA (grayscale alpha channel) @@ -2521,7 +2335,7 @@ public class PApplet implements PConstants { * noLoop(). * * @webref structure - * @webBrief Executes the code within draw() one time. + * @webBrief Executes the code within draw() one time * @usage web_application * @see PApplet#draw() * @see PApplet#loop() @@ -2554,7 +2368,7 @@ public class PApplet implements PConstants { * * @webref structure * @webBrief Causes Processing to continuously execute the code within - * draw(). + * draw() * @usage web_application * @see PApplet#noLoop() * @see PApplet#redraw() @@ -2586,7 +2400,7 @@ public class PApplet implements PConstants { * Otherwise, the sketch would enter an odd state until loop() was called. * * @webref structure - * @webBrief Stops Processing from continuously executing the code within draw(). + * @webBrief Stops Processing from continuously executing the code within draw() * @usage web_application * @see PApplet#loop() * @see PApplet#redraw() @@ -2785,7 +2599,7 @@ public class PApplet implements PConstants { * completely inconsistent across platforms. * * @webref input:mouse - * @webBrief Called once after every time a mouse button is pressed. + * @webBrief Called once after every time a mouse button is pressed * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -2816,7 +2630,7 @@ public class PApplet implements PConstants { * for events. * * @webref input:mouse - * @webBrief Called every time a mouse button is released. + * @webBrief Called every time a mouse button is released * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -2852,7 +2666,7 @@ public class PApplet implements PConstants { * * @webref input:mouse * @webBrief Called once after a mouse button has been pressed and then - * released. + * released * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -2885,7 +2699,7 @@ public class PApplet implements PConstants { * * @webref input:mouse * @webBrief Called once every time the mouse moves and a mouse button is - * pressed. + * pressed * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -2919,7 +2733,7 @@ public class PApplet implements PConstants { * * @webref input:mouse * @webBrief Called every time the mouse moves and a mouse button is not - * pressed. + * pressed * @see PApplet#mouseX * @see PApplet#mouseY * @see PApplet#pmouseX @@ -2977,7 +2791,7 @@ public class PApplet implements PConstants { * * @webref input:mouse * @webBrief The code within the mouseWheel() event function - * is run when the mouse wheel is moved. + * is run when the mouse wheel is moved * @param event the MouseEvent * @see PApplet#mouseX * @see PApplet#mouseY @@ -3142,7 +2956,7 @@ public class PApplet implements PConstants { * * * @webref input:keyboard - * @webBrief Called once every time a key is pressed. + * @webBrief Called once every time a key is pressed * @see PApplet#key * @see PApplet#keyCode * @see PApplet#keyPressed @@ -3167,7 +2981,7 @@ public class PApplet implements PConstants { * for events. * * @webref input:keyboard - * @webBrief called once every time a key is released. + * @webBrief Called once every time a key is released * @see PApplet#key * @see PApplet#keyCode * @see PApplet#keyPressed @@ -3197,7 +3011,7 @@ public class PApplet implements PConstants { * * @webref input:keyboard * @webBrief Called once every time a key is pressed, but action keys such as - * Ctrl, Shift, and Alt are ignored. + * Ctrl, Shift, and Alt are ignored * @see PApplet#keyPressed * @see PApplet#key * @see PApplet#keyCode @@ -3248,7 +3062,7 @@ public class PApplet implements PConstants { * * @webref input:time_date * @webBrief Returns the number of milliseconds (thousandths of a second) since - * starting an applet. + * starting an applet * @see PApplet#second() * @see PApplet#minute() * @see PApplet#hour() @@ -3267,7 +3081,7 @@ public class PApplet implements PConstants { * second() function returns the current second as a value from 0 - 59. * * @webref input:time_date - * @webBrief Processing communicates with the clock on your computer. + * @webBrief Returns the current second as a value from 0 - 59 * @see PApplet#millis() * @see PApplet#minute() * @see PApplet#hour() @@ -3286,7 +3100,7 @@ public class PApplet implements PConstants { * * * @webref input:time_date - * @webBrief Processing communicates with the clock on your computer. + * @webBrief Returns the current minute as a value from 0 - 59 * @see PApplet#millis() * @see PApplet#second() * @see PApplet#hour() @@ -3305,7 +3119,7 @@ public class PApplet implements PConstants { * hour() function returns the current hour as a value from 0 - 23. * * @webref input:time_date - * @webBrief Processing communicates with the clock on your computer. + * @webBrief Returns the current hour as a value from 0 - 23 * @see PApplet#millis() * @see PApplet#second() * @see PApplet#minute() @@ -3331,7 +3145,7 @@ public class PApplet implements PConstants { * or day of the year (1..365) then use java's Calendar.get() * * @webref input:time_date - * @webBrief Processing communicates with the clock on your computer. + * @webBrief Returns the current day as a value from 1 - 31 * @see PApplet#millis() * @see PApplet#second() * @see PApplet#minute() @@ -3350,7 +3164,7 @@ public class PApplet implements PConstants { * * * @webref input:time_date - * @webBrief Processing communicates with the clock on your computer. + * @webBrief Returns the current month as a value from 1 - 12 * @see PApplet#millis() * @see PApplet#second() * @see PApplet#minute() @@ -3371,7 +3185,8 @@ public class PApplet implements PConstants { * * * @webref input:time_date - * @webBrief Processing communicates with the clock on your computer. + * @webBrief Returns the current year as an integer (2003, + * 2004, 2005, etc) * @see PApplet#millis() * @see PApplet#second() * @see PApplet#minute() @@ -3391,22 +3206,22 @@ public class PApplet implements PConstants { /** * - * The delay() function causes the program to halt for a specified time. + * The delay() function causes the program to halt for a specified time. * Delay times are specified in thousandths of a second. For example, - * running delay(3000) will stop the program for three seconds and - * delay(500) will stop the program for a half-second. + * running delay(3000) will stop the program for three seconds and + * delay(500) will stop the program for a half-second. * - * The screen only updates when the end of draw() is reached, so delay() - * cannot be used to slow down drawing. For instance, you cannot use delay() + * The screen only updates when the end of draw() is reached, so delay() + * cannot be used to slow down drawing. For instance, you cannot use delay() * to control the timing of an animation. * - * The delay() function should only be used for pausing scripts (i.e. + * The delay() function should only be used for pausing scripts (i.e. * a script that needs to pause a few seconds before attempting a download, * or a sketch that needs to wait a few milliseconds before reading from * the serial port). * * @webref environment - * @webBrief The delay() function causes the program to halt for a specified time. + * @webBrief The delay() function causes the program to halt for a specified time * @param napTime milliseconds to pause before running draw() again * @see PApplet#frameRate * @see PApplet#draw() @@ -3431,7 +3246,7 @@ public class PApplet implements PConstants { * setup() is recommended. The default rate is 60 frames per second. * * @webref environment - * @webBrief Specifies the number of frames to be displayed every second. + * @webBrief Specifies the number of frames to be displayed every second * @param fps * number of desired frames per second * @see PApplet#frameRate @@ -3504,7 +3319,7 @@ public class PApplet implements PConstants { * * @webref input:files * @webBrief Attempts to open an application or file using your platform's - * launcher. + * launcher * @param args * arguments to the launcher, eg. a filename. * @usage Application @@ -3788,7 +3603,7 @@ public class PApplet implements PConstants { * (particularly with P3D). * * @webref structure - * @webBrief Quits/stops/exits the program. + * @webBrief Quits/stops/exits the program */ public void exit() { if (surface.isStopped()) { @@ -3930,7 +3745,7 @@ public class PApplet implements PConstants { * * @webref structure * @webBrief Launch a new thread and call the specified function from that new - * thread. + * thread * @usage Application * @param name * name of the function to be executed in a separate thread @@ -3966,7 +3781,7 @@ public class PApplet implements PConstants { * images without a background, use createGraphics(). * * @webref output:image - * @webBrief Saves an image from the display window. + * @webBrief Saves an image from the display window * @param filename * any sequence of letters and numbers * @see PApplet#saveFrame() @@ -4016,7 +3831,7 @@ public class PApplet implements PConstants { * * @webref output:image * @webBrief Saves a numbered sequence of images, one image each time the - * function is run. + * function is run * @see PApplet#save(String) * @see PApplet#createGraphics(int, int, String, String) * @see PApplet#frameCount @@ -4107,7 +3922,7 @@ public class PApplet implements PConstants { * * @webref environment * @webBrief Sets the cursor to a predefined symbol, an image, or makes it - * visible if already hidden. + * visible if already hidden * @see PApplet#noCursor() * @param img * any variable of type PImage @@ -4139,7 +3954,7 @@ public class PApplet implements PConstants { * Hide the cursor by creating a transparent image * and using it as a custom cursor. * @webref environment - * @webBrief Hides the cursor from view. + * @webBrief Hides the cursor from view * @see PApplet#cursor() * @usage Application */ @@ -4173,7 +3988,7 @@ public class PApplet implements PConstants { * can sometimes lock up the program, and cause the sketch to freeze. * * @webref output:text_area - * @webBrief Writes to the console area of the Processing environment. + * @webBrief Writes to the console area of the Processing environment * @usage IDE * @param what * data to print to console @@ -4272,7 +4087,7 @@ public class PApplet implements PConstants { * loop can sometimes lock up the program, and cause the sketch to freeze. * * @webref output:text_area - * @webBrief Writes to the text area of the Processing environment's console. + * @webBrief Writes to the text area of the Processing environment's console * @usage IDE * @see PApplet#print(byte) * @see PApplet#printArray(Object) @@ -4368,7 +4183,7 @@ public class PApplet implements PConstants { /** * - * The printArray() function writes array data to the text + * The printArray() function writes array data to the text * area of the Processing environment's console. A new line * is put between each element of the array. This function * can only print one dimensional arrays. @@ -4378,7 +4193,7 @@ public class PApplet implements PConstants { * * * @webref output:text_area - * @webBrief The printArray() function writes array data to the text + * @webBrief Writes array data to the text * area of the Processing environment's console. * @param what one-dimensional array * @usage IDE @@ -4506,7 +4321,7 @@ public class PApplet implements PConstants { * * * @webref math:calculation - * @webBrief Calculates the absolute value (magnitude) of a number. + * @webBrief Calculates the absolute value (magnitude) of a number * @param n number to compute */ static public final float abs(float n) { @@ -4521,10 +4336,10 @@ public class PApplet implements PConstants { * * Squares a number (multiplies a number by itself). The result is always a * positive number, as multiplying two negative numbers always yields a - * positive result. For example, -1 * -1 = 1. + * positive result. For example, -1 * -1 = 1. * * @webref math:calculation - * @webBrief Squares a number (multiplies a number by itself). + * @webBrief Squares a number (multiplies a number by itself) * @param n number to square * @see PApplet#sqrt(float) */ @@ -4540,7 +4355,7 @@ public class PApplet implements PConstants { * is the opposite of squaring. * * @webref math:calculation - * @webBrief Calculates the square root of a number. + * @webBrief Calculates the square root of a number * @param n non-negative number * @see PApplet#pow(float, float) * @see PApplet#sq(float) @@ -4556,7 +4371,7 @@ public class PApplet implements PConstants { * * @webref math:calculation * @webBrief Calculates the natural logarithm (the base-e logarithm) of a - * number. + * number * @param n number greater than 0.0 */ static public final float log(float n) { @@ -4570,7 +4385,7 @@ public class PApplet implements PConstants { * * @webref math:calculation * @webBrief Returns Euler's number e (2.71828...) raised to the power of the - * value parameter. + * value parameter * @param n exponent to raise */ static public final float exp(float n) { @@ -4585,7 +4400,7 @@ public class PApplet implements PConstants { * expression 3*3*3*3*3 and pow(3, -5) is equivalent to 1 / 3*3*3*3*3. * * @webref math:calculation - * @webBrief Facilitates exponential expressions. + * @webBrief Facilitates exponential expressions * @param n base of the exponential expression * @param e power by which to raise the base * @see PApplet#sqrt(float) @@ -4601,7 +4416,7 @@ public class PApplet implements PConstants { * values as parameters, or an array of any length. * * @webref math:calculation - * @webBrief Determines the largest value in a sequence of numbers. + * @webBrief Determines the largest value in a sequence of numbers * @param a * first number to compare * @param b @@ -4707,7 +4522,7 @@ public class PApplet implements PConstants { * values as parameters, or an array of any length. * * @webref math:calculation - * @webBrief Determines the smallest value in a sequence of numbers. + * @webBrief Determines the smallest value in a sequence of numbers * @param a * first number * @param b @@ -4782,7 +4597,7 @@ public class PApplet implements PConstants { * Constrains a value to not exceed a maximum and minimum value. * * @webref math:calculation - * @webBrief Constrains a value to not exceed a maximum and minimum value. + * @webBrief Constrains a value to not exceed a maximum and minimum value * @param amt the value to constrain * @param low minimum limit * @param high maximum limit @@ -4801,7 +4616,7 @@ public class PApplet implements PConstants { * 6.28). Values are returned in the range -1 to 1. * * @webref math:trigonometry - * @webBrief Calculates the sine of an angle. + * @webBrief Calculates the sine of an angle * @param angle an angle in radians * @see PApplet#cos(float) * @see PApplet#tan(float) @@ -4818,7 +4633,7 @@ public class PApplet implements PConstants { * PI*2). Values are returned in the range -1 to 1. * * @webref math:trigonometry - * @webBrief Calculates the cosine of an angle. + * @webBrief Calculates the cosine of an angle * @param angle an angle in radians * @see PApplet#sin(float) * @see PApplet#tan(float) @@ -4836,7 +4651,7 @@ public class PApplet implements PConstants { * infinity to -infinity. * * @webref math:trigonometry - * @webBrief Calculates the ratio of the sine and cosine of an angle. + * @webBrief Calculates the ratio of the sine and cosine of an angle * @param angle an angle in radians * @see PApplet#cos(float) * @see PApplet#sin(float) @@ -4853,7 +4668,7 @@ public class PApplet implements PConstants { * returned in the range -PI/2 to PI/2. * * @webref math:trigonometry - * @webBrief The inverse of sin(), returns the arc sine of a value. + * @webBrief The inverse of sin(), returns the arc sine of a value * @param value the value whose arc sine is to be returned * @see PApplet#sin(float) * @see PApplet#acos(float) @@ -4870,7 +4685,7 @@ public class PApplet implements PConstants { * returned in the range 0 to PI (3.1415927). * * @webref math:trigonometry - * @webBrief The inverse of cos(), returns the arc cosine of a value. + * @webBrief The inverse of cos(), returns the arc cosine of a value * @param value the value whose arc cosine is to be returned * @see PApplet#cos(float) * @see PApplet#asin(float) @@ -4887,7 +4702,7 @@ public class PApplet implements PConstants { * (exclusive) and values are returned in the range -PI/2 to PI/2 . * * @webref math:trigonometry - * @webBrief The inverse of tan(), returns the arc tangent of a value. + * @webBrief The inverse of tan(), returns the arc tangent of a value * @param value -Infinity to Infinity (exclusive) * @see PApplet#tan(float) * @see PApplet#asin(float) @@ -4909,7 +4724,7 @@ public class PApplet implements PConstants { * * @webref math:trigonometry * @webBrief Calculates the angle (in radians) from a specified point to the - * coordinate origin as measured from the positive x-axis. + * coordinate origin as measured from the positive x-axis * @param y y-coordinate of the point * @param x x-coordinate of the point * @see PApplet#tan(float) @@ -4927,7 +4742,7 @@ public class PApplet implements PConstants { * require their parameters to be specified in radians. * * @webref math:trigonometry - * @webBrief Converts a radian measurement to its corresponding value in degrees. + * @webBrief Converts a radian measurement to its corresponding value in degrees * @param radians radian value to convert to degrees * @see PApplet#radians(float) */ @@ -4944,7 +4759,7 @@ public class PApplet implements PConstants { * require their parameters to be specified in radians. * * @webref math:trigonometry - * @webBrief Converts a degree measurement to its corresponding value in radians. + * @webBrief Converts a degree measurement to its corresponding value in radians * @param degrees degree value to convert to radians * @see PApplet#degrees(float) */ @@ -4959,7 +4774,7 @@ public class PApplet implements PConstants { * * @webref math:calculation * @webBrief Calculates the closest int value that is greater than or equal to the - * value of the parameter. + * value of the parameter * @param n number to round up * @see PApplet#floor(float) * @see PApplet#round(float) @@ -4975,7 +4790,7 @@ public class PApplet implements PConstants { * * @webref math:calculation * @webBrief Calculates the closest int value that is less than or equal to the value - * of the parameter. + * of the parameter * @param n number to round down * @see PApplet#ceil(float) * @see PApplet#round(float) @@ -4990,7 +4805,7 @@ public class PApplet implements PConstants { * round(133.8) returns the value 134. * * @webref math:calculation - * @webBrief Calculates the integer closest to the value parameter. + * @webBrief Calculates the integer closest to the value parameter * @param n * number to round * @see PApplet#floor(float) @@ -5011,10 +4826,10 @@ public class PApplet implements PConstants { * direction in space commonly used in computer graphics and linear * algebra. Because it has no "start" position, the magnitude of a vector * can be thought of as the distance from coordinate (0,0) to its (x,y) - * value. Therefore, mag() is a shortcut for writing "dist(0, 0, x, y)". + * value. Therefore, mag() is a shortcut for writing dist(0, 0, x, y). * * @webref math:calculation - * @webBrief Calculates the magnitude (or length) of a vector. + * @webBrief Calculates the magnitude (or length) of a vector * @param a first value * @param b second value * @param c third value @@ -5034,7 +4849,7 @@ public class PApplet implements PConstants { * Calculates the distance between two points. * * @webref math:calculation - * @webBrief Calculates the distance between two points. + * @webBrief Calculates the distance between two points * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point * @param z1 z-coordinate of the first point @@ -5056,7 +4871,7 @@ public class PApplet implements PConstants { * creating motion along a straight path and for drawing dotted lines. * * @webref math:calculation - * @webBrief Calculates a number between two numbers at a specific increment. + * @webBrief Calculates a number between two numbers at a specific increment * @param start first value * @param stop second value * @param amt float between 0.0 and 1.0 @@ -5080,7 +4895,7 @@ public class PApplet implements PConstants { * * @webref math:calculation * @webBrief Normalizes a number from another range into a value between 0 and - * 1. + * 1 * @param value * the incoming value to be converted * @param start @@ -5107,7 +4922,7 @@ public class PApplet implements PConstants { * values are often intentional and useful. * * @webref math:calculation - * @webBrief Re-maps a number from one range to another. + * @webBrief Re-maps a number from one range to another * @param value * the incoming value to be converted * @param start1 @@ -5198,7 +5013,7 @@ public class PApplet implements PConstants { * * @webref math:random * @webBrief Returns a float from a random series of numbers having a mean of 0 - * and standard deviation of 1. + * and standard deviation of 1 * @see PApplet#random(float,float) * @see PApplet#noise(float, float, float) */ @@ -5225,7 +5040,7 @@ public class PApplet implements PConstants { * floating-point random number to an integer, use the int() function. * * @webref math:random - * @webBrief Generates random numbers. + * @webBrief Generates random numbers * @param low * lower limit * @param high @@ -5254,7 +5069,7 @@ public class PApplet implements PConstants { * the software is run. * * @webref math:random - * @webBrief Sets the seed value for random(). + * @webBrief Sets the seed value for random() * @param seed * seed value * @see PApplet#random(float,float) @@ -5354,7 +5169,7 @@ public class PApplet implements PConstants { * * * @webref math:random - * @webBrief Returns the Perlin noise value at specified coordinates. + * @webBrief Returns the Perlin noise value at specified coordinates * @param x * x-coordinate in noise space * @param y @@ -5465,7 +5280,7 @@ public class PApplet implements PConstants { * * @webref math:random * @webBrief Adjusts the character and level of detail produced by the Perlin - * noise function. + * noise function * @param lod * number of octaves to be used by the noise * @see PApplet#noise(float, float, float) @@ -5491,7 +5306,7 @@ public class PApplet implements PConstants { * numbers each time the software is run. * * @webref math:random - * @webBrief Sets the seed value for noise(). + * @webBrief Sets the seed value for noise() * @param seed seed value * @see PApplet#noise(float, float, float) * @see PApplet#noiseDetail(int, float) @@ -5530,9 +5345,9 @@ public class PApplet implements PConstants { *
* If the file is not available or an error occurs, null will be * returned and an error message will be printed to the console. The error - * message does not halt the program, however the null value may cause a + * message does not halt the program, however the null value may cause a * NullPointerException if your code does not check whether the value returned - * is null.
+ * is null.
*
* The extension parameter is used to determine the image type in cases * where the image filename does not end with a proper extension. Specify the @@ -5548,7 +5363,7 @@ public class PApplet implements PConstants { * * * @webref image:loading_displaying - * @webBrief Loads an image into a variable of type PImage. + * @webBrief Loads an image into a variable of type PImage * @param filename * name of file to load, can be .gif, .jpg, .tga, or a handful of * other image types depending on your platform @@ -5604,7 +5419,7 @@ public class PApplet implements PConstants { * * @webref image:loading_displaying * @webBrief Loads images on a separate thread so that your sketch does not - * freeze while images load during setup(). + * freeze while images load during setup() * @param filename * name of the file to load, can be .gif, .jpg, .tga, or a handful of * other image types depending on your platform @@ -5684,8 +5499,8 @@ public class PApplet implements PConstants { * not in UTF-8 format, see the * developer's reference for the XML object. * @webref input:files - * @webBrief Reads the contents of a file or URL and creates an XML - * object with its values. + * @webBrief Reads the contents of a file or URL and creates an XML + * object with its values * @param filename name of a file in the data folder or a URL. * @see XML * @see PApplet#parseXML(String) @@ -5721,13 +5536,13 @@ public class PApplet implements PConstants { /** * Takes a String, parses its contents, and returns an XML object. If the - * String does not contain XML data or cannot be parsed, a null value is + * String does not contain XML data or cannot be parsed, a null value is * returned.
*
* parseXML() is most useful when pulling data dynamically, such as * from third-party APIs. Normally, API results would be saved to a String, * and then can be converted to a structured XML object using - * parseXML(). Be sure to check if null is returned before performing + * parseXML(). Be sure to check if null is returned before performing * operations on the new XML object, in case the String content could not be * parsed.
*
@@ -5735,7 +5550,7 @@ public class PApplet implements PConstants { * simpler to use loadXML(). * * @webref input:files - * @webBrief Converts String content to an XML object + * @webBrief Converts String content to an XML object * @param xmlString * the content to be parsed as XML * @return an XML object, or null @@ -5770,7 +5585,7 @@ public class PApplet implements PConstants { * All files loaded and saved by the Processing API use UTF-8 encoding. * * @webref output:files - * @webBrief Writes the contents of an XML object to a file. + * @webBrief Writes the contents of an XML object to a file * @param xml * the XML object to save to disk * @param filename @@ -5807,14 +5622,19 @@ public class PApplet implements PConstants { * * @webref input:files * @webBrief Takes a String, parses its contents, and returns a - * JSONObject. + * JSONObject * @param input * String to parse as a JSONObject * @see PApplet#loadJSONObject(String) * @see PApplet#saveJSONObject(JSONObject, String) */ public JSONObject parseJSONObject(String input) { - return new JSONObject(new StringReader(input)); + try { + return new JSONObject(new StringReader(input)); + } catch (RuntimeException e) { + e.printStackTrace(); + return null; + } } @@ -5826,7 +5646,7 @@ public class PApplet implements PConstants { * * @webref input:files * @webBrief Loads a JSON from the data folder or a URL, and returns a - * JSONObject. + * JSONObject * @param filename * name of a file in the data folder or a URL * @see JSONObject @@ -5879,7 +5699,7 @@ public class PApplet implements PConstants { * All files loaded and saved by the Processing API use UTF-8 encoding. * * @webref output:files - * @webBrief Writes the contents of a JSONObject object to a file. + * @webBrief Writes the contents of a JSONObject object to a file * @param json * the JSONObject to save * @param filename @@ -5918,7 +5738,7 @@ public class PApplet implements PConstants { * simpler to use loadJSONArray(). * * @webref input:files - * @webBrief + * @webBrief Takes a String, parses its contents, and returns a JSONArray * @param input * String to parse as a JSONArray * @see JSONObject @@ -5926,7 +5746,12 @@ public class PApplet implements PConstants { * @see PApplet#saveJSONObject(JSONObject, String) */ public JSONArray parseJSONArray(String input) { - return new JSONArray(new StringReader(input)); + try { + return new JSONArray(new StringReader(input)); + } catch (RuntimeException e) { + e.printStackTrace(); + return null; + } } @@ -5940,7 +5765,7 @@ public class PApplet implements PConstants { * * @webref input:files * @webBrief Takes a String, parses its contents, and returns a - * JSONArray. + * JSONArray * @param filename * name of a file in the data folder or a URL * @see JSONArray @@ -5989,7 +5814,7 @@ public class PApplet implements PConstants { * All files loaded and saved by the Processing API use UTF-8 encoding. * * @webref output:files - * @webBrief Writes the contents of a JSONArray object to a file. + * @webBrief Writes the contents of a JSONArray object to a file * @param json * the JSONArray to save * @param filename @@ -6048,8 +5873,8 @@ public class PApplet implements PConstants { * All files loaded and saved by the Processing API use UTF-8 encoding. * * @webref input:files - * @webBrief Reads the contents of a file or URL and creates an Table object - * with its values. + * @webBrief Reads the contents of a file or URL and creates a Table object + * with its values * @param filename * name of a file in the data folder or a URL. * @see Table @@ -6112,7 +5937,7 @@ public class PApplet implements PConstants { * All files loaded and saved by the Processing API use UTF-8 encoding. * * @webref output:files - * @webBrief Writes the contents of a Table object to a file. + * @webBrief Writes the contents of a Table object to a file * @param table * the Table object to save to a file * @param filename @@ -6185,9 +6010,9 @@ public class PApplet implements PConstants { *
* If the file is not available or an error occurs, null will be * returned and an error message will be printed to the console. The error - * message does not halt the program, however the null value may cause a + * message does not halt the program, however the null value may cause a * NullPointerException if your code does not check whether the value returned - * is null.
+ * is null.
*
* Use createFont() (instead of loadFont()) to enable vector * data to be used with the default renderer setting. This can be helpful when @@ -6195,7 +6020,7 @@ public class PApplet implements PConstants { * renderer, such as the PDF library. * * @webref typography:loading_displaying - * @webBrief Loads a font into a variable of type PFont. + * @webBrief Loads a font into a variable of type PFont * @param filename * name of the font to load * @see PFont @@ -6260,7 +6085,7 @@ public class PApplet implements PConstants { * and the requested font is not available on the machine running the sketch. * * @webref typography:loading_displaying - * @webBrief Dynamically converts a font to the format used by Processing. + * @webBrief Dynamically converts a font to the format used by Processing * @param name * name of the font to load * @param size @@ -6318,7 +6143,7 @@ public class PApplet implements PConstants { /** * Open a platform-specific file chooser dialog to select a file for input. * After the selection is made, the selected File will be passed to the - * 'callback' function. If the dialog is closed or canceled, null will be sent + * 'callback' function. If the dialog is closed or canceled, null will be sent * to the function, so that the program is not waiting for additional input. * The callback is necessary because of how threading works. * @@ -6343,7 +6168,7 @@ public class PApplet implements PConstants { * * @webref input:files * @webBrief Open a platform-specific file chooser dialog to select a file for - * input. + * input * @param prompt * message to the user * @param callback @@ -6384,12 +6209,12 @@ public class PApplet implements PConstants { /** * Opens a platform-specific file chooser dialog to select a file for output. * After the selection is made, the selected File will be passed to the - * 'callback' function. If the dialog is closed or canceled, null will be sent + * 'callback' function. If the dialog is closed or canceled, null will be sent * to the function, so that the program is not waiting for additional input. * The callback is necessary because of how threading works. * * @webref output:files - * @webBrief Opens a platform-specific file chooser dialog to select a file for output. + * @webBrief Opens a platform-specific file chooser dialog to select a file for output * @param prompt message to the user * @param callback name of the method to be called when the selection is made */ @@ -6490,7 +6315,7 @@ public class PApplet implements PConstants { * threading works. * * @webref input:files - * @webBrief Opens a platform-specific file chooser dialog to select a folder. + * @webBrief Opens a platform-specific file chooser dialog to select a folder * @param prompt message to the user * @param callback name of the method to be called when the selection is made */ @@ -6650,7 +6475,7 @@ public class PApplet implements PConstants { } else if (opt.startsWith("extension=")) { extensions = new String[] { opt.substring(10) }; } else if (opt.startsWith("extensions=")) { - extensions = split(opt.substring(10), ','); + extensions = split(opt.substring(11), ','); } else if (opt.equals("files")) { directories = false; } else if (opt.equals("directories")) { @@ -6767,7 +6592,7 @@ public class PApplet implements PConstants { * * @webref input:files * @webBrief Creates a BufferedReader object that can be used to read - * files line-by-line as individual String objects. + * files line-by-line as individual String objects * @param filename * name of the file to be opened * @see BufferedReader @@ -6844,8 +6669,8 @@ public class PApplet implements PConstants { * * * @webref output:files - * @webBrief reates a new file in the sketch folder, and a PrintWriter object - * to write to it. + * @webBrief Creates a new file in the sketch folder, and a PrintWriter object + * to write to it * @param filename name of the file to be created * @see PrintWriter * @see PApplet#createReader @@ -6912,7 +6737,7 @@ public class PApplet implements PConstants { * - The full path to a file to be opened locally (when running as an * application)
*
- * If the requested item doesn't exist, null is returned. If not online, + * If the requested item doesn't exist, null is returned. If not online, * this will also check to see if the user is asking for a file whose name * isn't properly capitalized. If capitalization is different, an error * will be printed to the console. This helps prevent issues that appear @@ -6960,7 +6785,7 @@ public class PApplet implements PConstants { * * * @webref input:files - * @webBrief This is a function for advanced programmers to open a Java InputStream. + * @webBrief This is a function for advanced programmers to open a Java InputStream * @param filename the name of the file to use as input * @see PApplet#createOutput(String) * @see PApplet#selectOutput(String,String) @@ -7183,13 +7008,13 @@ public class PApplet implements PConstants { *
* If the file is not available or an error occurs, null will be * returned and an error message will be printed to the console. The error - * message does not halt the program, however the null value may cause a + * message does not halt the program, however the null value may cause a * NullPointerException if your code does not check whether the value returned - * is null.
+ * is null.
* * @webref input:files * @webBrief Reads the contents of a file or url and places it in a byte - * array. + * array * @param filename * name of a file in the data folder or a URL. * @see PApplet#loadStrings(String) @@ -7401,9 +7226,9 @@ public class PApplet implements PConstants { *
* If the file is not available or an error occurs, null will be * returned and an error message will be printed to the console. The error - * message does not halt the program, however the null value may cause a + * message does not halt the program, however the null value may cause a * NullPointerException if your code does not check whether the value returned - * is null.
+ * is null.
*
* Starting with Processing release 0134, all files loaded and saved by the * Processing API use UTF-8 encoding. In previous releases, the default @@ -7422,8 +7247,8 @@ public class PApplet implements PConstants { * Java methods for I/O. * * @webref input:files - * @webBrief Reads the contents of a file or url and creates a String array of - * its individual lines. + * @webBrief Reads the contents of a file or url and creates a String array of + * its individual lines * @param filename * name of the file or url to load * @see PApplet#loadBytes(String) @@ -7517,7 +7342,7 @@ public class PApplet implements PConstants { * * @webref output:files * @webBrief Similar to createInput(), this creates a Java - * OutputStream for a given filename or path. + * OutputStream for a given filename or path * @param filename * name of the file to open * @see PApplet#createInput(String) @@ -7559,7 +7384,7 @@ public class PApplet implements PConstants { * * * @webref output:files - * @webBrief Save the contents of a stream to a file in the sketch folder. + * @webBrief Save the contents of a stream to a file in the sketch folder * @param target * name of the file to write to * @param source @@ -7654,7 +7479,7 @@ public class PApplet implements PConstants { * * @webref output:files * @webBrief Opposite of loadBytes(), will write an entire array of - * bytes to a file. + * bytes to a file * @param filename * name of the file to write to * @param data @@ -7773,7 +7598,7 @@ public class PApplet implements PConstants { * platforms. * * @webref output:files - * @webBrief Writes an array of strings to a file, one line per string. + * @webBrief Writes an array of strings to a file, one line per string * @param filename * filename for output * @param data @@ -8080,7 +7905,7 @@ public class PApplet implements PConstants { * * @webref data:array_functions * @webBrief Sorts an array of numbers from smallest to largest and puts an - * array of words in alphabetical order. + * array of words in alphabetical order * @param list * array to sort * @see PApplet#reverse(boolean[]) @@ -8177,7 +8002,7 @@ public class PApplet implements PConstants { * method, so most things that apply there are inherited. * * @webref data:array_functions - * @webBrief Copies an array (or part of an array) to another array. + * @webBrief Copies an array (or part of an array) to another array * @param src * the source array * @param srcPosition @@ -8252,7 +8077,7 @@ public class PApplet implements PConstants { * * * @webref data:array_functions - * @webBrief Increases the size of an array. + * @webBrief Increases the size of an array * @param list * the array to expand * @see PApplet#shorten(boolean[]) @@ -8372,7 +8197,7 @@ public class PApplet implements PConstants { * * * @webref data:array_functions - * @webBrief Expands an array by one element and adds data to the new position. + * @webBrief Expands an array by one element and adds data to the new position * @param array array to append * @param value new data for the array * @see PApplet#shorten(boolean[]) @@ -8426,7 +8251,7 @@ public class PApplet implements PConstants { * * * @webref data:array_functions - * @webBrief Decreases an array by one element and returns the shortened array. + * @webBrief Decreases an array by one element and returns the shortened array * @param list array to shorten * @see PApplet#append(byte[], byte) * @see PApplet#expand(boolean[]) @@ -8476,7 +8301,7 @@ public class PApplet implements PConstants { * = (SomeClass[]) splice(array1, array2, index) * * @webref data:array_functions - * @webBrief Inserts a value or array of values into an existing array. + * @webBrief Inserts a value or array of values into an existing array * @param list * array to splice into * @param value @@ -8650,7 +8475,7 @@ public class PApplet implements PConstants { * (SomeClass[]) subset(originalArray, 0, 4) * * @webref data:array_functions - * @webBrief Extracts an array of elements from an existing array. + * @webBrief Extracts an array of elements from an existing array * @param list * array to extract from * @param start @@ -8775,7 +8600,7 @@ public class PApplet implements PConstants { * (SomeClass[]) concat(array1, array2). * * @webref data:array_functions - * @webBrief Concatenates two arrays. + * @webBrief Concatenates two arrays * @param a * first array to concatenate * @param b @@ -8843,7 +8668,7 @@ public class PApplet implements PConstants { * Reverses the order of an array. * * @webref data:array_functions - * @webBrief Reverses the order of an array. + * @webBrief Reverses the order of an array * @param list booleans[], bytes[], chars[], ints[], floats[], or Strings[] * @see PApplet#sort(String[], int) */ @@ -8926,7 +8751,7 @@ public class PApplet implements PConstants { * character and the zero width no-break space (U+FEFF) character. * * @webref data:string_functions - * @webBrief Removes whitespace characters from the beginning and end of a String. + * @webBrief Removes whitespace characters from the beginning and end of a String * @param str any string * @see PApplet#split(String, String) * @see PApplet#join(String[], char) @@ -8965,8 +8790,8 @@ public class PApplet implements PConstants { * nf() or nfs(). * * @webref data:string_functions - * @webBrief Combines an array of Strings into one String, each separated by the - * character(s) used for the separator parameter. + * @webBrief Combines an array of Strings into one String, each separated by the + * character(s) used for the separator parameter * @param list array of Strings * @param separator char or String to be placed between each item * @see PApplet#split(String, String) @@ -8996,8 +8821,8 @@ public class PApplet implements PConstants { /** * - * The splitTokens() function splits a String at one or many character - * delimiters or "tokens." The delim parameter specifies the character + * The splitTokens() function splits a String at one or many character + * delimiters or "tokens". The delim parameter specifies the character * or characters to be used as a boundary.
*
* If no delim characters are specified, any whitespace character is @@ -9009,8 +8834,8 @@ public class PApplet implements PConstants { * conversion functions int() and float(). * * @webref data:string_functions - * @webBrief The splitTokens() function splits a String at one or many - * character "tokens." + * @webBrief The splitTokens() function splits a String at one or many + * character "tokens" * @param value * the String to be split * @param delim @@ -9058,8 +8883,8 @@ public class PApplet implements PConstants { * characters on Wikipedia. --> * * @webref data:string_functions - * @webBrief The split() function breaks a string into pieces using a - * character or string as the divider. + * @webBrief The split() function breaks a string into pieces using a + * character or string as the divider * @usage web_application * @param value * the String to be split @@ -9149,12 +8974,12 @@ public class PApplet implements PConstants { * * This function is used to apply a regular expression to a piece of text, and * return matching groups (elements found inside parentheses) as a String - * array. If there are no matches, a null value will be returned. If no groups + * array. If there are no matches, a null value will be returned. If no groups * are specified in the regular expression, but the sequence matches, an array * of length 1 (with the matched text as the first element of the array) will * be returned.
*
- * To use the function, first check to see if the result is null. If the + * To use the function, first check to see if the result is null. If the * result is null, then the sequence did not match at all. If the sequence did * match, an array is returned.
*
@@ -9171,9 +8996,9 @@ public class PApplet implements PConstants { * Tutorial on the topic. * * @webref data:string_functions - * @webBrief The match() function is used to apply a regular expression to a + * @webBrief The function is used to apply a regular expression to a * piece of text, and return matching groups (elements found inside - * parentheses) as a String array. No match will return null. + * parentheses) as a String array * @param str * the String to be searched * @param regexp @@ -9203,12 +9028,12 @@ public class PApplet implements PConstants { * * This function is used to apply a regular expression to a piece of text, and * return a list of matching groups (elements found inside parentheses) as a - * two-dimensional String array. If there are no matches, a null value will be + * two-dimensional String array. If there are no matches, a null value will be * returned. If no groups are specified in the regular expression, but the * sequence matches, a two dimensional array is still returned, but the second * dimension is only of length one.
*
- * To use the function, first check to see if the result is null. If the + * To use the function, first check to see if the result is null. If the * result is null, then the sequence did not match at all. If the sequence did * match, a 2D array is returned.
*
@@ -9227,7 +9052,7 @@ public class PApplet implements PConstants { * * @webref data:string_functions * @webBrief This function is used to apply a regular expression to a piece of - * text. + * text * @param str * the String to be searched * @param regexp @@ -9787,7 +9612,7 @@ public class PApplet implements PConstants { * int(), ceil(), floor(), or round() functions. * * @webref data:string_functions - * @webBrief Utility function for formatting numbers into strings. + * @webBrief Utility function for formatting numbers into strings * @param nums * the numbers to format * @param digits @@ -9840,7 +9665,7 @@ public class PApplet implements PConstants { * * @webref data:string_functions * @webBrief Utility function for formatting numbers into strings and placing - * appropriate commas to mark units of 1000. + * appropriate commas to mark units of 1000 * @param nums * the numbers to format * @see PApplet#nf(float, int, int) @@ -9892,7 +9717,7 @@ public class PApplet implements PConstants { * should always be positive integers. * * @webref data:string_functions - * @webBrief Utility function for formatting numbers into strings. + * @webBrief Utility function for formatting numbers into strings * @param num the number to format * @param digits number of digits to pad with zeroes * @see PApplet#nf(float, int, int) @@ -9930,7 +9755,7 @@ public class PApplet implements PConstants { * right parameters should always be positive integers. * * @webref data:string_functions - * @webBrief Utility function for formatting numbers into strings. + * @webBrief Utility function for formatting numbers into strings * @param num * the number to format * @param digits @@ -10082,8 +9907,8 @@ public class PApplet implements PConstants { * increase the length of the String further. * * @webref data:conversion - * @webBrief Converts a byte, char, int, or color to a String containing the - * equivalent hexadecimal notation. + * @webBrief Converts a byte, char, int, or color to a String containing the + * equivalent hexadecimal notation * @param value * the value to convert * @see PApplet#unhex(String) @@ -10127,8 +9952,8 @@ public class PApplet implements PConstants { * * * @webref data:conversion - * @webBrief Converts a String representation of a hexadecimal number to its - * equivalent integer value. + * @webBrief Converts a String representation of a hexadecimal number to its + * equivalent integer value * @param value * String to convert to an integer * @see PApplet#hex(int, int) @@ -10186,8 +10011,8 @@ public class PApplet implements PConstants { * no effect. * * @webref data:conversion - * @webBrief Converts a byte, char, int, or color to a String containing the - * equivalent binary notation. + * @webBrief Converts an int, byte, char, or color to a + * String containing the equivalent binary notation * @param value * value to convert * @param digits @@ -10221,8 +10046,8 @@ public class PApplet implements PConstants { * 8. * * @webref data:conversion - * @webBrief Converts a String representation of a binary number to its - * equivalent integer value. + * @webBrief Converts a String representation of a binary number to its + * equivalent integer value * @param value * String to convert to an integer * @see PApplet#binary(byte) @@ -10265,7 +10090,7 @@ public class PApplet implements PConstants { * * @webref color:creating_reading * @webBrief Creates colors for storing in variables of the color - * datatype. + * datatype * @param gray * number specifying value between white and black * @see PApplet#colorMode(int) @@ -10384,19 +10209,19 @@ public class PApplet implements PConstants { /** * - * Calculates a color between two colors at a specific increment. The + * Calculates a color between two colors at a specific increment. The * amt parameter is the amount to interpolate between the two values * where 0.0 is equal to the first point, 0.1 is very near the first point, * 0.5 is halfway in between, etc.
* An amount below 0 will be treated as 0. Likewise, amounts above 1 will be - * capped at 1. This is different from the behavior of lerp(), but necessary + * capped at 1. This is different from the behavior of lerp(), but necessary * because otherwise numbers outside the range will produce strange and * unexpected colors. * * * @webref color:creating_reading - * @webBrief Calculates a color or colors between two color at a specific - * increment. + * @webBrief Calculates a color or colors between two colors at a specific + * increment * @usage web_application * @param c1 * interpolate from this color @@ -10950,7 +10775,7 @@ public class PApplet implements PConstants { * * @webref output:files * @webBrief Opens a new file and all subsequent drawing functions are echoed - * to this file as well as the display window. + * to this file as well as the display window * @param renderer * PDF or SVG * @param filename @@ -10982,7 +10807,7 @@ public class PApplet implements PConstants { * * @webref output:files * @webBrief Stops the recording process started by beginRecord() and closes - * the file. + * the file * @see PApplet#beginRecord(String, String) */ public void endRecord() { @@ -11025,7 +10850,7 @@ public class PApplet implements PConstants { * * @webref output:files * @webBrief To create vectors from 3D data, use the beginRaw() and - * endRaw() commands. + * endRaw() commands * @param renderer for example, PDF or DXF * @param filename filename for output * @see PApplet#endRaw() @@ -11062,7 +10887,7 @@ public class PApplet implements PConstants { * * * @webref output:files - * @webBrief Complement to beginRaw(); they must always be used together. + * @webBrief Complement to beginRaw(); they must always be used together * @see PApplet#beginRaw(String, String) */ public void endRaw() { @@ -11096,7 +10921,7 @@ public class PApplet implements PConstants { * * @webref image:pixels * @webBrief Loads the pixel data for the display window into the - * pixels[] array. + * pixels[] array * @see PApplet#pixels * @see PApplet#updatePixels() */ @@ -11114,7 +10939,7 @@ public class PApplet implements PConstants { * * @webref image:pixels * @webBrief Updates the display window with the data in the pixels[] - * array. + * array * @see PApplet#loadPixels() * @see PApplet#pixels */ @@ -11203,7 +11028,7 @@ public class PApplet implements PConstants { * * @webref shape:vertex * @webBrief Using the beginShape() and endShape() functions allow - * creating more complex forms. + * creating more complex forms * @param kind Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, * QUADS, or QUAD_STRIP * @see PShape @@ -11239,7 +11064,7 @@ public class PApplet implements PConstants { * is identical to glNormal3f() in OpenGL. * * @webref lights_camera:lights - * @webBrief Sets the current normal vector. + * @webBrief Sets the current normal vector * @param nx x direction * @param ny y direction * @param nz z direction @@ -11301,7 +11126,7 @@ public class PApplet implements PConstants { * (0,200). The same mapping in NORMAL is (0,0) (1,0) (1,1) (0,1). * * @webref image:textures - * @webBrief Sets the coordinate space for texture mapping. + * @webBrief Sets the coordinate space for texture mapping * @param mode either IMAGE or NORMAL * @see PGraphics#texture(PImage) * @see PGraphics#textureWrap(int) @@ -11320,7 +11145,7 @@ public class PApplet implements PConstants { * * * @webref image:textures - * @webBrief Defines if textures repeat or draw once within a texture map. + * @webBrief Defines if textures repeat or draw once within a texture map * @param wrap Either CLAMP (default) or REPEAT * @see PGraphics#texture(PImage) * @see PGraphics#textureMode(int) @@ -11343,7 +11168,7 @@ public class PApplet implements PConstants { * shape. * * @webref image:textures - * @webBrief Sets a texture to be applied to vertex points. + * @webBrief Sets a texture to be applied to vertex points * @param image reference to a PImage object * @see PGraphics#textureMode(int) * @see PGraphics#textureWrap(int) @@ -11415,7 +11240,7 @@ public class PApplet implements PConstants { * changed with textureMode(). * * @webref shape:vertex - * @webBrief All shapes are constructed by connecting a series of vertices. + * @webBrief All shapes are constructed by connecting a series of vertices * @param x x-coordinate of the vertex * @param y y-coordinate of the vertex * @param z z-coordinate of the vertex @@ -11451,7 +11276,7 @@ public class PApplet implements PConstants { * or rect() within. * * @webref shape:vertex - * @webBrief Begins recording vertices for the shape. + * @webBrief Begins recording vertices for the shape */ public void beginContour() { if (recorder != null) recorder.beginContour(); @@ -11475,7 +11300,7 @@ public class PApplet implements PConstants { * or rect() within. * * @webref shape:vertex - * @webBrief Stops recording vertices for the shape. + * @webBrief Stops recording vertices for the shape */ public void endContour() { if (recorder != null) recorder.endContour(); @@ -11499,7 +11324,7 @@ public class PApplet implements PConstants { * beginning and the end). * * @webref shape:vertex - * @webBrief the companion to beginShape() and may only be called after beginShape(). + * @webBrief the companion to beginShape() and may only be called after beginShape() * @param mode use CLOSE to close the shape * @see PShape * @see PGraphics#beginShape(int) @@ -11529,7 +11354,7 @@ public class PApplet implements PConstants { * the value returned is null.
* * @webref shape - * @webBrief Loads geometry into a variable of type PShape. + * @webBrief Loads geometry into a variable of type PShape * @param filename name of file to load, can be .svg or .obj * @see PShape * @see PApplet#createShape() @@ -11576,7 +11401,7 @@ public class PApplet implements PConstants { * PShape class are in the Processing Javadoc. * * @webref shape - * @webBrief The createShape() function is used to define a new shape. + * @webBrief The createShape() function is used to define a new shape * @see PShape * @see PShape#endShape() * @see PApplet#loadShape(String) @@ -11601,7 +11426,7 @@ public class PApplet implements PConstants { /** - * Loads a shader into the PShader object. The shader file must be + * Loads a shader into the PShader object. The shader file must be * loaded in the sketch's "data" folder/directory to load correctly. * Shaders are compatible with the P2D and P3D renderers, but not * with the default renderer.
@@ -11619,7 +11444,7 @@ public class PApplet implements PConstants { * * * @webref rendering:shaders - * @webBrief Loads a shader into the PShader object. + * @webBrief Loads a shader into the PShader object * @param fragFilename name of fragment shader file */ public PShader loadShader(String fragFilename) { @@ -11642,7 +11467,7 @@ public class PApplet implements PConstants { * * * @webref rendering:shaders - * @webBrief Applies the shader specified by the parameters. + * @webBrief Applies the shader specified by the parameters * @param shader name of shader file */ public void shader(PShader shader) { @@ -11667,7 +11492,7 @@ public class PApplet implements PConstants { * * * @webref rendering:shaders - * @webBrief Restores the default shaders. + * @webBrief Restores the default shaders */ public void resetShader() { if (recorder != null) recorder.resetShader(); @@ -11702,7 +11527,7 @@ public class PApplet implements PConstants { * * @webref rendering * @webBrief Limits the rendering to the boundaries of a rectangle defined - * by the parameters. + * by the parameters * @param a x-coordinate of the rectangle, by default * @param b y-coordinate of the rectangle, by default * @param c width of the rectangle, by default @@ -11720,7 +11545,7 @@ public class PApplet implements PConstants { * * * @webref rendering - * @webBrief Disables the clipping previously started by the clip() function. + * @webBrief Disables the clipping previously started by the clip() function */ public void noClip() { if (recorder != null) recorder.noClip(); @@ -11737,15 +11562,15 @@ public class PApplet implements PConstants { * channel of (A) and (B) independently. The red channel is compared with * red, green with green, and blue with blue.
*
- * BLEND - linear interpolation of colors: C = A*factor + B. This is the default.
+ * BLEND - linear interpolation of colors: C = A*factor + B. This is the default.
*
- * ADD - additive blending with white clip: C = min(A*factor + B, 255)
+ * ADD - additive blending with white clip: C = min(A*factor + B, 255)
*
- * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
+ * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
*
- * DARKEST - only the darkest color succeeds: C = min(A*factor, B)
+ * DARKEST - only the darkest color succeeds: C = min(A*factor, B)
*
- * LIGHTEST - only the lightest color succeeds: C = max(A*factor, B)
+ * LIGHTEST - only the lightest color succeeds: C = max(A*factor, B)
*
* DIFFERENCE - subtract colors from underlying image.
*
@@ -11765,7 +11590,7 @@ public class PApplet implements PConstants { * * * @webref rendering - * @webBrief Blends the pixels in the display window according to a defined mode. + * @webBrief Blends the pixels in the display window according to a defined mode * @param mode the blending mode to use */ public void blendMode(int mode) { @@ -11796,7 +11621,7 @@ public class PApplet implements PConstants { * for more information). * * @webref shape:vertex - * @webBrief Specifies vertex coordinates for Bezier curves. + * @webBrief Specifies vertex coordinates for Bezier curves * @param x2 the x-coordinate of the 1st control point * @param y2 the y-coordinate of the 1st control point * @param z2 the z-coordinate of the 1st control point @@ -11832,7 +11657,7 @@ public class PApplet implements PConstants { * reference for more information). * * @webref shape:vertex - * @webBrief Specifies vertex coordinates for quadratic Bezier curves. + * @webBrief Specifies vertex coordinates for quadratic Bezier curves * @param cx the x-coordinate of the control point * @param cy the y-coordinate of the control point * @param x3 the x-coordinate of the anchor point @@ -11876,7 +11701,7 @@ public class PApplet implements PConstants { * * * @webref shape:vertex - * @webBrief Specifies vertex coordinates for curves. + * @webBrief Specifies vertex coordinates for curves * @param x the x-coordinate of the vertex * @param y the y-coordinate of the vertex * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) @@ -11923,7 +11748,7 @@ public class PApplet implements PConstants { * * * @webref shape:2d_primitives - * @webBrief Draws a point, a coordinate in space at the dimension of one pixel. + * @webBrief Draws a point, a coordinate in space at the dimension of one pixel * @param x x-coordinate of the point * @param y y-coordinate of the point * @see PGraphics#stroke(int) @@ -11956,7 +11781,7 @@ public class PApplet implements PConstants { * parameter in combination with size() as shown in the above example. * * @webref shape:2d_primitives - * @webBrief Draws a line (a direct path between two points) to the screen. + * @webBrief Draws a line (a direct path between two points) to the screen * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point * @param x2 x-coordinate of the second point @@ -11990,7 +11815,7 @@ public class PApplet implements PConstants { * second point, and the last two arguments specify the third point. * * @webref shape:2d_primitives - * @webBrief A triangle is a plane created by connecting three points. + * @webBrief A triangle is a plane created by connecting three points * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point * @param x2 x-coordinate of the second point @@ -12015,7 +11840,7 @@ public class PApplet implements PConstants { * counter-clockwise around the defined shape. * * @webref shape:2d_primitives - * @webBrief A quad is a quadrilateral, a four sided polygon. + * @webBrief A quad is a quadrilateral, a four sided polygon * @param x1 x-coordinate of the first corner * @param y1 y-coordinate of the first corner * @param x2 x-coordinate of the second corner @@ -12057,7 +11882,7 @@ public class PApplet implements PConstants { * case-sensitive language. * * @webref shape:attributes - * @webBrief Modifies the location from which rectangles draw. + * @webBrief Modifies the location from which rectangles draw * @param mode either CORNER, CORNERS, CENTER, or RADIUS * @see PGraphics#rect(float, float, float, float) */ @@ -12085,7 +11910,7 @@ public class PApplet implements PConstants { * * * @webref shape:2d_primitives - * @webBrief Draws a rectangle to the screen. + * @webBrief Draws a rectangle to the screen * @param a x-coordinate of the rectangle by default * @param b y-coordinate of the rectangle by default * @param c width of the rectangle by default @@ -12132,7 +11957,7 @@ public class PApplet implements PConstants { * * * @webref shape:2d_primitives - * @webBrief Draws a square to the screen. + * @webBrief Draws a square to the screen * @param x x-coordinate of the rectangle by default * @param y y-coordinate of the rectangle by default * @param extent width and height of the rectangle by default @@ -12172,7 +11997,7 @@ public class PApplet implements PConstants { * * @webref shape:attributes * @webBrief The origin of the ellipse is modified by the ellipseMode() - * function. + * function * @param mode either CENTER, RADIUS, CORNER, or CORNERS * @see PApplet#ellipse(float, float, float, float) * @see PApplet#arc(float, float, float, float, float, float) @@ -12191,7 +12016,7 @@ public class PApplet implements PConstants { * be changed with the ellipseMode() function. * * @webref shape:2d_primitives - * @webBrief Draws an ellipse (oval) in the display window. + * @webBrief Draws an ellipse (oval) in the display window * @param a x-coordinate of the ellipse * @param b y-coordinate of the ellipse * @param c width of the ellipse by default @@ -12225,7 +12050,7 @@ public class PApplet implements PConstants { * arc yourself with beginShape()/endShape() or a PShape. * * @webref shape:2d_primitives - * @webBrief Draws an arc in the display window. + * @webBrief Draws an arc in the display window * @param a x-coordinate of the arc's ellipse * @param b y-coordinate of the arc's ellipse * @param c width of the arc's ellipse by default @@ -12262,7 +12087,7 @@ public class PApplet implements PConstants { * function. * * @webref shape:2d_primitives - * @webBrief Draws a circle to the screen. + * @webBrief Draws a circle to the screen * @param x x-coordinate of the ellipse * @param y y-coordinate of the ellipse * @param extent width and height of the ellipse by default @@ -12277,12 +12102,12 @@ public class PApplet implements PConstants { /** * - * A box is an extruded rectangle. A box with equal dimension on all sides + * A box is an extruded rectangle. A box with equal dimension on all sides * is a cube. * * * @webref shape:3d_primitives - * @webBrief A box is an extruded rectangle. + * @webBrief A box is an extruded rectangle * @param size dimension of the box in all dimensions (creates a cube) * @see PGraphics#sphere(float) */ @@ -12326,7 +12151,7 @@ public class PApplet implements PConstants { * @param res number of segments (minimum 3) used per full circle revolution * @webref shape:3d_primitives * @webBrief Controls the detail used to render a sphere by adjusting the number of - * vertices of the sphere mesh. + * vertices of the sphere mesh * @see PGraphics#sphere(float) */ public void sphereDetail(int res) { @@ -12372,7 +12197,7 @@ public class PApplet implements PConstants { * * * @webref shape:3d_primitives - * @webBrief A sphere is a hollow ball made from tessellated triangles. + * @webBrief A sphere is a hollow ball made from tessellated triangles * @param r the radius of the sphere * @see PGraphics#sphereDetail(int) */ @@ -12413,7 +12238,7 @@ public class PApplet implements PConstants { * endShape(); * * @webref shape:curves - * @webBrief Evaluates the Bezier at point t for points a, b, c, d. + * @webBrief Evaluates the Bezier at point t for points a, b, c, d * @param a coordinate of first point on the curve * @param b coordinate of first control point * @param c coordinate of second control point @@ -12439,7 +12264,7 @@ public class PApplet implements PConstants { * Code submitted by Dave Bollinger (davbol) for release 0136. * * @webref shape:curves - * @webBrief Calculates the tangent of a point on a Bezier curve. + * @webBrief Calculates the tangent of a point on a Bezier curve * @param a coordinate of first point on the curve * @param b coordinate of first control point * @param c coordinate of second control point @@ -12462,7 +12287,7 @@ public class PApplet implements PConstants { * * * @webref shape:curves - * @webBrief Sets the resolution at which Beziers display. + * @webBrief Sets the resolution at which Beziers display * @param detail resolution of the curves * @see PGraphics#curve(float, float, float, float, float, float, float, float, * float, float, float, float) @@ -12519,7 +12344,7 @@ public class PApplet implements PConstants { *
bezier(x1, y1, cx, cy, cx, cy, x2, y2);
* * @webref shape:curves - * @webBrief Draws a Bezier curve on the screen. + * @webBrief Draws a Bezier curve on the screen * @param x1 coordinates for the first anchor point * @param y1 coordinates for the first anchor point * @param z1 coordinates for the first anchor point @@ -12557,7 +12382,7 @@ public class PApplet implements PConstants { * * * @webref shape:curves - * @webBrief Evaluates the curve at point t for points a, b, c, d. + * @webBrief Evaluates the curve at point t for points a, b, c, d * @param a coordinate of first control point * @param b coordinate of first point on the curve * @param c coordinate of second point on the curve @@ -12584,7 +12409,7 @@ public class PApplet implements PConstants { * Code thanks to Dave Bollinger (Bug #715) * * @webref shape:curves - * @webBrief Calculates the tangent of a point on a curve. + * @webBrief Calculates the tangent of a point on a curve * @param a coordinate of first point on the curve * @param b coordinate of first control point * @param c coordinate of second control point @@ -12608,7 +12433,7 @@ public class PApplet implements PConstants { * * * @webref shape:curves - * @webBrief Sets the resolution at which curves display. + * @webBrief Sets the resolution at which curves display * @param detail resolution of the curves * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) @@ -12633,7 +12458,7 @@ public class PApplet implements PConstants { * * @webref shape:curves * @webBrief Modifies the quality of forms created with curve() and - * curveVertex(). + * curveVertex() * @param tightness amount of deformation from the original vertices * @see PGraphics#curve(float, float, float, float, float, float, float, float, * float, float, float, float) @@ -12673,7 +12498,7 @@ public class PApplet implements PConstants { * * * @webref shape:curves - * @webBrief Draws a curved line on the screen. + * @webBrief Draws a curved line on the screen * @param x1 coordinates for the beginning control point * @param y1 coordinates for the beginning control point * @param x2 coordinates for the first point @@ -12733,7 +12558,7 @@ public class PApplet implements PConstants { * * * @webref image:loading_displaying - * @webBrief Modifies the location from which images draw. + * @webBrief Modifies the location from which images draw * @param mode either CORNER, CORNERS, or CENTER * @see PApplet#loadImage(String, String) * @see PImage @@ -12767,7 +12592,7 @@ public class PApplet implements PConstants { * renderer, smooth() will also improve image quality of resized images. * * @webref image:loading_displaying - * @webBrief Displays images to the screen. + * @webBrief Displays images to the screen * @param img the image to display * @param a x-coordinate of the image by default * @param b y-coordinate of the image by default @@ -12825,7 +12650,7 @@ public class PApplet implements PConstants { * * * @webref shape:loading_displaying - * @webBrief Modifies the location from which shapes draw. + * @webBrief Modifies the location from which shapes draw * @param mode either CORNER, CORNERS, CENTER * @see PShape * @see PGraphics#shape(PShape) @@ -12856,7 +12681,7 @@ public class PApplet implements PConstants { * * * @webref shape:loading_displaying - * @webBrief Displays shapes to the screen. + * @webBrief Displays shapes to the screen * @param shape the shape to display * @param x x-coordinate of the shape * @param y y-coordinate of the shape @@ -12919,7 +12744,7 @@ public class PApplet implements PConstants { * * * @webref typography:attributes - * @webBrief Sets the current alignment for drawing text. + * @webBrief Sets the current alignment for drawing text * @param alignX horizontal alignment, either LEFT, CENTER, or RIGHT * @param alignY vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE * @see PApplet#loadFont(String) @@ -12942,7 +12767,7 @@ public class PApplet implements PConstants { * * * @webref typography:metrics - * @webBrief Returns ascent of the current font at its current size. + * @webBrief Returns ascent of the current font at its current size * @see PGraphics#textDescent() */ public float textAscent() { @@ -12956,7 +12781,7 @@ public class PApplet implements PConstants { * useful for determining the height of the font below the baseline. * * @webref typography:metrics - * @webBrief Returns descent of the current font at its current size. + * @webBrief Returns descent of the current font at its current size * @see PGraphics#textAscent() */ public float textDescent() { @@ -12985,7 +12810,7 @@ public class PApplet implements PConstants { * * @webref typography:loading_displaying * @webBrief Sets the current font that will be drawn with the text() - * function. + * function * @param which any variable of the type PFont * @see PApplet#createFont(String, float, boolean) * @see PApplet#loadFont(String) @@ -13019,7 +12844,7 @@ public class PApplet implements PConstants { * * * @webref typography:attributes - * @webBrief Sets the spacing between lines of text in units of pixels. + * @webBrief Sets the spacing between lines of text in units of pixels * @param leading the size in pixels for spacing between lines * @see PApplet#loadFont(String) * @see PFont#PFont @@ -13052,7 +12877,7 @@ public class PApplet implements PConstants { * beginRaw(). * * @webref typography:attributes - * @webBrief Sets the way text draws to the screen. + * @webBrief Sets the way text draws to the screen * @param mode either MODEL or SHAPE * @see PApplet#loadFont(String) * @see PFont#PFont @@ -13074,7 +12899,7 @@ public class PApplet implements PConstants { * * * @webref typography:attributes - * @webBrief Sets the current font size. + * @webBrief Sets the current font size * @param size the size of the letters in units of pixels * @see PApplet#loadFont(String) * @see PFont#PFont @@ -13101,7 +12926,7 @@ public class PApplet implements PConstants { * * * @webref typography:attributes - * @webBrief Calculates and returns the width of any character or text string. + * @webBrief Calculates and returns the width of any character or text string * @param str the String of characters to measure * @see PApplet#loadFont(String) * @see PFont#PFont @@ -13145,7 +12970,7 @@ public class PApplet implements PConstants { * * * @webref typography:loading_displaying - * @webBrief Draws text to the screen. + * @webBrief Draws text to the screen * @param c the alphanumeric character to be displayed * @param x x-coordinate of text * @param y y-coordinate of text @@ -13308,7 +13133,7 @@ public class PApplet implements PConstants { * @webref structure * @webBrief The push() function saves the current drawing style * settings and transformations, while pop() restores these - * settings. + * settings * @see PGraphics#pop() */ public void push() { @@ -13346,7 +13171,7 @@ public class PApplet implements PConstants { * * @webref structure * @webBrief The pop() function restores the previous drawing style - * settings and transformations after push() has changed them. + * settings and transformations after push() has changed them * @see PGraphics#push() */ public void pop() { @@ -13368,7 +13193,7 @@ public class PApplet implements PConstants { * * * @webref transform - * @webBrief Pushes the current transformation matrix onto the matrix stack. + * @webBrief Pushes the current transformation matrix onto the matrix stack * @see PGraphics#popMatrix() * @see PGraphics#translate(float, float, float) * @see PGraphics#scale(float) @@ -13395,7 +13220,7 @@ public class PApplet implements PConstants { * * * @webref transform - * @webBrief Pops the current transformation matrix off the matrix stack. + * @webBrief Pops the current transformation matrix off the matrix stack * @see PGraphics#pushMatrix() */ public void popMatrix() { @@ -13423,7 +13248,7 @@ public class PApplet implements PConstants { * * * @webref transform - * @webBrief Specifies an amount to displace objects within the display window. + * @webBrief Specifies an amount to displace objects within the display window * @param x left/right translation * @param y up/down translation * @see PGraphics#popMatrix() @@ -13469,7 +13294,7 @@ public class PApplet implements PConstants { * * * @webref transform - * @webBrief Rotates a shape the amount specified by the angle parameter. + * @webBrief Rotates a shape the amount specified by the angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -13503,7 +13328,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Rotates a shape around the x-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -13537,7 +13362,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Rotates a shape around the y-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -13571,7 +13396,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Rotates a shape around the z-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -13618,7 +13443,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Increases or decreases the size of a shape by expanding and - * contracting vertices. + * contracting vertices * @param s percentage to scale the object * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() @@ -13679,7 +13504,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Shears a shape around the x-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of shear specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -13714,7 +13539,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Shears a shape around the y-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of shear specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -13736,7 +13561,7 @@ public class PApplet implements PConstants { * * * @webref transform - * @webBrief Replaces the current matrix with the identity matrix. + * @webBrief Replaces the current matrix with the identity matrix * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() * @see PGraphics#applyMatrix(PMatrix) @@ -13753,12 +13578,12 @@ public class PApplet implements PConstants { * Multiplies the current matrix by the one specified through the * parameters. This is very slow because it will try to calculate the * inverse of the transform, so avoid it whenever possible. The equivalent - * function in OpenGL is glMultMatrix(). + * function in OpenGL is glMultMatrix(). * * * @webref transform * @webBrief Multiplies the current matrix by the one specified through the - * parameters. + * parameters * @source * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() @@ -13877,7 +13702,7 @@ public class PApplet implements PConstants { * * @webref transform * @webBrief Prints the current matrix to the Console (the text window at the bottom - * of Processing). + * of Processing) * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() * @see PGraphics#resetMatrix() @@ -13911,7 +13736,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:camera * @webBrief The beginCamera() and endCamera() functions enable - * advanced customization of the camera space. + * advanced customization of the camera space * @see PGraphics#camera() * @see PGraphics#endCamera() * @see PGraphics#applyMatrix(PMatrix) @@ -13934,7 +13759,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:camera * @webBrief The beginCamera() and endCamera() functions enable - * advanced customization of the camera space. + * advanced customization of the camera space * @see PGraphics#beginCamera() * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ @@ -13958,7 +13783,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:camera - * @webBrief Sets the position of the camera. + * @webBrief Sets the position of the camera * @see PGraphics#beginCamera() * @see PGraphics#endCamera() * @see PGraphics#frustum(float, float, float, float, float, float) @@ -13995,7 +13820,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:camera * @webBrief Prints the current camera matrix to the Console (the text window at the - * bottom of Processing). + * bottom of Processing) * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ public void printCamera() { @@ -14012,12 +13837,12 @@ public class PApplet implements PConstants { * the clipping volume where left and right are the minimum and maximum x * values, top and bottom are the minimum and maximum y values, and near and far * are the minimum and maximum z values. If no parameters are given, the default - * is used: ortho(-width/2, width/2, -height/2, height/2). + * is used: ortho(-width/2, width/2, -height/2, height/2). * * * @webref lights_camera:camera * @webBrief Sets an orthographic projection and defines a parallel clipping - * volume. + * volume */ public void ortho() { if (recorder != null) recorder.ortho(); @@ -14060,13 +13885,13 @@ public class PApplet implements PConstants { * accurately than orthographic projection. The version of perspective * without parameters sets the default perspective and the version with * four parameters allows the programmer to set the area precisely. The - * default values are: perspective(PI/3.0, width/height, cameraZ/10.0, - * cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)); + * default values are: perspective(PI/3.0, width/height, cameraZ/10.0, + * cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)) * * * @webref lights_camera:camera * @webBrief Sets a perspective projection applying foreshortening, making distant - * objects appear smaller than closer ones. + * objects appear smaller than closer ones */ public void perspective() { if (recorder != null) recorder.perspective(); @@ -14110,7 +13935,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:camera - * @webBrief Sets a perspective matrix defined through the parameters. + * @webBrief Sets a perspective matrix defined through the parameters * @param left left coordinate of the clipping plane * @param right right coordinate of the clipping plane * @param bottom bottom coordinate of the clipping plane @@ -14139,7 +13964,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:camera - * @webBrief Prints the current projection matrix to the Console. + * @webBrief Prints the current projection matrix to the Console * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ public void printProjection() { @@ -14156,7 +13981,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:coordinates * @webBrief Takes a three-dimensional X, Y, Z position and returns the X value for - * where it will appear on a (two-dimensional) screen. + * where it will appear on a (two-dimensional) screen * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @see PGraphics#screenY(float, float, float) @@ -14175,7 +14000,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:coordinates * @webBrief Takes a three-dimensional X, Y, Z position and returns the Y value for - * where it will appear on a (two-dimensional) screen. + * where it will appear on a (two-dimensional) screen * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @see PGraphics#screenX(float, float, float) @@ -14210,7 +14035,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:coordinates * @webBrief Takes a three-dimensional X, Y, Z position and returns the Z value for - * where it will appear on a (two-dimensional) screen. + * where it will appear on a (two-dimensional) screen * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -14233,13 +14058,13 @@ public class PApplet implements PConstants { * In the example, the modelX(), modelY(), and * modelZ() functions record the location of a box in space after * being placed using a series of translate and rotate commands. After - * popMatrix() is called, those transformations no longer apply, but the - * (x, y, z) coordinate returned by the model functions is used to place + * popMatrix() is called, those transformations no longer apply, but the + * (x, y, z) coordinate returned by the model functions is used to place * another box in the same location. * * * @webref lights_camera:coordinates - * @webBrief Returns the three-dimensional X, Y, Z position in model space. + * @webBrief Returns the three-dimensional X, Y, Z position in model space * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -14262,13 +14087,13 @@ public class PApplet implements PConstants { * In the example, the modelX(), modelY(), and * modelZ() functions record the location of a box in space after * being placed using a series of translate and rotate commands. After - * popMatrix() is called, those transformations no longer apply, but the - * (x, y, z) coordinate returned by the model functions is used to place + * popMatrix() is called, those transformations no longer apply, but the + * (x, y, z) coordinate returned by the model functions is used to place * another box in the same location. * * * @webref lights_camera:coordinates - * @webBrief Returns the three-dimensional X, Y, Z position in model space. + * @webBrief Returns the three-dimensional X, Y, Z position in model space * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -14291,13 +14116,13 @@ public class PApplet implements PConstants { * In the example, the modelX(), modelY(), and * modelZ() functions record the location of a box in space after * being placed using a series of translate and rotate commands. After - * popMatrix() is called, those transformations no longer apply, but the - * (x, y, z) coordinate returned by the model functions is used to place + * popMatrix() is called, those transformations no longer apply, but the + * (x, y, z) coordinate returned by the model functions is used to place * another box in the same location. * * * @webref lights_camera:coordinates - * @webBrief Returns the three-dimensional X, Y, Z position in model space. + * @webBrief Returns the three-dimensional X, Y, Z position in model space * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -14321,14 +14146,14 @@ public class PApplet implements PConstants { *

* The style information controlled by the following functions are included * in the style: - * fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), - * imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), - * textAlign(), textFont(), textMode(), textSize(), textLeading(), - * emissive(), specular(), shininess(), ambient() + * fill(), stroke(), tint(), strokeWeight(), strokeCap(),strokeJoin(), + * imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), + * textAlign(), textFont(), textMode(), textSize(), textLeading(), + * emissive(), specular(), shininess(), ambient() * * * @webref structure - * @webBrief Saves the current style settings and popStyle() restores the prior settings. + * @webBrief Saves the current style settings and popStyle() restores the prior settings * @see PGraphics#popStyle() */ public void pushStyle() { @@ -14377,7 +14202,7 @@ public class PApplet implements PConstants { * * @webref shape:attributes * @webBrief Sets the width of the stroke used for lines, points, and the border - * around shapes. + * around shapes * @param weight the weight (in pixels) of the stroke * @see PGraphics#stroke(int, float) * @see PGraphics#strokeJoin(int) @@ -14397,7 +14222,7 @@ public class PApplet implements PConstants { * * * @webref shape:attributes - * @webBrief Sets the style of the joints which connect line segments. + * @webBrief Sets the style of the joints which connect line segments * @param join either MITER, BEVEL, ROUND * @see PGraphics#stroke(int, float) * @see PGraphics#strokeWeight(float) @@ -14419,7 +14244,7 @@ public class PApplet implements PConstants { * strokeCap(SQUARE) (no cap) causes points to become invisible. * * @webref shape:attributes - * @webBrief Sets the style for rendering line endings. + * @webBrief Sets the style for rendering line endings * @param cap either SQUARE, PROJECT, or ROUND * @see PGraphics#stroke(int, float) * @see PGraphics#strokeWeight(float) @@ -14439,7 +14264,7 @@ public class PApplet implements PConstants { * * * @webref color:setting - * @webBrief Disables drawing the stroke (outline). + * @webBrief Disables drawing the stroke (outline) * @see PGraphics#stroke(int, float) * @see PGraphics#fill(float, float, float, float) * @see PGraphics#noFill() @@ -14474,7 +14299,7 @@ public class PApplet implements PConstants { * performance). See the hint() documentation for more details. * * @webref color:setting - * @webBrief Sets the color used to draw lines and borders around shapes. + * @webBrief Sets the color used to draw lines and borders around shapes * @param rgb color value in hexadecimal notation * @see PGraphics#noStroke() * @see PGraphics#strokeWeight(float) @@ -14541,7 +14366,7 @@ public class PApplet implements PConstants { * * @webref image:loading_displaying * @webBrief Removes the current fill value for displaying images and reverts to - * displaying images with their original hues. + * displaying images with their original hues * @usage web_application * @see PGraphics#tint(float, float, float, float) * @see PGraphics#image(PImage, float, float, float, float) @@ -14579,7 +14404,7 @@ public class PApplet implements PConstants { * * * @webref image:loading_displaying - * @webBrief Sets the fill value for displaying images. + * @webBrief Sets the fill value for displaying images * @usage web_application * @param rgb color value in hexadecimal notation * @see PGraphics#noTint() @@ -14639,7 +14464,7 @@ public class PApplet implements PConstants { * * * @webref color:setting - * @webBrief Disables filling geometry. + * @webBrief Disables filling geometry * @usage web_application * @see PGraphics#fill(float, float, float, float) * @see PGraphics#stroke(int, float) @@ -14675,7 +14500,7 @@ public class PApplet implements PConstants { * * * @webref color:setting - * @webBrief Sets the color used to fill shapes. + * @webBrief Sets the color used to fill shapes * @usage web_application * @param rgb color variable or hex value * @see PGraphics#noFill() @@ -14744,7 +14569,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:material_properties - * @webBrief Sets the ambient reflectance for shapes drawn to the screen. + * @webBrief Sets the ambient reflectance for shapes drawn to the screen * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#emissive(float, float, float) @@ -14788,7 +14613,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:material_properties * @webBrief Sets the specular color of the materials used for shapes drawn to the - * screen, which sets the color of highlights. + * screen, which sets the color of highlights * @usage web_application * @param rgb color to set * @see PGraphics#lightSpecular(float, float, float) @@ -14832,7 +14657,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:material_properties - * @webBrief Sets the amount of gloss in the surface of shapes. + * @webBrief Sets the amount of gloss in the surface of shapes * @usage web_application * @param shine degree of shininess * @see PGraphics#emissive(float, float, float) @@ -14855,7 +14680,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:material_properties * @webBrief Sets the emissive color of the material used for drawing shapes drawn to - * the screen. + * the screen * @usage web_application * @param rgb color to set * @see PGraphics#ambient(float, float, float) @@ -14893,17 +14718,17 @@ public class PApplet implements PConstants { /** * * Sets the default ambient light, directional light, falloff, and specular - * values. The defaults are ambientLight(128, 128, 128) and - * directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, 0, 0), and - * lightSpecular(0, 0, 0). Lights need to be included in the draw() to - * remain persistent in a looping program. Placing them in the setup() of a + * values. The defaults are ambientLight(128, 128, 128) and + * directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, 0, 0), and + * lightSpecular(0, 0, 0). Lights need to be included in the draw() to + * remain persistent in a looping program. Placing them in the setup() of a * looping program will cause them to only have an effect the first time * through the loop. * * * @webref lights_camera:lights * @webBrief Sets the default ambient light, directional light, falloff, and specular - * values. + * values * @usage web_application * @see PGraphics#ambientLight(float, float, float, float, float, float) * @see PGraphics#directionalLight(float, float, float, float, float, float) @@ -14926,7 +14751,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:lights - * @webBrief Disable all lighting. + * @webBrief Disable all lighting * @usage web_application * @see PGraphics#lights() */ @@ -14949,7 +14774,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:lights - * @webBrief Adds an ambient light. + * @webBrief Adds an ambient light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -14994,7 +14819,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:lights - * @webBrief Adds a directional light. + * @webBrief Adds a directional light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -15025,7 +14850,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:lights - * @webBrief Adds a point light. + * @webBrief Adds a point light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -15060,7 +14885,7 @@ public class PApplet implements PConstants { * that cone. * * @webref lights_camera:lights - * @webBrief Adds a spot light. + * @webBrief Adds a spot light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color @@ -15109,7 +14934,7 @@ public class PApplet implements PConstants { * * @webref lights_camera:lights * @webBrief Sets the falloff rates for point lights, spot lights, and ambient - * lights. + * lights * @usage web_application * @param constant constant value or determining falloff * @param linear linear value for determining falloff @@ -15139,7 +14964,7 @@ public class PApplet implements PConstants { * * * @webref lights_camera:lights - * @webBrief Sets the specular color for lights. + * @webBrief Sets the specular color for lights * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -15191,7 +15016,7 @@ public class PApplet implements PConstants { *

* * @webref color:setting - * @webBrief Sets the color used for the background of the Processing window. + * @webBrief Sets the color used for the background of the Processing window * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#stroke(float) @@ -15256,7 +15081,7 @@ public class PApplet implements PConstants { * 100% transparent. * * @webref color:setting - * @webBrief Clears the pixels within a buffer. + * @webBrief Clears the pixels within a buffer */ public void clear() { if (recorder != null) recorder.clear(); @@ -15306,7 +15131,7 @@ public class PApplet implements PConstants { * * * @webref color:setting - * @webBrief Changes the way Processing interprets color data. + * @webBrief Changes the way Processing interprets color data * @usage web_application * @param mode Either RGB or HSB, corresponding to Red/Green/Blue and * Hue/Saturation/Brightness @@ -15355,7 +15180,7 @@ public class PApplet implements PConstants { * Extracts the alpha value from a color. * * @webref color:creating_reading - * @webBrief Extracts the alpha value from a color. + * @webBrief Extracts the alpha value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -15392,7 +15217,7 @@ public class PApplet implements PConstants { * * @webref color:creating_reading * @webBrief Extracts the red value from a color, scaled to match current - * colorMode(). + * colorMode() * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#green(int) @@ -15430,7 +15255,7 @@ public class PApplet implements PConstants { * * @webref color:creating_reading * @webBrief Extracts the green value from a color, scaled to match current - * colorMode(). + * colorMode() * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -15468,7 +15293,7 @@ public class PApplet implements PConstants { * * @webref color:creating_reading * @webBrief Extracts the blue value from a color, scaled to match current - * colorMode(). + * colorMode() * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -15489,7 +15314,7 @@ public class PApplet implements PConstants { * Extracts the hue value from a color. * * @webref color:creating_reading - * @webBrief Extracts the hue value from a color. + * @webBrief Extracts the hue value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -15509,7 +15334,7 @@ public class PApplet implements PConstants { * Extracts the saturation value from a color. * * @webref color:creating_reading - * @webBrief Extracts the saturation value from a color. + * @webBrief Extracts the saturation value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -15530,7 +15355,7 @@ public class PApplet implements PConstants { * * * @webref color:creating_reading - * @webBrief Extracts the brightness value from a color. + * @webBrief Extracts the brightness value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -15652,7 +15477,7 @@ public class PApplet implements PConstants { * pixels[] array directly. * * @webref image:pixels - * @webBrief Reads the color of any pixel or grabs a rectangle of pixels. + * @webBrief Reads the color of any pixel or grabs a rectangle of pixels * @usage web_application * @param x x-coordinate of the pixel * @param y y-coordinate of the pixel @@ -15906,16 +15731,16 @@ public class PApplet implements PConstants { * of the following modes to blend the colors of source pixels (A) with the * ones of pixels in the destination image (B):
*
- * BLEND - linear interpolation of colours: C = A*factor + B
+ * BLEND - linear interpolation of colours: C = A*factor + B
*
- * ADD - additive blending with white clip: C = min(A*factor + B, 255)
+ * ADD - additive blending with white clip: C = min(A*factor + B, 255)
*
- * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - * 0)
+ * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, + * 0)
*
- * DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
+ * DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
*
- * LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
+ * LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
*
* DIFFERENCE - subtract colors from underlying image.
*
@@ -15949,7 +15774,7 @@ public class PApplet implements PConstants { * * * @webref image:pixels - * @webBrief Copies a pixel or rectangle of pixels using different blending modes. + * @webBrief Copies a pixel or rectangle of pixels using different blending modes * @param src an image variable referring to the source image * @param sx X coordinate of the source's upper left corner * @param sy Y coordinate of the source's upper left corner diff --git a/core/src/processing/core/PConstants.java b/core/src/processing/core/PConstants.java index b99990d4a..cc93f5f1c 100644 --- a/core/src/processing/core/PConstants.java +++ b/core/src/processing/core/PConstants.java @@ -135,7 +135,7 @@ public interface PConstants { * * @webref constants * @webBrief PI is a mathematical constant with the value - * 3.14159265358979323846. + * 3.14159265358979323846 * @see PConstants#TWO_PI * @see PConstants#TAU * @see PConstants#HALF_PI @@ -152,7 +152,7 @@ public interface PConstants { * * @webref constants * @webBrief HALF_PI is a mathematical constant with the value - * 1.57079632679489661923. + * 1.57079632679489661923 * @see PConstants#PI * @see PConstants#TWO_PI * @see PConstants#TAU @@ -168,7 +168,7 @@ public interface PConstants { * sin() and cos(). * * @webref constants - * @webBrief QUARTER_PI is a mathematical constant with the value 0.7853982. + * @webBrief QUARTER_PI is a mathematical constant with the value 0.7853982 * @see PConstants#PI * @see PConstants#TWO_PI * @see PConstants#TAU @@ -183,7 +183,7 @@ public interface PConstants { * sin() and cos(). * * @webref constants - * @webBrief TWO_PI is a mathematical constant with the value 6.28318530717958647693. + * @webBrief TWO_PI is a mathematical constant with the value 6.28318530717958647693 * @see PConstants#PI * @see PConstants#TAU * @see PConstants#HALF_PI @@ -199,7 +199,7 @@ public interface PConstants { * cos(). * * @webref constants - * @webBrief An alias for TWO_PI + * @webBrief An alias for TWO_PI * @see PConstants#PI * @see PConstants#TWO_PI * @see PConstants#HALF_PI diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index b26054a13..dcc7924a0 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -72,7 +72,7 @@ import java.util.HashMap; * * * @webref typography - * @webBrief Grayscale bitmap font class used by Processing. + * @webBrief Grayscale bitmap font class used by Processing * @see PApplet#loadFont(String) * @see PApplet#createFont(String, float, boolean, char[]) * @see PGraphics#textFont(PFont) @@ -267,17 +267,18 @@ public class PFont implements PConstants { if (charset == null) { lazy = true; -// lazyFont = font; } else { - // charset needs to be sorted to make index lookup run more quickly + // The charset needs to be sorted to make index lookup run quickly // http://dev.processing.org/bugs/show_bug.cgi?id=494 - Arrays.sort(charset); - - glyphs = new Glyph[charset.length]; + // First make copy of charset[] so the user's array is not modified + // https://github.com/processing/processing4/issues/197 + char[] sortedCharset = Arrays.copyOf(charset, charset.length); + Arrays.sort(sortedCharset); + glyphs = new Glyph[sortedCharset.length]; glyphCount = 0; - for (char c : charset) { + for (char c : sortedCharset) { if (font.canDisplay(c)) { Glyph glyf = new Glyph(c); if (glyf.value < 128) { @@ -289,31 +290,9 @@ public class PFont implements PConstants { } // shorten the array if necessary - if (glyphCount != charset.length) { + if (glyphCount != sortedCharset.length) { glyphs = (Glyph[]) PApplet.subset(glyphs, 0, glyphCount); } - - // foreign font, so just make ascent the max topExtent - // for > 1.0.9, not doing this anymore. - // instead using getAscent() and getDescent() values for these cases. -// if ((ascent == 0) && (descent == 0)) { -// //for (int i = 0; i < charCount; i++) { -// for (Glyph glyph : glyphs) { -// char cc = (char) glyph.value; -// //char cc = (char) glyphs[i].value; -// if (Character.isWhitespace(cc) || -// (cc == '\u00A0') || (cc == '\u2007') || (cc == '\u202F')) { -// continue; -// } -// if (glyph.topExtent > ascent) { -// ascent = glyph.topExtent; -// } -// int d = -glyph.topExtent + glyph.height; -// if (d > descent) { -// descent = d; -// } -// } -// } } // If not already created, just create these two characters to calculate @@ -876,7 +855,7 @@ public class PFont implements PConstants { * * * @webref pfont - * @webBrief Gets a list of the fonts installed on the system. + * @webBrief Gets a list of the fonts installed on the system * @usage application * @brief Gets a list of the fonts installed on the system */ diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 00d542dc0..f6effc330 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -146,7 +146,7 @@ import processing.opengl.PShader; * * @webref rendering * @webBrief Main graphics and rendering context, as well as the base API - * implementation for processing "core". + * implementation for processing "core" * @instanceName graphics any object of the type PGraphics * @usage Web & Application * @see PApplet#createGraphics(int, int, String) @@ -871,7 +871,7 @@ public class PGraphics extends PImage implements PConstants { /** * - * Sets the default properties for a PGraphics object. It should be called + * Sets the default properties for a PGraphics object. It should be called * before anything is drawn into the object. * *

Advanced

@@ -879,7 +879,7 @@ public class PGraphics extends PImage implements PConstants { * drawing anything. * * @webref pgraphics:method - * @webBrief Sets the default properties for a PGraphics object. + * @webBrief Sets the default properties for a PGraphics object */ public void beginDraw() { // ignore } @@ -887,7 +887,7 @@ public class PGraphics extends PImage implements PConstants { /** * - * Finalizes the rendering of a PGraphics object so that it can be shown on screen. + * Finalizes the rendering of a PGraphics object so that it can be shown on screen. * *

Advanced

*

@@ -895,7 +895,7 @@ public class PGraphics extends PImage implements PConstants { * you're finished drawing. * * @webref pgraphics:method - * @webBrief Finalizes the rendering of a PGraphics object so that it can be shown on screen. + * @webBrief Finalizes the rendering of a PGraphics object so that it can be shown on screen * @brief Finalizes the rendering of a PGraphics object */ public void endDraw() { // ignore @@ -1068,67 +1068,67 @@ public class PGraphics extends PImage implements PConstants { * manner across renderers. Many options will often graduate to standard * features instead of hints over time. *

- * hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This + * hint(ENABLE_OPENGL_4X_SMOOTH)- Enable 4x anti-aliasing for P3D. This * can help force anti-aliasing if it has not been enabled by the user. On * some graphics cards, this can also be set by the graphics driver's * control panel, however not all cards make this available. This hint must - * be called immediately after the size() command because it resets the - * renderer, obliterating any settings and anything drawn (and like size(), + * be called immediately after the size() command because it resets the + * renderer, obliterating any settings and anything drawn (and like size(), * re-running the code that came before it again). *

- * hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always + * hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always * enables 2x smoothing when the P3D renderer is used. This hint disables * the default 2x smoothing and returns the smoothing behavior found in - * earlier releases, where smooth() and noSmooth() could be used to enable + * earlier releases, where smooth() and noSmooth() could be used to enable * and disable smoothing, though the quality was inferior. *

- * hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are + * hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are * installed, rather than the bitmapped version from a .vlw file. This is * useful with the default (or JAVA2D) renderer setting, as it will improve * font rendering speed. This is not enabled by default, because it can be * misleading while testing because the type will look great on your * machine (because you have the font installed) but lousy on others' * machines if the identical font is unavailable. This option can only be - * set per-sketch, and must be called before any use of textFont(). + * set per-sketch, and must be called before any use of textFont(). *

- * hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on + * hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on * top of everything at will. When depth testing is disabled, items will be * drawn to the screen sequentially, like a painting. This hint is most * often used to draw in 3D, then draw in 2D on top of it (for instance, to * draw GUI controls in 2D on top of a 3D interface). Starting in release * 0149, this will also clear the depth buffer. Restore the default with - * hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, - * any 3D drawing that happens later in draw() will ignore existing shapes + * hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, + * any 3D drawing that happens later in draw() will ignore existing shapes * on the screen. *

- * hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and + * hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and * lines in P3D and OPENGL. This can slow performance considerably, and the - * algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). + * algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT). *

- * hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting - * by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). + * hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting + * by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). *

- * hint(ENABLE_BUFFER_READING) - Depth and stencil buffers in P2D/P3D will be + * hint(ENABLE_BUFFER_READING) - Depth and stencil buffers in P2D/P3D will be * down-sampled to make PGL#readPixels work with multisampling. Enabling this * introduces some overhead, so if you experience bad performance, disable - * multisampling with noSmooth() instead. This hint is not intended to be - * enabled and disabled repeatedly, so call this once in setup() or after + * multisampling with noSmooth() instead. This hint is not intended to be + * enabled and disabled repeatedly, so call this once in setup() or after * creating your PGraphics2D/3D. You can restore the default with - * hint(DISABLE_BUFFER_READING) if you don't plan to read depth from - * this PGraphics anymore. + * hint(DISABLE_BUFFER_READING) if you don't plan to read depth from + * this PGraphics anymore. *

- * hint(ENABLE_KEY_REPEAT) - Auto-repeating key events are discarded + * hint(ENABLE_KEY_REPEAT) - Auto-repeating key events are discarded * by default (works only in P2D/P3D); use this hint to get all the key events - * (including auto-repeated). Call hint(DISABLE_KEY_REPEAT) to get events + * (including auto-repeated). Call hint(DISABLE_KEY_REPEAT) to get events * only when the key goes physically up or down. *

- * hint(DISABLE_ASYNC_SAVEFRAME) - P2D/P3D only - save() and saveFrame() + * hint(DISABLE_ASYNC_SAVEFRAME) - P2D/P3D only - save() and saveFrame() * will not use separate threads for saving and will block until the image * is written to the drive. This was the default behavior in 3.0b7 and before. - * To enable, call hint(ENABLE_ASYNC_SAVEFRAME). + * To enable, call hint(ENABLE_ASYNC_SAVEFRAME). * * @webref rendering - * @webBrief Set various hints and hacks for the renderer. + * @webBrief Set various hints and hacks for the renderer * @param which name of the hint to be enabled or disabled * @see PGraphics * @see PApplet#createGraphics(int, int, String, String) @@ -1194,7 +1194,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref shape:vertex * @webBrief Using the beginShape() and endShape() functions allow - * creating more complex forms. + * creating more complex forms * @param kind Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, * QUADS, or QUAD_STRIP * @see PShape @@ -1228,7 +1228,7 @@ public class PGraphics extends PImage implements PConstants { * is identical to glNormal3f() in OpenGL. * * @webref lights_camera:lights - * @webBrief Sets the current normal vector. + * @webBrief Sets the current normal vector * @param nx x direction * @param ny y direction * @param nz z direction @@ -1297,7 +1297,7 @@ public class PGraphics extends PImage implements PConstants { * (0,200). The same mapping in NORMAL is (0,0) (1,0) (1,1) (0,1). * * @webref image:textures - * @webBrief Sets the coordinate space for texture mapping. + * @webBrief Sets the coordinate space for texture mapping * @param mode either IMAGE or NORMAL * @see PGraphics#texture(PImage) * @see PGraphics#textureWrap(int) @@ -1317,7 +1317,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref image:textures - * @webBrief Defines if textures repeat or draw once within a texture map. + * @webBrief Defines if textures repeat or draw once within a texture map * @param wrap Either CLAMP (default) or REPEAT * @see PGraphics#texture(PImage) * @see PGraphics#textureMode(int) @@ -1339,7 +1339,7 @@ public class PGraphics extends PImage implements PConstants { * shape. * * @webref image:textures - * @webBrief Sets a texture to be applied to vertex points. + * @webBrief Sets a texture to be applied to vertex points * @param image reference to a PImage object * @see PGraphics#textureMode(int) * @see PGraphics#textureWrap(int) @@ -1593,7 +1593,7 @@ public class PGraphics extends PImage implements PConstants { * changed with textureMode(). * * @webref shape:vertex - * @webBrief All shapes are constructed by connecting a series of vertices. + * @webBrief All shapes are constructed by connecting a series of vertices * @param x x-coordinate of the vertex * @param y y-coordinate of the vertex * @param z z-coordinate of the vertex @@ -1679,7 +1679,7 @@ public class PGraphics extends PImage implements PConstants { * or rect() within. * * @webref shape:vertex - * @webBrief Begins recording vertices for the shape. + * @webBrief Begins recording vertices for the shape */ public void beginContour() { showMissingWarning("beginContour"); @@ -1702,7 +1702,7 @@ public class PGraphics extends PImage implements PConstants { * or rect() within. * * @webref shape:vertex - * @webBrief Stops recording vertices for the shape. + * @webBrief Stops recording vertices for the shape */ public void endContour() { showMissingWarning("endContour"); @@ -1724,7 +1724,7 @@ public class PGraphics extends PImage implements PConstants { * beginning and the end). * * @webref shape:vertex - * @webBrief the companion to beginShape() and may only be called after beginShape(). + * @webBrief the companion to beginShape() and may only be called after beginShape() * @param mode use CLOSE to close the shape * @see PShape * @see PGraphics#beginShape(int) @@ -1758,7 +1758,7 @@ public class PGraphics extends PImage implements PConstants { * the value returned is null.
* * @webref shape - * @webBrief Loads geometry into a variable of type PShape. + * @webBrief Loads geometry into a variable of type PShape * @param filename name of file to load, can be .svg or .obj * @see PShape * @see PApplet#createShape() @@ -1812,7 +1812,7 @@ public class PGraphics extends PImage implements PConstants { * PShape class are in the Processing Javadoc. * * @webref shape - * @webBrief The createShape() function is used to define a new shape. + * @webBrief The createShape() function is used to define a new shape * @see PShape * @see PShape#endShape() * @see PApplet#loadShape(String) @@ -1933,7 +1933,7 @@ public class PGraphics extends PImage implements PConstants { // SHADERS /** - * Loads a shader into the PShader object. The shader file must be + * Loads a shader into the PShader object. The shader file must be * loaded in the sketch's "data" folder/directory to load correctly. * Shaders are compatible with the P2D and P3D renderers, but not * with the default renderer.
@@ -1951,7 +1951,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref rendering:shaders - * @webBrief Loads a shader into the PShader object. + * @webBrief Loads a shader into the PShader object * @param fragFilename name of fragment shader file */ public PShader loadShader(String fragFilename) { @@ -1976,7 +1976,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref rendering:shaders - * @webBrief Applies the shader specified by the parameters. + * @webBrief Applies the shader specified by the parameters * @param shader name of shader file */ public void shader(PShader shader) { @@ -1999,7 +1999,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref rendering:shaders - * @webBrief Restores the default shaders. + * @webBrief Restores the default shaders */ public void resetShader() { showMissingWarning("resetShader"); @@ -2036,7 +2036,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref rendering * @webBrief Limits the rendering to the boundaries of a rectangle defined - * by the parameters. + * by the parameters * @param a x-coordinate of the rectangle, by default * @param b y-coordinate of the rectangle, by default * @param c width of the rectangle, by default @@ -2086,7 +2086,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref rendering - * @webBrief Disables the clipping previously started by the clip() function. + * @webBrief Disables the clipping previously started by the clip() function */ public void noClip() { showMissingWarning("noClip"); @@ -2107,15 +2107,15 @@ public class PGraphics extends PImage implements PConstants { * channel of (A) and (B) independently. The red channel is compared with * red, green with green, and blue with blue.
*
- * BLEND - linear interpolation of colors: C = A*factor + B. This is the default.
+ * BLEND - linear interpolation of colors: C = A*factor + B. This is the default.
*
- * ADD - additive blending with white clip: C = min(A*factor + B, 255)
+ * ADD - additive blending with white clip: C = min(A*factor + B, 255)
*
- * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
+ * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
*
- * DARKEST - only the darkest color succeeds: C = min(A*factor, B)
+ * DARKEST - only the darkest color succeeds: C = min(A*factor, B)
*
- * LIGHTEST - only the lightest color succeeds: C = max(A*factor, B)
+ * LIGHTEST - only the lightest color succeeds: C = max(A*factor, B)
*
* DIFFERENCE - subtract colors from underlying image.
*
@@ -2135,7 +2135,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref rendering - * @webBrief Blends the pixels in the display window according to a defined mode. + * @webBrief Blends the pixels in the display window according to a defined mode * @param mode the blending mode to use */ public void blendMode(int mode) { @@ -2215,7 +2215,7 @@ public class PGraphics extends PImage implements PConstants { * for more information). * * @webref shape:vertex - * @webBrief Specifies vertex coordinates for Bezier curves. + * @webBrief Specifies vertex coordinates for Bezier curves * @param x2 the x-coordinate of the 1st control point * @param y2 the y-coordinate of the 1st control point * @param z2 the z-coordinate of the 1st control point @@ -2276,7 +2276,7 @@ public class PGraphics extends PImage implements PConstants { * reference for more information). * * @webref shape:vertex - * @webBrief Specifies vertex coordinates for quadratic Bezier curves. + * @webBrief Specifies vertex coordinates for quadratic Bezier curves * @param cx the x-coordinate of the control point * @param cy the y-coordinate of the control point * @param x3 the x-coordinate of the anchor point @@ -2360,7 +2360,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:vertex - * @webBrief Specifies vertex coordinates for curves. + * @webBrief Specifies vertex coordinates for curves * @param x the x-coordinate of the vertex * @param y the y-coordinate of the vertex * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) @@ -2521,7 +2521,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:2d_primitives - * @webBrief Draws a point, a coordinate in space at the dimension of one pixel. + * @webBrief Draws a point, a coordinate in space at the dimension of one pixel * @param x x-coordinate of the point * @param y y-coordinate of the point * @see PGraphics#stroke(int) @@ -2554,7 +2554,7 @@ public class PGraphics extends PImage implements PConstants { * parameter in combination with size() as shown in the above example. * * @webref shape:2d_primitives - * @webBrief Draws a line (a direct path between two points) to the screen. + * @webBrief Draws a line (a direct path between two points) to the screen * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point * @param x2 x-coordinate of the second point @@ -2590,7 +2590,7 @@ public class PGraphics extends PImage implements PConstants { * second point, and the last two arguments specify the third point. * * @webref shape:2d_primitives - * @webBrief A triangle is a plane created by connecting three points. + * @webBrief A triangle is a plane created by connecting three points * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point * @param x2 x-coordinate of the second point @@ -2618,7 +2618,7 @@ public class PGraphics extends PImage implements PConstants { * counter-clockwise around the defined shape. * * @webref shape:2d_primitives - * @webBrief A quad is a quadrilateral, a four sided polygon. + * @webBrief A quad is a quadrilateral, a four sided polygon * @param x1 x-coordinate of the first corner * @param y1 y-coordinate of the first corner * @param x2 x-coordinate of the second corner @@ -2669,7 +2669,7 @@ public class PGraphics extends PImage implements PConstants { * case-sensitive language. * * @webref shape:attributes - * @webBrief Modifies the location from which rectangles draw. + * @webBrief Modifies the location from which rectangles draw * @param mode either CORNER, CORNERS, CENTER, or RADIUS * @see PGraphics#rect(float, float, float, float) */ @@ -2696,7 +2696,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:2d_primitives - * @webBrief Draws a rectangle to the screen. + * @webBrief Draws a rectangle to the screen * @param a x-coordinate of the rectangle by default * @param b y-coordinate of the rectangle by default * @param c width of the rectangle by default @@ -2861,7 +2861,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:2d_primitives - * @webBrief Draws a square to the screen. + * @webBrief Draws a square to the screen * @param x x-coordinate of the rectangle by default * @param y y-coordinate of the rectangle by default * @param extent width and height of the rectangle by default @@ -2906,7 +2906,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref shape:attributes * @webBrief The origin of the ellipse is modified by the ellipseMode() - * function. + * function * @param mode either CENTER, RADIUS, CORNER, or CORNERS * @see PApplet#ellipse(float, float, float, float) * @see PApplet#arc(float, float, float, float, float, float) @@ -2924,7 +2924,7 @@ public class PGraphics extends PImage implements PConstants { * be changed with the ellipseMode() function. * * @webref shape:2d_primitives - * @webBrief Draws an ellipse (oval) in the display window. + * @webBrief Draws an ellipse (oval) in the display window * @param a x-coordinate of the ellipse * @param b y-coordinate of the ellipse * @param c width of the ellipse by default @@ -2991,7 +2991,7 @@ public class PGraphics extends PImage implements PConstants { * arc yourself with beginShape()/endShape() or a PShape. * * @webref shape:2d_primitives - * @webBrief Draws an arc in the display window. + * @webBrief Draws an arc in the display window * @param a x-coordinate of the arc's ellipse * @param b y-coordinate of the arc's ellipse * @param c width of the arc's ellipse by default @@ -3077,7 +3077,7 @@ public class PGraphics extends PImage implements PConstants { * function. * * @webref shape:2d_primitives - * @webBrief Draws a circle to the screen. + * @webBrief Draws a circle to the screen * @param x x-coordinate of the ellipse * @param y y-coordinate of the ellipse * @param extent width and height of the ellipse by default @@ -3095,12 +3095,12 @@ public class PGraphics extends PImage implements PConstants { /** * - * A box is an extruded rectangle. A box with equal dimension on all sides + * A box is an extruded rectangle. A box with equal dimension on all sides * is a cube. * * * @webref shape:3d_primitives - * @webBrief A box is an extruded rectangle. + * @webBrief A box is an extruded rectangle * @param size dimension of the box in all dimensions (creates a cube) * @see PGraphics#sphere(float) */ @@ -3198,7 +3198,7 @@ public class PGraphics extends PImage implements PConstants { * @param res number of segments (minimum 3) used per full circle revolution * @webref shape:3d_primitives * @webBrief Controls the detail used to render a sphere by adjusting the number of - * vertices of the sphere mesh. + * vertices of the sphere mesh * @see PGraphics#sphere(float) */ public void sphereDetail(int res) { @@ -3279,7 +3279,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:3d_primitives - * @webBrief A sphere is a hollow ball made from tessellated triangles. + * @webBrief A sphere is a hollow ball made from tessellated triangles * @param r the radius of the sphere * @see PGraphics#sphereDetail(int) */ @@ -3385,7 +3385,7 @@ public class PGraphics extends PImage implements PConstants { * endShape(); * * @webref shape:curves - * @webBrief Evaluates the Bezier at point t for points a, b, c, d. + * @webBrief Evaluates the Bezier at point t for points a, b, c, d * @param a coordinate of first point on the curve * @param b coordinate of first control point * @param c coordinate of second control point @@ -3410,7 +3410,7 @@ public class PGraphics extends PImage implements PConstants { * Code submitted by Dave Bollinger (davbol) for release 0136. * * @webref shape:curves - * @webBrief Calculates the tangent of a point on a Bezier curve. + * @webBrief Calculates the tangent of a point on a Bezier curve * @param a coordinate of first point on the curve * @param b coordinate of first control point * @param c coordinate of second control point @@ -3449,7 +3449,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:curves - * @webBrief Sets the resolution at which Beziers display. + * @webBrief Sets the resolution at which Beziers display * @param detail resolution of the curves * @see PGraphics#curve(float, float, float, float, float, float, float, float, * float, float, float, float) @@ -3520,7 +3520,7 @@ public class PGraphics extends PImage implements PConstants { *

bezier(x1, y1, cx, cy, cx, cy, x2, y2);
* * @webref shape:curves - * @webBrief Draws a Bezier curve on the screen. + * @webBrief Draws a Bezier curve on the screen * @param x1 coordinates for the first anchor point * @param y1 coordinates for the first anchor point * @param z1 coordinates for the first anchor point @@ -3567,7 +3567,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:curves - * @webBrief Evaluates the curve at point t for points a, b, c, d. + * @webBrief Evaluates the curve at point t for points a, b, c, d * @param a coordinate of first control point * @param b coordinate of first point on the curve * @param c coordinate of second point on the curve @@ -3604,7 +3604,7 @@ public class PGraphics extends PImage implements PConstants { * Code thanks to Dave Bollinger (Bug #715) * * @webref shape:curves - * @webBrief Calculates the tangent of a point on a curve. + * @webBrief Calculates the tangent of a point on a curve * @param a coordinate of first point on the curve * @param b coordinate of first control point * @param c coordinate of second control point @@ -3638,7 +3638,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:curves - * @webBrief Sets the resolution at which curves display. + * @webBrief Sets the resolution at which curves display * @param detail resolution of the curves * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) @@ -3663,7 +3663,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref shape:curves * @webBrief Modifies the quality of forms created with curve() and - * curveVertex(). + * curveVertex() * @param tightness amount of deformation from the original vertices * @see PGraphics#curve(float, float, float, float, float, float, float, float, * float, float, float, float) @@ -3756,7 +3756,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:curves - * @webBrief Draws a curved line on the screen. + * @webBrief Draws a curved line on the screen * @param x1 coordinates for the beginning control point * @param y1 coordinates for the beginning control point * @param x2 coordinates for the first point @@ -3894,7 +3894,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref image:loading_displaying - * @webBrief Modifies the location from which images draw. + * @webBrief Modifies the location from which images draw * @param mode either CORNER, CORNERS, or CENTER * @see PApplet#loadImage(String, String) * @see PImage @@ -3933,7 +3933,7 @@ public class PGraphics extends PImage implements PConstants { * renderer, smooth() will also improve image quality of resized images. * * @webref image:loading_displaying - * @webBrief Displays images to the screen. + * @webBrief Displays images to the screen * @param img the image to display * @param a x-coordinate of the image by default * @param b y-coordinate of the image by default @@ -4106,7 +4106,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:loading_displaying - * @webBrief Modifies the location from which shapes draw. + * @webBrief Modifies the location from which shapes draw * @param mode either CORNER, CORNERS, CENTER * @see PShape * @see PGraphics#shape(PShape) @@ -4150,7 +4150,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:loading_displaying - * @webBrief Displays shapes to the screen. + * @webBrief Displays shapes to the screen * @param shape the shape to display * @param x x-coordinate of the shape * @param y y-coordinate of the shape @@ -4237,7 +4237,18 @@ public class PGraphics extends PImage implements PConstants { * Used by PGraphics to remove the requirement for loading a font. */ protected PFont createDefaultFont(float size) { - Font baseFont = new Font("Lucida Sans", Font.PLAIN, 1); + Font baseFont; + try { + // For 4.0 alpha 4 and later, include a built-in font + InputStream input = getClass().getResourceAsStream("/font/ProcessingSansPro-Regular.ttf"); + baseFont = Font.createFont(Font.TRUETYPE_FONT, input); + + } catch (Exception e) { + // Fall back to how this was handled in 3.x, ugly! + e.printStackTrace(); // dammit + baseFont = new Font("Lucida Sans", Font.PLAIN, 1); + } + // Create a PFont from this java.awt.Font return createFont(baseFont, size, true, null, false); } @@ -4315,7 +4326,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref typography:attributes - * @webBrief Sets the current alignment for drawing text. + * @webBrief Sets the current alignment for drawing text * @param alignX horizontal alignment, either LEFT, CENTER, or RIGHT * @param alignY vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE * @see PApplet#loadFont(String) @@ -4338,7 +4349,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref typography:metrics - * @webBrief Returns ascent of the current font at its current size. + * @webBrief Returns ascent of the current font at its current size * @see PGraphics#textDescent() */ public float textAscent() { @@ -4355,7 +4366,7 @@ public class PGraphics extends PImage implements PConstants { * useful for determining the height of the font below the baseline. * * @webref typography:metrics - * @webBrief Returns descent of the current font at its current size. + * @webBrief Returns descent of the current font at its current size * @see PGraphics#textAscent() */ public float textDescent() { @@ -4387,7 +4398,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref typography:loading_displaying * @webBrief Sets the current font that will be drawn with the text() - * function. + * function * @param which any variable of the type PFont * @see PApplet#createFont(String, float, boolean) * @see PApplet#loadFont(String) @@ -4477,7 +4488,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref typography:attributes - * @webBrief Sets the spacing between lines of text in units of pixels. + * @webBrief Sets the spacing between lines of text in units of pixels * @param leading the size in pixels for spacing between lines * @see PApplet#loadFont(String) * @see PFont#PFont @@ -4509,7 +4520,7 @@ public class PGraphics extends PImage implements PConstants { * beginRaw(). * * @webref typography:attributes - * @webBrief Sets the way text draws to the screen. + * @webBrief Sets the way text draws to the screen * @param mode either MODEL or SHAPE * @see PApplet#loadFont(String) * @see PFont#PFont @@ -4554,7 +4565,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref typography:attributes - * @webBrief Sets the current font size. + * @webBrief Sets the current font size * @param size the size of the letters in units of pixels * @see PApplet#loadFont(String) * @see PFont#PFont @@ -4617,7 +4628,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref typography:attributes - * @webBrief Calculates and returns the width of any character or text string. + * @webBrief Calculates and returns the width of any character or text string * @param str the String of characters to measure * @see PApplet#loadFont(String) * @see PFont#PFont @@ -4704,7 +4715,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref typography:loading_displaying - * @webBrief Draws text to the screen. + * @webBrief Draws text to the screen * @param c the alphanumeric character to be displayed * @param x x-coordinate of text * @param y y-coordinate of text @@ -5308,7 +5319,7 @@ public class PGraphics extends PImage implements PConstants { * @webref structure * @webBrief The push() function saves the current drawing style * settings and transformations, while pop() restores these - * settings. + * settings * @see PGraphics#pop() */ public void push() { @@ -5345,7 +5356,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref structure * @webBrief The pop() function restores the previous drawing style - * settings and transformations after push() has changed them. + * settings and transformations after push() has changed them * @see PGraphics#push() */ public void pop() { @@ -5373,7 +5384,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref transform - * @webBrief Pushes the current transformation matrix onto the matrix stack. + * @webBrief Pushes the current transformation matrix onto the matrix stack * @see PGraphics#popMatrix() * @see PGraphics#translate(float, float, float) * @see PGraphics#scale(float) @@ -5399,7 +5410,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref transform - * @webBrief Pops the current transformation matrix off the matrix stack. + * @webBrief Pops the current transformation matrix off the matrix stack * @see PGraphics#pushMatrix() */ public void popMatrix() { @@ -5432,7 +5443,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref transform - * @webBrief Specifies an amount to displace objects within the display window. + * @webBrief Specifies an amount to displace objects within the display window * @param x left/right translation * @param y up/down translation * @see PGraphics#popMatrix() @@ -5476,7 +5487,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref transform - * @webBrief Rotates a shape the amount specified by the angle parameter. + * @webBrief Rotates a shape the amount specified by the angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -5509,7 +5520,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Rotates a shape around the x-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -5542,7 +5553,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Rotates a shape around the y-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -5575,7 +5586,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Rotates a shape around the z-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of rotation specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -5620,7 +5631,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Increases or decreases the size of a shape by expanding and - * contracting vertices. + * contracting vertices * @param s percentage to scale the object * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() @@ -5678,7 +5689,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Shears a shape around the x-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of shear specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -5712,7 +5723,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Shears a shape around the y-axis the amount specified by the - * angle parameter. + * angle parameter * @param angle angle of shear specified in radians * @see PGraphics#popMatrix() * @see PGraphics#pushMatrix() @@ -5738,7 +5749,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref transform - * @webBrief Replaces the current matrix with the identity matrix. + * @webBrief Replaces the current matrix with the identity matrix * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() * @see PGraphics#applyMatrix(PMatrix) @@ -5753,12 +5764,12 @@ public class PGraphics extends PImage implements PConstants { * Multiplies the current matrix by the one specified through the * parameters. This is very slow because it will try to calculate the * inverse of the transform, so avoid it whenever possible. The equivalent - * function in OpenGL is glMultMatrix(). + * function in OpenGL is glMultMatrix(). * * * @webref transform * @webBrief Multiplies the current matrix by the one specified through the - * parameters. + * parameters * @source * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() @@ -5889,7 +5900,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref transform * @webBrief Prints the current matrix to the Console (the text window at the bottom - * of Processing). + * of Processing) * @see PGraphics#pushMatrix() * @see PGraphics#popMatrix() * @see PGraphics#resetMatrix() @@ -5926,7 +5937,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:camera * @webBrief The beginCamera() and endCamera() functions enable - * advanced customization of the camera space. + * advanced customization of the camera space * @see PGraphics#camera() * @see PGraphics#endCamera() * @see PGraphics#applyMatrix(PMatrix) @@ -5947,7 +5958,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:camera * @webBrief The beginCamera() and endCamera() functions enable - * advanced customization of the camera space. + * advanced customization of the camera space * @see PGraphics#beginCamera() * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ @@ -5969,7 +5980,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:camera - * @webBrief Sets the position of the camera. + * @webBrief Sets the position of the camera * @see PGraphics#beginCamera() * @see PGraphics#endCamera() * @see PGraphics#frustum(float, float, float, float, float, float) @@ -6002,7 +6013,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:camera * @webBrief Prints the current camera matrix to the Console (the text window at the - * bottom of Processing). + * bottom of Processing) * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ public void printCamera() { @@ -6023,12 +6034,12 @@ public class PGraphics extends PImage implements PConstants { * the clipping volume where left and right are the minimum and maximum x * values, top and bottom are the minimum and maximum y values, and near and far * are the minimum and maximum z values. If no parameters are given, the default - * is used: ortho(-width/2, width/2, -height/2, height/2). + * is used: ortho(-width/2, width/2, -height/2, height/2). * * * @webref lights_camera:camera * @webBrief Sets an orthographic projection and defines a parallel clipping - * volume. + * volume */ public void ortho() { showMissingWarning("ortho"); @@ -6065,13 +6076,13 @@ public class PGraphics extends PImage implements PConstants { * accurately than orthographic projection. The version of perspective * without parameters sets the default perspective and the version with * four parameters allows the programmer to set the area precisely. The - * default values are: perspective(PI/3.0, width/height, cameraZ/10.0, - * cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)); + * default values are: perspective(PI/3.0, width/height, cameraZ/10.0, + * cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0)) * * * @webref lights_camera:camera * @webBrief Sets a perspective projection applying foreshortening, making distant - * objects appear smaller than closer ones. + * objects appear smaller than closer ones */ public void perspective() { showMissingWarning("perspective"); @@ -6111,7 +6122,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:camera - * @webBrief Sets a perspective matrix defined through the parameters. + * @webBrief Sets a perspective matrix defined through the parameters * @param left left coordinate of the clipping plane * @param right right coordinate of the clipping plane * @param bottom bottom coordinate of the clipping plane @@ -6138,7 +6149,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:camera - * @webBrief Prints the current projection matrix to the Console. + * @webBrief Prints the current projection matrix to the Console * @see PGraphics#camera(float, float, float, float, float, float, float, float, float) */ public void printProjection() { @@ -6160,7 +6171,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:coordinates * @webBrief Takes a three-dimensional X, Y, Z position and returns the X value for - * where it will appear on a (two-dimensional) screen. + * where it will appear on a (two-dimensional) screen * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @see PGraphics#screenY(float, float, float) @@ -6180,7 +6191,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:coordinates * @webBrief Takes a three-dimensional X, Y, Z position and returns the Y value for - * where it will appear on a (two-dimensional) screen. + * where it will appear on a (two-dimensional) screen * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @see PGraphics#screenX(float, float, float) @@ -6219,7 +6230,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:coordinates * @webBrief Takes a three-dimensional X, Y, Z position and returns the Z value for - * where it will appear on a (two-dimensional) screen. + * where it will appear on a (two-dimensional) screen * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -6243,13 +6254,13 @@ public class PGraphics extends PImage implements PConstants { * In the example, the modelX(), modelY(), and * modelZ() functions record the location of a box in space after * being placed using a series of translate and rotate commands. After - * popMatrix() is called, those transformations no longer apply, but the - * (x, y, z) coordinate returned by the model functions is used to place + * popMatrix() is called, those transformations no longer apply, but the + * (x, y, z) coordinate returned by the model functions is used to place * another box in the same location. * * * @webref lights_camera:coordinates - * @webBrief Returns the three-dimensional X, Y, Z position in model space. + * @webBrief Returns the three-dimensional X, Y, Z position in model space * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -6273,13 +6284,13 @@ public class PGraphics extends PImage implements PConstants { * In the example, the modelX(), modelY(), and * modelZ() functions record the location of a box in space after * being placed using a series of translate and rotate commands. After - * popMatrix() is called, those transformations no longer apply, but the - * (x, y, z) coordinate returned by the model functions is used to place + * popMatrix() is called, those transformations no longer apply, but the + * (x, y, z) coordinate returned by the model functions is used to place * another box in the same location. * * * @webref lights_camera:coordinates - * @webBrief Returns the three-dimensional X, Y, Z position in model space. + * @webBrief Returns the three-dimensional X, Y, Z position in model space * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -6303,13 +6314,13 @@ public class PGraphics extends PImage implements PConstants { * In the example, the modelX(), modelY(), and * modelZ() functions record the location of a box in space after * being placed using a series of translate and rotate commands. After - * popMatrix() is called, those transformations no longer apply, but the - * (x, y, z) coordinate returned by the model functions is used to place + * popMatrix() is called, those transformations no longer apply, but the + * (x, y, z) coordinate returned by the model functions is used to place * another box in the same location. * * * @webref lights_camera:coordinates - * @webBrief Returns the three-dimensional X, Y, Z position in model space. + * @webBrief Returns the three-dimensional X, Y, Z position in model space * @param x 3D x-coordinate to be mapped * @param y 3D y-coordinate to be mapped * @param z 3D z-coordinate to be mapped @@ -6339,14 +6350,14 @@ public class PGraphics extends PImage implements PConstants { *

* The style information controlled by the following functions are included * in the style: - * fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), - * imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), - * textAlign(), textFont(), textMode(), textSize(), textLeading(), - * emissive(), specular(), shininess(), ambient() + * fill(), stroke(), tint(), strokeWeight(), strokeCap(),strokeJoin(), + * imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), + * textAlign(), textFont(), textMode(), textSize(), textLeading(), + * emissive(), specular(), shininess(), ambient() * * * @webref structure - * @webBrief Saves the current style settings and popStyle() restores the prior settings. + * @webBrief Saves the current style settings and popStyle() restores the prior settings * @see PGraphics#popStyle() */ public void pushStyle() { @@ -6536,7 +6547,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref shape:attributes * @webBrief Sets the width of the stroke used for lines, points, and the border - * around shapes. + * around shapes * @param weight the weight (in pixels) of the stroke * @see PGraphics#stroke(int, float) * @see PGraphics#strokeJoin(int) @@ -6554,7 +6565,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref shape:attributes - * @webBrief Sets the style of the joints which connect line segments. + * @webBrief Sets the style of the joints which connect line segments * @param join either MITER, BEVEL, ROUND * @see PGraphics#stroke(int, float) * @see PGraphics#strokeWeight(float) @@ -6574,7 +6585,7 @@ public class PGraphics extends PImage implements PConstants { * strokeCap(SQUARE) (no cap) causes points to become invisible. * * @webref shape:attributes - * @webBrief Sets the style for rendering line endings. + * @webBrief Sets the style for rendering line endings * @param cap either SQUARE, PROJECT, or ROUND * @see PGraphics#stroke(int, float) * @see PGraphics#strokeWeight(float) @@ -6599,7 +6610,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref color:setting - * @webBrief Disables drawing the stroke (outline). + * @webBrief Disables drawing the stroke (outline) * @see PGraphics#stroke(int, float) * @see PGraphics#fill(float, float, float, float) * @see PGraphics#noFill() @@ -6633,7 +6644,7 @@ public class PGraphics extends PImage implements PConstants { * performance). See the hint() documentation for more details. * * @webref color:setting - * @webBrief Sets the color used to draw lines and borders around shapes. + * @webBrief Sets the color used to draw lines and borders around shapes * @param rgb color value in hexadecimal notation * @see PGraphics#noStroke() * @see PGraphics#strokeWeight(float) @@ -6721,7 +6732,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref image:loading_displaying * @webBrief Removes the current fill value for displaying images and reverts to - * displaying images with their original hues. + * displaying images with their original hues * @usage web_application * @see PGraphics#tint(float, float, float, float) * @see PGraphics#image(PImage, float, float, float, float) @@ -6758,7 +6769,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref image:loading_displaying - * @webBrief Sets the fill value for displaying images. + * @webBrief Sets the fill value for displaying images * @usage web_application * @param rgb color value in hexadecimal notation * @see PGraphics#noTint() @@ -6838,7 +6849,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref color:setting - * @webBrief Disables filling geometry. + * @webBrief Disables filling geometry * @usage web_application * @see PGraphics#fill(float, float, float, float) * @see PGraphics#stroke(int, float) @@ -6873,7 +6884,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref color:setting - * @webBrief Sets the color used to fill shapes. + * @webBrief Sets the color used to fill shapes * @usage web_application * @param rgb color variable or hex value * @see PGraphics#noFill() @@ -6961,7 +6972,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:material_properties - * @webBrief Sets the ambient reflectance for shapes drawn to the screen. + * @webBrief Sets the ambient reflectance for shapes drawn to the screen * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#emissive(float, float, float) @@ -7018,7 +7029,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:material_properties * @webBrief Sets the specular color of the materials used for shapes drawn to the - * screen, which sets the color of highlights. + * screen, which sets the color of highlights * @usage web_application * @param rgb color to set * @see PGraphics#lightSpecular(float, float, float) @@ -7077,7 +7088,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:material_properties - * @webBrief Sets the amount of gloss in the surface of shapes. + * @webBrief Sets the amount of gloss in the surface of shapes * @usage web_application * @param shine degree of shininess * @see PGraphics#emissive(float, float, float) @@ -7098,7 +7109,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:material_properties * @webBrief Sets the emissive color of the material used for drawing shapes drawn to - * the screen. + * the screen * @usage web_application * @param rgb color to set * @see PGraphics#ambient(float, float, float) @@ -7158,17 +7169,17 @@ public class PGraphics extends PImage implements PConstants { /** * * Sets the default ambient light, directional light, falloff, and specular - * values. The defaults are ambientLight(128, 128, 128) and - * directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, 0, 0), and - * lightSpecular(0, 0, 0). Lights need to be included in the draw() to - * remain persistent in a looping program. Placing them in the setup() of a + * values. The defaults are ambientLight(128, 128, 128) and + * directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, 0, 0), and + * lightSpecular(0, 0, 0). Lights need to be included in the draw() to + * remain persistent in a looping program. Placing them in the setup() of a * looping program will cause them to only have an effect the first time * through the loop. * * * @webref lights_camera:lights * @webBrief Sets the default ambient light, directional light, falloff, and specular - * values. + * values * @usage web_application * @see PGraphics#ambientLight(float, float, float, float, float, float) * @see PGraphics#directionalLight(float, float, float, float, float, float) @@ -7189,7 +7200,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:lights - * @webBrief Disable all lighting. + * @webBrief Disable all lighting * @usage web_application * @see PGraphics#lights() */ @@ -7210,7 +7221,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:lights - * @webBrief Adds an ambient light. + * @webBrief Adds an ambient light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -7251,7 +7262,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:lights - * @webBrief Adds a directional light. + * @webBrief Adds a directional light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -7280,7 +7291,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:lights - * @webBrief Adds a point light. + * @webBrief Adds a point light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -7313,7 +7324,7 @@ public class PGraphics extends PImage implements PConstants { * that cone. * * @webref lights_camera:lights - * @webBrief Adds a spot light. + * @webBrief Adds a spot light * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color @@ -7360,7 +7371,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref lights_camera:lights * @webBrief Sets the falloff rates for point lights, spot lights, and ambient - * lights. + * lights * @usage web_application * @param constant constant value or determining falloff * @param linear linear value for determining falloff @@ -7388,7 +7399,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref lights_camera:lights - * @webBrief Sets the specular color for lights. + * @webBrief Sets the specular color for lights * @usage web_application * @param v1 red or hue value (depending on current color mode) * @param v2 green or saturation value (depending on current color mode) @@ -7445,7 +7456,7 @@ public class PGraphics extends PImage implements PConstants { *

* * @webref color:setting - * @webBrief Sets the color used for the background of the Processing window. + * @webBrief Sets the color used for the background of the Processing window * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#stroke(float) @@ -7541,7 +7552,7 @@ public class PGraphics extends PImage implements PConstants { * 100% transparent. * * @webref color:setting - * @webBrief Clears the pixels within a buffer. + * @webBrief Clears the pixels within a buffer */ public void clear() { background(0, 0, 0, 0); @@ -7647,7 +7658,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref color:setting - * @webBrief Changes the way Processing interprets color data. + * @webBrief Changes the way Processing interprets color data * @usage web_application * @param mode Either RGB or HSB, corresponding to Red/Green/Blue and * Hue/Saturation/Brightness @@ -7984,7 +7995,7 @@ public class PGraphics extends PImage implements PConstants { * Extracts the alpha value from a color. * * @webref color:creating_reading - * @webBrief Extracts the alpha value from a color. + * @webBrief Extracts the alpha value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -8023,7 +8034,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref color:creating_reading * @webBrief Extracts the red value from a color, scaled to match current - * colorMode(). + * colorMode() * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#green(int) @@ -8063,7 +8074,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref color:creating_reading * @webBrief Extracts the green value from a color, scaled to match current - * colorMode(). + * colorMode() * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -8103,7 +8114,7 @@ public class PGraphics extends PImage implements PConstants { * * @webref color:creating_reading * @webBrief Extracts the blue value from a color, scaled to match current - * colorMode(). + * colorMode() * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -8126,7 +8137,7 @@ public class PGraphics extends PImage implements PConstants { * Extracts the hue value from a color. * * @webref color:creating_reading - * @webBrief Extracts the hue value from a color. + * @webBrief Extracts the hue value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -8151,7 +8162,7 @@ public class PGraphics extends PImage implements PConstants { * Extracts the saturation value from a color. * * @webref color:creating_reading - * @webBrief Extracts the saturation value from a color. + * @webBrief Extracts the saturation value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -8177,7 +8188,7 @@ public class PGraphics extends PImage implements PConstants { * * * @webref color:creating_reading - * @webBrief Extracts the brightness value from a color. + * @webBrief Extracts the brightness value from a color * @usage web_application * @param rgb any value of the color datatype * @see PGraphics#red(int) @@ -8212,14 +8223,14 @@ public class PGraphics extends PImage implements PConstants { * equal to the first point, 0.1 is very near the first point, 0.5 is halfway in * between, etc.
* An amount below 0 will be treated as 0. Likewise, amounts above 1 will be - * capped at 1. This is different from the behavior of lerp(), but necessary + * capped at 1. This is different from the behavior of lerp(), but necessary * because otherwise numbers outside the range will produce strange and * unexpected colors. * * * @webref color:creating_reading - * @webBrief Calculates a color or colors between two color at a specific - * increment. + * @webBrief Calculates a color or colors between two colors at a specific + * increment * @usage web_application * @param c1 interpolate from this color * @param c2 interpolate to this color diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java index e3add33cb..487ebd880 100644 --- a/core/src/processing/core/PImage.java +++ b/core/src/processing/core/PImage.java @@ -54,7 +54,7 @@ import processing.awt.ShimAWT; * * * @webref image - * @webBrief Datatype for storing images. + * @webBrief Datatype for storing images * @usage Web & Application * @instanceName pimg any object of type PImage * @see PApplet#loadImage(String) @@ -83,7 +83,7 @@ public class PImage implements PConstants, Cloneable { /** * - * The pixels[] array contains the values for all the pixels in the image. These + * The pixels[] array contains the values for all the pixels in the image. These * values are of the color datatype. This array is the size of the image, * meaning if the image is 100 x 100 pixels, there will be 10,000 values and if * the window is 200 x 300 pixels, there will be 60,000 values.
@@ -96,7 +96,7 @@ public class PImage implements PConstants, Cloneable { * * * @webref image:pixels - * @webBrief Array containing the color of every pixel in the image. + * @webBrief Array containing the color of every pixel in the image * @usage web_application */ public int[] pixels; @@ -113,7 +113,7 @@ public class PImage implements PConstants, Cloneable { * The width of the image in units of pixels. * * @webref pimage:field - * @webBrief The width of the image in units of pixels. + * @webBrief The width of the image in units of pixels * @usage web_application */ public int width; @@ -123,7 +123,7 @@ public class PImage implements PConstants, Cloneable { * The height of the image in units of pixels. * * @webref pimage:field - * @webBrief The height of the image in units of pixels. + * @webBrief The height of the image in units of pixels * @usage web_application */ public int height; @@ -379,7 +379,7 @@ public class PImage implements PConstants, Cloneable { * copy all data into the pixels[] array * * @webref pimage:pixels - * @webBrief Loads the pixel data for the image into its pixels[] array. + * @webBrief Loads the pixel data for the image into its pixels[] array * @usage web_application */ public void loadPixels() { // ignore @@ -408,7 +408,7 @@ public class PImage implements PConstants, Cloneable { * future. * * @webref pimage:pixels - * @webBrief Updates the image with the data in its pixels[] array. + * @webBrief Updates the image with the data in its pixels[] array * @usage web_application * @param x x-coordinate of the upper-left corner * @param y y-coordinate of the upper-left corner @@ -464,17 +464,17 @@ public class PImage implements PConstants, Cloneable { * Resize the image to a new width and height. To make the image scale * proportionally, use 0 as the value for the wide or high * parameter. For instance, to make the width of an image 150 pixels, and - * change the height using the same proportion, use resize(150, 0).
+ * change the height using the same proportion, use resize(150, 0).
*
- * Even though a PGraphics is technically a PImage, it is not possible to - * rescale the image data found in a PGraphics. (It's simply not possible + * Even though a PGraphics is technically a PImage, it is not possible to + * rescale the image data found in a PGraphics. (It's simply not possible * to do this consistently across renderers: technically infeasible with - * P3D, or what would it even do with PDF?) If you want to resize PGraphics + * P3D, or what would it even do with PDF?) If you want to resize PGraphics * content, first get a copy of its image data using the get() * method, and call resize() on the PImage that is returned. * * @webref pimage:method - * @webBrief Resize the image to a new width and height. + * @webBrief Resize the image to a new width and height * @usage web_application * @param w the resized image width * @param h the resized image height @@ -551,7 +551,7 @@ public class PImage implements PConstants, Cloneable { * pixels[] array directly. * * @webref image:pixels - * @webBrief Reads the color of any pixel or grabs a rectangle of pixels. + * @webBrief Reads the color of any pixel or grabs a rectangle of pixels * @usage web_application * @param x x-coordinate of the pixel * @param y y-coordinate of the pixel @@ -1582,7 +1582,7 @@ public class PImage implements PConstants, Cloneable { * * @webref color:creating_reading * @webBrief Blends two color values together based on the blending mode given as the - * MODE parameter. + * MODE parameter * @usage web_application * @param c1 the first color to blend * @param c2 the second color to blend @@ -1631,16 +1631,16 @@ public class PImage implements PConstants, Cloneable { * of the following modes to blend the colors of source pixels (A) with the * ones of pixels in the destination image (B):
*
- * BLEND - linear interpolation of colours: C = A*factor + B
+ * BLEND - linear interpolation of colours: C = A*factor + B
*
- * ADD - additive blending with white clip: C = min(A*factor + B, 255)
+ * ADD - additive blending with white clip: C = min(A*factor + B, 255)
*
- * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, - * 0)
+ * SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, + * 0)
*
- * DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
+ * DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
*
- * LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
+ * LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
*
* DIFFERENCE - subtract colors from underlying image.
*
@@ -1674,7 +1674,7 @@ public class PImage implements PConstants, Cloneable { * * * @webref image:pixels - * @webBrief Copies a pixel or rectangle of pixels using different blending modes. + * @webBrief Copies a pixel or rectangle of pixels using different blending modes * @param src an image variable referring to the source image * @param sx X coordinate of the source's upper left corner * @param sy Y coordinate of the source's upper left corner @@ -3289,7 +3289,7 @@ int testFunction(int dst, int src) { * file with no error. * * @webref pimage:method - * @webBrief Saves the image to a TIFF, TARGA, PNG, or JPEG file. + * @webBrief Saves the image to a TIFF, TARGA, PNG, or JPEG file * @usage application * @param filename a sequence of letters and numbers */ diff --git a/core/src/processing/core/PShape.java b/core/src/processing/core/PShape.java index 98329f92f..4c737ec19 100644 --- a/core/src/processing/core/PShape.java +++ b/core/src/processing/core/PShape.java @@ -87,7 +87,7 @@ import java.util.Base64; *

* * @webref shape - * @webBrief Datatype for storing shapes. + * @webBrief Datatype for storing shapes * @usage Web & Application * @see PApplet#loadShape(String) * @see PApplet#createShape() @@ -145,7 +145,7 @@ public class PShape implements PConstants { /** * - * The width of the PShape document. + * The width of the PShape document. * * @webref pshape:field * @usage web_application @@ -155,7 +155,7 @@ public class PShape implements PConstants { public float width; /** * - * The height of the PShape document. + * The height of the PShape document. * * @webref pshape:field * @usage web_application @@ -400,7 +400,7 @@ public class PShape implements PConstants { /** * - * Returns a boolean value "true" if the image is set to be visible, "false" if + * Returns a boolean value true if the image is set to be visible, false if * not. This value can be modified with the setVisible() method.
*
* The default visibility of a shape is usually controlled by whatever program @@ -409,8 +409,8 @@ public class PShape implements PConstants { * * @webref pshape:method * @usage web_application - * @webBrief Returns a boolean value "true" if the image is set to be visible, - * "false" if not + * @webBrief Returns a boolean value true if the image is set to be visible, + * false if not * @see PShape#setVisible(boolean) */ public boolean isVisible() { @@ -781,7 +781,7 @@ public class PShape implements PConstants { * function. It's always and only used with createShape(). * * @webref pshape:method - * @webBrief Starts the creation of a new PShape + * @webBrief Starts the creation of a new PShape * @see PApplet#endShape() */ public void beginShape() { @@ -799,7 +799,7 @@ public class PShape implements PConstants { * function. It's always and only used with createShape(). * * @webref pshape:method - * @webBrief Finishes the creation of a new PShape + * @webBrief Finishes the creation of a new PShape * @see PApplet#beginShape() */ public void endShape() { @@ -2005,7 +2005,7 @@ public class PShape implements PConstants { } /** - * Returns the number of children within the PShape. + * Returns the number of children within the PShape. * * @webref * @webBrief Returns the number of children @@ -2037,7 +2037,7 @@ public class PShape implements PConstants { * * @webref pshape:method * @usage web_application - * @webBrief Returns a child element of a shape as a PShape object + * @webBrief Returns a child element of a shape as a PShape object * @param index the layer position of the shape to get * @see PShape#addChild(PShape) */ @@ -2256,7 +2256,7 @@ public class PShape implements PConstants { /** * The getVertexCount() method returns the number of vertices that - * make up a PShape. In the above example, the value 4 is returned by the + * make up a PShape. In the above example, the value 4 is returned by the * getVertexCount() method because 4 vertices are defined in * setup(). * @@ -2274,7 +2274,7 @@ public class PShape implements PConstants { /** - * The getVertex() method returns a PVector with the coordinates of + * The getVertex() method returns a PVector with the coordinates of * the vertex point located at the position defined by the index * parameter. This method works when shapes are created as shown in the * example above, but won't work properly when a shape is defined explicitly @@ -3309,7 +3309,7 @@ public class PShape implements PConstants { /** * * Replaces the current matrix of a shape with the identity matrix. The - * equivalent function in OpenGL is glLoadIdentity(). + * equivalent function in OpenGL is glLoadIdentity(). * * @webref pshape:method * @webBrief Replaces the current matrix of a shape with the identity matrix diff --git a/core/src/processing/core/PVector.java b/core/src/processing/core/PVector.java index 1f5ac1cf0..c34623470 100644 --- a/core/src/processing/core/PVector.java +++ b/core/src/processing/core/PVector.java @@ -62,7 +62,7 @@ import java.io.Serializable; * Dan Shiffman. * * @webref math - * @webBrief A class to describe a two or three dimensional vector. + * @webBrief A class to describe a two or three dimensional vector */ public class PVector implements Serializable { /** @@ -138,7 +138,7 @@ public class PVector implements Serializable { /** * * Sets the x, y, and z component of the vector using two or three separate - * variables, the data from a PVector, or the values from a float array. + * variables, the data from a PVector, or the values from a float array. * * * @webref pvector:method @@ -205,7 +205,7 @@ public class PVector implements Serializable { * @webref pvector:method * @usage web_application * @return the random PVector - * @webBrief Make a new 2D unit vector with a random direction. + * @webBrief Make a new 2D unit vector with a random direction * @see PVector#random3D() */ static public PVector random2D() { @@ -255,7 +255,7 @@ public class PVector implements Serializable { * @webref pvector:method * @usage web_application * @return the random PVector - * @webBrief Make a new 3D unit vector with a random direction. + * @webBrief Make a new 3D unit vector with a random direction * @see PVector#random2D() */ static public PVector random3D() { @@ -345,7 +345,7 @@ public class PVector implements Serializable { /** * - * Copies the components of the vector and returns the result as a PVector. + * Copies the components of the vector and returns the result as a PVector. * * * @webref pvector:method @@ -420,7 +420,7 @@ public class PVector implements Serializable { * * Adds x, y, and z components to a vector, adds one vector to another, or adds * two independent vectors together. The version of the method that adds two - * vectors together is a static method and returns a new PVector, the others act + * vectors together is a static method and returns a new PVector, the others act * directly on the vector itself. See the examples for more context. * * @@ -488,7 +488,7 @@ public class PVector implements Serializable { * * Subtracts x, y, and z components from a vector, subtracts one vector from * another, or subtracts two independent vectors. The version of the method that - * substracts two vectors is a static method and returns a PVector, the others + * substracts two vectors is a static method and returns a PVector, the others * act directly on the vector. See the examples for more context. In all cases, * the second vector (v2) is subtracted from the first (v1), resulting in v1-v2. * @@ -557,8 +557,8 @@ public class PVector implements Serializable { * * Multiplies a vector by a scalar. The version of the method that uses a float * acts directly on the vector upon which it is called (as in the first example - * above). The versions that receive both a PVector and a float as arguments are - * static methods, and each returns a new PVector that is the result of the + * above). The versions that receive both a PVector and a float as arguments are + * static methods, and each returns a new PVector that is the result of the * multiplication operation. Both examples above produce the same visual output. * * @@ -601,8 +601,8 @@ public class PVector implements Serializable { * * Divides a vector by a scalar. The version of the method that uses a float * acts directly on the vector upon which it is called (as in the first example - * above). The version that receives both a PVector and a float as arguments is - * a static methods, and returns a new PVector that is the result of the + * above). The version that receives both a PVector and a float as arguments is + * a static methods, and returns a new PVector that is the result of the * division operation. Both examples above produce the same visual output. * * @webref pvector:method @@ -868,6 +868,14 @@ public class PVector implements Serializable { } + public PVector setHeading(float angle) { + float m = mag(); + x = (float) (m * Math.cos(angle)); + y = (float) (m * Math.sin(angle)); + return this; + } + + /** * * Rotate the vector by an angle (only 2D vectors), magnitude remains the same @@ -898,7 +906,7 @@ public class PVector implements Serializable { * static version is used by referencing the PVector class directly. (See the * middle example above.) The non-static versions, lerp(v, amt) and * lerp(x, y, z, amt), do not create a new PVector, but transform the - * values of the PVector on which they are called. These non-static versions + * values of the PVector on which they are called. These non-static versions * perform the same operation, but the former takes another vector as input, * while the latter takes three float values. (See the top and bottom examples * above, respectively.) diff --git a/core/src/processing/data/FloatDict.java b/core/src/processing/data/FloatDict.java index 3dbd639a7..2fd737b76 100644 --- a/core/src/processing/data/FloatDict.java +++ b/core/src/processing/data/FloatDict.java @@ -9,12 +9,12 @@ import processing.core.PApplet; /** - * A simple class to use a String as a lookup for an float value. String "keys" + * A simple class to use a String as a lookup for a float value. String "keys" * are associated with floating-point values. * * @webref data:composite - * @webBrief A simple table class to use a String as a lookup for an float - * value. + * @webBrief A simple table class to use a String as a lookup for a float + * value * @see IntDict * @see StringDict */ @@ -415,7 +415,7 @@ public class FloatDict { /** - * Add to a value. If the key does not exist, an new pair is initialized with + * Add to a value. If the key does not exist, a new pair is initialized with * the value supplied. * * @webref floatdict:method diff --git a/core/src/processing/data/FloatList.java b/core/src/processing/data/FloatList.java index 2816c2662..ab8300c20 100644 --- a/core/src/processing/data/FloatList.java +++ b/core/src/processing/data/FloatList.java @@ -11,14 +11,14 @@ import processing.core.PApplet; /** * Helper class for a list of floats. Lists are designed to have some of the - * features of ArrayLists, but to maintain the simplicity and efficiency of + * features of ArrayLists, but to maintain the simplicity and efficiency of * working with arrays. * - * Functions like sort() and shuffle() always act on the list itself. To get - * a sorted copy, use list.copy().sort(). + * Functions like sort() and shuffle() always act on the list itself. To get + * a sorted copy, use list.copy().sort(). * * @webref data:composite - * @webBrief Helper class for a list of floats. + * @webBrief Helper class for a list of floats * @see IntList * @see StringList */ @@ -678,7 +678,7 @@ public class FloatList implements Iterable { * reverse(), but is more efficient than running each separately. * * @webref floatlist:method - * @webBrief A sort in reverse. + * @webBrief A sort in reverse */ public void sortReverse() { new Sort() { diff --git a/core/src/processing/data/IntDict.java b/core/src/processing/data/IntDict.java index 78e594f5b..a68239dae 100644 --- a/core/src/processing/data/IntDict.java +++ b/core/src/processing/data/IntDict.java @@ -9,11 +9,11 @@ import processing.core.PApplet; /** - * A simple class to use a String as a lookup for an int value. String "keys" are + * A simple class to use a String as a lookup for an int value. String "keys" are * associated with integer values. * * @webref data:composite - * @webBrief A simple class to use a String as a lookup for an int value. + * @webBrief A simple class to use a String as a lookup for an int value * @see FloatDict * @see StringDict */ diff --git a/core/src/processing/data/IntList.java b/core/src/processing/data/IntList.java index 51af0ecb5..3ce6f0538 100644 --- a/core/src/processing/data/IntList.java +++ b/core/src/processing/data/IntList.java @@ -16,14 +16,14 @@ import processing.core.PApplet; /** * Helper class for a list of ints. Lists are designed to have some of the - * features of ArrayLists, but to maintain the simplicity and efficiency of + * features of ArrayLists, but to maintain the simplicity and efficiency of * working with arrays. * - * Functions like sort() and shuffle() always act on the list itself. To get - * a sorted copy, use list.copy().sort(). + * Functions like sort() and shuffle() always act on the list itself. To get + * a sorted copy, use list.copy().sort(). * * @webref data:composite - * @webBrief Helper class for a list of ints. + * @webBrief Helper class for a list of ints * @see FloatList * @see StringList */ diff --git a/core/src/processing/data/JSONArray.java b/core/src/processing/data/JSONArray.java index 32919e672..d81e4db60 100644 --- a/core/src/processing/data/JSONArray.java +++ b/core/src/processing/data/JSONArray.java @@ -96,7 +96,7 @@ import processing.core.PApplet; * @author JSON.org * @version 2012-11-13 * @webref data:composite - * @webBrief A JSONArray is an ordered sequence of values. + * @webBrief A JSONArray is an ordered sequence of values * @see JSONObject * @see PApplet#loadJSONObject(String) * @see PApplet#loadJSONArray(String) @@ -279,7 +279,7 @@ public class JSONArray { /** - * Gets the String value associated with the specified index. + * Gets the String value associated with the specified index. * * @webref jsonarray:method * @webBrief Gets the String value associated with an index @@ -317,7 +317,7 @@ public class JSONArray { * Gets the int value associated with the specified index. * * @webref jsonarray:method - * @webBrief Gets the int value associated with the specified index. + * @webBrief Gets the int value associated with the specified index * @param index must be between 0 and length() - 1 * @return The value. * @throws RuntimeException If the key is not found or if the value is not a number. @@ -395,7 +395,7 @@ public class JSONArray { * Gets the float value associated with the specified index. * * @webref jsonarray:method - * @webBrief Gets the float value associated with the specified index. + * @webBrief Gets the float value associated with the specified index * @param index must be between 0 and length() - 1 * @see JSONArray#getInt(int) * @see JSONArray#getString(int) @@ -457,7 +457,7 @@ public class JSONArray { * Gets the boolean value associated with the specified index. * * @webref jsonarray:method - * @webBrief Gets the boolean value associated with the specified index. + * @webBrief Gets the boolean value associated with the specified index * @param index must be between 0 and length() - 1 * @return The truth. * @throws RuntimeException If there is no value for the index or if the @@ -503,7 +503,7 @@ public class JSONArray { * Retrieves the JSONArray with the associated index value. * * @webref jsonobject:method - * @webBrief Retrieves the JSONArray with the associated index value. + * @webBrief Retrieves the JSONArray with the associated index value * @param index must be between 0 and length() - 1 * @return A JSONArray value. * @throws RuntimeException If there is no value for the index. or if the @@ -534,7 +534,7 @@ public class JSONArray { * Retrieves the JSONObject with the associated index value. * * @webref jsonobject:method - * @webBrief Retrieves the JSONObject with the associated index value. + * @webBrief Retrieves the JSONObject with the associated index value * @param index the index value of the object to get * @return A JSONObject value. * @throws RuntimeException If there is no value for the index or if the @@ -562,11 +562,11 @@ public class JSONArray { /** - * Returns the entire JSONArray as an array of Strings. - * (All values in the array must be of the String type.) + * Returns the entire JSONArray as an array of Strings. + * (All values in the array must be of the String type.) * * @webref jsonarray:method - * @webBrief Returns the entire JSONArray as an array of Strings + * @webBrief Returns the entire JSONArray as an array of Strings * @see JSONArray#getIntArray() */ public String[] getStringArray() { @@ -579,11 +579,11 @@ public class JSONArray { /** - * Returns the entire JSONArray as an array of ints. + * Returns the entire JSONArray as an array of ints. * (All values in the array must be of the int type.) * * @webref jsonarray:method - * @webBrief Returns the entire JSONArray as an array of ints + * @webBrief Returns the entire JSONArray as an array of ints * @see JSONArray#getStringArray() */ public int[] getIntArray() { @@ -702,8 +702,8 @@ public class JSONArray { /** * Appends a new value to the JSONArray, increasing the array's length - * by one. New values may be of the following types: int, float, String, - * boolean, JSONObject, or JSONArray. + * by one. New values may be of the following types: int, float, String, + * boolean, JSONObject, or JSONArray. * * @webref jsonarray:method * @webBrief Appends a value, increasing the array's length by one @@ -862,7 +862,7 @@ public class JSONArray { * necessary to pad it out. * * @webref jsonarray:method - * @webBrief Inserts a new value into the JSONArray at the specified index position. + * @webBrief Inserts a new value into the JSONArray at the specified index position * @param index an index value * @param value the value to assign * @return this. @@ -1080,7 +1080,7 @@ public class JSONArray { /** * Removes the element from a JSONArray in the specified index position. - * Returns either the value associated with the given index, or null, if there + * Returns either the value associated with the given index, or null, if there * is no value. * * @webref jsonarray:method diff --git a/core/src/processing/data/JSONObject.java b/core/src/processing/data/JSONObject.java index f5413b3ae..7f7a113ed 100644 --- a/core/src/processing/data/JSONObject.java +++ b/core/src/processing/data/JSONObject.java @@ -52,7 +52,7 @@ import processing.core.PApplet; /** * A JSONObject stores JSON data with multiple name/value pairs. Values - * can be numeric, Strings, booleans, other JSONObjects or + * can be numeric, Strings, booleans, other JSONObjects or * JSONArrays, or null. JSONObject and JSONArray objects * are quite similar and share most of the same methods; the primary difference * is that the latter stores an array of JSON objects, while the former @@ -116,7 +116,7 @@ import processing.core.PApplet; * @author JSON.org * @version 2012-12-01 * @webref data:composite - * @webBrief A JSONObject is an unordered collection of name/value pairs. + * @webBrief A JSONObject is an unordered collection of name/value pairs * @see JSONArray * @see PApplet#loadJSONObject(String) * @see PApplet#loadJSONArray(String) @@ -567,10 +567,10 @@ public class JSONObject { /** - * Gets the String value associated with the specified key. + * Gets the String value associated with the specified key. * * @webref jsonobject:method - * @webBrief Gets the String value associated with the specified key + * @webBrief Gets the String value associated with the specified key * @param key a key string * @return A string which is the value. * @throws RuntimeException if there is no string value for the key. @@ -606,10 +606,10 @@ public class JSONObject { /** - * Gets the int value associated with the specified key. + * Gets the int value associated with the specified key. * * @webref jsonobject:method - * @webBrief Gets the int value associated with the specified key + * @webBrief Gets the int value associated with the specified key * @param key A key string. * @return The integer value. * @throws RuntimeException if the key is not found or if the value cannot @@ -691,10 +691,10 @@ public class JSONObject { /** - * Gets the float value associated with the specified key + * Gets the float value associated with the specified key * * @webref jsonobject:method - * @webBrief Gets the float value associated with a key + * @webBrief Gets the float value associated with a key * @param key a key string * @see JSONObject#getInt(String) * @see JSONObject#getString(String) @@ -753,10 +753,10 @@ public class JSONObject { /** - * Gets the boolean value associated with the specified key. + * Gets the boolean value associated with the specified key. * * @webref jsonobject:method - * @webBrief Gets the boolean value associated with the specified key + * @webBrief Gets the boolean value associated with the specified key * @param key a key string * @return The truth. * @throws RuntimeException if the value is not a Boolean or the String "true" or "false". @@ -933,7 +933,7 @@ public class JSONObject { * * @webref * @webBrief Determines if the value associated with the key is null, that is has - * no defined value (false) or if it has a value (true). + * no defined value (false) or if it has a value (true) * @param key A key string. * @return true if there is no value associated with the key or if * the value is the JSONObject.NULL object. @@ -1227,7 +1227,7 @@ public class JSONObject { * the specified key already exists, assigns a new value. * * @webref jsonobject:method - * @webBrief Put a key/float pair in the JSONObject + * @webBrief Put a key/float pair in the JSONObject * @param key a key string * @param value the value to assign * @throws RuntimeException If the key is null or if the number is NaN or infinite. @@ -1260,7 +1260,7 @@ public class JSONObject { * with the specified key already exists, assigns a new value. * * @webref jsonobject:method - * @webBrief Put a key/boolean pair in the JSONObject + * @webBrief Put a key/boolean pair in the JSONObject * @param key a key string * @param value the value to assign * @return this. diff --git a/core/src/processing/data/LongList.java b/core/src/processing/data/LongList.java index 1598753d7..2c818526c 100644 --- a/core/src/processing/data/LongList.java +++ b/core/src/processing/data/LongList.java @@ -710,7 +710,7 @@ public class LongList implements Iterable { /** * Randomize the order of the list elements. Note that this does not - * obey the randomSeed() function in PApplet. + * obey the randomSeed() function in PApplet. * * @webref intlist:method * @webBrief Randomize the order of the list elements diff --git a/core/src/processing/data/StringDict.java b/core/src/processing/data/StringDict.java index 97e2e4d72..4e35c669d 100644 --- a/core/src/processing/data/StringDict.java +++ b/core/src/processing/data/StringDict.java @@ -9,11 +9,11 @@ import processing.core.PApplet; /** - * A simple class to use a String as a lookup for an String value. String "keys" - * are associated with String values. + * A simple class to use a String as a lookup for a String value. String "keys" + * are associated with String values. * * @webref data:composite - * @webBrief A simple class to use a String as a lookup for an String value + * @webBrief A simple class to use a String as a lookup for an String value * @see IntDict * @see FloatDict */ diff --git a/core/src/processing/data/StringList.java b/core/src/processing/data/StringList.java index f69c1a7ea..8438bfdb9 100644 --- a/core/src/processing/data/StringList.java +++ b/core/src/processing/data/StringList.java @@ -9,15 +9,15 @@ import java.util.Random; import processing.core.PApplet; /** - * Helper class for a list of Strings. Lists are designed to have some of the - * features of ArrayLists, but to maintain the simplicity and efficiency of + * Helper class for a list of Strings. Lists are designed to have some of the + * features of ArrayLists, but to maintain the simplicity and efficiency of * working with arrays. * - * Functions like sort() and shuffle() always act on the list itself. To get - * a sorted copy, use list.copy().sort(). + * Functions like sort() and shuffle() always act on the list itself. To get + * a sorted copy, use list.copy().sort(). * * @webref data:composite - * @webBrief Helper class for a list of Strings. + * @webBrief Helper class for a list of Strings * @see IntList * @see FloatList */ @@ -149,7 +149,7 @@ public class StringList implements Iterable { /** * Set the entry at a particular index. If the index is past the length of * the list, it'll expand the list to accommodate, and fill the intermediate - * entries with "null". + * entries with null. * * @webref stringlist:method * @webBrief Set an entry at a particular index diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index 505be67ff..e9bf45651 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -76,7 +76,7 @@ import processing.core.PConstants; * * @webref data:composite * @webBrief Generic class for handling tabular data, typically from a CSV, TSV, - * or other sort of spreadsheet file. + * or other sort of spreadsheet file * @see PApplet#loadTable(String) * @see PApplet#saveTable(Table, String) * @see TableRow @@ -1806,9 +1806,9 @@ public class Table { * Use addColumn() to add a new column to a Table object. * Typically, you will want to specify a title, so the column may be easily * referenced later by name. (If no title is specified, the new column's title - * will be null.) A column type may also be specified, in which case all values - * stored in this column must be of the same type (e.g., Table.INT or - * Table.FLOAT). If no type is specified, the default type of STRING is used. + * will be null.) A column type may also be specified, in which case all values + * stored in this column must be of the same type (e.g., Table.INT or + * Table.FLOAT). If no type is specified, the default type of STRING is used. * * @webref table:method * @webBrief Adds a new column to a table @@ -1886,7 +1886,7 @@ public class Table { /** * Use removeColumn() to remove an existing column from a Table * object. The column to be removed may be identified by either its title (a - * String) or its index value (an int). removeColumn(0) would remove the + * String) or its index value (an int). removeColumn(0) would remove the * first column, removeColumn(1) would remove the second column, and so * on. * @@ -2285,10 +2285,10 @@ public class Table { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . /** - * Returns the total number of rows in a table. + * Returns the total number of rows in a Table. * * @webref table:method - * @webBrief Returns the total number of rows in a table + * @webBrief Returns the total number of rows in a Table * @see Table#getColumnCount() */ public int getRowCount() { @@ -3609,7 +3609,7 @@ public class Table { } /** - * Retrieves all values in the specified column, and returns them as a String + * Retrieves all values in the specified column, and returns them as a String * array. The column may be specified by either its ID or title. * * @webref table:method diff --git a/core/src/processing/data/TableRow.java b/core/src/processing/data/TableRow.java index 45c7816e7..69c4638d3 100644 --- a/core/src/processing/data/TableRow.java +++ b/core/src/processing/data/TableRow.java @@ -4,13 +4,13 @@ import java.io.PrintWriter; /** * A TableRow object represents a single row of data values, - * stored in columns, from a table.
+ * stored in columns, from a Table.
*
* Additional TableRow methods are documented in the * Processing Data Javadoc. * * @webref data:composite - * @webBrief represents a single row of data values, stored in columns, from a table. + * @webBrief Represents a single row of data values, stored in columns, from a Table * @see Table * @see Table#addRow() * @see Table#removeRow(int) @@ -25,7 +25,7 @@ public interface TableRow { * The column may be specified by either its ID or title. * * @webref tablerow:method - * @webBrief Get an String value from the specified column + * @webBrief Get a String value from the specified column * @param column ID number of the column to reference * @see TableRow#getInt(int) * @see TableRow#getFloat(int) @@ -42,7 +42,7 @@ public interface TableRow { * The column may be specified by either its ID or title. * * @webref tablerow:method - * @webBrief Get an integer value from the specified column + * @webBrief Get an integer value from the specified column * @param column ID number of the column to reference * @see TableRow#getFloat(int) * @see TableRow#getString(int) @@ -55,7 +55,7 @@ public interface TableRow { public int getInt(String columnName); /** - * @webBrief Get a long value from the specified column + * @webBrief Get a long value from the specified column * @param column ID number of the column to reference * @see TableRow#getFloat(int) * @see TableRow#getString(int) @@ -73,7 +73,7 @@ public interface TableRow { * The column may be specified by either its ID or title. * * @webref tablerow:method - * @webBrief Get a float value from the specified column + * @webBrief Get a float value from the specified column * @param column ID number of the column to reference * @see TableRow#getInt(int) * @see TableRow#getString(int) @@ -86,7 +86,7 @@ public interface TableRow { public float getFloat(String columnName); /** - * @webBrief Get a double value from the specified column + * @webBrief Get a double value from the specified column * @param column ID number of the column to reference * @see TableRow#getInt(int) * @see TableRow#getString(int) @@ -99,11 +99,11 @@ public interface TableRow { public double getDouble(String columnName); /** - * Stores a String value in the TableRow's specified column. The column + * Stores a String value in the TableRow's specified column. The column * may be specified by either its ID or title. * * @webref tablerow:method - * @webBrief Store a String value in the specified column + * @webBrief Store a String value in the specified column * @param column ID number of the target column * @param value value to assign * @see TableRow#setInt(int, int) @@ -116,11 +116,11 @@ public interface TableRow { public void setString(String columnName, String value); /** - * Stores an integer value in the TableRow's specified column. The column + * Stores an integer value in the TableRow's specified column. The column * may be specified by either its ID or title. * * @webref tablerow:method - * @webBrief Store an integer value in the specified column + * @webBrief Store an integer value in the specified column * @param column ID number of the target column * @param value value to assign * @see TableRow#setFloat(int, float) @@ -134,7 +134,7 @@ public interface TableRow { public void setInt(String columnName, int value); /** - * @webBrief Store a long value in the specified column + * @webBrief Store a long value in the specified column * @param column ID number of the target column * @param value value to assign * @see TableRow#setFloat(int, float) @@ -148,11 +148,11 @@ public interface TableRow { public void setLong(String columnName, long value); /** - * Stores a float value in the TableRow's specified column. The column + * Stores a float value in the TableRow's specified column. The column * may be specified by either its ID or title. * * @webref tablerow:method - * @webBrief Store a float value in the specified column + * @webBrief Store a float value in the specified column * @param column ID number of the target column * @param value value to assign * @see TableRow#setInt(int, int) @@ -166,7 +166,7 @@ public interface TableRow { public void setFloat(String columnName, float value); /** - * @webBrief Store a double value in the specified column + * @webBrief Store a double value in the specified column * @param column ID number of the target column * @param value value to assign * @see TableRow#setFloat(int, float) @@ -183,13 +183,13 @@ public interface TableRow { * Returns the number of columns in a TableRow. * * @webref tablerow:method - * @webBrief Get the column count. + * @webBrief Get the column count * @return count of all columns */ public int getColumnCount(); /** - * @webBrief Get the column type. + * @webBrief Get the column type * @param columnName title of the target column * @return type of the column */ diff --git a/core/src/processing/data/XML.java b/core/src/processing/data/XML.java index f83451594..e9034f2f4 100644 --- a/core/src/processing/data/XML.java +++ b/core/src/processing/data/XML.java @@ -41,16 +41,16 @@ import processing.core.PApplet; /** - * XML is a representation of an XML object, able to parse XML code. Use + * XML is a representation of an XML object, able to parse XML code. Use * loadXML() to load external XML files and create XML * objects.
*
* Only files encoded as UTF-8 (or plain ASCII) are parsed properly; the - * encoding parameter inside XML files is ignored. + * encoding parameter inside XML files is ignored. * * @webref data:composite * @webBrief This is the base class used for the Processing XML library, - * representing a single node of an XML tree. + * representing a single node of an XML tree * @see PApplet#loadXML(String) * @see PApplet#parseXML(String) * @see PApplet#saveXML(XML, String) @@ -253,10 +253,10 @@ public class XML implements Serializable { /** - * Converts String content to an XML object + * Converts String content to an XML object * * @webref xml:method - * @webBrief Converts String content to an XML object + * @webBrief Converts String content to an XML object * @param data the content to be parsed as XML * @return an XML object, or null * @throws SAXException @@ -305,7 +305,7 @@ public class XML implements Serializable { /** - * Gets a copy of the element's parent. Returns the parent as another XML object. + * Gets a copy of the element's parent. Returns the parent as another XML object. * * @webref xml:method * @webBrief Gets a copy of the element's parent @@ -323,7 +323,7 @@ public class XML implements Serializable { /** - * Gets the element's full name, which is returned as a String. + * Gets the element's full name, which is returned as a String. * * @webref xml:method * @webBrief Gets the element's full name @@ -335,7 +335,7 @@ public class XML implements Serializable { } /** - * Sets the element's name, which is specified as a String. + * Sets the element's name, which is specified as a String. * * @webref xml:method * @webBrief Sets the element's name @@ -388,7 +388,7 @@ public class XML implements Serializable { /** - * Checks whether or not the element has any children, and returns the result as a boolean. + * Checks whether or not the element has any children, and returns the result as a boolean. * * @webref xml:method * @webBrief Checks whether or not an element has any children @@ -401,7 +401,7 @@ public class XML implements Serializable { /** * Get the names of all of the element's children, and returns the names as an - * array of Strings. This is the same as looping through and calling getName() + * array of Strings. This is the same as looping through and calling getName() * on each child element individually. * * @webref xml:method @@ -427,7 +427,7 @@ public class XML implements Serializable { /** - * Returns all of the element's children as an array of XML objects. When + * Returns all of the element's children as an array of XML objects. When * the name parameter is specified, then it will return all children * that match that name or path. The path is a series of elements and * sub-elements, separated by slashes. @@ -572,10 +572,10 @@ public class XML implements Serializable { /** * Appends a new child to the element. The child can be specified with either a - * String, which will be used as the new tag's name, or as a reference to an - * existing XML object.
+ * String, which will be used as the new tag's name, or as a reference to an + * existing XML object.
*
- * A reference to the newly created child is returned as an XML object. + * A reference to the newly created child is returned as an XML object. * * @webref xml:method * @webBrief Appends a new child to the element @@ -695,7 +695,7 @@ public class XML implements Serializable { /** - * Counts the specified element's number of attributes, returned as an int. + * Counts the specified element's number of attributes, returned as an int. * * @webref xml:method * @webBrief Counts the specified element's number of attributes @@ -706,7 +706,7 @@ public class XML implements Serializable { /** - * Gets all of the specified element's attributes, and returns them as an array of Strings. + * Gets all of the specified element's attributes, and returns them as an array of Strings. * * @webref xml:method * @webBrief Returns a list of names of all attributes as an array @@ -722,7 +722,7 @@ public class XML implements Serializable { /** * Checks whether or not an element has the specified attribute. The attribute - * must be specified as a String, and a boolean is returned. + * must be specified as a String, and a boolean is returned. * * @webref xml:method * @webBrief Checks whether or not an element has the specified attribute @@ -757,13 +757,13 @@ public class XML implements Serializable { /** - * Returns an attribute value of the element as a String. If the defaultValue + * Returns an attribute value of the element as a String. If the defaultValue * parameter is specified and the attribute doesn't exist, then defaultValue * is returned. If no defaultValue is specified and the attribute doesn't - * exist, null is returned. + * exist, null is returned. * * @webref xml:method - * @webBrief Gets the content of an attribute as a String + * @webBrief Gets the content of an attribute as a String */ public String getString(String name) { return getString(name, null); @@ -783,11 +783,11 @@ public class XML implements Serializable { /** - * Sets the content of an element's attribute as a String. The first String + * Sets the content of an element's attribute as a String. The first String * specifies the attribute name, while the second specifies the new content. * * @webref xml:method - * @webBrief Sets the content of an attribute as a String + * @webBrief Sets the content of an attribute as a String */ public void setString(String name, String value) { ((Element) node).setAttribute(name, value); @@ -795,13 +795,13 @@ public class XML implements Serializable { /** - * Returns an attribute value of the element as an int. If the defaultValue + * Returns an attribute value of the element as an int. If the defaultValue * parameter is specified and the attribute doesn't exist, then defaultValue * is returned. If no defaultValue is specified and the attribute doesn't * exist, the value 0 is returned. * * @webref xml:method - * @webBrief Gets the content of an attribute as an int + * @webBrief Gets the content of an attribute as an int */ public int getInt(String name) { return getInt(name, 0); @@ -809,11 +809,11 @@ public class XML implements Serializable { /** - * Sets the content of an element's attribute as an int. A String specifies + * Sets the content of an element's attribute as an int. A String specifies * the attribute name, while the int specifies the new content. * * @webref xml:method - * @webBrief Sets the content of an attribute as an int + * @webBrief Sets the content of an attribute as an int */ public void setInt(String name, int value) { setString(name, String.valueOf(value)); @@ -834,10 +834,10 @@ public class XML implements Serializable { /** - * Sets the content of an element as an int + * Sets the content of an element as an int * * @webref xml:method - * @webBrief Sets the content of an element as an int + * @webBrief Sets the content of an element as an int */ public void setLong(String name, long value) { setString(name, String.valueOf(value)); @@ -864,7 +864,7 @@ public class XML implements Serializable { * and the attribute doesn't exist, the value 0.0 is returned. * * @webref xml:method - * @webBrief Gets the content of an attribute as a float + * @webBrief Gets the content of an attribute as a float */ public float getFloat(String name) { return getFloat(name, 0); @@ -885,11 +885,11 @@ public class XML implements Serializable { /** - * Sets the content of an element's attribute as a float. A String specifies - * the attribute name, while the float specifies the new content. + * Sets the content of an element's attribute as a float. A String specifies + * the attribute name, while the float specifies the new content. * * @webref xml:method - * @webBrief Sets the content of an attribute as a float + * @webBrief Sets the content of an attribute as a float */ public void setFloat(String name, float value) { setString(name, String.valueOf(value)); @@ -941,11 +941,11 @@ public class XML implements Serializable { /** - * Returns the content of an element as an int. If there is no such content, + * Returns the content of an element as an int. If there is no such content, * either null or the provided default value is returned. * * @webref xml:method - * @webBrief Gets the content of an element as an int + * @webBrief Gets the content of an element as an int * @return the content. * @see XML#getContent() * @see XML#getFloatContent() @@ -964,11 +964,11 @@ public class XML implements Serializable { /** - * Returns the content of an element as a float. If there is no such content, + * Returns the content of an element as a float. If there is no such content, * either null or the provided default value is returned. * * @webref xml:method - * @webBrief Gets the content of an element as a float + * @webBrief Gets the content of an element as a float * @return the content. * @see XML#getContent() * @see XML#getIntContent() @@ -1019,7 +1019,7 @@ public class XML implements Serializable { /** - * Sets the element's content, which is specified as a String. + * Sets the element's content, which is specified as a String. * * @webref xml:method * @webBrief Sets the content of an element @@ -1050,19 +1050,19 @@ public class XML implements Serializable { /** - * Takes an XML object and converts it to a String, formatting its content as + * Takes an XML object and converts it to a String, formatting its content as * specified with the indent parameter.
*
* If indent is set to -1, then the String is returned with no line breaks, no - * indentation, and no XML declaration.
+ * indentation, and no XML declaration.
*
- * If indent is set to 0 or greater, then the String is returned with line + * If indent is set to 0 or greater, then the String is returned with line * breaks, and the specified number of spaces as indent values. Meaning, there * will be no indentation if 0 is specified, or each indent will be replaced * with the corresponding number of spaces: 1, 2, 3, and so on. * * @webref xml:method - * @webBrief Formats XML data as a String + * @webBrief Formats XML data as a String * @param indent -1 for a single line (and no declaration), >= 0 for indents and * newlines * @return the content @@ -1204,13 +1204,13 @@ public class XML implements Serializable { /** - * Takes an XML object and converts it to a String, using default formatting + * Takes an XML object and converts it to a String, using default formatting * rules (includes an XML declaration, line breaks, and two spaces for indents). * These are the same formatting rules used by println() when printing an - * XML object. This method produces the same results as using format(2). + * XML object. This method produces the same results as using format(2). * * @webref xml:method - * @webBrief Gets XML data as a String using default formatting + * @webBrief Gets XML data as a String using default formatting * @return the content * @see XML#format(int) */ diff --git a/core/src/processing/opengl/PShader.java b/core/src/processing/opengl/PShader.java index 0f7c08185..2009cb886 100644 --- a/core/src/processing/opengl/PShader.java +++ b/core/src/processing/opengl/PShader.java @@ -37,12 +37,12 @@ import java.util.HashMap; * fragment shader. It's compatible with the P2D and P3D renderers, but not with * the default renderer. Use the loadShader() function to load your * shader code. [Note: It's strongly encouraged to use loadShader() to - * create a PShader object, rather than calling the PShader constructor + * create a PShader object, rather than calling the PShader constructor * manually.] * * @webref rendering:shaders * @webBrief This class encapsulates a GLSL shader program, including a vertex - * and a fragment shader. + * and a fragment shader */ public class PShader implements PConstants { static protected final int POINT = 0; diff --git a/core/todo.txt b/core/todo.txt index 42762ca4c..82fd4c224 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,9 +1,62 @@ 1273 (4.0a4) +X fix typo in extensions= arg +X update batik to 1.14 +X https://github.com/processing/processing4/issues/179 +X https://github.com/processing/processing4/issues/192 +X update the batik url +X https://github.com/processing/processing4/pull/183 +X calling unregisterMethod() on dispose from dispose() means concurrent mod +o https://github.com/processing/processing4/pull/199 +X modernized the code a bit, checked in a version that queues to avoid list issue +X Make parseJSONObject/Array return null when parsing fails +X https://github.com/processing/processing4/issues/165 +X https://github.com/processing/processing4/pull/166 +X "textMode(SHAPE) is not supported by this renderer" message +X https://github.com/processing/processing4/issues/202 +X formerly https://github.com/processing/processing/issues/6169 +X add PVector.setHeading() for parity with p5.js +X https://github.com/processing/processing4/issues/193 +X .setAngle() for PVector? +X https://github.com/processing/processing-docs/issues/744 +o Math for BLEND incorrect in the reference? +o https://github.com/processing/processing-docs/issues/762 +o How much of the attrib*() functions should be documented? +o https://github.com/processing/processing-docs/issues/172 -fixed in 4.x (close/lock these 3.x issues with final 4.0 release) +regressions +_ (unconfirmed) setting which display to use does not work +_ https://github.com/processing/processing4/issues/187 +_ cursor(PImage) broken everywhere because PImage.getNative() returns null +_ https://github.com/processing/processing4/issues/180 +_ PImage.resize() not working +_ https://github.com/processing/processing4/issues/200 +_ two simple examples added to the issue that can be used for tests +_ mouseButton not set correctly on mouseReleased() with Java2D +_ https://github.com/processing/processing4/issues/181 +_ https://github.com/processing/processing4/pull/188 +_ copy() not working correctly +_ https://github.com/processing/processing4/issues/169 + + +_ setting surface size needs to happen outside draw() +_ surface.setSize() sadness etc +_ https://github.com/processing/processing4/issues/162 +_ https://github.com/processing/processing4/issues/186 +_ https://github.com/processing/processing/issues/4129 + +_ why does japplemenubar.JAppleMenuBar.hide(); still work? +_ it calls SetSystemUIMode, which is part of Carbon (which was removed in Catalina) +_ https://github.com/kritzikratzi/jAppleMenuBar/blob/master/src/native/jAppleMenuBar.m +_ setPresentationOptions() seems to be the Cocoa equivalent +_ https://www.cocoawithlove.com/2009/08/animating-window-to-fullscreen-on-mac.html +_ https://bugzilla.mozilla.org/attachment.cgi?id=8616917&action=diff +_ https://www.philipp.haussleiter.de/2012/09/building-native-macos-apps-with-java/ + + +should be fixed in 4.x (close/lock these 3.x issues with final 4.0 release) X AppKit errors from P2D/P3D -_ https://github.com/processing/processing/issues/5880 +X https://github.com/processing/processing/issues/5880 X Export Application broken in Processing 3.5.4 when using P2D or P3D renderers X may be a JOGL bug, fixed by the 2.4 RC (therefore fixed in 4.x already?) _ https://github.com/processing/processing/issues/5983 @@ -11,6 +64,12 @@ _ Profile GL3bc is not available on X11GraphicsDevice _ https://github.com/processing/processing/issues/5476 X Cannot run rotateZ() within the PShape class _ https://github.com/processing/processing/issues/5770 +_ Profile GL4bc is not available on X11GraphicsDevice +_ https://github.com/processing/processing/issues/6160 +_ https://github.com/processing/processing/issues/6154 +_ Profile GL3bc is not available on X11GraphicsDevice +_ https://github.com/processing/processing/issues/5476 + _ update P2D reference to make clear about drawing order and quality _ https://github.com/processing/processing/issues/5880 @@ -51,6 +110,7 @@ _ this may be a problem for anything that was relying on those internals _ removed MouseEvent.getClickCount() and MouseEvent.getAmount() _ these had been deprecated, not clear they were used anywhere _ add callbacks to requestImage() and others +_ new FloatList(float...) api todo @@ -114,6 +174,8 @@ _ y coords on macOS seem to be one pixel off retina/hi-dpi/sizing +_ notes from jetbrains +_ https://intellij-support.jetbrains.com/hc/en-us/articles/360007994999-HiDPI-configuration _ implement sketch scaling into PApplet _ https://github.com/processing/processing/issues/4897 _ Sketches on Windows don't take UI sizing into account @@ -148,15 +210,6 @@ _ Friendly Names for new Sketches (includes UI for switching it back) _ https://github.com/processing/processing/pull/6048 -from Casey -_ Math for BLEND incorrect in the reference? -_ https://github.com/processing/processing-docs/issues/762 -_ .setAngle() for PVector? -_ https://github.com/processing/processing-docs/issues/744 -_ How much of the attrib*() functions should be documented? -_ https://github.com/processing/processing-docs/issues/172 - - misc _ should we drop the 'default' prefix from the ex handler so it's not static? _ http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html diff --git a/doclet/ReferenceGenerator/processingrefBuild.sh b/doclet/ReferenceGenerator/processingrefBuild.sh index 946f6afe9..f773dceab 100755 --- a/doclet/ReferenceGenerator/processingrefBuild.sh +++ b/doclet/ReferenceGenerator/processingrefBuild.sh @@ -11,8 +11,8 @@ REFERENCES_OUT_PATH=../../../processing-website/content/references/translations/ echo "[REFERENCE GENERATOR] Source Path :: $PROCESSING_SRC_PATH" echo "[REFERENCE GENERATOR] Library Path :: $PROCESSING_LIB_PATH" -#you can pass one argument "sound" or "video" to generate those libraries separately -#if there is no argument it will generate everything +# You can pass one argument "sound" or "video" to generate those libraries separately +# if there is no argument it will generate everything if [ $# -eq 0 ] then echo "No arguments supplied, generating everything" @@ -34,7 +34,7 @@ if [ $# -eq 0 ] $PROCESSING_LIB_PATH/serial/src/processing/serial/*.java \ $PROCESSING_LIB_PATH/../../../processing-video/src/processing/video/*.java \ $PROCESSING_LIB_PATH/../../../processing-sound/src/processing/sound/*.java" - elif [ $1 = "processing" ] + elif [ $1 = "processing" ] then echo "Generating processing references" echo "[REFERENCE GENERATOR] Removing previous version of the ref..." @@ -53,7 +53,7 @@ if [ $# -eq 0 ] $PROCESSING_LIB_PATH/io/src/processing/io/*.java \ $PROCESSING_LIB_PATH/net/src/processing/net/*.java \ $PROCESSING_LIB_PATH/serial/src/processing/serial/*.java" - else + else echo "Generating $1 library" echo "[REFERENCE GENERATOR] Removing previous version of the ref..." rm -rf $REFERENCES_OUT_PATH/$1 @@ -73,4 +73,4 @@ javadoc -doclet ProcessingWeblet \ -imagedir images \ -encoding UTF-8 \ $FOLDERS \ - -noisy \ No newline at end of file + -noisy diff --git a/doclet/ReferenceGenerator/src/writers/ClassWriter.java b/doclet/ReferenceGenerator/src/writers/ClassWriter.java index 6860226df..b8d6787cc 100644 --- a/doclet/ReferenceGenerator/src/writers/ClassWriter.java +++ b/doclet/ReferenceGenerator/src/writers/ClassWriter.java @@ -137,6 +137,9 @@ public class ClassWriter extends BaseWriter { { constructor = constructor.substring(0, constructor.length()-2) + ")"; } + else { + constructor += ")"; + } constructors.add(constructor); } return constructors; diff --git a/doclet/ReferenceGenerator/src/writers/FieldWriter.java b/doclet/ReferenceGenerator/src/writers/FieldWriter.java index f8dd7e32b..669245111 100644 --- a/doclet/ReferenceGenerator/src/writers/FieldWriter.java +++ b/doclet/ReferenceGenerator/src/writers/FieldWriter.java @@ -22,16 +22,22 @@ public class FieldWriter extends BaseWriter { public static void write(HashMap vars, FieldDoc doc, String classname) throws IOException { - String filename = getAnchor(doc); TemplateWriter templateWriter = new TemplateWriter(); JSONObject fieldJSON = new JSONObject(); + String fieldName; + if (getName(doc).contains("[]")) { + fieldName = getName(doc).replace("[]", ""); + } else { + fieldName = getName(doc); + } + String fileName; if (classname != "") { - fileName = jsonDir + classname + "_" + getName(doc) + ".json"; + fileName = jsonDir + classname + "_" + fieldName + ".json"; } else { - fileName = jsonDir + getName(doc) + ".json"; + fileName = jsonDir + fieldName + ".json"; } Tag[] tags = doc.tags(Shared.i().getWebrefTagName()); @@ -40,7 +46,6 @@ public class FieldWriter extends BaseWriter { try { - fieldJSON.put("type", "field"); fieldJSON.put("description", getWebDescriptionFromSource(doc)); fieldJSON.put("brief", getWebBriefFromSource(doc)); fieldJSON.put("category", category); @@ -49,8 +54,9 @@ public class FieldWriter extends BaseWriter { fieldJSON.put("related", getRelated(doc)); if(Shared.i().isRootLevel(doc.containingClass())){ - fieldJSON.put("classname", ""); + fieldJSON.put("type", "other"); } else { + fieldJSON.put("type", "field"); fieldJSON.put("classanchor", getLocalAnchor(doc.containingClass())); fieldJSON.put("parameters", getParentParam(doc)); String syntax = templateWriter.writePartial("field.syntax.partial", getSyntax(doc)); diff --git a/java/libraries/io/src/processing/io/GPIO.java b/java/libraries/io/src/processing/io/GPIO.java index 6dbea0ad3..315f257f7 100644 --- a/java/libraries/io/src/processing/io/GPIO.java +++ b/java/libraries/io/src/processing/io/GPIO.java @@ -94,16 +94,16 @@ public class GPIO { /** * Calls a function when the value of an input pin changes
*
- * The sketch method provided must accept a single integer (int) parameter, which is the + * The sketch method provided must accept a single integer (int) parameter, which is the * number of the GPIO pin that the interrupt occured on. As this method might be called * at any time, including when drawing to the display window isn't permitted, it is best - * to only set simple variables that are being responded to in the next draw() call, as + * to only set simple variables that are being responded to in the next draw() call, as * shown above. Calling functions of the Hardware I/O library at this point is certainly * possible.
*
- * The mode parameter determines when the function will be called: GPIO.FALLING occurs - * when the level changes from high to low, GPIO.RISING when the level changes from low - * to high, and GPIO.CHANGE when either occurs. + * The mode parameter determines when the function will be called: GPIO.FALLING occurs + * when the level changes from high to low, GPIO.RISING when the level changes from low + * to high, and GPIO.CHANGE when either occurs. * * @param pin GPIO pin * @param parent typically use "this" @@ -333,7 +333,7 @@ public class GPIO { * Allows interrupts to happen
*
* You can use noInterrupts() - * and interrupts() in tandem to make sure no interrupts are occuring + * and interrupts() in tandem to make sure no interrupts are occuring * while your sketch is doing a particular task. By default, interrupts * are enabled. * @@ -351,7 +351,7 @@ public class GPIO { /** * Prevents interrupts from happpening
*
- * You can use noInterrupts() and interrupts() + * You can use noInterrupts() and interrupts() * in tandem to make sure no interrupts are occuring while your sketch is doing a * particular task.
* br/> @@ -529,9 +529,9 @@ public class GPIO { /** * Waits for the value of an input pin to change
*
- * The mode parameter determines when the function will return: GPIO.FALLING occurs - * when the level changes from high to low, GPIO.RISING when the level changes from - * low to high, and GPIO.CHANGE when either occurs.
+ * The mode parameter determines when the function will return: GPIO.FALLING occurs + * when the level changes from high to low, GPIO.RISING when the level changes from + * low to high, and GPIO.CHANGE when either occurs.
*
* The optional timeout parameter determines how many milliseconds the function will * wait at the most. If the value of the input pin hasn't changed at this point, an @@ -550,9 +550,9 @@ public class GPIO { /** * Waits for the value of an input pin to change
*
- * The mode parameter determines when the function will return: GPIO.FALLING occurs - * when the level changes from high to low, GPIO.RISING when the level changes from - * low to high, and GPIO.CHANGE when either occurs.
+ * The mode parameter determines when the function will return: GPIO.FALLING occurs + * when the level changes from high to low, GPIO.RISING when the level changes from + * low to high, and GPIO.CHANGE when either occurs.
*
* The optional timeout parameter determines how many milliseconds the function will * wait at the most. If the value of the input pin hasn't changed at this point, an diff --git a/java/libraries/io/src/processing/io/I2C.java b/java/libraries/io/src/processing/io/I2C.java index c65ecc5c9..1c1933c48 100644 --- a/java/libraries/io/src/processing/io/I2C.java +++ b/java/libraries/io/src/processing/io/I2C.java @@ -124,7 +124,7 @@ public class I2C { * time. * * @webref I2C - * @webBrief Closes the I2C device. + * @webBrief Closes the I2C device */ public void close() { if (NativeInterface.isSimulated()) { @@ -150,12 +150,12 @@ public class I2C { *
* This executes any queued writes. Read() * implicitly ends the current transmission as well, hence calling - * endTransmission() afterwards is not necessary. + * endTransmission() afterwards is not necessary. * * @see beginTransmission * @see write * @webref I2C - * @webBrief Ends the current transmissions. + * @webBrief Ends the current transmissions */ public void endTransmission() { if (!transmitting) { @@ -212,10 +212,10 @@ public class I2C { /** * Read bytes from the attached device
*
- * You must call beginTransmission() before calling this function. This function + * You must call beginTransmission() before calling this function. This function * also ends the current transmission and sends any data that was queued using - * write() before. It is not necessary to call - * endTransmission() after read(). + * write() before. It is not necessary to call + * endTransmission() after read(). * * @param len number of bytes to read * @return bytes read from device @@ -223,7 +223,7 @@ public class I2C { * @see write * @see endTransmission * @webref I2C - * @webBrief Read bytes from the attached device. + * @webBrief Read bytes from the attached device */ public byte[] read(int len) { if (!transmitting) { @@ -253,15 +253,15 @@ public class I2C { /** * Add bytes to be written to the device
*
- * You must call beginTransmission() before calling this function. The actual - * writing takes part when read() or endTransmission() is being called. + * You must call beginTransmission() before calling this function. The actual + * writing takes part when read() or endTransmission() is being called. * * @param out bytes to be written * @see beginTransmission * @see read * @see endTransmission * @webref I2C - * @webBrief Add bytes to be written to the device. + * @webBrief Add bytes to be written to the device */ public void write(byte[] out) { if (!transmitting) { diff --git a/java/libraries/io/src/processing/io/SoftwareServo.java b/java/libraries/io/src/processing/io/SoftwareServo.java index df01fd8bf..321959664 100644 --- a/java/libraries/io/src/processing/io/SoftwareServo.java +++ b/java/libraries/io/src/processing/io/SoftwareServo.java @@ -83,10 +83,10 @@ public class SoftwareServo { /** * Attaches a servo motor to a GPIO pin
*
- * You must call this function before calling write(). Note that the servo motor - * will only be instructed to move after the first time write() is called.
+ * You must call this function before calling write(). Note that the servo motor + * will only be instructed to move after the first time write() is called.
*
- * The optional parameters minPulse and maxPulse control the minimum and maximum + * The optional parameters minPulse and maxPulse control the minimum and maximum * pulse width durations. The default values, identical to those of Arduino's * Servo class, should be compatible with most servo motors. * @@ -105,8 +105,8 @@ public class SoftwareServo { /** * Attaches a servo motor to a GPIO pin
*
- * You must call this function before calling write(). Note that the servo motor - * will only be instructed to move after the first time write() is called.
+ * You must call this function before calling write(). Note that the servo motor + * will only be instructed to move after the first time write() is called.
*
* The optional parameters minPulse and maxPulse control the minimum and maximum * pulse width durations. The default values, identical to those of Arduino's diff --git a/java/libraries/net/src/processing/net/Client.java b/java/libraries/net/src/processing/net/Client.java index 9b241a32f..5598c355f 100644 --- a/java/libraries/net/src/processing/net/Client.java +++ b/java/libraries/net/src/processing/net/Client.java @@ -37,7 +37,7 @@ import java.net.*; * listening on a different port, an exception is thrown. * * @webref client - * @webBrief The client class is used to create client Objects which connect to a server to exchange data. + * @webBrief The client class is used to create client Objects which connect to a server to exchange data * @instanceName client any variable of type Client * @usage Application * @see_external LIB_net/clientEvent @@ -321,7 +321,7 @@ public class Client implements Runnable { * * @webref client * @usage application - * @webBrief Returns the IP address of the machine as a String + * @webBrief Returns the IP address of the machine as a String */ public String ip() { if (socket != null){ @@ -422,7 +422,7 @@ public class Client implements Runnable { * * @webref client * @usage application - * @webBrief Reads a group of bytes from the buffer. + * @webBrief Reads a group of bytes from the buffer */ public byte[] readBytes() { synchronized (bufferLock) { @@ -596,7 +596,7 @@ public class Client implements Runnable { /** * - * Returns the all the data from the buffer as a String. This method + * Returns the all the data from the buffer as a String. This method * assumes the incoming characters are ASCII. If you want to transfer * Unicode data, first convert the String to a byte stream in the * representation of your choice (i.e. UTF8 or two-byte Unicode data), and @@ -604,7 +604,7 @@ public class Client implements Runnable { * * @webref client * @usage application - * @webBrief Returns the buffer as a String + * @webBrief Returns the buffer as a String */ public String readString() { byte b[] = readBytes(); @@ -626,7 +626,7 @@ public class Client implements Runnable { * * @webref client * @usage application - * @webBrief Returns the buffer as a String up to and including a particular character + * @webBrief Returns the buffer as a String up to and including a particular character * @param interesting character designated to mark the end of the data */ public String readStringUntil(int interesting) { @@ -644,7 +644,7 @@ public class Client implements Runnable { * * @webref client * @usage application - * @webBrief Writes bytes, chars, ints, bytes[], Strings + * @webBrief Writes bytes, chars, ints, bytes[], Strings * @param data data to write */ public void write(int data) { // will also cover char diff --git a/java/libraries/net/src/processing/net/Server.java b/java/libraries/net/src/processing/net/Server.java index 432d91643..dc354df44 100644 --- a/java/libraries/net/src/processing/net/Server.java +++ b/java/libraries/net/src/processing/net/Server.java @@ -44,7 +44,7 @@ import java.net.*; * @webref server * @usage application * @webBrief The server class is used to create server objects which send - * and receives data to and from its associated clients (other programs connected to it). + * and receives data to and from its associated clients (other programs connected to it) * @instanceName server any variable of type Server */ public class Server implements Runnable { @@ -118,7 +118,7 @@ public class Server implements Runnable { * Disconnect a particular client. * * @webref server - * @webBrief Disconnect a particular client. + * @webBrief Disconnect a particular client * @param client the client to disconnect */ public void disconnect(Client client) { @@ -188,7 +188,7 @@ public class Server implements Runnable { * into any trouble. * * @webref server - * @webBrief Return true if this server is still active. + * @webBrief Return true if this server is still active */ public boolean active() { return thread != null; @@ -215,7 +215,7 @@ public class Server implements Runnable { * Returns the next client in line with a new message. * * @webref server - * @webBrief Returns the next client in line with a new message. + * @webBrief Returns the next client in line with a new message * @usage application */ public Client available() { @@ -255,7 +255,7 @@ public class Server implements Runnable { * is still running. Otherwise, it will be automatically be shut down by the * host PApplet using dispose(), which is identical. * @webref server - * @webBrief Disconnects all clients and stops the server. + * @webBrief Disconnects all clients and stops the server * @usage application */ public void stop() { diff --git a/java/libraries/serial/src/processing/serial/Serial.java b/java/libraries/serial/src/processing/serial/Serial.java index d843963b7..6ff3909d8 100644 --- a/java/libraries/serial/src/processing/serial/Serial.java +++ b/java/libraries/serial/src/processing/serial/Serial.java @@ -38,7 +38,7 @@ import jssc.*; * Class for sending and receiving data using the serial communication protocol. * * @webref serial - * @webBrief Class for sending and receiving data using the serial communication protocol. + * @webBrief Class for sending and receiving data using the serial communication protocol * @instanceName serial any variable of type Serial * @usage Application * @see_external LIB_serial/serialEvent @@ -189,7 +189,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_available.xml * @webref serial - * @webBrief Returns the number of bytes available. + * @webBrief Returns the number of bytes available * @usage web_application */ public int available() { @@ -198,10 +198,10 @@ public class Serial implements SerialPortEventListener { /** - * Sets the number of bytes to buffer before calling serialEvent() + * Sets the number of bytes to buffer before calling serialEvent() * @generate Serial_buffer.xml * @webref serial - * @webBrief Sets the number of bytes to buffer before calling serialEvent() + * @webBrief Sets the number of bytes to buffer before calling serialEvent() * @usage web_application * @param size number of bytes to buffer */ @@ -215,7 +215,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_bufferUntil.xml * @webref serial - * @webBrief Sets a specific byte to buffer until before calling serialEvent(). + * @webBrief Sets a specific byte to buffer until before calling serialEvent() * @usage web_application * @param inByte the value to buffer until */ @@ -230,7 +230,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_clear.xml * @webref serial - * @webBrief Empty the buffer, removes all the data stored there. + * @webBrief Empty the buffer, removes all the data stored there * @usage web_application */ public void clear() { @@ -273,7 +273,7 @@ public class Serial implements SerialPortEventListener { * and clears the buffer. Useful when you just want the most * recent value sent over the port. * @webref serial - * @webBrief Returns last byte received or -1 if there is none available. + * @webBrief Returns last byte received or -1 if there is none available * @usage web_application */ public int last() { @@ -295,7 +295,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_lastChar.xml * @webref serial - * @webBrief Returns the last byte received as a char or -1 if there is none available. + * @webBrief Returns the last byte received as a char or -1 if there is none available * @usage web_application */ public char lastChar() { @@ -309,7 +309,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_list.xml * @webref serial - * @webBrief Gets a list of all available serial ports. + * @webBrief Gets a list of all available serial ports * @usage web_application */ public static String[] list() { @@ -326,7 +326,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_read.xml * @webref serial - * @webBrief Returns a number between 0 and 255 for the next byte that's waiting in the buffer. + * @webBrief Returns a number between 0 and 255 for the next byte that's waiting in the buffer * @usage web_application */ public int read() { @@ -354,7 +354,7 @@ public class Serial implements SerialPortEventListener { * byteBuffer, only those that fit are read. * @generate Serial_readBytes.xml * @webref serial - * @webBrief Reads a group of bytes from the buffer or null if there are none available. + * @webBrief Reads a group of bytes from the buffer or null if there are none available * @usage web_application */ public byte[] readBytes() { @@ -446,7 +446,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_readBytesUntil.xml * @webref serial - * @webBrief Reads from the port into a buffer of bytes up to and including a particular character. + * @webBrief Reads from the port into a buffer of bytes up to and including a particular character * @usage web_application * @param inByte character designated to mark the end of the data */ @@ -532,7 +532,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_readChar.xml * @webref serial - * @webBrief Returns the next byte in the buffer as a char. + * @webBrief Returns the next byte in the buffer as a char * @usage web_application */ public char readChar() { @@ -541,14 +541,14 @@ public class Serial implements SerialPortEventListener { /** - * Returns all the data from the buffer as a String or null if there is nothing available. + * Returns all the data from the buffer as a String or null if there is nothing available. * This method assumes the incoming characters are ASCII. If you want to transfer Unicode data, * first convert the String to a byte stream in the representation of your choice (i.e. UTF8 or * two-byte Unicode data), and send it as a byte array. * * @generate Serial_readString.xml * @webref serial - * @webBrief Returns all the data from the buffer as a String or null if there is nothing available. + * @webBrief Returns all the data from the buffer as a String or null if there is nothing available * @usage web_application */ public String readString() { @@ -570,7 +570,7 @@ public class Serial implements SerialPortEventListener { * (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. * * @webref serial - * @webBrief Combination of readBytesUntil() and readString(). + * @webBrief Combination of readBytesUntil() and readString() * @usage web_application * @param inByte character designated to mark the end of the data */ @@ -594,7 +594,7 @@ public class Serial implements SerialPortEventListener { * * @generate serialEvent.xml * @webref serial_event - * @webBrief Called when data is available. + * @webBrief Called when data is available * @usage web_application * @param event the port where new data is available */ @@ -679,7 +679,7 @@ public class Serial implements SerialPortEventListener { * * @generate Serial_stop.xml * @webref serial - * @webBrief Stops data communication on this port. + * @webBrief Stops data communication on this port * @usage web_application */ public void stop() { @@ -722,7 +722,7 @@ public class Serial implements SerialPortEventListener { /** - * Writes bytes, chars, ints, bytes[], Strings to the serial port + * Writes bytes, chars, ints, bytes[], Strings to the serial port * *

Advanced

* Write a String to the output. Note that this doesn't account @@ -737,7 +737,7 @@ public class Serial implements SerialPortEventListener { * (i.e. UTF8 or two-byte Unicode data), and send it as a byte array. * * @webref serial - * @webBrief Writes bytes, chars, ints, bytes[], Strings to the serial port + * @webBrief Writes bytes, chars, ints, bytes[], Strings to the serial port * @usage web_application * @param src data to write */ diff --git a/java/libraries/svg/.classpath b/java/libraries/svg/.classpath index e720065c6..2b0e67a5a 100644 --- a/java/libraries/svg/.classpath +++ b/java/libraries/svg/.classpath @@ -1,7 +1,7 @@ - + diff --git a/java/libraries/svg/build.xml b/java/libraries/svg/build.xml index 1b9ae317e..db7112d41 100644 --- a/java/libraries/svg/build.xml +++ b/java/libraries/svg/build.xml @@ -6,7 +6,7 @@ - + @@ -14,7 +14,7 @@ + value="https://archive.apache.org/dist/xmlgraphics/batik/binaries/${batik.zip}" /> diff --git a/java/libraries/svg/src/processing/svg/PGraphicsSVG.java b/java/libraries/svg/src/processing/svg/PGraphicsSVG.java index 788cb70ff..11ec0eb3f 100644 --- a/java/libraries/svg/src/processing/svg/PGraphicsSVG.java +++ b/java/libraries/svg/src/processing/svg/PGraphicsSVG.java @@ -75,12 +75,6 @@ public class PGraphicsSVG extends PGraphicsJava2D { } - protected void defaultSettings() { // ignore - super.defaultSettings(); - textMode = SHAPE; - } - - public void beginDraw() { DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); diff --git a/java/src/processing/mode/java/JavaTextArea.java b/java/src/processing/mode/java/JavaTextArea.java index c922ddebd..cd5b78be6 100644 --- a/java/src/processing/mode/java/JavaTextArea.java +++ b/java/src/processing/mode/java/JavaTextArea.java @@ -514,7 +514,7 @@ public class JavaTextArea extends PdeTextArea { */ protected void showSuggestion(DefaultListModel listModel, String subWord) { // TODO can this be ListModel instead? why is size() in DefaultListModel - // different from getSize() in ListModel (or are they, really?) + // different from getSize() in ListModel (or are they, really?) hideSuggestion(); if (listModel.size() != 0) { diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 04897afa4..df53a3fa0 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -85,16 +85,24 @@ public class Runner implements MessageConsumer { public Runner(JavaBuild build, RunnerListener listener) throws SketchException { this.listener = listener; -// this.sketch = sketch; this.build = build; checkLocalHost(); - if (listener instanceof JavaEditor) { - this.editor = (JavaEditor) listener; - sketchErr = editor.getConsole().getErr(); - sketchOut = editor.getConsole().getOut(); - } else { + if (listener instanceof RunnerListenerEdtAdapter) { + // RunnerListener gets wrapped so that it behaves on the EDT. + // Need to extract the wrapped Object and see if it's a Java Editor, + // in which case we'll be passing additional parameters to the PApplet. + // https://github.com/processing/processing/issues/5843 + RunnerListener wrapped = ((RunnerListenerEdtAdapter) listener).getWrapped(); + if (wrapped instanceof JavaEditor) { + editor = (JavaEditor) wrapped; + sketchErr = editor.getConsole().getErr(); + sketchOut = editor.getConsole().getOut(); + } + } + // If it's not a JavaEditor, then we don't redirect to a console. + if (editor == null) { sketchErr = System.err; sketchOut = System.out; } @@ -466,10 +474,8 @@ public class Runner implements MessageConsumer { } params.append(PApplet.ARGS_EXTERNAL); } - params.append(PApplet.ARGS_DISPLAY + "=" + runDisplay); - if (present) { params.append(PApplet.ARGS_PRESENT); // if (Preferences.getBoolean("run.present.exclusive")) { @@ -495,6 +501,7 @@ public class Runner implements MessageConsumer { if (args != null) { params.append(args); } + // Pass back the whole list return params; } diff --git a/todo.txt b/todo.txt index 4d3ebe3d3..a03481c6e 100755 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,32 @@ 1273 (4.0a4) -X replace about.bmp that was causing processing.exe to crash on startup +X “An error occurred while starting the application” with 4.0a3 on Windows +X replace about.bmp that was causing processing.exe to crash on startup X https://github.com/processing/processing4/issues/156 +X update to JDK 11.0.10 +X update from JNA 5.2.0 to 5.7.0 +X was having trouble with "java.lang.UnsatisfiedLinkError: Unable to load library 'CoreServices': Native library (darwin/libCoreServices.dylib) not found in resource path" +X https://github.com/fathominfo/processing-p5js-mode/issues/26 +X implement auto-download for JNA updates +X “Exception in thread "Contribution Uninstaller" NullPointerException” during Remove +X https://github.com/processing/processing4/issues/174 +X catch NoClassDefError in Platform.deleteFile() (still unclear of its cause) +X https://github.com/processing/processing4/issues/159 +_ https://github.com/processing/processing/issues/6185 +X need to set a nicer default font +X increases export size, but impact is so worth it +X Update JDK to 11.0.11+9 +X modernize the RegisteredMethods code to use collections classes w/ concurrency +X https://github.com/processing/processing4/pull/199 +X don't sort user's charset array when calling createFont() +X https://github.com/processing/processing4/issues/197 +X https://github.com/processing/processing4/pull/198 +X automatically lock closed issues +X https://github.com/apps/lock +X Display Window doesn't remember its position +X seems that --external not getting passed +X https://github.com/processing/processing4/issues/158 +X https://github.com/processing/processing/issues/5843 +X https://github.com/processing/processing/issues/5781 earlier o further streamline the downloader @@ -8,14 +34,57 @@ o https://github.com/processing/processing4/issues/47 o next video release o https://github.com/processing/processing-video/milestone/1 +contribs +X many updates in the docs portion of the repo +X https://github.com/processing/processing4/pull/191 +X fixing undo +X fix? https://github.com/processing/processing4/pull/175 +_ https://github.com/processing/processing/issues/4775 +X tweak the number of updates based on Akarshit's attempt +X https://github.com/processing/processing4/issues/201 +X https://github.com/processing/processing/pull/4097 + + +regressions +_ Code completion not working +_ https://github.com/processing/processing4/issues/177 + +_ when exporting an app, run xattr on it to handle "app is damaged" errors? +_ https://osxdaily.com/2019/02/13/fix-app-damaged-cant-be-opened-trash-error-mac/ +_ https://github.com/processing/processing/issues/4214 + +_ exporting on Linux is setting the wrong path? or an extra subfolder is used? +_ https://github.com/processing/processing/issues/6182 + +_ when lib downloads (batik) go dead, fallback to the download.processing.org version +_ or for now, tell users how to do it manually + +windows/scaling +_ we're turning off automatic UI scaling in Windows, should we turn it back on? +_ using -Dsun.java2d.uiScale.enabled=false inside config.xml for launch4j +_ this was for Java 9, and we should have better support now +_ also check whether this is set on Linux +_ Welcome screen doesn't size properly for HiDPI screens +_ https://github.com/processing/processing/issues/4896 +_ getSystemZoom() not available to splash screen +_ https://github.com/processing/processing4/issues/145 +_ move all platform code out that doesn't require additional setup? +_ i.e. all the things that rely on preferences can be inited separately (later) +_ include JNA so that sketches can also scale properly? +_ what happens re: getting scaled/high-res graphics? +_ make that a preference? (and double the size by default?) +_ pixelDensity() not working in exported Windows applications +_ https://github.com/processing/processing/issues/5414#issuecomment-841088518 already fixed in 4.x? (confirm/close on release) _ HDPI support GNOME desktop _ https://github.com/processing/processing/issues/6059 - _ remove the JRE Downloader _ https://github.com/processing/processing4/issues/155 +_ editor breakpoints out of the .pde files +_ https://github.com/processing/processing/issues/5848 +_ or at least avoid the multiple _ MovieMaker .mov not compatible with QuicktTime Player _ https://github.com/processing/processing/issues/6110 @@ -31,6 +100,9 @@ _ demo: https://github.com/jcodec/jcodec/blob/master/samples/main/java/org/jco decisions before final 4.0 release +_ Add ability to move ~/.processing directory +_ use ~/.config as parent, or $XDG_CONFIG_HOME +_ https://github.com/processing/processing/issues/6115 X Shutting off VAqua due to interface ugliness and Contribution Manager freezing _ https://github.com/processing/processing4/issues/129 _ now with a release 9 to cover Big Sur @@ -50,6 +122,8 @@ _ https://github.com/processing/processing4/issues/157 would like to fix +_ better command line support/basic language server support? +_ make it easier to use with other editors _ detach sketch name and folder name (use sketch.properties) _ better for git, etc _ single file thing is long gone @@ -57,11 +131,14 @@ _ introduce the idea of 'scraps' (ala gist) that are just single page blobs _ launch/psk files/import from web editor (more details below) _ ability to switch mode in p5 w/o saving/closing/etc _ trying to save the user from themselves here is just messier than needed +_ https://github.com/processing/processing4/issues/189 _ 'show sketch folder' weird when in temp folder _ ask to save first (sketch has not been saved yet) _ or make the temp folder part of the sketchbook _ same with adding files to an unsaved sketch, do we block that? -_ Add language support to Modes + + +_ add language support to Modes (request from Andres) _ https://github.com/processing/processing4/pull/14 _ this was a small change; rebase not really needed since needs rewrite anyway @@ -81,19 +158,7 @@ _ https://developer.apple.com/documentation/xcode/porting_your_macos_apps_to windows -_ we're turning off automatic UI scaling in Windows, should we turn it back on? -_ using -Dsun.java2d.uiScale.enabled=false inside config.xml for launch4j -_ this was for Java 9, and we should have better support now -_ also check whether this is set on Linux -_ Welcome screen doesn't size properly for HiDPI screens -_ https://github.com/processing/processing/issues/4896 -_ getSystemZoom() not available to splash screen -_ https://github.com/processing/processing4/issues/145 -_ move all platform code out that doesn't require additional setup? -_ i.e. all the things that rely on preferences can be inited separately (later) -_ “An error occurred while starting the application” with 4.0a3 on Windows -_ fixed by bypassing launch4j... need to figure out what's going on -_ https://github.com/processing/processing4/issues/156 +_ go back to including a .bat file? _ .\java\bin\java.exe -cp lib/pde.jar;core/library/core.jar;lib/jna.jar;lib/jna-platform.jar;lib/antlr-4.7.2-complete.jar;lib/ant.jar;lib/ant-launcher.jar -Djna.nosys=true -Dsun.java2d.uiScale.enabled=false -Djna.boot.library.path=lib -Djna.nounpack=true -Dsun.java2d.d3d=false -Dsun.java2d.ddoffscreen=false -Dsun.java2d.noddraw=true processing.app.Base _ launch4j doesn't work from folders with non-native charsets _ anything in CP1252 on an English Windows system is fine @@ -154,8 +219,6 @@ _ check with Casey re: shallow clone or approach _ show the recommended sw version for users' platform on the download page -_ fixing undo -_ https://github.com/processing/processing/issues/4775 _ reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform _ https://github.com/processing/processing4/issues/9 _ i18n support for Modes