| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ | |||
| 22 | 22 | Boston, MA 02111-1307 USA | |
| 23 | 23 | */ | |
| 24 | 24 | ||
| 25 | - package processing.core; | ||
| 25 | + package processing.awt; | ||
| 26 | 26 | ||
| 27 | 27 | import java.awt.*; | |
| 28 | 28 | import java.awt.font.TextAttribute; | |
@@ -32,6 +32,8 @@ | |||
| 32 | 32 | import java.util.HashMap; | |
| 33 | 33 | import java.util.Map; | |
| 34 | 34 | ||
| 35 | + import processing.core.*; | ||
| 36 | + | ||
| 35 | 37 | ||
| 36 | 38 | /** | |
| 37 | 39 | * Subclass for PGraphics that implements the graphics API using Java2D. | |
@@ -1571,7 +1573,7 @@ protected void imageImpl(PImage who, | |||
| 1571 | 1573 | cash = new ImageCache(); //who); | |
| 1572 | 1574 | setCache(who, cash); | |
| 1573 | 1575 | who.updatePixels(); // mark the whole thing for update | |
| 1574 | - who.modified = true; | ||
| 1576 | + who.setModified(); | ||
| 1575 | 1577 | } | |
| 1576 | 1578 | ||
| 1577 | 1579 | // If image previously was tinted, or the color changed | |
@@ -1583,15 +1585,15 @@ protected void imageImpl(PImage who, | |||
| 1583 | 1585 | who.updatePixels(); | |
| 1584 | 1586 | } | |
| 1585 | 1587 | ||
| 1586 | - if (who.modified) { | ||
| 1588 | + if (who.isModified()) { | ||
| 1587 | 1589 | if (who.pixels == null) { | |
| 1588 | 1590 | // This might be a PGraphics that hasn't been drawn to yet. | |
| 1589 | 1591 | // Can't just bail because the cache has been created above. | |
| 1590 | 1592 | // https://github.com/processing/processing/issues/2208 | |
| 1591 | 1593 | who.pixels = new int[who.width * who.height]; | |
| 1592 | 1594 | } | |
| 1593 | 1595 | cash.update(who, tint, tintColor); | |
| 1594 | - who.modified = false; | ||
| 1596 | + who.setModified(false); | ||
| 1595 | 1597 | } | |
| 1596 | 1598 | ||
| 1597 | 1599 | g2.drawImage(((ImageCache) getCache(who)).image, | |
@@ -2030,7 +2032,7 @@ protected void textLineImpl(char buffer[], int start, int stop, | |||
| 2030 | 2032 | // also changes global setting for antialiasing, but this is because it's | |
| 2031 | 2033 | // not possible to enable/disable them independently in some situations. | |
| 2032 | 2034 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, | |
| 2033 | - textFont.smooth ? | ||
| 2035 | + textFont.isSmooth() ? | ||
| 2034 | 2036 | RenderingHints.VALUE_ANTIALIAS_ON : | |
| 2035 | 2037 | RenderingHints.VALUE_ANTIALIAS_OFF); | |
| 2036 | 2038 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,7 @@ | |||
| 20 | 20 | Boston, MA 02111-1307 USA | |
| 21 | 21 | */ | |
| 22 | 22 | ||
| 23 | - package processing.core; | ||
| 23 | + package processing.awt; | ||
| 24 | 24 | ||
| 25 | 25 | import java.awt.*; | |
| 26 | 26 | import java.awt.event.*; | |
@@ -32,6 +32,11 @@ | |||
| 32 | 32 | ||
| 33 | 33 | import javax.swing.JFrame; | |
| 34 | 34 | ||
| 35 | + import processing.core.PApplet; | ||
| 36 | + import processing.core.PConstants; | ||
| 37 | + import processing.core.PGraphics; | ||
| 38 | + import processing.core.PImage; | ||
| 39 | + import processing.core.PSurfaceNone; | ||
| 35 | 40 | import processing.event.KeyEvent; | |
| 36 | 41 | import processing.event.MouseEvent; | |
| 37 | 42 | ||
@@ -101,7 +106,7 @@ public PSurfaceAWT(PGraphics graphics) { | |||
| 101 | 106 | canvas.addComponentListener(new ComponentAdapter() { | |
| 102 | 107 | @Override | |
| 103 | 108 | public void componentResized(ComponentEvent e) { | |
| 104 | - if (!sketch.looping) { | ||
| 109 | + if (!sketch.isLooping()) { | ||
| 105 | 110 | // make sure this is a real resize event, not just initial setup | |
| 106 | 111 | // https://github.com/processing/processing/issues/3310 | |
| 107 | 112 | Dimension canvasSize = canvas.getSize(); | |
@@ -792,16 +797,16 @@ public void placeWindow(int[] location, int[] editorLocation) { | |||
| 792 | 797 | // needs to resize the frame, which will resize the canvas, and so on... | |
| 793 | 798 | @Override | |
| 794 | 799 | public void setSize(int wide, int high) { | |
| 795 | - if (PApplet.DEBUG) { | ||
| 796 | - //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high); | ||
| 797 | - new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out); | ||
| 798 | - } | ||
| 800 | + // if (PApplet.DEBUG) { | ||
| 801 | + // //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high); | ||
| 802 | + // new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out); | ||
| 803 | + // } | ||
| 799 | 804 | ||
| 800 | 805 | //if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch | |
| 801 | 806 | if (wide == sketch.width && high == sketch.height) { | |
| 802 | - if (PApplet.DEBUG) { | ||
| 803 | - new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out); | ||
| 804 | - } | ||
| 807 | + // if (PApplet.DEBUG) { | ||
| 808 | + // new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out); | ||
| 809 | + // } | ||
| 805 | 810 | return; // unchanged, don't rebuild everything | |
| 806 | 811 | } | |
| 807 | 812 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2526,6 +2526,11 @@ synchronized public void noLoop() { | |||
| 2526 | 2526 | } | |
| 2527 | 2527 | ||
| 2528 | 2528 | ||
| 2529 | + public boolean isLooping() { | ||
| 2530 | + return looping; | ||
| 2531 | + } | ||
| 2532 | + | ||
| 2533 | + | ||
| 2529 | 2534 | ////////////////////////////////////////////////////////////// | |
| 2530 | 2535 | ||
| 2531 | 2536 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,7 @@ public interface PConstants { | |||
| 57 | 57 | }); | |
| 58 | 58 | */ | |
| 59 | 59 | ||
| 60 | - static final String JAVA2D = "processing.core.PGraphicsJava2D"; | ||
| 60 | + static final String JAVA2D = "processing.awt.PGraphicsJava2D"; | ||
| 61 | 61 | ||
| 62 | 62 | static final String P2D = "processing.opengl.PGraphics2D"; | |
| 63 | 63 | static final String P3D = "processing.opengl.PGraphics3D"; | |
@@ -70,7 +70,7 @@ public interface PConstants { | |||
| 70 | 70 | // static final String E2D = PGraphicsDanger2D.class.getName(); | |
| 71 | 71 | ||
| 72 | 72 | // Experimental JavaFX renderer; even better 2D performance | |
| 73 | - static final String FX2D = "processing.core.PGraphicsFX2D"; | ||
| 73 | + static final String FX2D = "processing.javafx.PGraphicsFX2D"; | ||
| 74 | 74 | ||
| 75 | 75 | static final String PDF = "processing.pdf.PGraphicsPDF"; | |
| 76 | 76 | static final String SVG = "processing.svg.PGraphicsSVG"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -560,6 +560,11 @@ public int getDefaultSize() { | |||
| 560 | 560 | } | |
| 561 | 561 | ||
| 562 | 562 | ||
| 563 | + public boolean isSmooth() { | ||
| 564 | + return smooth; | ||
| 565 | + } | ||
| 566 | + | ||
| 567 | + | ||
| 563 | 568 | public boolean isStream() { | |
| 564 | 569 | return stream; | |
| 565 | 570 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,7 @@ | |||
| 35 | 35 | import java.util.HashMap; | |
| 36 | 36 | import java.util.WeakHashMap; | |
| 37 | 37 | ||
| 38 | + import processing.awt.PSurfaceAWT; | ||
| 38 | 39 | import processing.opengl.PGL; | |
| 39 | 40 | import processing.opengl.PShader; | |
| 40 | 41 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | package processing.core; | |
| 25 | 25 | ||
| 26 | + import processing.awt.PGraphicsJava2D; | ||
| 26 | 27 | import processing.data.*; | |
| 27 | 28 | ||
| 28 | 29 | import java.awt.Paint; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,12 +28,12 @@ | |||
| 28 | 28 | * class for other drawing surfaces. It includes the standard rendering loop. | |
| 29 | 29 | */ | |
| 30 | 30 | public class PSurfaceNone implements PSurface { | |
| 31 | - PApplet sketch; | ||
| 32 | - PGraphics graphics; | ||
| 31 | + protected PApplet sketch; | ||
| 32 | + protected PGraphics graphics; | ||
| 33 | 33 | ||
| 34 | - Thread thread; | ||
| 35 | - boolean paused; | ||
| 36 | - Object pauseObject = new Object(); | ||
| 34 | + protected Thread thread; | ||
| 35 | + protected boolean paused; | ||
| 36 | + protected Object pauseObject = new Object(); | ||
| 37 | 37 | ||
| 38 | 38 | protected float frameRateTarget = 60; | |
| 39 | 39 | protected long frameRatePeriod = 1000000000L / 60L; | |
@@ -245,7 +245,7 @@ public void setFrameRate(float fps) { | |||
| 245 | 245 | } | |
| 246 | 246 | ||
| 247 | 247 | ||
| 248 | - class AnimationThread extends Thread { | ||
| 248 | + public class AnimationThread extends Thread { | ||
| 249 | 249 | ||
| 250 | 250 | public AnimationThread() { | |
| 251 | 251 | super("Animation Thread"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ | |||
| 29 | 29 | import com.lowagie.text.*; | |
| 30 | 30 | import com.lowagie.text.pdf.*; | |
| 31 | 31 | ||
| 32 | + import processing.awt.PGraphicsJava2D; | ||
| 32 | 33 | import processing.core.*; | |
| 33 | 34 | ||
| 34 | 35 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ | |||
| 30 | 30 | import org.w3c.dom.Document; | |
| 31 | 31 | import org.w3c.dom.DOMImplementation; | |
| 32 | 32 | ||
| 33 | + import processing.awt.PGraphicsJava2D; | ||
| 33 | 34 | import processing.core.*; | |
| 34 | 35 | ||
| 35 | 36 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments