retina may be working

This commit is contained in:
Ben Fry
2014-11-15 15:21:54 -07:00
parent d22288c6e6
commit 8a232abd5b
5 changed files with 23 additions and 26 deletions
+6
View File
@@ -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();
}
+12 -23
View File
@@ -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;
}
*/
}
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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;