From 32a276a321f5061e6794985464efc638eec633a1 Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 14 May 2006 11:49:51 +0000 Subject: [PATCH] begin/endPixels, begin/endDraw, begin/endGL, stroke/fill/tint/color(#FFCC00, alpha) --- core/PApplet.java | 54 ++++++++++++++++--- core/PGraphics.java | 99 ++++++++++++++++++++++++++-------- core/PGraphics2.java | 54 +++++++++---------- core/PGraphics3.java | 6 +-- core/PImage.java | 22 ++++++-- core/todo.txt | 63 +++++++++++++++------- opengl/PGraphicsGL.java | 71 ++++++++++++++++--------- todo.txt | 115 +++++++++++++++++++++++++++++++++------- 8 files changed, 360 insertions(+), 124 deletions(-) diff --git a/core/PApplet.java b/core/PApplet.java index 03619f035..506f178a7 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -182,7 +182,7 @@ public class PApplet extends Applet * Pixel buffer from this applet's PGraphics. *

* When used with OpenGL or Java2D, this value will - * be null until loadPixels() has been called. + * be null until beginPixels() has been called. */ public int pixels[]; @@ -1294,7 +1294,7 @@ public class PApplet extends Applet // if depth() is called inside setup, pixels/width/height // will be ok by the time it's back out again - //this.pixels = g.pixels; // make em call loadPixels + //this.pixels = g.pixels; // make em call beginPixels // now for certain that we've got a valid size this.width = g.width; this.height = g.height; @@ -5714,11 +5714,19 @@ public class PApplet extends Applet } + /** + * As of 0116 this also takes color(#FF8800, alpha) + */ public final int color(int gray, int alpha) { if (g == null) { - if (gray > 255) gray = 255; else if (gray < 0) gray = 0; if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0; - return (alpha << 24) | (gray << 16) | (gray << 8) | gray; + if (gray > 255) { + // then assume this is actually a #FF8800 + return (alpha << 24) | (gray & 0xFFFFFF); + } else { + //if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + return (alpha << 24) | (gray << 16) | (gray << 8) | gray; + } } return g.color(gray, alpha); } @@ -6321,7 +6329,13 @@ public class PApplet extends Applet public void loadPixels() { - g.loadPixels(); + System.err.println("Use beginPixels() instead of loadPixels() " + + "with release 0116 and later."); + } + + + public void beginPixels() { + g.beginPixels(); pixels = g.pixels; } @@ -6356,9 +6370,15 @@ public class PApplet extends Applet } - public void updatePixels(int x1, int y1, int x2, int y2) { - if (recorder != null) recorder.updatePixels(x1, y1, x2, y2); - g.updatePixels(x1, y1, x2, y2); + public void endPixels() { + if (recorder != null) recorder.endPixels(); + g.endPixels(); + } + + + public void endPixels(int x1, int y1, int x2, int y2) { + if (recorder != null) recorder.endPixels(x1, y1, x2, y2); + g.endPixels(x1, y1, x2, y2); } @@ -7152,6 +7172,12 @@ public class PApplet extends Applet } + public void stroke(int rgb, float alpha) { + if (recorder != null) recorder.stroke(rgb, alpha); + g.stroke(rgb, alpha); + } + + public void stroke(float gray) { if (recorder != null) recorder.stroke(gray); g.stroke(gray); @@ -7188,6 +7214,12 @@ public class PApplet extends Applet } + public void tint(int rgb, float alpha) { + if (recorder != null) recorder.tint(rgb, alpha); + g.tint(rgb, alpha); + } + + public void tint(float gray) { if (recorder != null) recorder.tint(gray); g.tint(gray); @@ -7224,6 +7256,12 @@ public class PApplet extends Applet } + public void fill(int rgb, float alpha) { + if (recorder != null) recorder.fill(rgb, alpha); + g.fill(rgb, alpha); + } + + public void fill(float gray) { if (recorder != null) recorder.fill(gray); g.fill(gray); diff --git a/core/PGraphics.java b/core/PGraphics.java index 19e34d981..a68894531 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -615,7 +615,7 @@ public class PGraphics extends PImage implements PConstants { } // mark pixels as having been updated, so that they'll work properly // when this PGraphics is drawn using image(). - updatePixels(); + endPixels(); } @@ -1982,19 +1982,19 @@ public class PGraphics extends PImage implements PConstants { /** * Draw a single character on screen. * Extremely slow when used with textMode(SCREEN) and Java 2D, - * because loadPixels has to be called first and updatePixels last. + * because beginPixels has to be called first and updatePixels last. */ public void text(char c, float x, float y) { if (textFont == null) { throw new RuntimeException("use textFont() before text()"); } - if (textMode == SCREEN) loadPixels(); + if (textMode == SCREEN) beginPixels(); textBuffer[0] = c; textLineImpl(textBuffer, 0, 1, x, y); - if (textMode == SCREEN) updatePixels(); + if (textMode == SCREEN) endPixels(); } @@ -2035,7 +2035,7 @@ public class PGraphics extends PImage implements PConstants { throw new RuntimeException("use textFont() before text()"); } - if (textMode == SCREEN) loadPixels(); + if (textMode == SCREEN) beginPixels(); int length = str.length(); if (length > textBuffer.length) { @@ -2056,7 +2056,7 @@ public class PGraphics extends PImage implements PConstants { if (start < length) { textLineImpl(textBuffer, start, index, x, y); } - if (textMode == SCREEN) updatePixels(); + if (textMode == SCREEN) endPixels(); } @@ -2126,7 +2126,7 @@ public class PGraphics extends PImage implements PConstants { throw new RuntimeException("use textFont() before text()"); } - if (textMode == SCREEN) loadPixels(); + if (textMode == SCREEN) beginPixels(); float hradius, vradius; switch (rectMode) { @@ -2254,7 +2254,7 @@ public class PGraphics extends PImage implements PConstants { textLineImpl(textBuffer, lineStart, index, lineX, currentY); } - if (textMode == SCREEN) updatePixels(); + if (textMode == SCREEN) endPixels(); } @@ -2940,9 +2940,13 @@ public class PGraphics extends PImage implements PConstants { *

* Note, no need for a bounds check since it's a 32 bit number. */ - protected void colorCalcARGB(int argb) { + protected void colorCalcARGB(int argb, float alpha) { calcColor = argb; - calcAi = (argb >> 24) & 0xff; + if (alpha == colorModeA) { + calcAi = (argb >> 24) & 0xff; + } else { + calcAi = (int) (((argb >> 24) & 0xff) * (alpha / colorModeA)); + } calcRi = (argb >> 16) & 0xff; calcGi = (argb >> 8) & 0xff; calcBi = argb & 0xff; @@ -2978,15 +2982,26 @@ public class PGraphics extends PImage implements PConstants { /** - * Set the tint to either a grayscale or ARGB value. See notes - * attached to the fill() function. + * Set the tint to either a grayscale or ARGB value. + * See notes attached to the fill() function. */ public void stroke(int rgb) { if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above stroke((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); + strokeFromCalc(); + } + } + + + public void stroke(int rgb, float alpha) { + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { + stroke((float) rgb, alpha); + + } else { + colorCalcARGB(rgb, alpha); strokeFromCalc(); } } @@ -3049,7 +3064,17 @@ public class PGraphics extends PImage implements PConstants { tint((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); + tintFromCalc(); + } + } + + public void tint(int rgb, float alpha) { + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { + tint((float) rgb, alpha); + + } else { + colorCalcARGB(rgb, alpha); tintFromCalc(); } } @@ -3126,11 +3151,23 @@ public class PGraphics extends PImage implements PConstants { fill((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); fillFromCalc(); } } + + public void fill(int rgb, float alpha) { + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above + fill((float) rgb, alpha); + + } else { + colorCalcARGB(rgb, alpha); + fillFromCalc(); + } + } + + public void fill(float gray) { colorCalc(gray); fillFromCalc(); @@ -3292,7 +3329,7 @@ public class PGraphics extends PImage implements PConstants { background((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); backgroundFromCalc(); } clear(); @@ -3402,12 +3439,17 @@ public class PGraphics extends PImage implements PConstants { public final int color(int gray) { // ignore - if (colorRgb255) { - // bounds checking to make sure the numbers aren't to high or low - if (gray > 255) gray = 255; else if (gray < 0) gray = 0; - return 0xff000000 | (gray << 16) | (gray << 8) | gray; + if (((gray & 0xff000000) == 0) && (gray <= colorModeX)) { + if (colorRgb255) { + // bounds checking to make sure the numbers aren't to high or low + if (gray > 255) gray = 255; else if (gray < 0) gray = 0; + return 0xff000000 | (gray << 16) | (gray << 8) | gray; + } else { + colorCalc(gray); + } + } else { + colorCalcARGB(gray, colorModeA); } - colorCalc(gray); return calcColor; } @@ -3417,6 +3459,9 @@ public class PGraphics extends PImage implements PConstants { } + /** + * @param gray can be packed ARGB or a gray in this case + */ public final int color(int gray, int alpha) { // ignore if (colorRgb255) { // bounds checking to make sure the numbers aren't to high or low @@ -3429,6 +3474,18 @@ public class PGraphics extends PImage implements PConstants { return calcColor; } + /** + * @param rgb can be packed ARGB or a gray in this case + */ + public final int color(int rgb, float alpha) { // ignore + if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { + colorCalc(rgb, alpha); + } else { + colorCalcARGB(rgb, alpha); + } + return calcColor; + } + public final int color(float gray, float alpha) { // ignore colorCalc(gray, alpha); return calcColor; diff --git a/core/PGraphics2.java b/core/PGraphics2.java index b73aedda9..5f95dae93 100644 --- a/core/PGraphics2.java +++ b/core/PGraphics2.java @@ -122,8 +122,8 @@ public class PGraphics2 extends PGraphics { //mis.newPixels(pixels, cm, 0, width); // need to mark pixels as needing an update, without calling - // its own updatePixels, since that's crazy slow - //updatePixels(); + // its own endPixels, since that's crazy slow + //endPixels(); } @@ -520,7 +520,7 @@ public class PGraphics2 extends PGraphics { int u1, int v1, int u2, int v2) { if (who.cache == null) { who.cache = new ImageCache(who); - who.updatePixels(); // mark the whole thing for update + who.endPixels(); // mark the whole thing for update } ImageCache cash = (ImageCache) who.cache; @@ -530,7 +530,7 @@ public class PGraphics2 extends PGraphics { (tint && (cash.tintedColor != tintColor)) || (!tint && cash.tinted)) { // for tint change, mark all pixels as needing update - who.updatePixels(); + who.endPixels(); } if (who.modified) { @@ -973,7 +973,7 @@ public class PGraphics2 extends PGraphics { ////////////////////////////////////////////////////////////// - public void loadPixels() { + public void beginPixels() { if ((pixels == null) || (pixels.length != width * height)) { pixels = new int[width * height]; } @@ -986,11 +986,11 @@ public class PGraphics2 extends PGraphics { /** * Update the pixels[] buffer to the PGraphics image. *

- * Unlike in PImage, where updatePixels() only asks that the + * Unlike in PImage, where endPixels() only asks that the * update happens, in PGraphics2, this will happen immediately. */ - public void updatePixels() { - //updatePixels(0, 0, width, height); + public void endPixels() { + //endPixels(0, 0, width, height); WritableRaster raster = ((BufferedImage) image).getRaster(); raster.setDataElements(0, 0, width, height, pixels); } @@ -999,14 +999,14 @@ public class PGraphics2 extends PGraphics { /** * Update the pixels[] buffer to the PGraphics image. *

- * Unlike in PImage, where updatePixels() only asks that the + * Unlike in PImage, where endPixels() only asks that the * update happens, in PGraphics2, this will happen immediately. */ - public void updatePixels(int x, int y, int c, int d) { + public void endPixels(int x, int y, int c, int d) { if ((x == 0) && (y == 0) && (c == width) && (d == height)) { - updatePixels(); + endPixels(); } else { - throw new RuntimeException("updatePixels(x, y, c, d) not implemented"); + throw new RuntimeException("endPixels(x, y, c, d) not implemented"); } /* ((BufferedImage) image).setRGB(x, y, @@ -1158,16 +1158,16 @@ public class PGraphics2 extends PGraphics { public void filter(int kind) { - loadPixels(); + beginPixels(); super.filter(kind); - updatePixels(); + endPixels(); } public void filter(int kind, float param) { - loadPixels(); + beginPixels(); super.filter(kind, param); - updatePixels(); + endPixels(); } @@ -1193,9 +1193,9 @@ public class PGraphics2 extends PGraphics { public void copy(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { - loadPixels(); + beginPixels(); super.copy(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); - updatePixels(); + endPixels(); } @@ -1203,32 +1203,32 @@ public class PGraphics2 extends PGraphics { public void blend(PImage src, int sx, int sy, int dx, int dy, int mode) { - loadPixels(); + beginPixels(); super.blend(src, sx, sy, dx, dy, mode); - updatePixels(); + endPixels(); } public void blend(int sx, int sy, int dx, int dy, int mode) { - loadPixels(); + beginPixels(); super.blend(sx, sy, dx, dy, mode); - updatePixels(); + endPixels(); } public void blend(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { - loadPixels(); + beginPixels(); super.blend(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); - updatePixels(); + endPixels(); } public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { - loadPixels(); + beginPixels(); super.blend(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); - updatePixels(); + endPixels(); } @@ -1237,7 +1237,7 @@ public class PGraphics2 extends PGraphics { public void save(String filename) { //System.out.println("start load"); - loadPixels(); + beginPixels(); //System.out.println("end load, start save"); super.save(filename); //System.out.println("done with save"); diff --git a/core/PGraphics3.java b/core/PGraphics3.java index b736f9500..b51c2e1e2 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -3434,7 +3434,7 @@ public class PGraphics3 extends PGraphics { ambient((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); ambientFromCalc(); } } @@ -3467,7 +3467,7 @@ public class PGraphics3 extends PGraphics { specular((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); specularFromCalc(); } } @@ -3522,7 +3522,7 @@ public class PGraphics3 extends PGraphics { emissive((float) rgb); } else { - colorCalcARGB(rgb); + colorCalcARGB(rgb, colorModeA); emissiveFromCalc(); } } diff --git a/core/PImage.java b/core/PImage.java index 55a6eab86..09a0339fc 100644 --- a/core/PImage.java +++ b/core/PImage.java @@ -276,19 +276,33 @@ public class PImage implements PConstants, Cloneable { */ + public void loadPixels() { // ignore + System.err.println("Use beginPixels() instead of loadPixels() " + + "with release 0116 and later."); + beginPixels(); + } + + + public void updatePixels() { + System.err.println("Use endPixels() instead of updatePixels() " + + "with release 0116 and later."); + endPixels(); + } + + /** * For subclasses where the pixels[] buffer isn't set by default, * this should copy all data into the pixels[] array */ - public void loadPixels() { // ignore + public void beginPixels() { // ignore } /** * Mark all pixels as needing update. */ - public void updatePixels() { - updatePixels(0, 0, width, height); + public void endPixels() { + endPixels(0, 0, width, height); } @@ -302,7 +316,7 @@ public class PImage implements PConstants, Cloneable { * Note that when using imageMode(CORNERS), * the x2 and y2 positions are non-inclusive. */ - public void updatePixels(int x1, int y1, int x2, int y2) { + public void endPixels(int x1, int y1, int x2, int y2) { //if (!modified) { // could just set directly, but.. //} diff --git a/core/todo.txt b/core/todo.txt index 0256793aa..5c01c4c0b 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -15,24 +15,56 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=115 X fix issue where processing applets would run extremely fast X after having been starved of resources where there framerate dropped X http://dev.processing.org/bugs/show_bug.cgi?id=336 +X added color/stroke/tint/fill(#FF8800, 30); +fixed in 0115 / quicktime 7.1 +X color values on camera input flipped on intel macs +X checked in a change for this recommended on qtjava list +X http://dev.processing.org/bugs/show_bug.cgi?id=313 -0117 core -_ bring back the old P2D, rename PGraphics2 into PGraphicsJava +_ AIOOBE on PLine 757.. halts renderer +X begin/endPixels.. change has been made +_ on PImage, sets a flag that marks it to be updated on next render +_ for PImage, begin after an end is ignored, no pixels are re-loaded +_ the "changed" bit gets turned off when the PImage is rendered +_ for subclasses of PGraphics, the reload bit needs to be set on endFrame +_ filter() checks to see if inside begin/endPixels, if so doesn't call +o if line() is called inside beginpixels, call updatepixels? +_ when NPE on line with pixels[], suggest user includes beginPixels + +_ with network connection +_ download a copy of the source for 0069, get the renderer +_ svn mv PGraphics2 PGraphicsJava + +_ for subclasses, make it easy to grab the structure of vertices +_ actually, just use PShape internally and this will be easier + +_ add notes about fixing serial on the mac to the faq (and link to bug) _ endRaw() is a problem with hint(ENABLE_DEPTH_SORT) _ because the triangles won't be rendered by the time endRaw() is called _ force depth sorted triangles to flush _ fix dxf export bug _ fix erik's problems with export (also in bugs db) +_ check into ricard's problems with beginRecord() +_ should beginRecord inherit settings from its parent renderer? +_ textFont() is null on beginRecord +_ same would be the case for strokeWeight, background, etc. +_ http://dev.processing.org/bugs/show_bug.cgi?id=346 + + +_ bring back the old P2D, rename PGraphics2 into PGraphicsJava +_ remove POLYGON, LINE_LOOP, LINE_STRIP + _ an image marked RGB but with 0s for the alpha won't draw in JAVA2D - -_ test support for reading and writing images that have alpha and imageio +_ test imageio with images that have alpha (does it work?) _ get tiff exporter for p5 to support argb and gray +_ would also need to modify the tiff loading code, +_ because the header would be different _ http://dev.processing.org/bugs/show_bug.cgi?id=343 _ this produces a dark blue background: @@ -62,21 +94,11 @@ _ because opengl needs vectors, but also the image cache for textures _ how to clear the screen with alpha? background(0, 0, 0, 0)? _ background(EMPTY) -> background(0x01000000) or something? -_ remove POLYGON, LINE_LOOP, LINE_STRIP -_ begin/endPixels.. -_ on PImage, sets a flag that marks it to be updated on next render -_ for PImage, begin after an end is ignored, no pixels are re-loaded -_ the "changed" bit gets turned off when the PImage is rendered -_ for subclasses of PGraphics, the reload bit needs to be set on endFrame -_ filter() checks to see if inside begin/endPixels, if so doesn't call -o if line() is called inside beginpixels, call updatepixels? _ introduce calc() _ tint() sets texture color, fill() is ignored with textures _ cmyk version of tiff encoder code? -_ when NPE on line with pixels[], suggest user includes beginPixels - _ when turning smoothing on, internal lines of shapes are visible _ need to turn off smoothing for the interior of shapes _ http://dev.processing.org/bugs/show_bug.cgi?id=200 @@ -88,9 +110,6 @@ _ get()/set() in PGraphicsJava don't bounds check _ add better error messages for all built-in renderers _ i.e. "import library -> pdf" when pdf is missing -_ color values on camera input flipped on intel macs -X checked in a change for this recommended on qtjava list -_ http://dev.processing.org/bugs/show_bug.cgi?id=313 _ need to merge sorting/drawing of lines and triangles _ lines will occlude tris and vice versa @@ -723,7 +742,7 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=127 PGraphicsGL -_ polygon z-order with alpha in opengl +_ polygon z-order depth sorting with alpha in opengl _ complete the implementation of hint() with proper implementation _ http://dev.processing.org/bugs/show_bug.cgi?id=176 _ opengl needs to shut itself down properly when closing applet @@ -784,3 +803,11 @@ _ sorting of polygons/lines on simple painters algorithm _ better lighting model to show darkness at various depths _ maybe just ultra-high res bitmaps from gl o version of BApplet that replaces g. with ai. or pdf. + + +PGraphicsPDF + +_ pdf export ignoring transparency on linux +_ check to see if this is the case on other linux machines +_ seems to be working fine on windows +_ http://dev.processing.org/bugs/show_bug.cgi?id=345 diff --git a/opengl/PGraphicsGL.java b/opengl/PGraphicsGL.java index 6acb87e25..d927d9213 100644 --- a/opengl/PGraphicsGL.java +++ b/opengl/PGraphicsGL.java @@ -419,6 +419,7 @@ public class PGraphicsGL extends PGraphics3 { // load p5 modelview into the opengl modelview if (ctm == null) ctm = new float[16]; + /* ctm[0] = modelview.m00; ctm[1] = modelview.m01; ctm[2] = modelview.m02; @@ -438,6 +439,26 @@ public class PGraphicsGL extends PGraphics3 { ctm[13] = modelview.m31; ctm[14] = modelview.m32; ctm[15] = modelview.m33; + */ + ctm[0] = modelview.m00; + ctm[1] = modelview.m10; + ctm[2] = modelview.m20; + ctm[3] = modelview.m30; + + ctm[4] = modelview.m01; + ctm[5] = modelview.m11; + ctm[6] = modelview.m21; + ctm[7] = modelview.m31; + + ctm[8] = modelview.m02; + ctm[9] = modelview.m12; + ctm[10] = modelview.m22; + ctm[11] = modelview.m32; + + ctm[12] = modelview.m03; + ctm[13] = modelview.m13; + ctm[14] = modelview.m23; + ctm[15] = modelview.m33; // apply this modelview and get to work gl.glMultMatrixf(ctm, 0); @@ -1783,7 +1804,7 @@ public class PGraphicsGL extends PGraphics3 { ////////////////////////////////////////////////////////////// - public void loadPixels() { + public void beginPixels() { if ((pixels == null) || (pixels.length != width*height)) { pixels = new int[width * height]; pixelBuffer = BufferUtil.newIntBuffer(pixels.length); @@ -1848,7 +1869,7 @@ public class PGraphicsGL extends PGraphics3 { for (int x = 0; x < width; x++) { int temp = pixels[index]; - // identical to updatePixels because only two + // identical to endPixels because only two // components are being swapped pixels[index] = 0xff000000 | ((pixels[yindex] << 16) & 0xff0000) | @@ -1893,7 +1914,7 @@ public class PGraphicsGL extends PGraphics3 { for (int x = 0; x < image.width; x++) { int temp = image.pixels[index]; - // identical to updatePixels because only two + // identical to endPixels because only two // components are being swapped image.pixels[index] = 0xff000000 | ((image.pixels[yindex] << 16) & 0xff0000) | @@ -1940,7 +1961,7 @@ public class PGraphicsGL extends PGraphics3 { for (int x = 0; x < image.width; x++) { int temp = image.pixels[index]; - // identical to updatePixels because only two + // identical to endPixels because only two // components are being swapped image.pixels[index] = (image.pixels[yindex] & 0xff000000) | @@ -2072,7 +2093,7 @@ public class PGraphicsGL extends PGraphics3 { } - public void updatePixels() { + public void endPixels() { // flip vertically (opengl stores images upside down), int index = 0; @@ -2145,11 +2166,11 @@ public class PGraphicsGL extends PGraphics3 { } - public void updatePixels(int x, int y, int c, int d) { - //throw new RuntimeException("updatePixels() not available with OpenGL"); + public void endPixels(int x, int y, int c, int d) { + //throw new RuntimeException("endPixels() not available with OpenGL"); // TODO make this actually work for a smaller region // problem is, it gets pretty messy with the y reflection, etc - updatePixels(); + endPixels(); } @@ -2296,29 +2317,29 @@ public class PGraphicsGL extends PGraphics3 { /** * Extremely slow and not optimized, should use glCopyPixels instead. - * Currently calls a loadPixels() on the whole canvas, then does the copy, - * then it calls updatePixels(). + * Currently calls a beginPixels() on the whole canvas, then does the copy, + * then it calls endPixels(). */ public void copy(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { //throw new RuntimeException("copy() not available with OpenGL"); - loadPixels(); + beginPixels(); super.copy(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); - updatePixels(); + endPixels(); } /** * TODO - extremely slow and not optimized. - * Currently calls a loadPixels() on the whole canvas, - * then does the copy, then it calls updatePixels(). + * Currently calls a beginPixels() on the whole canvas, + * then does the copy, then it calls endPixels(). */ public void copy(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { - loadPixels(); + beginPixels(); super.copy(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); - updatePixels(); + endPixels(); } @@ -2338,28 +2359,28 @@ public class PGraphicsGL extends PGraphics3 { /** * TODO - extremely slow and not optimized. - * Currently calls a loadPixels() on the whole canvas, - * then does the blend, then it calls updatePixels(). + * Currently calls a beginPixels() on the whole canvas, + * then does the blend, then it calls endPixels(). */ public void blend(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { - loadPixels(); + beginPixels(); super.blend(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); - updatePixels(); + endPixels(); } /** * TODO - extremely slow and not optimized. - * Currently calls a loadPixels() on the whole canvas, - * then does the blend, then it calls updatePixels(). + * Currently calls a beginPixels() on the whole canvas, + * then does the blend, then it calls endPixels(). */ public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { - loadPixels(); + beginPixels(); super.blend(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); - updatePixels(); + endPixels(); } @@ -2367,7 +2388,7 @@ public class PGraphicsGL extends PGraphics3 { public void save(String filename) { - loadPixels(); + beginPixels(); super.save(filename); } diff --git a/todo.txt b/todo.txt index 82a1ffff8..64caabada 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,78 @@ 0116 pde +o including function outlines in the code? +o i.e. make setup() and draw() for people? seems silly.. not much to do +o when importing a library, insert 'captureEvent'? +o again, seems to fraught with potential problems -_ size of sketch different in setup() and draw() on linux -_ make sure that the sketch isn't being sized based on bad insets -_ http://dev.processing.org/bugs/show_bug.cgi?id=341 +_ archive sketch direct to bug report +_ start including source tarball? +_ post releases on sourceforge so that international mirrors are better? + +_ does closing the window call stop()? +_ need to make sure hitting stop button and closing window explicitly call + +_ exporting applications copies .java files +_ .java files are copied to the root folder as well as the source folder +_ hitting ESC on "create this, move file, continue" opened anyway + +_ show progress dialog during export and save + +libraries +_ make a note of how to add to a sketch (put in sketchbook) +_ disable subfolders working as libraries (if a sketch, don't allow subfolders) +o or maybe just that libraries must be in the root? +o nah, cuz that would mean can't make subfolder called "libraries" +_ library/download.url and library/home.url +_ tools -> get library +_ library url: [ http://blahblah.org/something ] +_ this would grab something.version, and something.zip +_ tools -> update libraries +_ this would check the something.version to see if it's newer + +_ tools -> shared code +_ Integrator / FloatThing / CameraStuff -- Update +_ to pull code from a local folder +_ update will update classes from shared in the current folder + +_ need to document how subclass of pgraphics works +_ what are the necessary bits that need to be subclassed +_ simple handling of colors, what fields are available +_ how to get the matrices +_ simple endshape handler + +_ include a separate video class to handle playback +_ video playback can be much faster if not messing with pixels +_ could instead use texsubimage in opengl, etc + +site +_ make source link on p5 site go direct to the source +_ start creating source tarball when finishing +_ post the downloads also on the sourceforge site + +_ make the p5 icon show up for the window (and in the dock) +_ when launching a new sketch +_ tools -> import sketch from url (takes a zip from archive sketch) +_ tools -> ftp upload sketch + +_ several save/save as issues in the release + +faq +_ include notes about the new way to fix the serial lib on the mac +_ opengl, may need to install new version of video drivers +_ add note in reference about how to add something to the sketch +_ (code, .java files, etc) +_ audio hiccups, throttling the cpu +_ p5 will take as much cpu as it can, which can choke other apps +_ call delay(10) (or so) if you want to make sure audio keeps running +_ using beginGL().. also import javax.media.opengl.*; +_ lighting will not work +_ write a threading example +_ show an example of how to handle callback into the app +X or handle this some more intelligent way, super.stop() is needed. +X registerDispose() does the trick +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083574943 +_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1067383998 +_ fix the internal file chooser so that people don't need to make their own text faq _ how to use textMode(SHAPES) with opengl @@ -20,6 +90,13 @@ the only way to do it (this will improve later) is to use some undocumented feat 3) use createFont() (which you already are) this will convert all the shape data from the fonts for writing. it will be *extremely* slow, which is part of why it's not documented yet. but it will work with beginRaw(). +video faq +_ clean up the notes in the faq about how to get video to work +_ make the instructions for winvdig clearer +_ be sure to say "yes to all" when deinstalling winvdig +_ install 1.0.1 not 1.0.5 +_ 1.0.5 doesn't seem to be necessary, and can't resize windows + advanced faq X advanced reference contains more info about how things work X move 'how do i create large images' here @@ -28,17 +105,29 @@ _ explain how to integrate code with swing _ use a separate environment, call init(), use noLoop(), redraw() _ how do i add gui to a sketch? _ don't use awt components +_ how to use swing and embed components inside p5 X createGraphics with PDF, using dispose() to clear the thing X calling nextPage() _ notes about setting key=0 to catch ESC _ also size(screen.width, screen.height); _ maybe make a section in installations with p5 -_ clean up the notes in the faq about how to get video to work -_ make the instructions for winvdig clearer +_ add note to bugs db asking to please use archive sketch and attach _ toInt() needs to go away in time for the book.. fix parser bugs -_ make expand() et al work on objects + + +linux problems +_ things not showing up +_ probably threading issue, 98 doesn't have any trouble +_ signs point to Runner or PApplet changes between 98 and 99 +_ commenting out applet.setupFrameResizeListener() +_ in line 307 from Runner.java solved the problem +_ http://dev.processing.org/bugs/show_bug.cgi?id=282 +_ size of sketch different in setup() and draw() on linux +_ make sure that the sketch isn't being sized based on bad insets +_ http://dev.processing.org/bugs/show_bug.cgi?id=341 +_ not being able to make a link to the processing app _ would be nice to have macosx packaged up as a single .app file _ should recommend that people install libraries into their sketchbook @@ -62,13 +151,6 @@ _ set "no smileys" as the default for posting code _ make the export to the board just copy to clipboard _ also make it insert   for extra spaces -_ linux problems with things not showing up -_ probably threading issue, 98 doesn't have any trouble -_ signs point to Runner or PApplet changes between 98 and 99 -_ commenting out applet.setupFrameResizeListener() -_ in line 307 from Runner.java solved the problem -_ http://dev.processing.org/bugs/show_bug.cgi?id=282 - _ svg loader is on the list for 1.0 _ maybe include as part of PApplet (casey thinks so) _ svg output, make simple version of PGraphicsSVG based on PGraphicsPDF @@ -257,14 +339,11 @@ _ ctrl-x-o switch windows _ ctrl-x-1 single window _ write a timer class/example library -_ write a threading example -X or handle this some more intelligent way, super.stop() is needed. -X registerDispose() does the trick -_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083574943 -_ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1067383998 _ write an example that uses Hashtable _ write an example that uses Vector _ get an xml library and example in there +_ xquery and xpath (latter in particular) for dealing with xml +_ jeff uses saxon for switchboard.. saxon also part of nux _ nanoxml problems with manifest _ appears to use 1.6.8 version since it's just two classes _ post to web example