Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sams July 2020 staging #12

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions src/main/java/processing/awt/PGraphicsJava2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.awt.geom.*;
import java.awt.image.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import processing.core.*;
Expand Down Expand Up @@ -295,10 +294,10 @@ public PSurface createSurface() {
* is going to return the {@link Graphics2D} object.
* @return
*/
@Override
public Image getImage() {
return image;
}
// @Override
// public Image getImage() {
// return image;
// }


/** Returns the java.awt.Graphics2D object used by this renderer.
Expand Down Expand Up @@ -346,30 +345,30 @@ public Graphics2D checkImage() {
// image = new BufferedImage(width * pixelFactor, height * pixelFactor
// format == RGB ? BufferedImage.TYPE_INT_ARGB);

GraphicsConfiguration gc = null;
if (surface != null) {
Component comp = null; //surface.getComponent();
if (comp == null) {
// System.out.println("component null, but parent.frame is " + parent.frame);
comp = parent.frame;
}
if (comp != null) {
gc = comp.getGraphicsConfiguration();
}
}
// If not realized (off-screen, i.e the Color Selector Tool), gc will be null.
if (gc == null) {
//System.err.println("GraphicsConfiguration null in initImage()");
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
}
// GraphicsConfiguration gc = null;
// if (surface != null) {
// Component comp = null; //surface.getComponent();
// if (comp == null) {
//// System.out.println("component null, but parent.frame is " + parent.frame);
// comp = parent.frame;
// }
// if (comp != null) {
// gc = comp.getGraphicsConfiguration();
// }
// }
// // If not realized (off-screen, i.e the Color Selector Tool), gc will be null.
// if (gc == null) {
// //System.err.println("GraphicsConfiguration null in initImage()");
// GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
// gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
// }

// 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 wide = width * pixelDensity;
int high = height * pixelDensity;
// System.out.println("re-creating image");
image = gc.createCompatibleImage(wide, high, Transparency.TRANSLUCENT);
image = new BufferedImage(wide, high, BufferedImage.TYPE_INT_ARGB);
// image = gc.createCompatibleVolatileImage(wide, high);
//image = surface.getComponent().createImage(width, height);
}
Expand Down
Loading