picrate 0.3.0-java → 0.4.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +1 -1
- data/CHANGELOG.md +1 -2
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/lib/picrate.rb +1 -0
- data/lib/picrate/app.rb +4 -4
- data/lib/picrate/helper_methods.rb +0 -4
- data/lib/picrate/version.rb +1 -1
- data/library/color_group/color_group.rb +27 -0
- data/picrate.gemspec +1 -1
- data/pom.rb +5 -5
- data/pom.xml +5 -5
- data/src/main/java/monkstone/ColorUtil.java +57 -32
- data/src/main/java/processing/awt/PShapeJava2D.java +33 -9
- data/src/main/java/processing/awt/PSurfaceAWT.java +169 -76
- data/src/main/java/processing/core/PApplet.java +15921 -13981
- data/src/main/java/processing/core/PConstants.java +981 -475
- data/src/main/java/processing/core/PFont.java +202 -50
- data/src/main/java/processing/core/PGraphics.java +8470 -7323
- data/src/main/java/processing/core/PImage.java +212 -42
- data/src/main/java/processing/core/PMatrix.java +160 -21
- data/src/main/java/processing/core/PMatrix2D.java +178 -18
- data/src/main/java/processing/core/PMatrix3D.java +324 -48
- data/src/main/java/processing/core/PShape.java +42 -20
- data/src/main/java/processing/core/PShapeOBJ.java +91 -16
- data/src/main/java/processing/core/PShapeSVG.java +253 -53
- data/src/main/java/processing/core/PStyle.java +179 -34
- data/src/main/java/processing/core/PSurface.java +94 -13
- data/src/main/java/processing/core/PSurfaceNone.java +140 -35
- data/src/main/java/processing/core/PVector.java +87 -10
- data/src/main/java/processing/data/JSONObject.java +2 -2
- data/src/main/java/processing/event/Event.java +69 -86
- data/src/main/java/processing/event/MouseEvent.java +102 -102
- data/src/main/java/processing/opengl/PJOGL.java +3 -0
- data/test/color_group_test.rb +33 -0
- data/vendors/Rakefile +1 -1
- metadata +7 -4
| @@ -23,41 +23,186 @@ | |
| 23 23 |  | 
| 24 24 | 
             
            package processing.core;
         | 
| 25 25 |  | 
| 26 | 
            -
             | 
| 26 | 
            +
            /**
         | 
| 27 | 
            +
             *
         | 
| 28 | 
            +
             * @author tux
         | 
| 29 | 
            +
             */
         | 
| 27 30 | 
             
            public class PStyle implements PConstants {
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 31 | 
            +
             | 
| 32 | 
            +
                /**
         | 
| 33 | 
            +
                 *
         | 
| 34 | 
            +
                 */
         | 
| 35 | 
            +
                public int imageMode;
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                /**
         | 
| 38 | 
            +
                 *
         | 
| 39 | 
            +
                 */
         | 
| 40 | 
            +
                public int rectMode;
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                /**
         | 
| 43 | 
            +
                 *
         | 
| 44 | 
            +
                 */
         | 
| 45 | 
            +
                public int ellipseMode;
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                /**
         | 
| 48 | 
            +
                 *
         | 
| 49 | 
            +
                 */
         | 
| 50 | 
            +
                public int shapeMode;
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                /**
         | 
| 53 | 
            +
                 *
         | 
| 54 | 
            +
                 */
         | 
| 55 | 
            +
                public int blendMode;
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                /**
         | 
| 58 | 
            +
                 *
         | 
| 59 | 
            +
                 */
         | 
| 60 | 
            +
                public int colorMode;
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                /**
         | 
| 63 | 
            +
                 *
         | 
| 64 | 
            +
                 */
         | 
| 65 | 
            +
                public float colorModeX;
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                /**
         | 
| 68 | 
            +
                 *
         | 
| 69 | 
            +
                 */
         | 
| 70 | 
            +
                public float colorModeY;
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                /**
         | 
| 73 | 
            +
                 *
         | 
| 74 | 
            +
                 */
         | 
| 75 | 
            +
                public float colorModeZ;
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                /**
         | 
| 78 | 
            +
                 *
         | 
| 79 | 
            +
                 */
         | 
| 80 | 
            +
                public float colorModeA;
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                /**
         | 
| 83 | 
            +
                 *
         | 
| 84 | 
            +
                 */
         | 
| 85 | 
            +
                public boolean tint;
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                /**
         | 
| 88 | 
            +
                 *
         | 
| 89 | 
            +
                 */
         | 
| 90 | 
            +
                public int tintColor;
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                /**
         | 
| 93 | 
            +
                 *
         | 
| 94 | 
            +
                 */
         | 
| 95 | 
            +
                public boolean fill;
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                /**
         | 
| 98 | 
            +
                 *
         | 
| 99 | 
            +
                 */
         | 
| 100 | 
            +
                public int fillColor;
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                /**
         | 
| 103 | 
            +
                 *
         | 
| 104 | 
            +
                 */
         | 
| 105 | 
            +
                public boolean stroke;
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                /**
         | 
| 108 | 
            +
                 *
         | 
| 109 | 
            +
                 */
         | 
| 110 | 
            +
                public int strokeColor;
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                /**
         | 
| 113 | 
            +
                 *
         | 
| 114 | 
            +
                 */
         | 
| 115 | 
            +
                public float strokeWeight;
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                /**
         | 
| 118 | 
            +
                 *
         | 
| 119 | 
            +
                 */
         | 
| 120 | 
            +
                public int strokeCap;
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                /**
         | 
| 123 | 
            +
                 *
         | 
| 124 | 
            +
                 */
         | 
| 125 | 
            +
                public int strokeJoin;
         | 
| 50 126 |  | 
| 51 127 | 
             
              // TODO these fellas are inconsistent, and may need to go elsewhere
         | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 128 | 
            +
             | 
| 129 | 
            +
                /**
         | 
| 130 | 
            +
                 *
         | 
| 131 | 
            +
                 */
         | 
| 132 | 
            +
              public float ambientR,
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                /**
         | 
| 135 | 
            +
                 *
         | 
| 136 | 
            +
                 */
         | 
| 137 | 
            +
                ambientG,
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                /**
         | 
| 140 | 
            +
                 *
         | 
| 141 | 
            +
                 */
         | 
| 142 | 
            +
                ambientB;
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                /**
         | 
| 145 | 
            +
                 *
         | 
| 146 | 
            +
                 */
         | 
| 147 | 
            +
                public float specularR,
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                /**
         | 
| 150 | 
            +
                 *
         | 
| 151 | 
            +
                 */
         | 
| 152 | 
            +
                specularG,
         | 
| 153 | 
            +
             | 
| 154 | 
            +
                /**
         | 
| 155 | 
            +
                 *
         | 
| 156 | 
            +
                 */
         | 
| 157 | 
            +
                specularB;
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                /**
         | 
| 160 | 
            +
                 *
         | 
| 161 | 
            +
                 */
         | 
| 162 | 
            +
                public float emissiveR,
         | 
| 163 | 
            +
             | 
| 164 | 
            +
                /**
         | 
| 165 | 
            +
                 *
         | 
| 166 | 
            +
                 */
         | 
| 167 | 
            +
                emissiveG,
         | 
| 168 | 
            +
             | 
| 169 | 
            +
                /**
         | 
| 170 | 
            +
                 *
         | 
| 171 | 
            +
                 */
         | 
| 172 | 
            +
                emissiveB;
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                /**
         | 
| 175 | 
            +
                 *
         | 
| 176 | 
            +
                 */
         | 
| 177 | 
            +
                public float shininess;
         | 
| 178 | 
            +
             | 
| 179 | 
            +
                /**
         | 
| 180 | 
            +
                 *
         | 
| 181 | 
            +
                 */
         | 
| 182 | 
            +
                public PFont textFont;
         | 
| 183 | 
            +
             | 
| 184 | 
            +
                /**
         | 
| 185 | 
            +
                 *
         | 
| 186 | 
            +
                 */
         | 
| 187 | 
            +
                public int textAlign;
         | 
| 188 | 
            +
             | 
| 189 | 
            +
                /**
         | 
| 190 | 
            +
                 *
         | 
| 191 | 
            +
                 */
         | 
| 192 | 
            +
                public int textAlignY;
         | 
| 193 | 
            +
             | 
| 194 | 
            +
                /**
         | 
| 195 | 
            +
                 *
         | 
| 196 | 
            +
                 */
         | 
| 197 | 
            +
                public int textMode;
         | 
| 198 | 
            +
             | 
| 199 | 
            +
                /**
         | 
| 200 | 
            +
                 *
         | 
| 201 | 
            +
                 */
         | 
| 202 | 
            +
                public float textSize;
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                /**
         | 
| 205 | 
            +
                 *
         | 
| 206 | 
            +
                 */
         | 
| 207 | 
            +
                public float textLeading;
         | 
| 63 208 | 
             
            }
         | 
| @@ -22,7 +22,10 @@ | |
| 22 22 |  | 
| 23 23 | 
             
            package processing.core;
         | 
| 24 24 |  | 
| 25 | 
            -
             | 
| 25 | 
            +
            /**
         | 
| 26 | 
            +
             *
         | 
| 27 | 
            +
             * @author tux
         | 
| 28 | 
            +
             */
         | 
| 26 29 | 
             
            public interface PSurface {
         | 
| 27 30 | 
             
              /**
         | 
| 28 31 | 
             
               * Minimum dimensions for the window holding an applet. This varies between
         | 
| @@ -32,9 +35,18 @@ public interface PSurface { | |
| 32 35 | 
             
               * sizes to be negative numbers.
         | 
| 33 36 | 
             
               */
         | 
| 34 37 | 
             
              static public final int MIN_WINDOW_WIDTH = 128;
         | 
| 35 | 
            -
             | 
| 38 | 
            +
             | 
| 39 | 
            +
                /**
         | 
| 40 | 
            +
                 *
         | 
| 41 | 
            +
                 */
         | 
| 42 | 
            +
                static public final int MIN_WINDOW_HEIGHT = 128;
         | 
| 36 43 |  | 
| 37 44 | 
             
              // renderer that doesn't draw to the screen
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                /**
         | 
| 47 | 
            +
                 *
         | 
| 48 | 
            +
                 * @param sketch
         | 
| 49 | 
            +
                 */
         | 
| 38 50 | 
             
              public void initOffscreen(PApplet sketch);
         | 
| 39 51 |  | 
| 40 52 | 
             
              // considering removal in favor of separate Component classes for appropriate renderers
         | 
| @@ -44,6 +56,11 @@ public interface PSurface { | |
| 44 56 | 
             
              //public Frame initFrame(PApplet sketch, Color backgroundColor,
         | 
| 45 57 | 
             
            //  public void initFrame(PApplet sketch, int backgroundColor,
         | 
| 46 58 | 
             
            //                        int deviceIndex, boolean fullScreen, boolean spanDisplays);
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                /**
         | 
| 61 | 
            +
                 *
         | 
| 62 | 
            +
                 * @param sketch
         | 
| 63 | 
            +
                 */
         | 
| 47 64 | 
             
              public void initFrame(PApplet sketch);
         | 
| 48 65 |  | 
| 49 66 | 
             
              /**
         | 
| @@ -53,6 +70,7 @@ public interface PSurface { | |
| 53 70 | 
             
               * and using this method means you're willing to deal with underlying
         | 
| 54 71 | 
             
               * implementation changes and that you won't throw a fit like a toddler
         | 
| 55 72 | 
             
               * if your code breaks sometime in the future.
         | 
| 73 | 
            +
                 * @return 
         | 
| 56 74 | 
             
               */
         | 
| 57 75 | 
             
              public Object getNative();
         | 
| 58 76 |  | 
| @@ -62,30 +80,53 @@ public interface PSurface { | |
| 62 80 | 
             
              // Silly, but prevents a lot of rewrite and extra methods for little benefit.
         | 
| 63 81 | 
             
              // However, maybe prevents us from having to document the 'frame' variable?
         | 
| 64 82 |  | 
| 65 | 
            -
              /** Set the window (and dock, or whatever necessary) title. | 
| 83 | 
            +
              /** Set the window (and dock, or whatever necessary) title.
         | 
| 84 | 
            +
                 * @param title */
         | 
| 66 85 | 
             
              public void setTitle(String title);
         | 
| 67 86 |  | 
| 68 | 
            -
              /** Show or hide the window. | 
| 87 | 
            +
              /** Show or hide the window.
         | 
| 88 | 
            +
                 * @param visible */
         | 
| 69 89 | 
             
              public void setVisible(boolean visible);
         | 
| 70 90 |  | 
| 71 | 
            -
              /** Set true if we want to resize things (default is not resizable) | 
| 91 | 
            +
              /** Set true if we want to resize things (default is not resizable)
         | 
| 92 | 
            +
                 * @param resizable */
         | 
| 72 93 | 
             
              public void setResizable(boolean resizable);
         | 
| 73 94 |  | 
| 74 | 
            -
              /** Dumb name, but inherited from Frame and no better ideas. | 
| 95 | 
            +
              /** Dumb name, but inherited from Frame and no better ideas.
         | 
| 96 | 
            +
                 * @param always */
         | 
| 75 97 | 
             
              public void setAlwaysOnTop(boolean always);
         | 
| 76 98 |  | 
| 77 | 
            -
             | 
| 99 | 
            +
                /**
         | 
| 100 | 
            +
                 *
         | 
| 101 | 
            +
                 * @param icon
         | 
| 102 | 
            +
                 */
         | 
| 103 | 
            +
                public void setIcon(PImage icon);
         | 
| 78 104 |  | 
| 79 105 | 
             
              //
         | 
| 80 106 |  | 
| 81 107 | 
             
            //  public void placeWindow(int[] location);
         | 
| 82 108 |  | 
| 109 | 
            +
                /**
         | 
| 110 | 
            +
                 *
         | 
| 111 | 
            +
                 * @param location
         | 
| 112 | 
            +
                 * @param editorLocation
         | 
| 113 | 
            +
                 */
         | 
| 114 | 
            +
             | 
| 83 115 | 
             
              public void placeWindow(int[] location, int[] editorLocation);
         | 
| 84 116 |  | 
| 85 117 | 
             
              //public void placeFullScreen(boolean hideStop);
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                /**
         | 
| 120 | 
            +
                 *
         | 
| 121 | 
            +
                 * @param stopColor
         | 
| 122 | 
            +
                 */
         | 
| 86 123 | 
             
              public void placePresent(int stopColor);
         | 
| 87 124 |  | 
| 88 125 | 
             
              // Sketch is running from the PDE, set up messaging back to the PDE
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                /**
         | 
| 128 | 
            +
                 *
         | 
| 129 | 
            +
                 */
         | 
| 89 130 | 
             
              public void setupExternalMessages();
         | 
| 90 131 |  | 
| 91 132 | 
             
              //
         | 
| @@ -93,9 +134,20 @@ public interface PSurface { | |
| 93 134 | 
             
              // sets displayWidth/Height inside PApplet
         | 
| 94 135 | 
             
              //public void checkDisplaySize();
         | 
| 95 136 |  | 
| 137 | 
            +
                /**
         | 
| 138 | 
            +
                 *
         | 
| 139 | 
            +
                 * @param x
         | 
| 140 | 
            +
                 * @param y
         | 
| 141 | 
            +
                 */
         | 
| 142 | 
            +
             | 
| 96 143 | 
             
              public void setLocation(int x, int y);
         | 
| 97 144 |  | 
| 98 | 
            -
             | 
| 145 | 
            +
                /**
         | 
| 146 | 
            +
                 *
         | 
| 147 | 
            +
                 * @param width
         | 
| 148 | 
            +
                 * @param height
         | 
| 149 | 
            +
                 */
         | 
| 150 | 
            +
                public void setSize(int width, int height);
         | 
| 99 151 |  | 
| 100 152 | 
             
            //  /**
         | 
| 101 153 | 
             
            //   * Called by {@link PApplet#createGraphics} to initialize the
         | 
| @@ -118,6 +170,11 @@ public interface PSurface { | |
| 118 170 | 
             
            //   */
         | 
| 119 171 | 
             
            //  public void setSmooth(int level);
         | 
| 120 172 |  | 
| 173 | 
            +
                /**
         | 
| 174 | 
            +
                 *
         | 
| 175 | 
            +
                 * @param fps
         | 
| 176 | 
            +
                 */
         | 
| 177 | 
            +
             | 
| 121 178 | 
             
              public void setFrameRate(float fps);
         | 
| 122 179 |  | 
| 123 180 | 
             
            //  // called on the first frame so that the now-visible drawing surface can
         | 
| @@ -129,13 +186,30 @@ public interface PSurface { | |
| 129 186 |  | 
| 130 187 | 
             
              //
         | 
| 131 188 |  | 
| 189 | 
            +
                /**
         | 
| 190 | 
            +
                 *
         | 
| 191 | 
            +
                 * @param kind
         | 
| 192 | 
            +
                 */
         | 
| 193 | 
            +
             | 
| 132 194 | 
             
              public void setCursor(int kind);
         | 
| 133 195 |  | 
| 134 | 
            -
             | 
| 196 | 
            +
                /**
         | 
| 197 | 
            +
                 *
         | 
| 198 | 
            +
                 * @param image
         | 
| 199 | 
            +
                 * @param hotspotX
         | 
| 200 | 
            +
                 * @param hotspotY
         | 
| 201 | 
            +
                 */
         | 
| 202 | 
            +
                public void setCursor(PImage image, int hotspotX, int hotspotY);
         | 
| 135 203 |  | 
| 136 | 
            -
             | 
| 204 | 
            +
                /**
         | 
| 205 | 
            +
                 *
         | 
| 206 | 
            +
                 */
         | 
| 207 | 
            +
                public void showCursor();
         | 
| 137 208 |  | 
| 138 | 
            -
             | 
| 209 | 
            +
                /**
         | 
| 210 | 
            +
                 *
         | 
| 211 | 
            +
                 */
         | 
| 212 | 
            +
                public void hideCursor();
         | 
| 139 213 |  | 
| 140 214 | 
             
              //
         | 
| 141 215 |  | 
| @@ -149,7 +223,10 @@ public interface PSurface { | |
| 149 223 | 
             
               */
         | 
| 150 224 | 
             
              public void pauseThread();
         | 
| 151 225 |  | 
| 152 | 
            -
             | 
| 226 | 
            +
                /**
         | 
| 227 | 
            +
                 *
         | 
| 228 | 
            +
                 */
         | 
| 229 | 
            +
                public void resumeThread();
         | 
| 153 230 |  | 
| 154 231 | 
             
              /**
         | 
| 155 232 | 
             
               * Stop the animation thread (set it null)
         | 
| @@ -157,5 +234,9 @@ public interface PSurface { | |
| 157 234 | 
             
               */
         | 
| 158 235 | 
             
              public boolean stopThread();
         | 
| 159 236 |  | 
| 160 | 
            -
             | 
| 237 | 
            +
                /**
         | 
| 238 | 
            +
                 *
         | 
| 239 | 
            +
                 * @return
         | 
| 240 | 
            +
                 */
         | 
| 241 | 
            +
                public boolean isStopped();
         | 
| 161 242 | 
             
            }
         | 
| @@ -28,23 +28,55 @@ package processing.core; | |
| 28 28 | 
             
             * class for other drawing surfaces. It includes the standard rendering loop.
         | 
| 29 29 | 
             
             */
         | 
| 30 30 | 
             
            public class PSurfaceNone implements PSurface {
         | 
| 31 | 
            -
              protected PApplet sketch;
         | 
| 32 | 
            -
              protected PGraphics graphics;
         | 
| 33 31 |  | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 32 | 
            +
                /**
         | 
| 33 | 
            +
                 *
         | 
| 34 | 
            +
                 */
         | 
| 35 | 
            +
                protected PApplet sketch;
         | 
| 37 36 |  | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 37 | 
            +
                /**
         | 
| 38 | 
            +
                 *
         | 
| 39 | 
            +
                 */
         | 
| 40 | 
            +
                protected PGraphics graphics;
         | 
| 40 41 |  | 
| 42 | 
            +
                /**
         | 
| 43 | 
            +
                 *
         | 
| 44 | 
            +
                 */
         | 
| 45 | 
            +
                protected Thread thread;
         | 
| 41 46 |  | 
| 42 | 
            -
             | 
| 47 | 
            +
                /**
         | 
| 48 | 
            +
                 *
         | 
| 49 | 
            +
                 */
         | 
| 50 | 
            +
                protected boolean paused;
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                /**
         | 
| 53 | 
            +
                 *
         | 
| 54 | 
            +
                 */
         | 
| 55 | 
            +
                protected Object pauseObject = new Object();
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                /**
         | 
| 58 | 
            +
                 *
         | 
| 59 | 
            +
                 */
         | 
| 60 | 
            +
                protected float frameRateTarget = 60;
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                /**
         | 
| 63 | 
            +
                 *
         | 
| 64 | 
            +
                 */
         | 
| 65 | 
            +
                protected long frameRatePeriod = 1000000000L / 60L;
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                /**
         | 
| 68 | 
            +
                 *
         | 
| 69 | 
            +
                 * @param graphics
         | 
| 70 | 
            +
                 */
         | 
| 71 | 
            +
                public PSurfaceNone(PGraphics graphics) {
         | 
| 43 72 | 
             
                this.graphics = graphics;
         | 
| 44 73 | 
             
              }
         | 
| 45 74 |  | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 75 | 
            +
                /**
         | 
| 76 | 
            +
                 *
         | 
| 77 | 
            +
                 * @param sketch
         | 
| 78 | 
            +
                 */
         | 
| 79 | 
            +
                @Override
         | 
| 48 80 | 
             
              public void initOffscreen(PApplet sketch) {
         | 
| 49 81 | 
             
                this.sketch = sketch;
         | 
| 50 82 |  | 
| @@ -56,6 +88,11 @@ public class PSurfaceNone implements PSurface { | |
| 56 88 | 
             
            //    return null;
         | 
| 57 89 | 
             
            //  }
         | 
| 58 90 |  | 
| 91 | 
            +
                /**
         | 
| 92 | 
            +
                 *
         | 
| 93 | 
            +
                 * @param sketch
         | 
| 94 | 
            +
                 */
         | 
| 95 | 
            +
             | 
| 59 96 |  | 
| 60 97 | 
             
              @Override
         | 
| 61 98 | 
             
              public void initFrame(PApplet sketch) {/*, int backgroundColor,
         | 
| @@ -72,42 +109,57 @@ public class PSurfaceNone implements PSurface { | |
| 72 109 | 
             
              }
         | 
| 73 110 |  | 
| 74 111 |  | 
| 75 | 
            -
              /** Set the window (and dock, or whatever necessary) title. | 
| 112 | 
            +
              /** Set the window (and dock, or whatever necessary) title.
         | 
| 113 | 
            +
                 * @param title */
         | 
| 76 114 | 
             
              @Override
         | 
| 77 115 | 
             
              public void setTitle(String title) {
         | 
| 78 116 | 
             
                // You're in a utopian PSurface implementation where titles don't exist.
         | 
| 79 117 | 
             
              }
         | 
| 80 118 |  | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 119 | 
            +
                /**
         | 
| 120 | 
            +
                 *
         | 
| 121 | 
            +
                 * @param image
         | 
| 122 | 
            +
                 */
         | 
| 123 | 
            +
                @Override
         | 
| 83 124 | 
             
              public void setIcon(PImage image) {
         | 
| 84 125 | 
             
                // I ain't visible, man.
         | 
| 85 126 | 
             
              }
         | 
| 86 127 |  | 
| 87 128 |  | 
| 88 | 
            -
              /** Show or hide the window. | 
| 129 | 
            +
              /** Show or hide the window.
         | 
| 130 | 
            +
                 * @param visible */
         | 
| 89 131 | 
             
              @Override
         | 
| 90 132 | 
             
              public void setVisible(boolean visible) {
         | 
| 91 133 | 
             
                // I'm always invisible. You can't catch me.
         | 
| 92 134 | 
             
              }
         | 
| 93 135 |  | 
| 94 136 |  | 
| 95 | 
            -
              /** Set true if we want to resize things (default is not resizable) | 
| 137 | 
            +
              /** Set true if we want to resize things (default is not resizable)
         | 
| 138 | 
            +
                 * @param resizable */
         | 
| 96 139 | 
             
              @Override
         | 
| 97 140 | 
             
              public void setResizable(boolean resizable) {
         | 
| 98 141 | 
             
                // I don't need size to know my worth.
         | 
| 99 142 | 
             
              }
         | 
| 100 143 |  | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 144 | 
            +
                /**
         | 
| 145 | 
            +
                 *
         | 
| 146 | 
            +
                 * @param location
         | 
| 147 | 
            +
                 * @param editorLocation
         | 
| 148 | 
            +
                 */
         | 
| 149 | 
            +
                @Override
         | 
| 103 150 | 
             
              public void placeWindow(int[] location, int[] editorLocation) { }
         | 
| 104 151 |  | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 152 | 
            +
                /**
         | 
| 153 | 
            +
                 *
         | 
| 154 | 
            +
                 * @param stopColor
         | 
| 155 | 
            +
                 */
         | 
| 156 | 
            +
                @Override
         | 
| 107 157 | 
             
              public void placePresent(int stopColor) { }
         | 
| 108 158 |  | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 159 | 
            +
                /**
         | 
| 160 | 
            +
                 *
         | 
| 161 | 
            +
                 */
         | 
| 162 | 
            +
                @Override
         | 
| 111 163 | 
             
              public void setupExternalMessages() { }
         | 
| 112 164 |  | 
| 113 165 |  | 
| @@ -117,14 +169,24 @@ public class PSurfaceNone implements PSurface { | |
| 117 169 |  | 
| 118 170 | 
             
              //
         | 
| 119 171 |  | 
| 172 | 
            +
                /**
         | 
| 173 | 
            +
                 *
         | 
| 174 | 
            +
                 * @param x
         | 
| 175 | 
            +
                 * @param y
         | 
| 176 | 
            +
                 */
         | 
| 177 | 
            +
             | 
| 120 178 |  | 
| 121 179 | 
             
              @Override
         | 
| 122 180 | 
             
              public void setLocation(int x, int y) {
         | 
| 123 181 | 
             
                // I'm everywhere, because I'm nowhere.
         | 
| 124 182 | 
             
              }
         | 
| 125 183 |  | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 184 | 
            +
                /**
         | 
| 185 | 
            +
                 *
         | 
| 186 | 
            +
                 * @param wide
         | 
| 187 | 
            +
                 * @param high
         | 
| 188 | 
            +
                 */
         | 
| 189 | 
            +
                @Override
         | 
| 128 190 | 
             
              public void setSize(int wide, int high) {
         | 
| 129 191 | 
             
                if (PApplet.DEBUG) {
         | 
| 130 192 | 
             
                  //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
         | 
| @@ -169,17 +231,39 @@ public class PSurfaceNone implements PSurface { | |
| 169 231 | 
             
            //    // TODO Auto-generated method stub
         | 
| 170 232 | 
             
            //  }
         | 
| 171 233 |  | 
| 234 | 
            +
                /**
         | 
| 235 | 
            +
                 *
         | 
| 236 | 
            +
                 * @param kind
         | 
| 237 | 
            +
                 */
         | 
| 238 | 
            +
             | 
| 172 239 | 
             
              public void setCursor(int kind) { }
         | 
| 173 240 |  | 
| 174 | 
            -
             | 
| 241 | 
            +
                /**
         | 
| 242 | 
            +
                 *
         | 
| 243 | 
            +
                 * @param image
         | 
| 244 | 
            +
                 * @param hotspotX
         | 
| 245 | 
            +
                 * @param hotspotY
         | 
| 246 | 
            +
                 */
         | 
| 247 | 
            +
                public void setCursor(PImage image, int hotspotX, int hotspotY) { }
         | 
| 175 248 |  | 
| 176 | 
            -
             | 
| 249 | 
            +
                /**
         | 
| 250 | 
            +
                 *
         | 
| 251 | 
            +
                 */
         | 
| 252 | 
            +
                public void showCursor() { }
         | 
| 177 253 |  | 
| 178 | 
            -
             | 
| 254 | 
            +
                /**
         | 
| 255 | 
            +
                 *
         | 
| 256 | 
            +
                 */
         | 
| 257 | 
            +
                public void hideCursor() { }
         | 
| 179 258 |  | 
| 180 259 |  | 
| 181 260 | 
             
              //
         | 
| 182 261 |  | 
| 262 | 
            +
                /**
         | 
| 263 | 
            +
                 *
         | 
| 264 | 
            +
                 * @return
         | 
| 265 | 
            +
                 */
         | 
| 266 | 
            +
             | 
| 183 267 |  | 
| 184 268 | 
             
              public Thread createThread() {
         | 
| 185 269 | 
             
                return new AnimationThread();
         | 
| @@ -205,8 +289,11 @@ public class PSurfaceNone implements PSurface { | |
| 205 289 | 
             
                return true;
         | 
| 206 290 | 
             
              }
         | 
| 207 291 |  | 
| 208 | 
            -
             | 
| 209 | 
            -
             | 
| 292 | 
            +
                /**
         | 
| 293 | 
            +
                 *
         | 
| 294 | 
            +
                 * @return
         | 
| 295 | 
            +
                 */
         | 
| 296 | 
            +
                public boolean isStopped() {
         | 
| 210 297 | 
             
                return thread == null || !thread.isAlive();
         | 
| 211 298 | 
             
              }
         | 
| 212 299 |  | 
| @@ -219,6 +306,10 @@ public class PSurfaceNone implements PSurface { | |
| 219 306 |  | 
| 220 307 |  | 
| 221 308 | 
             
              // halts the animation thread if the pause flag is set
         | 
| 309 | 
            +
             | 
| 310 | 
            +
                /**
         | 
| 311 | 
            +
                 *
         | 
| 312 | 
            +
                 */
         | 
| 222 313 | 
             
              protected void checkPause() {
         | 
| 223 314 | 
             
                if (paused) {
         | 
| 224 315 | 
             
                  synchronized (pauseObject) {
         | 
| @@ -233,29 +324,43 @@ public class PSurfaceNone implements PSurface { | |
| 233 324 | 
             
            //    PApplet.debug("done with pause");
         | 
| 234 325 | 
             
              }
         | 
| 235 326 |  | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 327 | 
            +
                /**
         | 
| 328 | 
            +
                 *
         | 
| 329 | 
            +
                 */
         | 
| 330 | 
            +
                public void resumeThread() {
         | 
| 238 331 | 
             
                paused = false;
         | 
| 239 332 | 
             
                synchronized (pauseObject) {
         | 
| 240 333 | 
             
                  pauseObject.notifyAll();  // wake up the animation thread
         | 
| 241 334 | 
             
                }
         | 
| 242 335 | 
             
              }
         | 
| 243 336 |  | 
| 244 | 
            -
             | 
| 245 | 
            -
             | 
| 337 | 
            +
                /**
         | 
| 338 | 
            +
                 *
         | 
| 339 | 
            +
                 * @param fps
         | 
| 340 | 
            +
                 */
         | 
| 341 | 
            +
                public void setFrameRate(float fps) {
         | 
| 246 342 | 
             
                frameRateTarget = fps;
         | 
| 247 343 | 
             
                frameRatePeriod = (long) (1000000000.0 / frameRateTarget);
         | 
| 248 344 | 
             
                //g.setFrameRate(fps);
         | 
| 249 345 | 
             
              }
         | 
| 250 346 |  | 
| 347 | 
            +
                /**
         | 
| 348 | 
            +
                 *
         | 
| 349 | 
            +
                 */
         | 
| 350 | 
            +
                public class AnimationThread extends Thread {
         | 
| 251 351 |  | 
| 252 | 
            -
             | 
| 253 | 
            -
             | 
| 254 | 
            -
             | 
| 352 | 
            +
                  /**
         | 
| 353 | 
            +
                   *
         | 
| 354 | 
            +
                   */
         | 
| 355 | 
            +
                  public AnimationThread() {
         | 
| 255 356 | 
             
                  super("Animation Thread");
         | 
| 256 357 | 
             
                }
         | 
| 257 358 |  | 
| 258 359 | 
             
                // broken out so it can be overridden by Danger et al
         | 
| 360 | 
            +
             | 
| 361 | 
            +
                  /**
         | 
| 362 | 
            +
                   *
         | 
| 363 | 
            +
                   */
         | 
| 259 364 | 
             
                public void callDraw() {
         | 
| 260 365 | 
             
                  sketch.handleDraw();
         | 
| 261 366 | 
             
                }
         |