mirror of
https://github.com/processing/processing4.git
synced 2026-05-04 01:45:40 +02:00
tacking the other direction on offscreen
This commit is contained in:
@@ -1679,6 +1679,9 @@ public class PApplet implements PConstants {
|
||||
pg.setPrimary(primary);
|
||||
if (path != null) pg.setPath(path);
|
||||
// pg.setQuality(sketchQuality());
|
||||
if (!primary) {
|
||||
surface.initImage(pg, w, h);
|
||||
}
|
||||
pg.setSize(w, h);
|
||||
|
||||
// everything worked, return it
|
||||
|
||||
@@ -103,6 +103,9 @@ public interface PSurface {
|
||||
|
||||
public void setSize(int width, int height);
|
||||
|
||||
// create pixel buffer (pulled out for offscreen graphics)
|
||||
public void initImage(PGraphics gr, int wide, int high);
|
||||
|
||||
public void setSmooth(int level);
|
||||
|
||||
public void setFrameRate(float fps);
|
||||
|
||||
@@ -203,7 +203,8 @@ public class PSurfaceAWT implements PSurface {
|
||||
protected synchronized void render() {
|
||||
if (!EventQueue.isDispatchThread()) {
|
||||
//throw new IllegalStateException("render() called outside the EDT");
|
||||
System.err.println("render() called outside the EDT");
|
||||
//System.err.println("render() called outside the EDT");
|
||||
new Exception("render() called outside the EDT").printStackTrace();
|
||||
}
|
||||
// if (canvas == null) {
|
||||
// removeListeners(this);
|
||||
@@ -739,6 +740,18 @@ public class PSurfaceAWT implements PSurface {
|
||||
// frame.setLocationRelativeTo(null);
|
||||
// }
|
||||
|
||||
initImage(graphics, wide, high);
|
||||
|
||||
//throw new RuntimeException("implement me, see readme.md");
|
||||
sketch.width = wide;
|
||||
sketch.height = high;
|
||||
|
||||
// set PGraphics variables for width/height/pixelWidth/pixelHeight
|
||||
graphics.setSize(wide, high);
|
||||
}
|
||||
|
||||
|
||||
public void initImage(PGraphics gr, int wide, int high) {
|
||||
GraphicsConfiguration gc = canvas.getGraphicsConfiguration();
|
||||
// If not realized (off-screen, i.e the Color Selector Tool), gc will be null.
|
||||
if (gc == null) {
|
||||
@@ -749,15 +762,8 @@ public class PSurfaceAWT implements PSurface {
|
||||
|
||||
// Formerly this was broken into separate versions based on offscreen or
|
||||
// not, but we may as well create a compatible image; it won't hurt, right?
|
||||
int factor = graphics.pixelFactor;
|
||||
graphics.image = gc.createCompatibleImage(wide * factor, high * factor);
|
||||
|
||||
//throw new RuntimeException("implement me, see readme.md");
|
||||
sketch.width = wide;
|
||||
sketch.height = high;
|
||||
|
||||
// sets internal variables for width/height/pixelWidth/pixelHeight
|
||||
graphics.setSize(wide, high);
|
||||
int factor = gr.pixelFactor;
|
||||
gr.image = gc.createCompatibleImage(wide * factor, high * factor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -415,6 +415,11 @@ public class PSurfaceLWJGL implements PSurface {
|
||||
}
|
||||
|
||||
|
||||
public void initImage(PGraphics gr, int wide, int high) {
|
||||
// TODO not sure yet how to implement [fry]
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSmooth(int level) {
|
||||
System.err.println("set smooth " + level);
|
||||
|
||||
Reference in New Issue
Block a user