| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,10 +25,13 @@ | |||
| 25 | 25 | package processing.core; | |
| 26 | 26 | ||
| 27 | 27 | // used for setting bg colors and whatnot | |
| 28 | - import java.awt.Color; | ||
| 28 | + //import java.awt.Color; | ||
| 29 | 29 | // Component is further up the chain than Canvas | |
| 30 | - import java.awt.Component; | ||
| 30 | + //import java.awt.Component; | ||
| 31 | 31 | // use for the link() command (and maybe open()?) | |
| 32 | + | ||
| 33 | + // these are used for various methods (url opening, file selection, etc) | ||
| 34 | + // how many more can we remove? | ||
| 32 | 35 | import java.awt.Desktop; | |
| 33 | 36 | import java.awt.EventQueue; | |
| 34 | 37 | import java.awt.FileDialog; | |
@@ -38,13 +41,6 @@ | |||
| 38 | 41 | import java.awt.Toolkit; | |
| 39 | 42 | import java.awt.color.ColorSpace; | |
| 40 | 43 | import java.awt.image.BufferedImage; | |
| 41 | - import java.io.*; | ||
| 42 | - import java.lang.reflect.*; | ||
| 43 | - import java.net.*; | ||
| 44 | - import java.text.*; | ||
| 45 | - import java.util.*; | ||
| 46 | - import java.util.regex.*; | ||
| 47 | - import java.util.zip.*; | ||
| 48 | 44 | ||
| 49 | 45 | // used by loadImage() functions | |
| 50 | 46 | import javax.imageio.ImageIO; | |
@@ -54,6 +50,14 @@ | |||
| 54 | 50 | // used by desktopFile() method | |
| 55 | 51 | import javax.swing.filechooser.FileSystemView; | |
| 56 | 52 | ||
| 53 | + import java.io.*; | ||
| 54 | + import java.lang.reflect.*; | ||
| 55 | + import java.net.*; | ||
| 56 | + import java.text.*; | ||
| 57 | + import java.util.*; | ||
| 58 | + import java.util.regex.*; | ||
| 59 | + import java.util.zip.*; | ||
| 60 | + | ||
| 57 | 61 | import processing.data.*; | |
| 58 | 62 | import processing.event.*; | |
| 59 | 63 | import processing.opengl.*; | |
@@ -9409,8 +9413,9 @@ static protected void runSketchEDT(final String[] args, | |||
| 9409 | 9413 | int[] editorLocation = null; | |
| 9410 | 9414 | ||
| 9411 | 9415 | String name = null; | |
| 9412 | - Color backgroundColor = null; | ||
| 9413 | - Color stopColor = Color.GRAY; | ||
| 9416 | + int backgroundColor = 0; | ||
| 9417 | + //int stopColor = java.awt.Color.GRAY.getRGB(); | ||
| 9418 | + int stopColor = 0xff808080; | ||
| 9414 | 9419 | boolean hideStop = false; | |
| 9415 | 9420 | ||
| 9416 | 9421 | int displayIndex = -1; // -1 means use default, b/c numbered from 0 | |
@@ -9436,11 +9441,11 @@ static protected void runSketchEDT(final String[] args, | |||
| 9436 | 9441 | ||
| 9437 | 9442 | } else if (param.equals(ARGS_BGCOLOR)) { | |
| 9438 | 9443 | if (value.charAt(0) == '#') value = value.substring(1); | |
| 9439 | - backgroundColor = new Color(Integer.parseInt(value, 16)); | ||
| 9444 | + backgroundColor = 0xff000000 | Integer.parseInt(value, 16); | ||
| 9440 | 9445 | ||
| 9441 | 9446 | } else if (param.equals(ARGS_STOP_COLOR)) { | |
| 9442 | 9447 | if (value.charAt(0) == '#') value = value.substring(1); | |
| 9443 | - stopColor = new Color(Integer.parseInt(value, 16)); | ||
| 9448 | + stopColor = 0xff000000 | Integer.parseInt(value, 16); | ||
| 9444 | 9449 | ||
| 9445 | 9450 | } else if (param.equals(ARGS_SKETCH_FOLDER)) { | |
| 9446 | 9451 | folder = value; | |
@@ -9558,7 +9563,7 @@ static protected void runSketchEDT(final String[] args, | |||
| 9558 | 9563 | if (fullScreen) { | |
| 9559 | 9564 | //surface.placeFullScreen(hideStop); | |
| 9560 | 9565 | if (hideStop) { | |
| 9561 | - stopColor = null; // they'll get the hint | ||
| 9566 | + stopColor = 0; // they'll get the hint | ||
| 9562 | 9567 | } | |
| 9563 | 9568 | surface.placePresent(stopColor); | |
| 9564 | 9569 | } else { | |
@@ -9571,7 +9576,7 @@ static protected void runSketchEDT(final String[] args, | |||
| 9571 | 9576 | } | |
| 9572 | 9577 | ||
| 9573 | 9578 | ||
| 9574 | - protected PSurface initSurface(Color backgroundColor, int displayIndex, | ||
| 9579 | + protected PSurface initSurface(int backgroundColor, int displayIndex, | ||
| 9575 | 9580 | boolean present, boolean spanDisplays) { | |
| 9576 | 9581 | // try { | |
| 9577 | 9582 | // String renderer = applet.sketchRenderer(); | |
@@ -9662,21 +9667,21 @@ private void deprecationWarning(String method) { | |||
| 9662 | 9667 | // } | |
| 9663 | 9668 | ||
| 9664 | 9669 | ||
| 9665 | - /** | ||
| 9666 | - * Return a Canvas object that can be embedded into other Java GUIs. | ||
| 9667 | - * This is necessary because PApplet no longer subclasses Component. | ||
| 9668 | - * | ||
| 9669 | - * <pre> | ||
| 9670 | - * PApplet sketch = new EmbedSketch(); | ||
| 9671 | - * Canvas canvas = sketch.getCanvas(); | ||
| 9672 | - * // add the canvas object to your project and validate() it | ||
| 9673 | - * sketch.init() // start the animation thread | ||
| 9674 | - */ | ||
| 9675 | - public Component getComponent() { | ||
| 9676 | - g = createPrimaryGraphics(); | ||
| 9677 | - surface = g.createSurface(); | ||
| 9678 | - return surface.initComponent(this); | ||
| 9679 | - } | ||
| 9670 | + // /** | ||
| 9671 | + // * Return a Canvas object that can be embedded into other Java GUIs. | ||
| 9672 | + // * This is necessary because PApplet no longer subclasses Component. | ||
| 9673 | + // * | ||
| 9674 | + // * <pre> | ||
| 9675 | + // * PApplet sketch = new EmbedSketch(); | ||
| 9676 | + // * Canvas canvas = sketch.getCanvas(); | ||
| 9677 | + // * // add the canvas object to your project and validate() it | ||
| 9678 | + // * sketch.init() // start the animation thread | ||
| 9679 | + // */ | ||
| 9680 | + // public Component getComponent() { | ||
| 9681 | + // g = createPrimaryGraphics(); | ||
| 9682 | + // surface = g.createSurface(); | ||
| 9683 | + // return surface.initComponent(this); | ||
| 9684 | + // } | ||
| 9680 | 9685 | ||
| 9681 | 9686 | ||
| 9682 | 9687 | /** Convenience method, should only be called by PSurface subclasses. */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -285,7 +285,7 @@ public Graphics2D checkImage() { | |||
| 285 | 285 | ||
| 286 | 286 | GraphicsConfiguration gc = null; | |
| 287 | 287 | if (surface != null) { | |
| 288 | - Component comp = surface.getComponent(); | ||
| 288 | + Component comp = null; //surface.getComponent(); | ||
| 289 | 289 | if (comp == null) { | |
| 290 | 290 | // System.out.println("component null, but parent.frame is " + parent.frame); | |
| 291 | 291 | comp = parent.frame; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,9 +22,6 @@ | |||
| 22 | 22 | ||
| 23 | 23 | package processing.core; | |
| 24 | 24 | ||
| 25 | - import java.awt.Color; | ||
| 26 | - import java.awt.Component; | ||
| 27 | - | ||
| 28 | 25 | ||
| 29 | 26 | public interface PSurface { | |
| 30 | 27 | /** | |
@@ -40,15 +37,18 @@ public interface PSurface { | |||
| 40 | 37 | // Background default needs to be different from the default value in | |
| 41 | 38 | // PGraphics.backgroundColor, otherwise size(100, 100) bg spills over. | |
| 42 | 39 | // https://github.com/processing/processing/issues/2297 | |
| 43 | - static final Color WINDOW_BGCOLOR = new Color(0xDD, 0xDD, 0xDD); | ||
| 40 | + //static final Color WINDOW_BGCOLOR = new Color(0xDD, 0xDD, 0xDD); | ||
| 41 | + static final int WINDOW_BGCOLOR = 0xffDDDDDD; | ||
| 44 | 42 | ||
| 45 | 43 | // renderer that doesn't draw to the screen | |
| 46 | 44 | public void initOffscreen(PApplet sketch); | |
| 47 | 45 | ||
| 48 | - public Component initComponent(PApplet sketch); | ||
| 46 | + // considering removal in favor of separate Component classes for appropriate renderers | ||
| 47 | + // (i.e. for Java2D or a generic Image surface, but not PDF, debatable for GL or FX) | ||
| 48 | + //public Component initComponent(PApplet sketch); | ||
| 49 | 49 | ||
| 50 | 50 | //public Frame initFrame(PApplet sketch, Color backgroundColor, | |
| 51 | - public void initFrame(PApplet sketch, Color backgroundColor, | ||
| 51 | + public void initFrame(PApplet sketch, int backgroundColor, | ||
| 52 | 52 | int deviceIndex, boolean fullScreen, boolean spanDisplays); | |
| 53 | 53 | ||
| 54 | 54 | // | |
@@ -73,7 +73,7 @@ public void initFrame(PApplet sketch, Color backgroundColor, | |||
| 73 | 73 | public void placeWindow(int[] location, int[] editorLocation); | |
| 74 | 74 | ||
| 75 | 75 | //public void placeFullScreen(boolean hideStop); | |
| 76 | - public void placePresent(Color stopColor); | ||
| 76 | + public void placePresent(int stopColor); | ||
| 77 | 77 | ||
| 78 | 78 | // Sketch is running from the PDE, set up messaging back to the PDE | |
| 79 | 79 | public void setupExternalMessages(); | |
@@ -98,7 +98,7 @@ public void initFrame(PApplet sketch, Color backgroundColor, | |||
| 98 | 98 | // create pixel buffer, called from allocate() to produce a compatible image for rendering efficiently | |
| 99 | 99 | // public void initImage(PGraphics gr); | |
| 100 | 100 | ||
| 101 | - public Component getComponent(); | ||
| 101 | + //public Component getComponent(); | ||
| 102 | 102 | ||
| 103 | 103 | /** | |
| 104 | 104 | * Sometimes smoothing must be set at the drawing surface level | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -374,6 +374,7 @@ public Frame initOffscreen() { | |||
| 374 | 374 | } | |
| 375 | 375 | */ | |
| 376 | 376 | ||
| 377 | + /* | ||
| 377 | 378 | @Override | |
| 378 | 379 | public Component initComponent(PApplet sketch) { | |
| 379 | 380 | this.sketch = sketch; | |
@@ -384,11 +385,12 @@ public Component initComponent(PApplet sketch) { | |||
| 384 | 385 | ||
| 385 | 386 | return canvas; | |
| 386 | 387 | } | |
| 388 | + */ | ||
| 387 | 389 | ||
| 388 | 390 | ||
| 389 | 391 | @Override | |
| 390 | - public void initFrame(PApplet sketch, Color backgroundColor, | ||
| 391 | - int deviceIndex, boolean fullScreen, boolean spanDisplays) { | ||
| 392 | + public void initFrame(PApplet sketch, int backgroundColor, | ||
| 393 | + int deviceIndex, boolean fullScreen, boolean spanDisplays) { | ||
| 392 | 394 | this.sketch = sketch; | |
| 393 | 395 | ||
| 394 | 396 | GraphicsEnvironment environment = | |
@@ -450,10 +452,10 @@ public void initFrame(PApplet sketch, Color backgroundColor, | |||
| 450 | 452 | ||
| 451 | 453 | // Removed code above, also removed from what's now in the placeXxxx() | |
| 452 | 454 | // methods. Not sure why it was being double-set; hopefully anachronistic. | |
| 453 | - if (backgroundColor == null) { | ||
| 455 | + if (backgroundColor == 0) { | ||
| 454 | 456 | backgroundColor = WINDOW_BGCOLOR; | |
| 455 | 457 | } | |
| 456 | - frame.getContentPane().setBackground(backgroundColor); | ||
| 458 | + frame.getContentPane().setBackground(new Color(backgroundColor, false)); | ||
| 457 | 459 | ||
| 458 | 460 | // Put the p5 logo in the Frame's corner to override the Java coffee cup. | |
| 459 | 461 | setIconImage(frame); | |
@@ -561,7 +563,7 @@ public void setVisible(boolean visible) { | |||
| 561 | 563 | ||
| 562 | 564 | //public void placeFullScreen(boolean hideStop) { | |
| 563 | 565 | @Override | |
| 564 | - public void placePresent(Color stopColor) { | ||
| 566 | + public void placePresent(int stopColor) { | ||
| 565 | 567 | // After the pack(), the screen bounds are gonna be 0s | |
| 566 | 568 | frame.setBounds(screenRect); | |
| 567 | 569 | canvas.setBounds((screenRect.width - sketchWidth) / 2, | |
@@ -573,9 +575,9 @@ public void placePresent(Color stopColor) { | |||
| 573 | 575 | // macosxFullScreenToggle(frame); | |
| 574 | 576 | // } | |
| 575 | 577 | ||
| 576 | - if (stopColor != null) { | ||
| 578 | + if (stopColor != 0) { | ||
| 577 | 579 | Label label = new Label("stop"); | |
| 578 | - label.setForeground(stopColor); | ||
| 580 | + label.setForeground(new Color(stopColor, false)); | ||
| 579 | 581 | label.addMouseListener(new MouseAdapter() { | |
| 580 | 582 | @Override | |
| 581 | 583 | public void mousePressed(java.awt.event.MouseEvent e) { | |
@@ -806,10 +808,10 @@ public void initImage(PGraphics graphics) { | |||
| 806 | 808 | */ | |
| 807 | 809 | ||
| 808 | 810 | ||
| 809 | - @Override | ||
| 810 | - public Component getComponent() { | ||
| 811 | - return canvas; | ||
| 812 | - } | ||
| 811 | + // @Override | ||
| 812 | + // public Component getComponent() { | ||
| 813 | + // return canvas; | ||
| 814 | + // } | ||
| 813 | 815 | ||
| 814 | 816 | ||
| 815 | 817 | @Override | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,8 +22,8 @@ | |||
| 22 | 22 | ||
| 23 | 23 | package processing.core; | |
| 24 | 24 | ||
| 25 | - import java.awt.Component; | ||
| 26 | - import java.awt.Frame; | ||
| 25 | + //import java.awt.Component; | ||
| 26 | + //import java.awt.Frame; | ||
| 27 | 27 | ||
| 28 | 28 | import javafx.animation.AnimationTimer; | |
| 29 | 29 | import javafx.application.Application; | |
@@ -65,7 +65,7 @@ public class PSurfaceFX implements PSurface { | |||
| 65 | 65 | PGraphicsFX fx; | |
| 66 | 66 | Stage stage; | |
| 67 | 67 | Canvas canvas; | |
| 68 | - Frame dummy; | ||
| 68 | + // Frame dummy; | ||
| 69 | 69 | ||
| 70 | 70 | AnimationTimer timer; | |
| 71 | 71 | ||
@@ -140,9 +140,9 @@ public void initOffscreen(PApplet sketch) { | |||
| 140 | 140 | } | |
| 141 | 141 | ||
| 142 | 142 | ||
| 143 | - public Component initComponent(PApplet sketch) { | ||
| 144 | - return null; | ||
| 145 | - } | ||
| 143 | + // public Component initComponent(PApplet sketch) { | ||
| 144 | + // return null; | ||
| 145 | + // } | ||
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | 148 | static public class PApplicationFX extends Application { | |
@@ -162,13 +162,13 @@ public void start(final Stage stage) { | |||
| 162 | 162 | ||
| 163 | 163 | //stage.setScene(new Scene(new Group(canvas))); | |
| 164 | 164 | stage.setScene(new Scene(stackPane)); | |
| 165 | - stage.show(); // move to setVisible(true)? | ||
| 165 | + //stage.show(); // move to setVisible(true)? | ||
| 166 | 166 | } | |
| 167 | 167 | } | |
| 168 | 168 | ||
| 169 | 169 | ||
| 170 | 170 | //public Frame initFrame(PApplet sketch, java.awt.Color backgroundColor, | |
| 171 | - public void initFrame(PApplet sketch, java.awt.Color backgroundColor, | ||
| 171 | + public void initFrame(PApplet sketch, int backgroundColor, | ||
| 172 | 172 | int deviceIndex, boolean fullScreen, | |
| 173 | 173 | boolean spanDisplays) { | |
| 174 | 174 | this.sketch = sketch; | |
@@ -191,7 +191,7 @@ public void setTitle(String title) { | |||
| 191 | 191 | ||
| 192 | 192 | /** Show or hide the window. */ | |
| 193 | 193 | public void setVisible(boolean visible) { | |
| 194 | - // TODO ignored? | ||
| 194 | + stage.show(); | ||
| 195 | 195 | } | |
| 196 | 196 | ||
| 197 | 197 | ||
@@ -254,7 +254,6 @@ public void start(final Stage stage) { | |||
| 254 | 254 | ||
| 255 | 255 | public void placeWindow(int[] location) { | |
| 256 | 256 | // TODO Auto-generated method stub | |
| 257 | - | ||
| 258 | 257 | } | |
| 259 | 258 | ||
| 260 | 259 | ||
@@ -264,28 +263,28 @@ public void placeWindow(int[] location, int[] editorLocation) { | |||
| 264 | 263 | } | |
| 265 | 264 | ||
| 266 | 265 | ||
| 267 | - public void placePresent(java.awt.Color stopColor) { | ||
| 266 | + // http://download.java.net/jdk8/jfxdocs/javafx/stage/Stage.html#setFullScreenExitHint-java.lang.String- | ||
| 267 | + // http://download.java.net/jdk8/jfxdocs/javafx/stage/Stage.html#setFullScreenExitKeyCombination-javafx.scene.input.KeyCombination- | ||
| 268 | + public void placePresent(int stopColor) { | ||
| 268 | 269 | // TODO Auto-generated method stub | |
| 269 | - | ||
| 270 | 270 | } | |
| 271 | 271 | ||
| 272 | 272 | ||
| 273 | 273 | public void setupExternalMessages() { | |
| 274 | 274 | // TODO Auto-generated method stub | |
| 275 | - | ||
| 276 | 275 | } | |
| 277 | 276 | ||
| 278 | 277 | ||
| 279 | 278 | public void setSize(int width, int height) { | |
| 280 | - // TODO Auto-generated method stub | ||
| 281 | - | ||
| 279 | + System.out.println(getClass().getSimpleName() + " setSize()"); | ||
| 280 | + stage.setWidth(width); | ||
| 281 | + stage.setHeight(height); | ||
| 282 | 282 | } | |
| 283 | 283 | ||
| 284 | 284 | ||
| 285 | - public Component getComponent() { | ||
| 286 | - // TODO Auto-generated method stub | ||
| 287 | - return null; | ||
| 288 | - } | ||
| 285 | + // public Component getComponent() { | ||
| 286 | + // return null; | ||
| 287 | + // } | ||
| 289 | 288 | ||
| 290 | 289 | public void setSmooth(int level) { | |
| 291 | 290 | // TODO Auto-generated method stub | |
| Back | FazBrowse Home | New Git URL |
0 commit comments