Skip to content

Commit ce11c08

Browse files
committed
adding clarifications
1 parent 950f855 commit ce11c08

File tree

3 files changed

+38
-24
lines changed

3 files changed

+38
-24
lines changed

core/src/processing/core/PSurface.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,21 @@ public Frame initFrame(PApplet sketch, Color backgroundColor,
103103

104104
public void setSize(int width, int height);
105105

106+
/**
107+
* Called by {@link PApplet#createGraphics(int, int)} to nitialize the
108+
* {@link PGraphics#image} object with an image that's compatible with this
109+
* drawing surface/display/hardware.
110+
* @param gr PGraphics object whose image will be set
111+
* @param wide
112+
* @param high
113+
*/
106114
// create pixel buffer (pulled out for offscreen graphics)
107115
public void initImage(PGraphics gr, int wide, int high);
108116

117+
/**
118+
* Sometimes smoothing must be set at the drawing surface level
119+
* not just inside the renderer itself.
120+
*/
109121
public void setSmooth(int level);
110122

111123
public void setFrameRate(float fps);

core/src/processing/core/PSurfaceAWT.java

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public Frame initFrame(PApplet sketch, Color backgroundColor,
375375
}
376376
frame.getContentPane().setBackground(backgroundColor);
377377

378-
// Set the trimmings around the image
378+
// Put the p5 logo in the Frame's corner to override the Java coffee cup.
379379
setIconImage(frame);
380380

381381
// For 0149, moving this code (up to the pack() method) before init().
@@ -812,7 +812,7 @@ private boolean checkRetina() {
812812
}
813813

814814

815-
// get the bounds for all displays
815+
/** Get the bounds rectangle for all displays. */
816816
static Rectangle getDisplaySpan() {
817817
Rectangle bounds = new Rectangle();
818818
GraphicsEnvironment environment =
@@ -1418,8 +1418,8 @@ public void run() {
14181418
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14191419

14201420

1421-
int cursorType = PConstants.ARROW; // cursor type
1422-
boolean cursorVisible = true; // cursor visibility flag
1421+
int cursorType = PConstants.ARROW;
1422+
boolean cursorVisible = true;
14231423
Cursor invisibleCursor;
14241424

14251425

@@ -1436,26 +1436,22 @@ public void setCursor(int kind) {
14361436

14371437

14381438
public void setCursor(PImage img, int x, int y) {
1439-
// don't set this as cursor type, instead use cursor_type
1440-
// to save the last cursor used in case cursor() is called
1439+
// Don't set cursorType, instead use cursorType to save the last
1440+
// regular cursor type used for when cursor() is called.
14411441
//cursor_type = Cursor.CUSTOM_CURSOR;
1442-
Image jimage =
1443-
canvas.getToolkit().createImage(new MemoryImageSource(img.width, img.height,
1444-
img.pixels, 0, img.width));
1445-
Point hotspot = new Point(x, y);
1446-
Toolkit tk = Toolkit.getDefaultToolkit();
1447-
Cursor cursor = tk.createCustomCursor(jimage, hotspot, "Custom Cursor");
1442+
Cursor cursor =
1443+
canvas.getToolkit().createCustomCursor((Image) img.getNative(),
1444+
new Point(x, y),
1445+
"custom");
14481446
canvas.setCursor(cursor);
14491447
cursorVisible = true;
1450-
14511448
}
14521449

14531450

14541451
public void showCursor() {
1455-
// maybe should always set here? seems dangerous, since
1456-
// it's likely that java will set the cursor to something
1457-
// else on its own, and the applet will be stuck b/c bagel
1458-
// thinks that the cursor is set to one particular thing
1452+
// Maybe should always set here? Seems dangerous, since it's likely that
1453+
// Java will set the cursor to something else on its own, and the sketch
1454+
// will be stuck b/c p5 thinks the cursor is set to one particular thing.
14591455
if (!cursorVisible) {
14601456
cursorVisible = true;
14611457
canvas.setCursor(Cursor.getPredefinedCursor(cursorType));
@@ -1464,18 +1460,15 @@ public void showCursor() {
14641460

14651461

14661462
public void hideCursor() {
1467-
// in 0216, just re-hide it?
1468-
// if (!cursorVisible) return; // don't hide if already hidden.
1463+
// Because the OS may have shown the cursor on its own,
1464+
// don't return if 'cursorVisible' is set to true. [rev 0216]
14691465

14701466
if (invisibleCursor == null) {
14711467
BufferedImage cursorImg =
14721468
new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
14731469
invisibleCursor =
14741470
canvas.getToolkit().createCustomCursor(cursorImg, new Point(8, 8), "blank");
14751471
}
1476-
// was formerly 16x16, but the 0x0 was added by jdf as a fix
1477-
// for macosx, which wasn't honoring the invisible cursor
1478-
// cursor(invisibleCursor, 8, 8);
14791472
canvas.setCursor(invisibleCursor);
14801473
cursorVisible = false;
14811474
}

core/todo.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ X add check to require .vlw extension with loadFont()
6767
X Memory usage insane increasing in 3.0a5
6868
X https://github.com/processing/processing/issues/3007
6969
X seems fixed due to the rewrite
70+
X remove set/get/removeCache() methods from PApplet (add //ignore line)
7071

7172
full screen
7273
X roll back full screen changes
@@ -79,11 +80,19 @@ o sketchDisplay() -> 0 for all, or 1, 2, 3...
7980
X added --span option
8081
X play with improvements to full screen here
8182

82-
_ exitCalled() and exitActual made public by Andres, breaks Python
83-
_ also not API we want to expose, so sort this out
83+
_ remove setTitle() etc methods from PSurface, just use the ones from Frame?
84+
_ and with that, encourage the use of the dummy frame object in renderers
8485
_ destroy() removed, but bring back? is that better than dispose()?
8586
_ Python Mode has a hook for when it's called
8687

88+
opengl misc
89+
_ sketchQuality() vs sketchSmooth()?
90+
_ move glsl entries to their own subdirectory?
91+
_ exitCalled() and exitActual made public by Andres, breaks Python
92+
_ also not API we want to expose, so sort this out
93+
_ get code into makeGraphics() to handle bad path settings for LWJGL
94+
_ right now it has a bunch of JOGL-specific code
95+
8796
_ split 'present' and 'full screen'?
8897
_ --full-screen causes considerable flicker at this point
8998
_ or split them when sketchWidth/Height are implemented?

0 commit comments

Comments
 (0)