Skip to content

Commit f8d77c8

Browse files
committed
bring back getImage() to fix processing#4473
1 parent efb74dc commit f8d77c8

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

core/src/processing/awt/PGraphicsJava2D.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,16 @@ public PSurface createSurface() {
253253
}
254254

255255

256+
/**
257+
* Still need a means to get the java.awt.Image object, since getNative()
258+
* is going to return the {@link Graphics2D} object.
259+
*/
260+
@Override
261+
public Image getImage() {
262+
return image;
263+
}
264+
265+
256266
/** Returns the java.awt.Graphics2D object used by this renderer. */
257267
@Override
258268
public Object getNative() {

core/src/processing/core/PImage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ public PImage(Image img) {
345345
/**
346346
* Use the getNative() method instead, which allows library interfaces to be
347347
* written in a cross-platform fashion for desktop, Android, and others.
348+
* This is still included for PGraphics objects, which may need the image.
348349
*/
349-
@Deprecated
350350
public Image getImage() { // ignore
351351
return (Image) getNative();
352352
}

core/todo.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
X some Table cleanup based on other CSV parsing work
33
X use StandardCharsets.UTF_8 instead of getting encoding by name
44
X PApplet.main(Blah.class) now works
5+
o add push() and pop() methods to mirror js?
56
X add toJSON() method to IntDict
67
X had to use JSONObject.quote() to wrap the text
78
_ do the same for the other data classes
@@ -19,7 +20,7 @@ X https://github.com/processing/processing/issues/4265
1920
X https://github.com/processing/processing/pull/4268
2021

2122

22-
_ disable OpenGL ES on Linux?
23+
_ option to disable OpenGL ES on Linux?
2324
_ https://github.com/processing/processing/issues/4584
2425

2526
_ Can't render PGraphics object using image() within a PDF
@@ -33,10 +34,6 @@ _ textAlign(CENTER) and pixelDensity(2) aligning incorrectly with Java2D
3334
_ https://github.com/processing/processing/issues/4020
3435
_ add increment() that takes IntDict to merge things
3536

36-
_ normalize error messages for missing files
37-
_ https://github.com/processing/processing/issues/4265
38-
_ https://github.com/processing/processing/pull/4268
39-
4037
_ should fullScreen() set width and height to displayWidth/Height
4138
_ or is that being set/unset used for any state info?
4239
_ when calling exit(), if sketch has halted w/ exception, force the quit
@@ -45,7 +42,6 @@ _ simple test case: using size() inside setup() from Eclipse
4542

4643

4744
discussion
48-
_ add push() and pop() methods to mirror js?
4945
_ how to handle the touch api
5046
_ figure our size(img.width, img.height) situation
5147
_ just make loadImage() work in settings

java/libraries/pdf/src/processing/pdf/PGraphicsPDF.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ protected void imageImpl(PImage image,
423423
scale((x2 - x1) / imageWidth,
424424
(y2 - y1) / imageHeight);
425425
if (u2-u1 == imageWidth && v2-v1 == imageHeight) {
426-
g2.drawImage((Image) image.getNative(), 0, 0, null);
426+
g2.drawImage(image.getImage(), 0, 0, null);
427427
} else {
428428
PImage tmp = image.get(u1, v1, u2-u1, v2-v1);
429429
g2.drawImage((Image) tmp.getNative(), 0, 0, null);

0 commit comments

Comments
 (0)