massive changes for revision 78

This commit is contained in:
benfry
2005-03-30 08:48:03 +00:00
parent 770b2d7baf
commit 425540c3b6
17 changed files with 1345 additions and 341 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ import com.ice.jni.registry.*;
* files and images, etc) that comes from that.
*/
public class PdeBase {
static final String VERSION = "0077 Alpha";
static final String VERSION = "0078 Alpha";
static String openedAtStartup;
+14
View File
@@ -1278,6 +1278,20 @@ public class PdeSketch {
importedLibraries.add(libFolder);
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();
/*
String list[] = libFolder.list();
if (list != null) {
for (int j = 0; j < list.length; j++) {
// this might have a dll/jnilib/so packed,
// so add it to the library path
if (list[j].toLowerCase().endsWith(".jar")) {
libraryPath += File.pathSeparator +
libFolder.getAbsolutePath() + File.separator + list[j];
}
}
}
*/
}
+1 -1
View File
@@ -279,7 +279,7 @@ public class PdeSketchbook {
fd.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
//System.out.println("check filter on " + dir + " " + name);
return name.endsWith(".pde");
return name.toLowerCase().endsWith(".pde");
}
});
+6
View File
@@ -180,6 +180,12 @@ OPENGL PROBLEMS
have this graphics chipset on your machine before installing.
(thanks to Daniel Shiffman for finding this fix!)
- on macosx, i don't think there's much we can do about the following error:
Error: view not ready, cannot lock focus at
"/Users/kbr/JavaNet/jogl/src/native/jogl/
MacOSXWindowSystemInterface.m:createContext:51"
this shows up sometimes on run, just hit run again and things oughta work.
- on windows, if you're getting a lot of opengl crashing, blue screens,
or other mess, your driver might be bad. if you're using a dell, use
the driver they provide (support.dell.com) instead of what might be a
+88 -10
View File
@@ -7,23 +7,47 @@ releases will be super crusty.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ABOUT REV 0078
ABOUT REV 0078 - 30 March 2005
bug fixes:
this release includes a large number of fixes for the 2D graphics engine.
nothing has changed in the processing 3D engine (what you get when you
call depth()), however the OpenGL renderer now supports loadPixels(),
updatePixels(), saveFrame(), get(), and pmouseX/Y.
- lines of text were getting mashed together both horizontally and
vertically. the font stuff was moved around a lot in 0077 and so
this made a mess of things.
around the corner are big fixes to 3D when simon finishes the new
lighting model. he's moving through it pretty quickly so we hope to have
it in a release shortly.
- backwards rectangles and ellipses are now drawn properly. (i.e.
rectangles where (x2 < x1) or (y2 < y1), or ellipses with a
negative width or height).
- same thing for backwards images, note that an image drawn backwards
won't actually flip the image or anything nutty like that.
major things still not solved since last release:
- still lots of threading/flickering strangeness
- applet not being placed properly inside its window
- things sometims not starting up (gives a cryptic error in the console)
- text inside a rect is slightly broken
- you can't do per-vertex coloring of lines in 2D
- everything else not covered here that was broken in 77...
api changes:
- fun things: some of the filter() stuff in PImage now works:
+ filter(GRAY) will convert a PImage to grayscale.
+ filter(INVERT) will invert an image
+ filter(POSTERIZE, int levels) will posterize to that many levels
+ filter(THRESHOLD) or filter(THRESHOLD, float midpoint)
will give you a black and white image, with optionally settable
midpoint (a value from 0 to 1)
+ coming soon is filter(BLUR) and filter(BLUR, float radius)...
- strokeCap/strokeJoin constants for MITERED is now MITER, BEVELED is BEVEL,
and PROJECTED is now PROJECT.
- as of 0077, font.width() works differently. it returns the width of
a one point font, not the font at its current size. the font api
built into PGraphics/PApplet now consists of:
@@ -43,6 +67,60 @@ api changes:
text, you should use textWidth() or textAscent() in PGraphics/PApplet
which will return values based on what was set in textSize().
- bezierVertex has changed. instead of four calls to bezierVertex,
you should instead use:
vertex(x1, y1);
bezierVertex(x2, y2, x3, y3, x4, y4);
this helps iron out some inconsistencies that you get with the wrong
number of bezierVertex coords. it also prevents you from having to
double up the final coordinate to draw the next segment.
- got rid of CONCAVE_POLYGON and CONVEX_POLYGON since they never really
came into full use.
bug fixes:
- curveVertex works again.
- lines of text were getting mashed together both horizontally and
vertically. the font stuff was moved around a lot in 0077 and so
this made a mess of things.
- backwards rectangles and ellipses are now drawn properly. (i.e.
rectangles where (x2 < x1) or (y2 < y1), or ellipses with a
negative width or height).
- same thing for backwards images, note that an image drawn backwards
won't actually flip the image or anything nutty like that.
- the file open dialog on macosx now lets you open files ending
with all caps .PDE instead of .pde
- imageMode() was broken
- loadPixels, updatePixels, save, and saveFrame were totally broken
and now they work in both the Java2D and OpenGL renderers.
- patched in the latest version of jogl to hopefully fix some of the
overly chatty error messages.
- SCREEN_SPACE text is working again
- tint() is now working properly, except that it ignores colors (but
accepts alpha) with PGraphics3 (processing renderer with depth())
- arc was broken and inconsistent, now fixed.
- several bug fixes inside Camera and Movie.
- PImage.get() had a bug where it wouldn't properly read data as
you neared or crossed any of the edges of the image.
- bug in the gl renderer that had images drawing the wrong size/shape.
- default strokeCap and strokeJoin now set.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+48 -30
View File
@@ -317,6 +317,8 @@ public class PApplet extends Applet
public void stop() {
//finished = true; // why did i comment this out?
//System.out.println("stopping applet");
// don't run stop and disposers twice
if (thread == null) return;
thread = null;
@@ -458,6 +460,7 @@ public class PApplet extends Applet
public void draw() {
// if no draw method, then shut things down
//System.out.println("no draw method, goodbye");
finished = true;
}
@@ -615,6 +618,7 @@ public class PApplet extends Applet
*/
while ((Thread.currentThread() == thread) && !finished) {
//while ((thread != null) && !finished) {
//while (!finished) {
//updated = false;
@@ -764,7 +768,10 @@ public class PApplet extends Applet
// note that this will not catch errors inside setup()
// those are caught by the PdeRuntime
System.out.println("exception occurred (if you don't see a stack " +
"trace below this message, we've got a bug)");
finished = true;
//e.printStackTrace(System.out);
if (leechErr != null) {
// if draw() mode, make sure that ui stops waiting
@@ -779,6 +786,7 @@ public class PApplet extends Applet
}
if (THREAD_DEBUG) println(Thread.currentThread().getName() +
" thread finished");
//System.out.println("exiting run " + finished);
stop(); // call to shutdown libs?
}
@@ -3171,6 +3179,7 @@ public class PApplet extends Applet
}
//////////////////////////////////////////////////////////////
// STRINGS
@@ -4093,10 +4102,14 @@ public class PApplet extends Applet
int anything = System.in.read();
if (anything == EXTERNAL_STOP) {
//System.out.println("got external stop");
// adding this for 0073.. need to stop libraries
// when the stop button is hit.
PApplet.this.stop();
finished = true;
//} else {
//print((char) anything);
}
} catch (IOException e) {
finished = true;
@@ -4444,6 +4457,26 @@ v PApplet.this.stop();
}
//////////////////////////////////////////////////////////////
public void loadPixels() {
g.loadPixels();
pixels = g.pixels;
}
public void updatePixels() {
// anything special here?
g.updatePixels();
}
public void updatePixels(int x1, int y1, int x2, int y2) {
g.updatePixels(x1, y1, x2, y2);
}
//////////////////////////////////////////////////////////////
// everything below this line is automatically generated. no touch.
@@ -4468,24 +4501,6 @@ v PApplet.this.stop();
}
public void loadPixels() {
if (recorder != null) recorder.loadPixels();
g.loadPixels();
}
public void updatePixels() {
if (recorder != null) recorder.updatePixels();
g.updatePixels();
}
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 int get(int x, int y) {
return g.get(x, y);
}
@@ -4496,6 +4511,11 @@ v PApplet.this.stop();
}
public PImage get() {
return g.get();
}
public void set(int x, int y, int c) {
if (recorder != null) recorder.set(x, y, c);
g.set(x, y, c);
@@ -4686,15 +4706,19 @@ v PApplet.this.stop();
}
public void bezierVertex(float x, float y) {
if (recorder != null) recorder.bezierVertex(x, y);
g.bezierVertex(x, y);
public void bezierVertex(float x1, float y1,
float x2, float y2,
float x3, float y3) {
if (recorder != null) recorder.bezierVertex(x1, y1, x2, y2, x3, y3);
g.bezierVertex(x1, y1, x2, y2, x3, y3);
}
public void bezierVertex(float x, float y, float z) {
if (recorder != null) recorder.bezierVertex(x, y, z);
g.bezierVertex(x, y, z);
public void bezierVertex(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3) {
if (recorder != null) recorder.bezierVertex(x1, y1, z1, x2, y2, z2, x3, y3, z3);
g.bezierVertex(x1, y1, z1, x2, y2, z2, x3, y3, z3);
}
@@ -5458,12 +5482,6 @@ v PApplet.this.stop();
}
public void clear() {
if (recorder != null) recorder.clear();
g.clear();
}
public final float alpha(int what) {
return g.alpha(what);
}
+18 -18
View File
@@ -83,12 +83,13 @@ public interface PConstants {
// filter/convert types
static final int BLACK_WHITE = 10;
static final int GRAYSCALE = 11;
static final int BLUR = 12;
static final int GAUSSIAN_BLUR = 13;
static final int POSTERIZE = 14;
static final int FIND_EDGES = 15;
static final int BLUR = 12;
//static final int EDGES = 15; // removed
static final int GRAY = 11;
static final int INVERT = 13;
static final int POSTERIZE = 14;
static final int THRESHOLD = 10;
// RGB is also a filter option
// blend mode keyword definitions
@@ -156,8 +157,8 @@ public interface PConstants {
static final int QUAD_STRIP = (1 << 7) | 1;
static final int POLYGON = (1 << 8) | 0;
static final int CONCAVE_POLYGON = (1 << 8) | 1;
static final int CONVEX_POLYGON = (1 << 8) | 2;
//static final int CONCAVE_POLYGON = (1 << 8) | 1;
//static final int CONVEX_POLYGON = (1 << 8) | 2;
// shape modes
@@ -195,15 +196,14 @@ public interface PConstants {
// stroke modes
static final int SQUARE = 1 << 0;
static final int ROUND = 1 << 1;
static final int PROJECTED = 1 << 2;
static final int CAP_MASK = SQUARE | ROUND | PROJECTED;
static final int MITERED = 1 << 3;
static final int SQUARE = 1 << 0;
static final int ROUND = 1 << 1;
static final int PROJECT = 1 << 2;
//static final int CAP_MASK = SQUARE | ROUND | PROJECT;
static final int MITER = 1 << 3;
//static final int ROUND = 1 << 4;
static final int BEVELED = 1 << 5;
static final int JOIN_MASK = MITERED | ROUND | BEVELED;
static final int BEVEL = 1 << 5;
//static final int JOIN_MASK = MITERED | ROUND | BEVELED;
// lighting
@@ -216,8 +216,8 @@ public interface PConstants {
// net
static final int CLIENT = 0;
static final int SERVER = 1;
//static final int CLIENT = 0;
//static final int SERVER = 1;
// key constants
+110 -80
View File
@@ -189,6 +189,14 @@ public class PGraphics extends PImage implements PConstants {
{ -3, 3, 0, 0},
{ 1, 0, 0, 0}
};
protected PMatrix bezierBasis =
new PMatrix(RADIANS,
-1, 3, -3, 1,
3, -6, 3, 0,
-3, 3, 0, 0,
1, 0, 0, 0);
protected float bezier_forward[][]; // = new float[4][4];
protected float bezier_draw[][]; // = new float[4][4];
@@ -202,6 +210,9 @@ public class PGraphics extends PImage implements PConstants {
protected float curve_forward[][]; // = new float[4][4];
protected float curve_draw[][];
protected PMatrix bezierBasisInverse;
protected PMatrix curveToBezierMatrix;
// ........................................................
// spline vertices
@@ -369,7 +380,11 @@ public class PGraphics extends PImage implements PConstants {
colorMode(RGB, TFF);
fill(TFF);
stroke(0);
strokeWeight(ONE);
strokeCap(SQUARE);
strokeJoin(MITER);
background(204);
// init shape stuff
@@ -588,8 +603,8 @@ public class PGraphics extends PImage implements PConstants {
break;
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//case CONCAVE_POLYGON:
//case CONVEX_POLYGON:
if (vertexCount == 1) {
path = new Path();
path.moveTo(x, y);
@@ -619,7 +634,15 @@ public class PGraphics extends PImage implements PConstants {
}
public void bezierVertex(float x, float y) {
public void bezierVertex(float x1, float y1,
float x2, float y2,
float x3, float y3) {
// if there hasn't yet been a call to vertex(), throw an error
// otherwise, draw a bezier segment to this point
}
protected void bezier_vertex(float x, float y) {
vertexCount = 0;
if (splineVertices == null) {
@@ -640,9 +663,8 @@ public class PGraphics extends PImage implements PConstants {
switch (shape) {
case LINE_LOOP:
case LINE_STRIP:
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
if (splineVertexCount == 1) {
path.moveTo(x, y);
@@ -662,10 +684,9 @@ public class PGraphics extends PImage implements PConstants {
}
/**
* See notes with the bezier() function.
*/
public void bezierVertex(float x, float y, float z) {
public void bezierVertex(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3) {
throw new RuntimeException("bezierVertex(x, y, z) can only be used with " +
"depth(), use bezierVertex(x, y) instead.");
}
@@ -703,8 +724,8 @@ public class PGraphics extends PImage implements PConstants {
break;
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//case CONCAVE_POLYGON:
//case CONVEX_POLYGON:
path.closePath();
draw_shape(path);
break;
@@ -924,14 +945,13 @@ public class PGraphics extends PImage implements PConstants {
if (angleMode == DEGREES) {
start = start * DEG_TO_RAD;
stop = stop * DEG_TO_RAD;
// before running a while loop like this,
// make sure it will exit at some point.
if (Float.isInfinite(start) || Float.isInfinite(stop)) return;
while (stop < start) stop += TWO_PI;
}
// before running a while loop like this,
// make sure it will exit at some point.
if (Float.isInfinite(start) || Float.isInfinite(stop)) return;
while (stop < start) stop += TWO_PI;
arcImpl(start, stop, x, y, w, h);
arcImpl(x, y, w, h, start, stop);
}
@@ -979,8 +999,8 @@ public class PGraphics extends PImage implements PConstants {
* b and c are the control points. this can be done once with the
* x coordinates and a second time with the y coordinates to get
* the location of a bezier curve at t.
*
* for instance, to convert the following example:<code>
* <P>
* For instance, to convert the following example:<PRE>
* stroke(255, 102, 0);
* line(85, 20, 10, 10);
* line(90, 90, 15, 80);
@@ -994,11 +1014,11 @@ public class PGraphics extends PImage implements PConstants {
* beginShape(LINE_STRIP);
* for (int i = 0; i <= 10; i++) {
* float t = i / 10.0f;
* float x = bezier(85, 10, 90, 15, t);
* float y = bezier(20, 10, 90, 80, t);
* float x = bezierPoint(85, 10, 90, 15, t);
* float y = bezierPoint(20, 10, 90, 80, t);
* vertex(x, y);
* }
* endShape();</code>
* endShape();</PRE>
*/
public float bezierPoint(float a, float b, float c, float d, float t) {
float t1 = 1.0f - t;
@@ -1030,51 +1050,28 @@ public class PGraphics extends PImage implements PConstants {
* Draw a bezier curve. The first and last points are
* the on-curve points. The middle two are the 'control' points,
* or 'handles' in an application like Illustrator.
*
* <P>
* Identical to typing:
* beginShape();
* bezierVertex(x1, y1);
* bezierVertex(x2, y2);
* bezierVertex(x3, y3);
* bezierVertex(x4, y4);
* endShape();
* <PRE>beginShape();
* vertex(x1, y1);
* bezierVertex(x2, y2, x3, y3, x4, y4);
* endShape();</PRE>
*
* In Postscript-speak, this would be:
* moveto(x1, y1);
* curveto(x2, y2, x3, y3, x4, y4);
* <PRE>moveto(x1, y1);
* curveto(x2, y2, x3, y3, x4, y4);</PRE>
* If you were to try and continue that curve like so:
* curveto(x5, y5, x6, y6, x7, y7);
* This would be done in bagel by adding these statements:
* curveVertex(x4, y4);
* curveVertex(x5, y5);
* curveVertex(x6, y6);
* curveVertex(x7, y7);
* Note that x4/y4 are being pulled from the previous
* curveto and used again.
*
* The solution here may be a bit more verbose than Postscript,
* but in general, decisions opted for maximum flexibility,
* since these beginShape() commands are intended as a bit lower-level.
* Rather than having many types of curveto (curve to corner,
* and several others described in the Postscript and Illustrator specs)
* let someone else implement a nice moveto/lineto/curveto library on top.
* In fact, it's tempting that we may put one in there ourselves.
*
* Another method for bezier (though not implemented this way)
* 1. first start with a call to vertex()
* 2. every three calls to bezierVertex produce a new segment
* This option seemed no good because of the confusion of mixing
* vertex and bezierVertex calls.
* <PRE>curveto(x5, y5, x6, y6, x7, y7);</PRE>
* This would be done in processing by adding these statements:
* <PRE>bezierVertex(x5, y5, x6, y6, x7, y7)</PRE>
*/
public void bezier(float x1, float y1,
float x2, float y2,
float x3, float y3,
float x4, float y4) {
beginShape(LINE_STRIP);
bezierVertex(x1, y1);
bezierVertex(x2, y2);
bezierVertex(x3, y3);
bezierVertex(x4, y4);
vertex(x1, y1);
bezierVertex(x2, y2, x3, y3, x4, y4);
endShape();
}
@@ -1131,7 +1128,7 @@ public class PGraphics extends PImage implements PConstants {
* curve, and setting the s parameter, which defines how tightly
* the curve fits to each vertex. Catmull-Rom curves are actually
* a subset of this curve type where the s is set to zero.
*
* <P>
* (This function is not optimized, since it's not expected to
* be called all that often. there are many juicy and obvious
* opimizations in here, but it's probably better to keep the
@@ -1164,6 +1161,18 @@ public class PGraphics extends PImage implements PConstants {
}
setup_spline_forward(segments, curve_forward);
if (bezierBasisInverse == null) {
bezierBasisInverse = new PMatrix(bezierBasis).invert();
}
// hack here to get PGraphics2 working
curveToBezierMatrix = new PMatrix(RADIANS,
c[0][0], c[0][1], c[0][2], c[0][3],
c[1][0], c[1][1], c[1][2], c[1][3],
c[2][0], c[2][1], c[2][2], c[2][3],
c[3][0], c[3][1], c[3][2], c[3][3]);
curveToBezierMatrix.preApplyMatrix(bezierBasisInverse);
// multiply the basis and forward diff matrices together
// saves much time since this needn't be done for each curve
mult_spline_matrix(curve_forward, curve_basis, curve_draw, 4);
@@ -1199,18 +1208,19 @@ public class PGraphics extends PImage implements PConstants {
/**
* Draws a segment of Catmull-Rom curve.
*
* Identical to typing out:
* <P>
* As of 0070, this function no longer doubles the first and
* last points. The curves are a bit more boring, but it's more
* mathematically correct, and properly mirrored in curvePoint().
* <P>
* Identical to typing out:<PRE>
* beginShape();
* curveVertex(x1, y1);
* curveVertex(x2, y2);
* curveVertex(x3, y3);
* curveVertex(x4, y4);
* endShape();
*
* As of 0070, this function no longer doubles the first and
* last points. The curves are a bit more boring, but it's more
* mathematically correct, and properly mirrored in curvePoint().
* </PRE>
*/
public void curve(float x1, float y1,
float x2, float y2,
@@ -2286,16 +2296,10 @@ public class PGraphics extends PImage implements PConstants {
}
// if high bit isn't set, then it's not a #ffcc00 style web color
// so redirect to the float version, b/c they want a gray.
// only danger is that someone would try to set the color to a
// zero alpha.. which would be kooky but not unlikely
// (i.e. if it were in a loop) so in addition to checking the high
// bit, check to see if the value is at least just below the
// colorModeX (i.e. 0..255). can't just check the latter since
// if the high bit is > 0x80 then the int value for rgb will be
// negative. yay for no unsigned types in java!
/**
* Set the tint to either a grayscale or ARGB value. See notes
* attached to the fill() function.
*/
public void tint(int rgb) {
if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) {
tint((float) rgb);
@@ -2338,6 +2342,26 @@ public class PGraphics extends PImage implements PConstants {
}
/**
* Set the fill to either a grayscale value or an ARGB int.
* <P>
* The problem with this code is that it has to detect between
* these two situations automatically. This is done by checking
* to see if the high bits (the alpha for 0xAA000000) is set,
* and if not, whether the color value that follows is less than
* colorModeX (the first param passed to colorMode).
* <P>
* This auto-detect would break in the following situation:
* <PRE>size(256, 256);
* for (int i = 0; i < 256; i++) {
* color c = color(0, 0, 0, i);
* stroke(c);
* line(i, 0, i, 256);
* }</PRE>
* ...on the first time through the loop, where (i == 0),
* since the color itself is zero (black) then it would appear
* indistinguishable from someone having written fill(0).
*/
public void fill(int rgb) {
if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above
fill((float) rgb);
@@ -2396,6 +2420,10 @@ public class PGraphics extends PImage implements PConstants {
}
/**
* 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);
@@ -2441,7 +2469,7 @@ public class PGraphics extends PImage implements PConstants {
* before drawing.
*/
public void background(int rgb) {
if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) { // see above
if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) {
background((float) rgb);
} else {
@@ -2467,12 +2495,12 @@ public class PGraphics extends PImage implements PConstants {
/**
* Takes an RGB or RGBA image and sets it as the background.
*
* Takes an RGB or ARGB image and sets it as the background.
* <P>
* Note that even if the image is set as RGB, the high 8 bits of
* each pixel must be set (0xFF000000), because the image data will
* be copied directly to the screen.
*
* <P>
* Also clears out the zbuffer and stencil buffer if they exist.
*/
public void background(PImage image) {
@@ -2490,13 +2518,15 @@ public class PGraphics extends PImage implements PConstants {
/**
* Clears pixel buffer. Also clears the stencil and zbuffer
* Clears pixel buffer. Subclasses (PGraphics3) will also clear the
* stencil and zbuffer
* if they exist. Their existence is more accurate than using 'depth'
* to test whether to clear them, because if they're non-null,
* it means that depth() has been called somewhere in the program,
* even if noDepth() was called before draw() exited.
*/
public void clear() {
//public void clear() {
protected void clear() {
for (int i = 0; i < pixelCount; i++) {
pixels[i] = backgroundColor;
}
+196 -59
View File
@@ -159,7 +159,6 @@ public class PGraphics2 extends PGraphics {
case LINE_STRIP:
case LINE_LOOP:
if (gpath == null) {
//if (vertexCount == 1) {
gpath = new GeneralPath();
gpath.moveTo(x, y);
} else {
@@ -273,8 +272,8 @@ public class PGraphics2 extends PGraphics {
break;
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//case CONCAVE_POLYGON:
//case CONVEX_POLYGON:
//if (vertexCount == 1) {
if (gpath == null) {
//System.out.println("starting poly path " + x + " " + y);
@@ -289,7 +288,39 @@ public class PGraphics2 extends PGraphics {
}
public void bezierVertex(float x, float y) {
public void bezierVertex(float x1, float y1,
float x2, float y2,
float x3, float y3) {
//if (vertexCount == 0) {
if (gpath == null) {
throw new RuntimeException("Must call vertex() at least once " +
"before using bezierVertex()");
}
switch (shape) {
case LINE_LOOP:
case LINE_STRIP:
case POLYGON:
gpath.curveTo(x1, y1, x2, y2, x3, y3);
break;
default:
throw new RuntimeException("bezierVertex() can only be used with " +
"LINE_STRIP, LINE_LOOP, or POLYGON");
}
}
float curveX[] = new float[4];
float curveY[] = new float[4];
public void curveVertex(float x, float y) {
if ((shape != LINE_LOOP) && (shape != LINE_STRIP) && (shape != POLYGON)) {
throw new RuntimeException("curveVertex() can only be used with " +
"LINE_LOOP, LINE_STRIP, and POLYGON shapes");
}
if (!curve_inited) curve_init();
vertexCount = 0;
if (splineVertices == null) {
@@ -304,35 +335,41 @@ public class PGraphics2 extends PGraphics {
splineVertices[1], 0, VERTEX_FIELD_COUNT);
splineVertexCount = 3;
}
// this new guy will be the fourth point (or higher),
// which means it's time to draw segments of the curve
if (splineVertexCount >= 3) {
curveX[0] = splineVertices[splineVertexCount-3][MX];
curveY[0] = splineVertices[splineVertexCount-3][MY];
curveX[1] = splineVertices[splineVertexCount-2][MX];
curveY[1] = splineVertices[splineVertexCount-2][MY];
curveX[2] = splineVertices[splineVertexCount-1][MX];
curveY[2] = splineVertices[splineVertexCount-1][MY];
curveX[3] = x;
curveY[3] = y;
curveToBezierMatrix.mult(curveX, curveX);
curveToBezierMatrix.mult(curveY, curveY);
// since the paths are continuous,
// only the first point needs the actual moveto
if (gpath == null) {
gpath = new GeneralPath();
gpath.moveTo(curveX[0], curveY[0]);
}
gpath.curveTo(curveX[1], curveY[1],
curveX[2], curveY[2],
curveX[3], curveY[3]);
}
// add the current point to the list
splineVertices[splineVertexCount][MX] = x;
splineVertices[splineVertexCount][MY] = y;
splineVertexCount++;
switch (shape) {
case LINE_LOOP:
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//if (splineVertexCount == 1) {
if (gpath == null) {
gpath = new GeneralPath();
gpath.moveTo(x, y);
} else if (splineVertexCount >= 4) {
gpath.curveTo(splineVertices[splineVertexCount-3][MX],
splineVertices[splineVertexCount-3][MY],
splineVertices[splineVertexCount-2][MX],
splineVertices[splineVertexCount-2][MY],
x, y);
}
break;
}
}
public void curveVertex(float x, float y) {
// TODO handle inverse matrix action
throw new RuntimeException("curveVertex() not yet implemented");
}
@@ -361,8 +398,8 @@ public class PGraphics2 extends PGraphics {
break;
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//case CONCAVE_POLYGON:
//case CONVEX_POLYGON:
//System.out.println("finishing polygon");
gpath.closePath();
draw_shape(gpath);
@@ -377,14 +414,12 @@ public class PGraphics2 extends PGraphics {
//////////////////////////////////////////////////////////////
/*
protected void fill_shape(Shape s) {
if (fill) {
graphics.setColor(fillColorObject);
graphics.fill(s);
g2.setColor(fillColorObject);
g2.fill(s);
}
}
*/
protected void stroke_shape(Shape s) {
if (stroke) {
@@ -507,16 +542,74 @@ public class PGraphics2 extends PGraphics {
}
public void arcImpl(float x, float y, float w, float h,
float start, float stop) {
arc.setArc(x, y, w, h, start, stop-start, Arc2D.PIE);
draw_shape(arc);
protected void arcImpl(float x, float y, float w, float h,
float start, float stop) {
// 0 to 90 in java would be 0 to -90 for p5 renderer
// but that won't work, so -90 to 0?
if (stop - start >= TWO_PI) {
start = 0;
stop = 360;
} else {
start = -start * RAD_TO_DEG;
stop = -stop * RAD_TO_DEG;
// ok to do this because already checked for NaN
//while (start < 0) start += 360;
//while (stop < 0) stop += 360;
while (start < 0) {
start += 360;
stop += 360;
}
/*
while (stop < 0) {
start += 360;
stop += 360;
}
*/
if (start > stop) {
float temp = start;
start = stop;
stop = temp;
}
}
float span = stop - start;
/*
float span = stop - start;
start -= span;
start *= RAD_TO_DEG;
span *= RAD_TO_DEG;
*/
//start %= 360;
//System.out.println(RAD_TO_DEG*start + " " + RAD_TO_DEG*span);
//System.out.println(start + " " + span);
// start is int proper place, but the stop is the wrong way
//float stop = start;
//float start =
// stroke as Arc2D.OPEN, fill as Arc2D.PIE
if (fill) {
//System.out.println("filla");
arc.setArc(x, y, w, h, start, span, Arc2D.PIE);
fill_shape(arc);
}
if (stroke) {
//System.out.println("strokey");
arc.setArc(x, y, w, h, start, span, Arc2D.OPEN);
stroke_shape(arc);
}
}
//////////////////////////////////////////////////////////////
/*
public void bezier(float x1, float y1,
float x2, float y2,
float x3, float y3,
@@ -528,6 +621,7 @@ public class PGraphics2 extends PGraphics {
draw_shape(gp);
}
*/
public void bezierDetail(int detail) {
@@ -539,6 +633,7 @@ public class PGraphics2 extends PGraphics {
}
/*
public void curveTightness(float tightness) {
// TODO
}
@@ -549,8 +644,9 @@ public class PGraphics2 extends PGraphics {
float x3, float y3,
float x4, float y4) {
// TODO need inverse catmull rom to bezier matrix
}
}
*/
//////////////////////////////////////////////////////////////
@@ -621,10 +717,9 @@ public class PGraphics2 extends PGraphics {
public ImageCache(PImage source) {
this.source = source;
// if RGB, set the image type to RGB,
// otherwise it's ALPHA or ARGB, and use an ARGB bimage
int type = (source.format == RGB) ?
BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
// even if RGB, set the image type to ARGB, because the
// image may have an alpha value for its tint().
int type = BufferedImage.TYPE_INT_ARGB;
image = new BufferedImage(source.width, source.height, type);
}
@@ -641,21 +736,42 @@ public class PGraphics2 extends PGraphics {
int r2 = (tintColor >> 16) & 0xff;
int g2 = (tintColor >> 8) & 0xff;
int b2 = (tintColor) & 0xff;
//System.out.println("a2 is " + a2);
// multiply each of the color components into tintedPixels
for (int i = 0; i < tintedPixels.length; i++) {
int argb1 = source.pixels[i];
int a1 = (argb1 >> 24) & 0xff;
int r1 = (argb1 >> 16) & 0xff;
int g1 = (argb1 >> 8) & 0xff;
int b1 = (argb1) & 0xff;
// if straight RGB image, don't bother multiplying
// (also avoids problems if high bits not set)
if (source.format == RGB) {
int alpha = a2 << 24;
tintedPixels[i] =
(((a2 * a1) & 0xff00) << 16) |
(((r2 * r1) & 0xff00) << 8) |
((g2 * g1) & 0xff00) |
(((b2 * b1) & 0xff00) >> 8);
for (int i = 0; i < tintedPixels.length; i++) {
int argb1 = source.pixels[i];
int r1 = (argb1 >> 16) & 0xff;
int g1 = (argb1 >> 8) & 0xff;
int b1 = (argb1) & 0xff;
tintedPixels[i] = alpha |
(((r2 * r1) & 0xff00) << 8) |
((g2 * g1) & 0xff00) |
(((b2 * b1) & 0xff00) >> 8);
}
} else {
for (int i = 0; i < tintedPixels.length; i++) {
int argb1 = source.pixels[i];
int a1 = (argb1 >> 24) & 0xff;
int r1 = (argb1 >> 16) & 0xff;
int g1 = (argb1 >> 8) & 0xff;
int b1 = (argb1) & 0xff;
tintedPixels[i] =
(((a2 * a1) & 0xff00) << 16) |
(((r2 * r1) & 0xff00) << 8) |
((g2 * g1) & 0xff00) |
(((b2 * b1) & 0xff00) >> 8);
}
}
tinted = true;
tintedColor = tintColor;
@@ -665,6 +781,7 @@ public class PGraphics2 extends PGraphics {
} else { // no tint
// just do a setRGB like before
// (and we'll just hope that the high bits are set)
image.setRGB(0, 0, source.width, source.height,
source.pixels, 0, source.width);
}
@@ -849,12 +966,12 @@ public class PGraphics2 extends PGraphics {
int cap = BasicStroke.CAP_BUTT;
if (strokeCap == ROUND) {
cap = BasicStroke.CAP_ROUND;
} else if (strokeCap == PROJECTED) {
} else if (strokeCap == PROJECT) {
cap = BasicStroke.CAP_SQUARE;
}
int join = BasicStroke.JOIN_BEVEL;
if (strokeJoin == MITERED) {
if (strokeJoin == MITER) {
join = BasicStroke.JOIN_MITER;
} else if (strokeJoin == ROUND) {
join = BasicStroke.JOIN_ROUND;
@@ -952,8 +1069,28 @@ public class PGraphics2 extends PGraphics {
public PImage get(int x, int y, int w, int h) {
if (imageMode == CORNERS) { // if CORNER, do nothing
//x2 += x1; y2 += y1;
// w/h are x2/y2 in this case, bring em down to size
w = (w - x);
h = (h - x);
}
if (x < 0) {
w += x; // clip off the left edge
x = 0;
}
if (y < 0) {
h += y; // clip off some of the height
y = 0;
}
if (x + w > width) w = width - x;
if (y + h > height) h = height - y;
PImage output = new PImage(w, h);
((BufferedImage) image).getRGB(x, y, w, h, output.pixels, 0, width);
// oops, the last parameter is the scan size of the *target* buffer
((BufferedImage) image).getRGB(x, y, w, h, output.pixels, 0, w);
return output;
}
+12 -4
View File
@@ -778,8 +778,8 @@ public class PGraphics3 extends PGraphics {
break;
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//case CONCAVE_POLYGON:
//case CONVEX_POLYGON:
{
// store index of first vertex
int first = lineCount;
@@ -853,8 +853,8 @@ public class PGraphics3 extends PGraphics {
break;
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//case CONCAVE_POLYGON:
//case CONVEX_POLYGON:
{
triangulate_polygon();
}
@@ -1463,9 +1463,17 @@ public class PGraphics3 extends PGraphics {
public void point(float x, float y, float z) {
/*
beginShape(POINTS);
vertex(x, y, z);
endShape();
*/
// hacked workaround for carlos line bug
beginShape(LINES);
vertex(x, y, z);
vertex(x + EPSILON, y + EPSILON, z);
endShape();
}
/*
+108 -40
View File
@@ -2,11 +2,12 @@
/*
PImage - storage class for pixel data
Part of the Processing project - http://Proce55ing.net
Part of the Processing project - http://processing.org
Copyright (c) 2001-05
Ben Fry, Massachusetts Institute of Technology and
Casey Reas, Interaction Design Institute Ivrea
Additional code contributions from toxi
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -33,7 +34,7 @@ import java.io.*;
/**
* [fry 0407XX]
* <PRE>[fry 0407XX]
* - get() on RGB images sets the high bits to opaque
* - modification of naming for functions
* - inclusion of Object.clone()
@@ -66,7 +67,7 @@ import java.io.*;
* image object as parameter. this is to provide an easy syntax for cases
* where the main pixel buffer is the destination. as those methods are
* overloaded in BApplet, users can call those functions directly without
* explicitly giving a reference to PGraphics.
* explicitly giving a reference to PGraphics.</PRE>
*/
public class PImage implements PConstants, Cloneable {
@@ -299,14 +300,14 @@ public class PImage implements PConstants, Cloneable {
* For subclasses where the pixels[] buffer isn't set by default,
* this should copy all data into the pixels[] array
*/
public void loadPixels() {
public void loadPixels() { // ignore
}
/**
* Mark all pixels as needing update.
*/
public void updatePixels() {
public void updatePixels() { // ignore
updatePixels(0, 0, width, height);
}
@@ -315,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 updatePixels(int x1, int y1, int x2, int y2) { // ignore
//if (!modified) { // could just set directly, but..
//}
@@ -382,15 +383,16 @@ public class PImage implements PConstants, Cloneable {
// w/h are x2/y2 in this case, bring em down to size
w = (w - x);
h = (h - x);
//} else if (imageMode == CENTER) {
// w/h are the proper w/h, but x/y need to be moved
//x -= w/2;
//y -= h/2;
}
if (x < 0) x = 0;
if (y < 0) y = 0;
if (x < 0) {
w += x; // clip off the left edge
x = 0;
}
if (y < 0) {
h += y; // clip off some of the height
y = 0;
}
if (x + w > width) w = width - x;
if (y + h > height) h = height - y;
@@ -410,10 +412,8 @@ public class PImage implements PConstants, Cloneable {
/**
* Convenience method to avoid an extra cast,
* and the exception handling.
* Returns a copy of this PImage. Equivalent to get(0, 0, width, height).
*/
/*
public PImage get() {
try {
return (PImage) clone();
@@ -421,7 +421,6 @@ public class PImage implements PConstants, Cloneable {
return null;
}
}
*/
public void set(int x, int y, int c) {
@@ -487,31 +486,26 @@ public class PImage implements PConstants, Cloneable {
/**
* Options to filter an image in place.
* RGB set all the high bits in the image to opaque
* and sets the format to RGB
* FIND_EDGES (no params) .. high pass filter
* BLUR (no params)
* GAUSSIAN_BLUR (one param)
* BLACK_WHITE? (param for midpoint)
* GRAYSCALE
* POSTERIZE (int num of levels)
* Method to apply a variety of basic filters to this image.
* <P>
* <UL>
* <LI>filter(BLUR) provides a basic blur.
* <LI>filter(GRAY) converts the image to grayscale.
* <LI>filter(INVERT) will invert the color components in the image.
* <LI>filter(RGB) set all the high bits in the image to opaque
* and sets the format to RGB.
* <LI>filter(THRESHOLD) converts the image to black and white.
* </UL>
*/
public void filter(int kind) {
switch (kind) {
case RGB:
for (int i = 0; i < pixels.length; i++) {
pixels[i] |= 0xff000000;
}
format = RGB;
case BLUR:
// TODO write basic low-pass filter blur here
// what does photoshop do on the edges with this guy?
break;
case BLACK_WHITE:
filter(BLACK_WHITE, 0.5f);
break;
case GRAYSCALE:
case GRAY:
// Converts RGB image data into grayscale using
// weighted RGB components, and keeps alpha channel intact.
// [toxi 040115]
@@ -525,14 +519,87 @@ public class PImage implements PConstants, Cloneable {
pixels[i] = (col & ALPHA_MASK) | lum<<16 | lum<<8 | lum;
}
break;
case INVERT:
for (int i = 0; i < pixels.length; i++) {
//pixels[i] = 0xff000000 |
pixels[i] ^= 0xffffff;
}
break;
case POSTERIZE:
throw new RuntimeException("Use filter(POSTERIZE, int levels) " +
"instead of filter(POSTERIZE)");
case RGB:
for (int i = 0; i < pixels.length; i++) {
pixels[i] |= 0xff000000;
}
format = RGB;
break;
case THRESHOLD:
filter(THRESHOLD, 0.5f);
break;
}
updatePixels(); // mark as modified
}
/**
* Method to apply a variety of basic filters to this image.
* These filters all take a parameter.
* <P>
* <UL>
* <LI>filter(BLUR, float radius) performas a gaussian blur of the
* specified radius.
* <LI>filter(POSTERIZE, int levels) will posterize the image to
* between 2 and 255 levels.
* <LI>filter(THRESHOLD, float center) allows you to set the
* center point for the threshold. It takes a value from 0 to 1.0.
* </UL>
*/
public void filter(int kind, float param) {
switch (kind) {
case BLACK_WHITE: // greater than or equal to the threshold
case BLUR:
// TODO write gaussian blur
break;
case GRAY:
throw new RuntimeException("Use filter(GRAY) instead of " +
"filter(GRAY, param)");
case INVERT:
throw new RuntimeException("Use filter(INVERT) instead of " +
"filter(INVERT, param)");
case POSTERIZE:
int levels = (int)param;
if ((levels < 2) || (levels > 255)) {
throw new RuntimeException("Levels must be between 2 and 255 for " +
"filter(POSTERIZE, levels)");
}
// TODO not optimized
int levels256 = 256 / levels;
int levels1 = levels - 1;
for (int i = 0; i < pixels.length; i++) {
int rlevel = ((pixels[i] >> 16) & 0xff) / levels256;
int glevel = ((pixels[i] >> 8) & 0xff) / levels256;
int blevel = (pixels[i] & 0xff) / levels256;
rlevel = (rlevel * 255 / levels1) & 0xff;
glevel = (glevel * 255 / levels1) & 0xff;
blevel = (blevel * 255 / levels1) & 0xff;
pixels[i] = ((0xff000000 & pixels[i]) |
(rlevel << 16) |
(glevel << 8) |
blevel);
}
break;
case THRESHOLD: // greater than or equal to the threshold
int thresh = (int) (param * 255);
for (int i = 0; i < pixels.length; i++) {
int max = Math.max((pixels[i] & RED_MASK) >> 16,
@@ -543,10 +610,11 @@ public class PImage implements PConstants, Cloneable {
}
break;
case GRAYSCALE:
filter(GRAYSCALE);
break;
case RGB:
throw new RuntimeException("Use filter(RGB) instead of " +
"filter(RGB, param)");
}
updatePixels(); // mark as modified
}
+4 -6
View File
@@ -366,6 +366,7 @@ public class PLine implements PConstants
return;
}
/*
// draw antialias polygon lines for non stroked polygons
if (BLENDER && SMOOTH) {
// fix for endpoints not being drawn
@@ -376,6 +377,7 @@ public class PLine implements PConstants
drawline_blender(x_array[0], y_array[0], x_array[1], y_array[1]);
return;
}
*/
// draw normal strokes
if (SMOOTH) {
@@ -1114,6 +1116,7 @@ public class PLine implements PConstants
* Special "blender" line code by sami,
* used for anti-aliasing polygon edges
*/
/*
private void drawline_blender(double x0, double y0, double x1, double y1)
{
double tmp;
@@ -1279,10 +1282,5 @@ public class PLine implements PConstants
}
}
}
*/
}
+552
View File
@@ -0,0 +1,552 @@
package processing.core;
public final class PMatrix implements PConstants {
final static int DEFAULT_STACK_DEPTH = 0;
float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33;
float tmpx, tmpy, tmpz, tmpw;
float stack[][];
float resetValue[];
int stackPointer = 0;
int angleMode;
int maxStackDepth;
public PMatrix(int angleMode) {
this.angleMode = angleMode;
set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
maxStackDepth = DEFAULT_STACK_DEPTH;
}
public PMatrix(int angleMode, int stackDepth) {
this.angleMode = angleMode;
set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
stack = new float[stackDepth][16];
maxStackDepth = stackDepth;
}
public PMatrix(int angleMode,
float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33) {
this.angleMode = angleMode;
set(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);
maxStackDepth = DEFAULT_STACK_DEPTH;
}
// Make a copy of a matrix. We copy the stack depth,
// but we don't make a copy of the stack or the stack pointer.
public PMatrix(PMatrix src) {
angleMode = src.angleMode;
set(src.m00, src.m01, src.m02, src.m03,
src.m10, src.m11, src.m12, src.m13,
src.m20, src.m21, src.m22, src.m23,
src.m30, src.m31, src.m32, src.m33);
maxStackDepth = src.maxStackDepth;
stack = new float[maxStackDepth][16];
}
void angleMode(int angleMode) {
this.angleMode = angleMode;
}
void identity() {
set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
void reset() {
if (resetValue == null) {
identity();
}
else {
set(resetValue[0], resetValue[1], resetValue[2],resetValue[3],
resetValue[4], resetValue[5], resetValue[6], resetValue[7],
resetValue[8], resetValue[9], resetValue[10], resetValue[11],
resetValue[12], resetValue[13], resetValue[14], resetValue[15]);
}
}
void storeResetValue() {
if (resetValue == null) {
resetValue = new float[16];
}
resetValue[0] = m00; resetValue[1] = m01; resetValue[2] = m02; resetValue[3] = m03;
resetValue[4] = m10; resetValue[5] = m11; resetValue[6] = m12; resetValue[7] = m13;
resetValue[8] = m20; resetValue[9] = m21; resetValue[10] = m22; resetValue[11] = m23;
resetValue[12] = m30; resetValue[13] = m31; resetValue[14] = m32; resetValue[15] = m33;
}
void clearStack() {
stackPointer = 0;
}
boolean push() {
if (stackPointer == maxStackDepth) return false;
stack[stackPointer][0] = m00; stack[stackPointer][1] = m01; stack[stackPointer][2] = m02; stack[stackPointer][3] = m03;
stack[stackPointer][4] = m10; stack[stackPointer][5] = m11; stack[stackPointer][6] = m12; stack[stackPointer][7] = m13;
stack[stackPointer][8] = m20; stack[stackPointer][9] = m21; stack[stackPointer][10] = m22; stack[stackPointer][11] = m23;
stack[stackPointer][12] = m30; stack[stackPointer][13] = m31; stack[stackPointer][14] = m32; stack[stackPointer][15] = m33;
stackPointer++;
return true;
}
boolean pop() {
if (stackPointer == 0) return false;
stackPointer--;
m00 = stack[stackPointer][0]; m01 = stack[stackPointer][1]; m02 = stack[stackPointer][2]; m03 = stack[stackPointer][3];
m10 = stack[stackPointer][4]; m11 = stack[stackPointer][5]; m12 = stack[stackPointer][6]; m13 = stack[stackPointer][7];
m20 = stack[stackPointer][8]; m21 = stack[stackPointer][9]; m22 = stack[stackPointer][10]; m23 = stack[stackPointer][11];
m30 = stack[stackPointer][12]; m31 = stack[stackPointer][13]; m32 = stack[stackPointer][14]; m33 = stack[stackPointer][15];
return true;
}
void set(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33) {
this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03;
this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13;
this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23;
this.m30 = m30; this.m31 = m31; this.m32 = m32; this.m33 = m33;
}
public void translate(float tx, float ty) {
translate(tx, ty, 0);
}
public void invTranslate(float tx, float ty) {
invTranslate(tx, ty, 0);
}
public void translate(float tx, float ty, float tz) {
m03 += tx*m00 + ty*m01 + tz*m02;
m13 += tx*m10 + ty*m11 + tz*m12;
m23 += tx*m20 + ty*m21 + tz*m22;
m33 += tx*m30 + ty*m31 + tz*m32;
}
public void invTranslate(float tx, float ty, float tz) {
preApplyMatrix(1, 0, 0, -tx,
0, 1, 0, -ty,
0, 0, 1, -tz,
0, 0, 0, 1);
}
// OPT could save several multiplies for the 0s and 1s by just
// putting the multMatrix code here and removing uneccessary terms
public void rotateX(float angle) {
//rotate(angle, 1, 0, 0);
float c = cos(angle);
float s = sin(angle);
applyMatrix(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
}
public void invRotateX(float angle) {
float c = cos(-angle);
float s = sin(-angle);
preApplyMatrix(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
}
public void rotateY(float angle) {
//rotate(angle, 0, 1, 0);
float c = cos(angle);
float s = sin(angle);
applyMatrix(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
}
public void invRotateY(float angle) {
//rotate(angle, 0, 1, 0);
float c = cos(-angle);
float s = sin(-angle);
preApplyMatrix(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
}
// two dimensional rotation is the same as rotating along the z-axis
public void rotate(float angle) {
rotateZ(angle);
}
public void invRotate(float angle) {
invRotateZ(angle);
}
// note that this doesn't make things 3D
public void rotateZ(float angle) {
//rotate(angle, 0, 0, 1);
float c = cos(angle);
float s = sin(angle);
applyMatrix(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
public void invRotateZ(float angle) {
//rotate(angle, 0, 0, 1);
float c = cos(-angle);
float s = sin(-angle);
preApplyMatrix(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
public void rotate(float angle, float v0, float v1, float v2) {
// should be in radians (i think), instead of degrees (gl uses degrees)
// based on 15-463 code, but similar to opengl ref p.443
// TODO should make sure this vector is normalized
float c = cos(angle);
float s = sin(angle);
float t = 1.0f - c;
applyMatrix((t*v0*v0) + c, (t*v0*v1) - (s*v2), (t*v0*v2) + (s*v1), 0,
(t*v0*v1) + (s*v2), (t*v1*v1) + c, (t*v1*v2) - (s*v0), 0,
(t*v0*v2) - (s*v1), (t*v1*v2) + (s*v0), (t*v2*v2) + c, 0,
0, 0, 0, 1);
}
public void invRotate(float angle, float v0, float v1, float v2) {
// TODO should make sure this vector is normalized
float c = cos(-angle);
float s = sin(-angle);
float t = 1.0f - c;
preApplyMatrix((t*v0*v0) + c, (t*v0*v1) - (s*v2), (t*v0*v2) + (s*v1), 0,
(t*v0*v1) + (s*v2), (t*v1*v1) + c, (t*v1*v2) - (s*v0), 0,
(t*v0*v2) - (s*v1), (t*v1*v2) + (s*v0), (t*v2*v2) + c, 0,
0, 0, 0, 1);
}
public void scale(float s) {
applyMatrix(s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1);
}
public void invScale(float s) {
preApplyMatrix(1/s, 0, 0, 0, 0, 1/s, 0, 0, 0, 0, 1/s, 0, 0, 0, 0, 1);
}
public void scale(float sx, float sy) {
applyMatrix(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
public void invScale(float sx, float sy) {
preApplyMatrix(1/sx, 0, 0, 0, 0, 1/sy, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
// OPTIMIZE: same as above
public void scale(float x, float y, float z) {
applyMatrix(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);
}
public void invScale(float x, float y, float z) {
preApplyMatrix(1/x, 0, 0, 0, 0, 1/y, 0, 0, 0, 0, 1/z, 0, 0, 0, 0, 1);
}
public void transform(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
applyMatrix(n00, n01, n02, n03, n10, n11, n12, n13,
n20, n21, n22, n23, n30, n31, n32, n33);
}
public void preApplyMatrix(PMatrix lhs) {
preApplyMatrix(lhs.m00, lhs.m01, lhs.m02, lhs.m03,
lhs.m10, lhs.m11, lhs.m12, lhs.m13,
lhs.m20, lhs.m21, lhs.m22, lhs.m23,
lhs.m30, lhs.m31, lhs.m32, lhs.m33);
}
// for inverse operations, like multiplying the matrix on the left
public void preApplyMatrix(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
//modelMatrixIsIdentity = false;
float r00 = n00*m00 + n01*m10 + n02*m20 + n03*m30;
float r01 = n00*m01 + n01*m11 + n02*m21 + n03*m31;
float r02 = n00*m02 + n01*m12 + n02*m22 + n03*m32;
float r03 = n00*m03 + n01*m13 + n02*m23 + n03*m33;
float r10 = n10*m00 + n11*m10 + n12*m20 + n13*m30;
float r11 = n10*m01 + n11*m11 + n12*m21 + n13*m31;
float r12 = n10*m02 + n11*m12 + n12*m22 + n13*m32;
float r13 = n10*m03 + n11*m13 + n12*m23 + n13*m33;
float r20 = n20*m00 + n21*m10 + n22*m20 + n23*m30;
float r21 = n20*m01 + n21*m11 + n22*m21 + n23*m31;
float r22 = n20*m02 + n21*m12 + n22*m22 + n23*m32;
float r23 = n20*m03 + n21*m13 + n22*m23 + n23*m33;
float r30 = n30*m00 + n31*m10 + n32*m20 + n33*m30;
float r31 = n30*m01 + n31*m11 + n32*m21 + n33*m31;
float r32 = n30*m02 + n31*m12 + n32*m22 + n33*m32;
float r33 = n30*m03 + n31*m13 + n32*m23 + n33*m33;
m00 = r00; m01 = r01; m02 = r02; m03 = r03;
m10 = r10; m11 = r11; m12 = r12; m13 = r13;
m20 = r20; m21 = r21; m22 = r22; m23 = r23;
m30 = r30; m31 = r31; m32 = r32; m33 = r33;
}
public boolean invApplyMatrix(PMatrix rhs) {
PMatrix copy = new PMatrix(rhs);
PMatrix inverse = copy.invert();
if (inverse == null) return false;
preApplyMatrix(inverse);
return true;
}
public boolean invApplyMatrix(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
PMatrix copy = new PMatrix(0, n00, n01, n02, n03,
n10, n11, n12, n13,
n20, n21, n22, n23,
n30, n31, n32, n33);
PMatrix inverse = copy.invert();
if (inverse == null) return false;
preApplyMatrix(inverse);
return true;
}
public void applyMatrix(PMatrix rhs) {
applyMatrix(rhs.m00, rhs.m01, rhs.m02, rhs.m03,
rhs.m10, rhs.m11, rhs.m12, rhs.m13,
rhs.m20, rhs.m21, rhs.m22, rhs.m23,
rhs.m30, rhs.m31, rhs.m32, rhs.m33);
}
public void applyMatrix(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
//modelMatrixIsIdentity = false;
float r00 = m00*n00 + m01*n10 + m02*n20 + m03*n30;
float r01 = m00*n01 + m01*n11 + m02*n21 + m03*n31;
float r02 = m00*n02 + m01*n12 + m02*n22 + m03*n32;
float r03 = m00*n03 + m01*n13 + m02*n23 + m03*n33;
float r10 = m10*n00 + m11*n10 + m12*n20 + m13*n30;
float r11 = m10*n01 + m11*n11 + m12*n21 + m13*n31;
float r12 = m10*n02 + m11*n12 + m12*n22 + m13*n32;
float r13 = m10*n03 + m11*n13 + m12*n23 + m13*n33;
float r20 = m20*n00 + m21*n10 + m22*n20 + m23*n30;
float r21 = m20*n01 + m21*n11 + m22*n21 + m23*n31;
float r22 = m20*n02 + m21*n12 + m22*n22 + m23*n32;
float r23 = m20*n03 + m21*n13 + m22*n23 + m23*n33;
float r30 = m30*n00 + m31*n10 + m32*n20 + m33*n30;
float r31 = m30*n01 + m31*n11 + m32*n21 + m33*n31;
float r32 = m30*n02 + m31*n12 + m32*n22 + m33*n32;
float r33 = m30*n03 + m31*n13 + m32*n23 + m33*n33;
m00 = r00; m01 = r01; m02 = r02; m03 = r03;
m10 = r10; m11 = r11; m12 = r12; m13 = r13;
m20 = r20; m21 = r21; m22 = r22; m23 = r23;
m30 = r30; m31 = r31; m32 = r32; m33 = r33;
}
void mult3(float vec[], float out[]) {
// Must use these temp vars because vec may be the same as out
tmpx = m00*vec[0] + m01*vec[1] + m02*vec[2] + m03;
tmpy = m10*vec[0] + m11*vec[1] + m12*vec[2] + m13;
tmpz = m20*vec[0] + m21*vec[1] + m22*vec[2] + m23;
out[0] = tmpx;
out[1] = tmpy;
out[2] = tmpz;
}
void mult(float vec[], float out[]) {
// Must use these temp vars because vec may be the same as out
tmpx = m00*vec[0] + m01*vec[1] + m02*vec[2] + m03*vec[3];
tmpy = m10*vec[0] + m11*vec[1] + m12*vec[2] + m13*vec[3];
tmpz = m20*vec[0] + m21*vec[1] + m22*vec[2] + m23*vec[3];
tmpw = m30*vec[0] + m31*vec[1] + m32*vec[2] + m33*vec[3];
out[0] = tmpx;
out[1] = tmpy;
out[2] = tmpz;
out[3] = tmpw;
}
/**
* @return the determinant of the matrix
*/
public float determinant() {
float f =
m00
* ((m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32)
- m13 * m22 * m31
- m11 * m23 * m32
- m12 * m21 * m33);
f -= m01
* ((m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32)
- m13 * m22 * m30
- m10 * m23 * m32
- m12 * m20 * m33);
f += m02
* ((m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31)
- m13 * m21 * m30
- m10 * m23 * m31
- m11 * m20 * m33);
f -= m03
* ((m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31)
- m12 * m21 * m30
- m10 * m22 * m31
- m11 * m20 * m32);
return f;
}
/**
* Calculate the determinant of a 3x3 matrix
* @return result
*/
private float determinant3x3(float t00, float t01, float t02,
float t10, float t11, float t12,
float t20, float t21, float t22)
{
return t00 * (t11 * t22 - t12 * t21)
+ t01 * (t12 * t20 - t10 * t22)
+ t02 * (t10 * t21 - t11 * t20);
}
public PMatrix transpose() {
float temp;
temp = m01; m01 = m10; m10 = temp;
temp = m02; m02 = m20; m20 = temp;
temp = m03; m03 = m30; m30 = temp;
temp = m12; m12 = m21; m21 = temp;
temp = m13; m13 = m31; m31 = temp;
temp = m23; m23 = m32; m32 = temp;
return this;
}
/**
* Invert this matrix
* @return this if successful, null otherwise
*/
public PMatrix invert() {
float determinant = determinant();
if (determinant != 0)
{
/*
* m00 m01 m02 m03
* m10 m11 m12 m13
* m20 m21 m22 m23
* m30 m31 m32 m33
*/
float determinant_inv = 1f/determinant;
// first row
float t00 = determinant3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33);
float t01 = -determinant3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33);
float t02 = determinant3x3(m10, m11, m13, m20, m21, m23, m30, m31, m33);
float t03 = -determinant3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32);
// second row
float t10 = -determinant3x3(m01, m02, m03, m21, m22, m23, m31, m32, m33);
float t11 = determinant3x3(m00, m02, m03, m20, m22, m23, m30, m32, m33);
float t12 = -determinant3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33);
float t13 = determinant3x3(m00, m01, m02, m20, m21, m22, m30, m31, m32);
// third row
float t20 = determinant3x3(m01, m02, m03, m11, m12, m13, m31, m32, m33);
float t21 = -determinant3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33);
float t22 = determinant3x3(m00, m01, m03, m10, m11, m13, m30, m31, m33);
float t23 = -determinant3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32);
// fourth row
float t30 = -determinant3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23);
float t31 = determinant3x3(m00, m02, m03, m10, m12, m13, m20, m22, m23);
float t32 = -determinant3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23);
float t33 = determinant3x3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
// transpose and divide by the determinant
m00 = t00*determinant_inv;
m11 = t11*determinant_inv;
m22 = t22*determinant_inv;
m33 = t33*determinant_inv;
m01 = t10*determinant_inv;
m10 = t01*determinant_inv;
m20 = t02*determinant_inv;
m02 = t20*determinant_inv;
m12 = t21*determinant_inv;
m21 = t12*determinant_inv;
m03 = t30*determinant_inv;
m30 = t03*determinant_inv;
m13 = t31*determinant_inv;
m31 = t13*determinant_inv;
m32 = t23*determinant_inv;
m23 = t32*determinant_inv;
return this;
} else
return null;
}
public void print() {
int big = (int) Math.abs(max(max(max(max(abs(m00), abs(m01)),
max(abs(m02), abs(m03))),
max(max(abs(m10), abs(m11)),
max(abs(m12), abs(m13)))),
max(max(max(abs(m20), abs(m21)),
max(abs(m22), abs(m23))),
max(max(abs(m30), abs(m31)),
max(abs(m32), abs(m33))))));
int d = 1;
while ((big /= 10) != 0) d++; // cheap log()
System.out.println(PApplet.nfs(m00, d, 4) + " " +
PApplet.nfs(m01, d, 4) + " " +
PApplet.nfs(m02, d, 4) + " " +
PApplet.nfs(m03, d, 4));
System.out.println(PApplet.nfs(m10, d, 4) + " " +
PApplet.nfs(m11, d, 4) + " " +
PApplet.nfs(m12, d, 4) + " " +
PApplet.nfs(m13, d, 4));
System.out.println(PApplet.nfs(m20, d, 4) + " " +
PApplet.nfs(m21, d, 4) + " " +
PApplet.nfs(m22, d, 4) + " " +
PApplet.nfs(m23, d, 4));
System.out.println(PApplet.nfs(m30, d, 4) + " " +
PApplet.nfs(m31, d, 4) + " " +
PApplet.nfs(m32, d, 4) + " " +
PApplet.nfs(m33, d, 4));
System.out.println();
}
private final float max(float a, float b) {
return (a > b) ? a : b;
}
private final float abs(float a) {
return (a < 0) ? -a : a;
}
private final float sin(float angle) {
if (angleMode == DEGREES) angle *= DEG_TO_RAD;
return (float)Math.sin(angle);
}
private final float cos(float angle) {
if (angleMode == DEGREES) angle *= DEG_TO_RAD;
return (float)Math.cos(angle);
}
}
+12 -11
View File
@@ -37,9 +37,13 @@ public interface PMethods {
public void vertex(float x, float y, float z,
float u, float v);
public void bezierVertex(float x, float y);
public void bezierVertex(float x1, float y1,
float x2, float y2,
float x3, float y3);
public void bezierVertex(float x, float y, float z);
public void bezierVertex(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3);
public void curveVertex(float x, float y);
@@ -221,7 +225,7 @@ public interface PMethods {
public void scale(float sx, float sy);
public void scale(float x, float y, float z);
public void scale(float sx, float sy, float sz);
//
@@ -410,13 +414,10 @@ public interface PMethods {
//
public void loadPixels();
public void updatePixels();
public void updatePixels(int x, int y, int c, int d);
public void pixelsUpdated();
// now handled by PApplet
//public void loadPixels();
//public void updatePixels();
//public void updatePixels(int x, int y, int c, int d);
//
@@ -424,7 +425,7 @@ public interface PMethods {
public PImage get(int x, int y, int c, int d);
//public PImage get(); // too abstract/confusing
public PImage get();
public void set(int x, int y, int argb);
+2 -1
View File
@@ -2,6 +2,7 @@
#C:\jdk-1.4.2_05\bin
#/cygdrive/c/jdk-1.4.2_05/bin/javadoc -d doc processing.core *.java
/cygdrive/c/jdk-1.4.2_05/bin/javadoc -d doc *.java
#/cygdrive/c/jdk-1.4.2_05/bin/javadoc -d doc *.java
javadoc -public -d doc *.java
jikes -d . +D *.java
#jikes -d . +D PApplet.java
+142 -72
View File
@@ -14,41 +14,121 @@ X loadPixels throwing NPEs
X fixes to SCREEN_SPACE text not being sized properly
X loadPixels()/updatePixels() on screen space text (ouch)
X get SCREEN_SPACE text working again
X patch in newer jogl.. too many BSODs
X saveFrame seems to be broken
X fixed for PGraphics2
X fixed for PGraphicsGL
X also implemented loadPixels/updatePixels for gl
X fix tint() with color and alpha for PGraphics2
X alpha() colors are inverted (white is opaque.. doesn't make sense)
X should we swap this around? no - this is how photoshop works
X fix arc
X get() is back
X set camera.modified so that it draws properly
X it's annoying not having a copy() function inside PImage
X formerly get() with no params
o clone throws an exception
o PImage constructor that takes itself?
o PImage copy = new PImage(another);
X got rid of CONCAVE_POLYGON and CONVEX_POLYGON
X hack for points to work in opengl, but still not working broadly
X work on filter() functions
X POSTERIZE - find simple code that does it?
X there must be a straightforward optimized version of it
o EDGES - find edges in casey's example is differen than photoshop
o which version do people want with their stuff
X edges filter removed
X several fixes to Movie and Camera to work with the new gfx model
X PImage.get(x, y, w, h) had a bug when things went off the edge
X set defaults for strokeCap and strokeJoin
X get() and gl images were broken for screen sizes less than full size
X fix arcs, were badly broken between java2d and pgraphics
X look at curve functions more closely
X should we switch to curveVertex(1,2,3) (ala curveto)
X because some confusion with mixing types of curves
o make sure we don't want curveVertices(1,2,3,u,v)
o also make test cases so that java2d and java11 behave the same
X implement PGraphics2.curveVertex()
X updatePixels() not setting PApplet.pixels
X make loadPixels in PGraphics ignored, and put it in PApplet
X made loadStrings() and openStream(File) static again
X test loadPixels()/updatePixels()/saveFrame() on the pc
X better, just assume that they need the endian swap
X fixed draw mode apps for opengl
X (gl was missing a beginFrame)
X pmouseX, pmouseY are not working in OpenGL mode
X (as they are working in Processing mode)
_ why is java2d so flickery?
X is it because the lock was taken off (g) in PApplet?
_ test to see whether it's still happening
o screenX/Y aren't properly working for 2D points against a 3D matrix
o (ryan alexander rounding bug)
o Just to clarify, it works completely correctly with rounding
o screenX/Y and also using the 3 arg version of translate -
o ie translate(hw,hh,0) instead of just translate(hw,hh).
X no longer an issue because moving to 2D and 3D modes
o PImage: remove the static versions of manipulators?
o probably not, because they're inherited by PApplet
o i.e. mask(image, themask);
X no PImage needed b/c PGraphics is a PImage
o colorMode(GRAY) to avoid stroke(0) causing trouble?
o or maybe get rid of stroke(0)? hrm
_ saveFrame seems to be broken (PGraphics2 and PGraphicsGL?)
_ printarr() of null array crashes without an error
_ actually, errors from many crashes not coming through on the mac?
createGraphics and placement issues
_ make pappletgl work back inside papplet
_ and then size(300, 300, DEPTH) etc
_ get rid of opengl renderer menu
_ othersise hint() to use the p5 renderer instead of java2d
_ applet placement is screwy
_ how to force PGraphics() instead of PGraphics2()
o applets on osx (and windows) sometimes show up 20 pixels off the top
_ saveFrame() is saving to sketch folder, save() is not
bezier/catmull rom curves
_ non-homogenous coloring for curve vertices
_ implement curveTangent
PApplet
_ updatePixels() not setting PApplet.pixels
_ make loadPixels in PGraphics ignored, and put it in PApplet
X made loadStrings() and openStream(File) static again
_ fix other stuff that's supposed to be static
_ check for what else inside PApplet should be static
PFont
_ text in a box is broken (at least for PGraphics2)
o get text rect working again (seems to be in infinite loop)
_ patch in newer jogl.. too many BSODs
PGraphics
_ fix-up the curve_init() and the rest to use matrices
_ and not have ugly names (i.e. just g.curveDetail is good)
PGraphics2
_ In this example, tint() is working fine with OpenGL,
_ but not working with the Processing renderer.
size(200, 200);
PImage a; // Declare variable "a" of type PImage
a = loadImage("arch.jpg"); // Load the images into the program
image(a, 0, 0); // Displays the image from point (0,0)
tint(255, 0, 0, 100);
image(a, width/2, 0, a.width/2, a.height/2);
_ why is java2d so flickery?
X is it because the lock was taken off (g) in PApplet?
_ test to see whether it's still happening
_ textSpace(SCREEN_SPACE) needs to be faster
_ need flat image implementation that takes no transforms
_ along with 90, 180 and 270 versions of it as well
_ tie to glDrawPixels.. how to clear matrix properly for that?
_ gradient-painted lines
Color c = new Color(0x00FFFF00, true);
GradientPaint gradient =
new GradientPaint(0,0,Color.red,100,100,c);
GeneralPath gp = new GeneralPath();
gp.moveTo(10, 10);
gp.lineTo(100, 90);
gp.lineTo(20, 50);
gp.closePath();
Graphics2D g2 = ((PGraphics2)g).g2;
g2.setPaint(gradient);
g2.draw(gp);
PAppletGL
_ are draw mode apps now fixed in gl?
_ (gl was missing a beginFrame)
_ pmouseX, pmouseY are not working in OpenGL mode
_ (as they are working in Processing mode)
PGraphics3
_ tint() honoring alpha but not colored tint
_ check with the a_Displaying example and tint(255, 0, 0, 100);
_ make sure arc goes in the right direction that we want it to
_ (make sure that PGraphics3 goes the same direction)
_ Stroking a rect() leaves the upper right pixel off.
_ points not working in opengl (carlos line truncation?)
_ also, points not working in opengl (carlos line truncation?)
void setup() {
size(200, 200);
background(0);
@@ -57,35 +137,37 @@ void draw() {
stroke(255);
point(60, 30);
}
_ error message saying that strokeCap and strokeJoin don't work
PGraphicsGL
_ implement copy() and blend()
_ background color seems to be wrong?
. . . . .
0079+ core
add simon's new 3d code as soon as he has gl working
and make a release based on that
0079 java 1.1 graphics comes back
0080 export to application
api questions
_ alpha() colors are inverted (white is opaque.. doesn't make sense)
_ should we swap this around? also get rid of static version?
_ colorMode(GRAY) to avoid stroke(0) causing trouble?
_ or maybe get rid of stroke(0)? hrm
_ sphere x,y,z,r or box w,h,d.. need to make them consistent
_ look at curve functions more closely
_ should we switch to curveVertex(1,2,3) (ala curveto)
_ because some confusion with mixing types of curves
_ really need to take a look at the curve/vertex code
_ make sure we don't want curveVertices(1,2,3,u,v)
_ also make test cases so that java2d and java11 behave the same
_ make pappletgl work back inside papplet
_ and then size(300, 300, DEPTH) etc
_ get rid of opengl renderer menu
_ othersise hint() to use the p5 renderer instead of java2d
_ how to force PGraphics() instead of PGraphics2()
_ write filter() functions
_ BLUR - write simple blur
_ how does photoshop handle this?
_ BLUR - add gaussian blur
_ remove SCREEN_SPACE altogether?
_ PImage.filter()
_ maybe use quasimonod's gaussian blur code?
_ maybe use quasimondo's gaussian blur code?
_ http://incubator.quasimondo.com/processing/gaussian_blur_1.php
_ filter() on subsections? yes, in keeping with rest of api
_ PImage: remove the static versions of manipulators?
o filter() on subsections? yes, in keeping with rest of api
X no, in keeping with getting shit done
_ might be able to do a typed expand()
public Object growArray(Object array, int size) {
Class type = array.getClass().getComponentType();
@@ -103,6 +185,7 @@ _ do we change to font(arial, 12) ?
_ how to shut off rendering to screen when illustrator in use?
_ need size(30000, 20000) for illustrator, problem in papplet
_ be consistent about getXxx() methods
_ just use the variable names.. don't do overkill on fillR et al
_ or just what functions are actually made public
_ is fillRi needed? it's pretty goofy..
_ how to handle full screen (opengl especially) or no screen (for scripts)
@@ -110,10 +193,20 @@ _ implement fullsize().. this takes over the screen as best it can
_ or should it be more like present mode?
_ that if applet is 500x500, centers on a 800x600 window
_ though how do you get the screen size?
_ screen.width and screen.height?
_ screen.width and screen.height? - yes
_ write java 1.3 code for full screen version of PApplet
_ this might be used for presentation mode
_ go through and see what functions (no pixel ops?) frame recorders should have
_ expose api to launch files, folders, URLs
_ use with/in place of link()
_ particles lib requires depth() (but shouldn't)
_ fix for 78 since not sure when simon's new version is happening
_ PPolygon no longer in use and PLine is a mess
video lib
_ grabbing sub-devices from camera in the lib (via list() or whatever)
_ actually, need to use numbered indices (multiple w/ same name)
_ list should be: "0 - Logitech QuickCam (Blah)"
_ and then use the indices (or the str i guess) to choose
_ something really bad happened with println() in this release
_ perhaps only without a code folder and/or running in java2d mode?
@@ -132,21 +225,11 @@ _ since needs to render to screen as well
_ rewrite library/howto.txt for to get rid of old interface
_ closing window w/o first hitting stop() causes freak out
_ opengl gives an OutOfMemoryError
_ java2d just goes into a lock
_ could also be code that's in an infinite loop (i.e. text error)
_ which then causes a full lock
_ stop() not working very well
_ doesn't seem to actually be stopping things
_ also have a simple way to hook in triangle leeches to PGraphics3
_ this exists, but needs to be documented, or have accessors
_ sphere() and box() should set normals and take textures
- applets on osx (and windows) sometimes show up 20 pixels off the top
_ implement PGraphics2.curveVertex()
_ fix tint() for PGraphics3 (what could be wrong?)
_ maybe not setting fill color when drawing textures
_ guessing it's an implementation issue in sami's renderer
@@ -164,9 +247,6 @@ _ lighting totally sucks (both PGraphics3 and PGraphicsGL)
_ bring in materials for opengl as well?
_ don't include a class, just make it similar to the light functions
_ also have a simple way to hook in triangle leeches to PGraphics3
_ this exists, but needs to be documented, or have accessors
_ get PGraphics.java engine working again
_ beginShape()
@@ -185,6 +265,7 @@ _ image loading bug is huge
_ figure out how to handle cached images, multiple images
_ MediaTracker blocking is prolly making jar download really slow
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1089914280;start=0
_ also threaded images
_ 404 error because first searches applet directory on zipdecode
@@ -281,12 +362,6 @@ _ just have a "thin_flat_line" option in opengl code
_ go through and figure out what stuff to make public
_ screenX/Y aren't properly working for 2D points against a 3D matrix
_ (ryan alexander rounding bug)
_ Just to clarify, it works completely correctly with rounding
_ screenX/Y and also using the 3 arg version of translate -
_ ie translate(hw,hh,0) instead of just translate(hw,hh).
text issues
_ text() with \n is semi-broken
_ font encoding issues
@@ -328,9 +403,6 @@ _ addcolor("blah blah blah", colornum);
_ fill("blah blah blah");
_ maybe this is bad practice--too slow, should use variables
_ write java 1.3 code for full screen version of PApplet
_ this might be used for presentation mode
_ illustrator export / rendering mode
_ also postscript or pdf export?
_ update illustrator code to use core api
@@ -523,8 +595,6 @@ CORE / Details
1 _ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1083650609;start=0
1 _ http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1082481891;start=2
1 _ what is the stroked version of a sphere? a circle?
1 _ non-homogenous coloring for curve vertices
1 _ properly interpolate
1 _ too many push() will silently stop the applet inside a loop
1 _ test winding polygons in different directions
1 _ test lighting to see how it compares with gl
+31 -8
View File
@@ -1,14 +1,38 @@
0078 pde
X file open dialog needs to allow .PDE instead of .pde
X include "you need to install java" text on default export page
0079 pde
_ implement horizontal version of PdeEditorButtons
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1076707944
...
_ include /** */ comments into the html page
_ stop() not working very well
_ doesn't seem to actually be stopping things
_ closing window w/o first hitting stop() causes freak out
_ opengl gives an OutOfMemoryError
_ java2d just goes into a lock
_ could also be code that's in an infinite loop (i.e. text error)
_ which then causes a full lock
_ PdeRuntime/PApplet cleanup
_ run as external whenever using present mode
_ significantly limit range of cases.. if presenting ext is ok
_ uses internal pretty much only when single class, etc
_ include "you need to install java" text on default export page
_ the runtime environment requires java 1.4
_ make sure this is known and tested for properly
_ can't scroll the PdeEditorConsole downwards at all on osx
_ if a .pde isn't contained in a properly named folder
_ offer to rename the parent folder, rather than placing in a new folder
_ some type of sketch archive format for posting examples?
create a new sketch
create a new tab named "a"
@@ -48,10 +72,6 @@ _ that copies applet.html,
_ opens sketch folder,
_ and gives info about what to do next (how to edit)
_ get an xml library in there
_ nanoxml problems with manifest
_ appears to use 1.6.8 version since it's just two classes
check these errors to see if they still exist
_ odd error in System.err stream coming from running external
_ dies after a while or goes weird
@@ -61,11 +81,17 @@ _ no System.out was coming through
_ System.err was getting cut off before finishing
libraries
_ libraries need to remove the PLibrary interface
_ particles lib requires depth() (but shouldn't)
_ fix for 78 since not sure when simon's new version is happening
_ should we queue lib events until the end of loop?
_ lib could call queueEvent with the args
_ then call them inside post()
_ add prompt() method to Camera ("" means default, null is prompt)
_ add prompt() method to Serial (simple dialog box that pops up)
_ get an xml library in there
_ nanoxml problems with manifest
_ appears to use 1.6.8 version since it's just two classes
_ straighten out int() -> toInt() conversion in the preproc
_ add use of doubles on casting -- particularly for Math.cos() et al
@@ -100,9 +126,6 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs
_ mouse wheel broken in the text editor? (windows jdk 1.5?)
_ implement horizontal version of PdeEditorButtons
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1076707944
_ transparently convert spaces to underscores (?)
_ underscoring everything is kinda nasty