mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
retina may be working
This commit is contained in:
@@ -13997,12 +13997,18 @@ public class PApplet implements PConstants {
|
||||
|
||||
/**
|
||||
* Returns a copy of this PImage. Equivalent to get(0, 0, width, height).
|
||||
* Deprecated, just use copy() instead.
|
||||
*/
|
||||
public PImage get() {
|
||||
return g.get();
|
||||
}
|
||||
|
||||
|
||||
public PImage copy() {
|
||||
return g.copy();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ( begin auto-generated from PImage_set.xml )
|
||||
*
|
||||
|
||||
@@ -381,6 +381,8 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
// Marks pixels as modified so that the pixels will be updated.
|
||||
// Also sets mx1/y1/x2/y2 so that OpenGL will pick it up.
|
||||
setModified();
|
||||
|
||||
g2.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,10 +14,11 @@ public class PGraphicsRetina2D extends PGraphicsJava2D {
|
||||
// INTERNAL
|
||||
|
||||
|
||||
// public PGraphicsRetina2D() {
|
||||
public PGraphicsRetina2D() {
|
||||
pixelFactor = 2;
|
||||
// retina = new PImage();
|
||||
// retina.format = RGB;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
@@ -96,13 +97,13 @@ public class PGraphicsRetina2D extends PGraphicsJava2D {
|
||||
|
||||
@Override
|
||||
public void beginDraw() {
|
||||
GraphicsConfiguration gc = parent.getGraphicsConfiguration();
|
||||
|
||||
if (image == null) {
|
||||
retina.width = width * 2;
|
||||
retina.height = height * 2;
|
||||
image = gc.createCompatibleImage(retina.width, retina.height);
|
||||
}
|
||||
// GraphicsConfiguration gc = parent.getGraphicsConfiguration();
|
||||
//
|
||||
// if (image == null) {
|
||||
// retina.width = width * 2;
|
||||
// retina.height = height * 2;
|
||||
// image = gc.createCompatibleImage(retina.width, retina.height);
|
||||
// }
|
||||
g2 = (Graphics2D) image.getGraphics();
|
||||
|
||||
checkSettings();
|
||||
@@ -196,8 +197,7 @@ public class PGraphicsRetina2D extends PGraphicsJava2D {
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// int[] retinaPixels;
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void loadPixels() {
|
||||
if ((retina.pixels == null) || (retina.pixels.length != retina.width * retina.height)) {
|
||||
@@ -265,12 +265,6 @@ public class PGraphicsRetina2D extends PGraphicsJava2D {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the pixels[] buffer to the PGraphics image.
|
||||
* <P>
|
||||
* Unlike in PImage, where updatePixels() only requests that the
|
||||
* update happens, in PGraphicsJava2D, this will happen immediately.
|
||||
*/
|
||||
@Override
|
||||
public void updatePixels(int ux, int uy, int uw, int uh) {
|
||||
int wide = hints[ENABLE_RETINA_PIXELS] ? retina.width : width;
|
||||
@@ -636,10 +630,5 @@ public class PGraphicsRetina2D extends PGraphicsJava2D {
|
||||
return super.save(filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean is2X() {
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -210,7 +210,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
*/
|
||||
public PImage() {
|
||||
format = ARGB; // default to ARGB images for release 0116
|
||||
// cache = null;
|
||||
pixelFactor = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -785,8 +785,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?
|
||||
graphics.image = gc.createCompatibleImage(wide, high);
|
||||
// System.out.println(graphics.image);
|
||||
int factor = graphics.pixelFactor;
|
||||
graphics.image = gc.createCompatibleImage(wide * factor, high * factor);
|
||||
|
||||
//throw new RuntimeException("implement me, see readme.md");
|
||||
sketchWidth = sketch.width = wide;
|
||||
|
||||
Reference in New Issue
Block a user