diff --git a/app/PdeEditor.java b/app/PdeEditor.java index 8a3afd6f7..ef78fdeab 100644 --- a/app/PdeEditor.java +++ b/app/PdeEditor.java @@ -178,7 +178,7 @@ implements MRJAboutHandler, MRJQuitHandler, MRJPrefsHandler textarea.setRightClickPopup(new TextAreaPopup()); textarea.setTokenMarker(new PdeKeywords()); - textarea.setHorizontalOffset(4); + textarea.setHorizontalOffset(5); //textarea.setBorder(new EmptyBorder(0, 20, 0, 0)); //textarea.setBackground(Color.white); diff --git a/build/macosx/dist/Processing.app/Contents/Resources/processing.icns b/build/macosx/dist/Processing.app/Contents/Resources/processing.icns index 3def58a59..c0df6e38b 100755 Binary files a/build/macosx/dist/Processing.app/Contents/Resources/processing.icns and b/build/macosx/dist/Processing.app/Contents/Resources/processing.icns differ diff --git a/build/windows/launcher/application.ico b/build/windows/launcher/application.ico index 2e8b3b7ae..0d50b66f4 100644 Binary files a/build/windows/launcher/application.ico and b/build/windows/launcher/application.ico differ diff --git a/build/windows/make.sh b/build/windows/make.sh index 52275319c..a51055880 100755 --- a/build/windows/make.sh +++ b/build/windows/make.sh @@ -189,6 +189,7 @@ rm -rf simong mkdir -p ../../build/windows/work/libraries/particles/library/ cp library/particles.jar ../../build/windows/work/libraries/particles/library/ +exit; # OPENGL LIBRARY echo Building OpenGL library... diff --git a/core/PApplet.java b/core/PApplet.java index 0194cfbab..9053ee8f1 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -4180,7 +4180,7 @@ public class PApplet extends Applet } - public void copy(int sx1, int sy1, int sx2, int sy2, + public void copy(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { g.copy(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); } @@ -4207,13 +4207,13 @@ public class PApplet extends Applet } - public void blend(int sx1, int sy1, int sx2, int sy2, + public void blend(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { g.blend(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); } - public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, + public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { g.blend(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); } @@ -4753,25 +4753,25 @@ public class PApplet extends Applet } - public void colorMode(int icolorMode) { - g.colorMode(icolorMode); + public void colorMode(int mode) { + g.colorMode(mode); } - public void colorMode(int icolorMode, float max) { - g.colorMode(icolorMode, max); + public void colorMode(int mode, float max) { + g.colorMode(mode, max); } - public void colorMode(int icolorMode, + public void colorMode(int mode, float maxX, float maxY, float maxZ) { - g.colorMode(icolorMode, maxX, maxY, maxZ); + g.colorMode(mode, maxX, maxY, maxZ); } - public void colorMode(int icolorMode, + public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA) { - g.colorMode(icolorMode, maxX, maxY, maxZ, maxA); + g.colorMode(mode, maxX, maxY, maxZ, maxA); } diff --git a/core/PGraphics.java b/core/PGraphics.java index ddf9b5e45..15afb967b 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -203,7 +203,7 @@ public class PGraphics extends PImage // OLD_GRAPHICS - PPolygon polygon; // general polygon to use for shape + protected PPolygon polygon; // general polygon to use for shape PPolygon fpolygon; // used to fill polys for tri or quad strips PPolygon spolygon; // stroke/line polygon float svertices[][]; // temp vertices used for stroking end of poly @@ -259,7 +259,7 @@ public class PGraphics extends PImage public float normalX, normalY, normalZ; // used by NEW_GRAPHICS, or by OLD_GRAPHICS simply as a boolean - private PImage textureImage; + public PImage textureImage; // NEW_GRAPHICS static final int DEFAULT_TEXTURES = 3; @@ -274,7 +274,7 @@ public class PGraphics extends PImage boolean unchangedZ; boolean strokeChanged; boolean fillChanged; - boolean normalChanged; + protected boolean normalChanged; // ........................................................ @@ -318,7 +318,7 @@ public class PGraphics extends PImage // [toxi031031] new & faster sphere code w/ support flexibile resolutions // will be set by sphereDetail() or 1st call to sphere() - public int sphere_detail = 0; + public int sphereDetail = 0; float sphereX[], sphereY[], sphereZ[]; //int text_mode; @@ -515,8 +515,8 @@ public class PGraphics extends PImage lightG[1] = ONE; lightB[1] = ONE; - textureMode = IMAGE_SPACE; - rectMode = CORNER; + textureMode = IMAGE_SPACE; + rectMode = CORNER; ellipseMode = CENTER; angleMode = RADIANS; //text_mode = ALIGN_LEFT; @@ -3212,7 +3212,7 @@ public class PGraphics extends PImage int ix2 = image.width; int iy2 = image.height; - if (image_mode == CENTER) { + if (imageMode == CENTER) { sx1 -= image.width / 2; sy1 -= image.height / 2; } @@ -3550,42 +3550,42 @@ public class PGraphics extends PImage // precompute vertices along unit sphere with new detail setting public void sphereDetail(int res) { - if (res<3) res=3; // force a minimum res - if (res != sphere_detail) { - float delta = (float)SINCOS_LENGTH/res; - float[] cx = new float[res]; - float[] cz = new float[res]; - // calc unit circle in XZ plane - for (int i = 0; i < res; i++) { - cx[i] = cosLUT[(int) (i*delta) % SINCOS_LENGTH]; - cz[i] = sinLUT[(int) (i*delta) % SINCOS_LENGTH]; - } - // computing vertexlist - // vertexlist starts at south pole - int vertCount = res * (res-1) + 2; - int currVert = 0; + if (res < 3) res = 3; // force a minimum res + if (res == sphereDetail) return; - // re-init arrays to store vertices - sphereX = new float[vertCount]; - sphereY = new float[vertCount]; - sphereZ = new float[vertCount]; - - float angle_step = (SINCOS_LENGTH*0.5f)/res; - float angle = angle_step; - - // step along Y axis - for (int i = 1; i < res; i++) { - float curradius = sinLUT[(int) angle % SINCOS_LENGTH]; - float currY = -cosLUT[(int) angle % SINCOS_LENGTH]; - for (int j = 0; j < res; j++) { - sphereX[currVert] = cx[j] * curradius; - sphereY[currVert] = currY; - sphereZ[currVert++] = cz[j] * curradius; - } - angle += angle_step; - } - sphere_detail = res; + float delta = (float)SINCOS_LENGTH/res; + float[] cx = new float[res]; + float[] cz = new float[res]; + // calc unit circle in XZ plane + for (int i = 0; i < res; i++) { + cx[i] = cosLUT[(int) (i*delta) % SINCOS_LENGTH]; + cz[i] = sinLUT[(int) (i*delta) % SINCOS_LENGTH]; } + // computing vertexlist + // vertexlist starts at south pole + int vertCount = res * (res-1) + 2; + int currVert = 0; + + // re-init arrays to store vertices + sphereX = new float[vertCount]; + sphereY = new float[vertCount]; + sphereZ = new float[vertCount]; + + float angle_step = (SINCOS_LENGTH*0.5f)/res; + float angle = angle_step; + + // step along Y axis + for (int i = 1; i < res; i++) { + float curradius = sinLUT[(int) angle % SINCOS_LENGTH]; + float currY = -cosLUT[(int) angle % SINCOS_LENGTH]; + for (int j = 0; j < res; j++) { + sphereX[currVert] = cx[j] * curradius; + sphereY[currVert] = currY; + sphereZ[currVert++] = cz[j] * curradius; + } + angle += angle_step; + } + sphereDetail = res; } @@ -3607,7 +3607,7 @@ public class PGraphics extends PImage } public void sphere(float x, float y, float z, float r) { - if (sphere_detail == 0) { + if (sphereDetail == 0) { sphereDetail(30); } @@ -3620,7 +3620,7 @@ public class PGraphics extends PImage // 1st ring from south pole beginShape(TRIANGLE_STRIP); - for (int i = 0; i < sphere_detail; i++) { + for (int i = 0; i < sphereDetail; i++) { vertex(0, -1, 0); vertex(sphereX[i], sphereY[i], sphereZ[i]); } @@ -3630,12 +3630,12 @@ public class PGraphics extends PImage // middle rings int voff = 0; - for(int i = 2; i < sphere_detail; i++) { + for(int i = 2; i < sphereDetail; i++) { v1=v11=voff; - voff += sphere_detail; + voff += sphereDetail; v2=voff; beginShape(TRIANGLE_STRIP); - for (int j = 0; j < sphere_detail; j++) { + for (int j = 0; j < sphereDetail; j++) { vertex(sphereX[v1], sphereY[v1], sphereZ[v1++]); vertex(sphereX[v2], sphereY[v2], sphereZ[v2++]); } @@ -3649,7 +3649,7 @@ public class PGraphics extends PImage // add the northern cap beginShape(TRIANGLE_STRIP); - for (int i = 0; i < sphere_detail; i++) { + for (int i = 0; i < sphereDetail; i++) { v2 = voff + i; vertex(0, 1, 0); vertex(sphereX[v2], sphereY[v2], sphereZ[v2]); @@ -4091,7 +4091,7 @@ public class PGraphics extends PImage public void image(PImage image, float x1, float y1) { if ((dimensions == 0) && !lights && !tint && - (image_mode != CENTER_RADIUS)) { + (imageMode != CENTER_RADIUS)) { // if drawing a flat image with no warping, // use faster routine to draw direct to the screen flat_image(image, (int)x1, (int)y1); @@ -4122,7 +4122,7 @@ public class PGraphics extends PImage public void image(PImage image, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2) { - switch (image_mode) { + switch (imageMode) { case CORNERS: break; case CORNER: @@ -4141,22 +4141,17 @@ public class PGraphics extends PImage break; } - // fill must be set to 'true' for image to show up - // (although need to do some sort of color blending) - // stroke should be set to false or it gets confusing - // (and annoying) because one has to keep disabling stroke - boolean savedStroke = stroke; boolean savedFill = fill; + stroke = false; + fill = true; + float savedFillR = fillR; float savedFillG = fillG; float savedFillB = fillB; float savedFillA = fillA; - stroke = false; - fill = true; - if (tint) { fillR = tintR; fillG = tintG; @@ -4164,7 +4159,10 @@ public class PGraphics extends PImage fillA = tintA; } else { - fillR = fillG = fillB = fillA = 1; + fillR = 1; + fillG = 1; + fillB = 1; + fillA = 1; } beginShape(QUADS); @@ -4512,10 +4510,19 @@ public class PGraphics extends PImage /** + * Calling cameraMode(PERSPECTIVE) will setup the standard + * Processing transformation. + * + * cameraMode(ORTHOGRAPHIC) will setup a straight orthographic + * projection. + * + * cameraMode(CUSTOM) will set the perspective (camera) matrix + * to identity, after which time the user can make a mess. + * * Note that this setting gets nuked if resize() is called. */ - public void cameraMode(int icameraMode) { - cameraMode = icameraMode; // this doesn't do much + public void cameraMode(int mode) { + cameraMode = mode; // this doesn't do much if (cameraMode == PERSPECTIVE) { beginCamera(); @@ -4531,6 +4538,11 @@ public class PGraphics extends PImage resetMatrix(); ortho(0, width, 0, height, -10, 10); endCamera(); + + } else if (cameraMode == CUSTOM) { + beginCamera(); + resetMatrix(); + endCamera(); } } @@ -4922,13 +4934,13 @@ public class PGraphics extends PImage // COLOR - public void colorMode(int icolorMode) { - colorMode = icolorMode; + public void colorMode(int mode) { + colorMode = mode; } - public void colorMode(int icolorMode, float max) { - colorMode(icolorMode, max, max, max, max); + public void colorMode(int mode, float max) { + colorMode(mode, max, max, max, max); } @@ -4936,15 +4948,15 @@ public class PGraphics extends PImage // so colorMode(RGB, 255, 255, 255) would retain the previous max alpha // could be a problem when colorMode(HSB, 360, 100, 100); - public void colorMode(int icolorMode, + public void colorMode(int mode, float maxX, float maxY, float maxZ) { - colorMode(icolorMode, maxX, maxY, maxZ, colorModeA); //maxX); //ONE); + colorMode(mode, maxX, maxY, maxZ, colorModeA); //maxX); //ONE); } - public void colorMode(int icolorMode, + public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA) { - colorMode = icolorMode; + colorMode = mode; colorModeX = maxX; // still needs to be set for hsb colorModeY = maxY; diff --git a/core/PImage.java b/core/PImage.java index b42e4034a..4898ec565 100644 --- a/core/PImage.java +++ b/core/PImage.java @@ -4,8 +4,8 @@ PImage - storage class for pixel data Part of the Processing project - http://Proce55ing.net - Copyright (c) 2001-03 - Ben Fry, Massachusetts Institute of Technology and + Copyright (c) 2001-03 + Ben Fry, Massachusetts Institute of Technology and Casey Reas, Interaction Design Institute Ivrea This library is free software; you can redistribute it and/or @@ -18,9 +18,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -32,18 +32,18 @@ import java.io.*; /** - * [fry 0407XX] + * [fry 0407XX] * - get() on RGB images sets the high bits to opaque * - modification of naming for functions * - inclusion of Object.clone() * - make get(), copy(), blend() honor imageMode * - lots of moving things around for new megabucket api - * + * * [toxi 030722] - * advanced copying/blitting code + * advanced copying/blitting code * * [fry 030918] - * integrated and modified to fit p5 spec + * integrated and modified to fit p5 spec * * [toxi 030930] * - target pixel buffer doesn't loose alpha channel anymore @@ -51,19 +51,19 @@ import java.io.*; * - resizing by large factors (>250%) doesn't yield any rounding errors * anymore, changed to 16bit precision (=65536% max or 0.000015% min) * - replicate() is now only using REPLACE mode to avoid semantic problems - * - added blend() methods to use replicate()'s functionality, + * - added blend() methods to use replicate()'s functionality, * but with blend modes * * [toxi 031006] - * blit_resize() is now clipping input coordinates to avoid array - * exceptions target dimension can be larger than destination image + * blit_resize() is now clipping input coordinates to avoid array + * exceptions target dimension can be larger than destination image * object, outside pixels will be skipped * * [toxi 031017] - * versions of replicate() and blend() methods which use cross-image - * blitting are now called in the destination image and expect a source - * 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 + * versions of replicate() and blend() methods which use cross-image + * blitting are now called in the destination image and expect a source + * 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. */ @@ -81,8 +81,8 @@ public class PImage implements PConstants, Cloneable { // would scan line be useful? maybe for pow of 2 gl textures // note! inherited by PGraphics - int image_mode = CORNER; - boolean smooth = false; + public int imageMode = CORNER; + public boolean smooth = false; /** for gl subclass / hardware accel */ public int cacheIndex; @@ -102,11 +102,11 @@ public class PImage implements PConstants, Cloneable { static final int PREC_RED_SHIFT = 16-PRECISIONB; - /** + /** * Create an empty image object, set its format to RGB. * The pixel array is not allocated. */ - public PImage() { + public PImage() { format = RGB; // makes sure that this guy is useful cacheIndex = -1; } @@ -124,8 +124,8 @@ public class PImage implements PConstants, Cloneable { //for(int i=0; i> 16, Math.max((pixels[i] & GREEN_MASK) >> 8, (pixels[i] & BLUE_MASK))); - pixels[i] = (pixels[i] & ALPHA_MASK) | + pixels[i] = (pixels[i] & ALPHA_MASK) | ((max < thresh) ? 0x000000 : 0xffffff); } break; @@ -285,13 +285,13 @@ public class PImage implements PConstants, Cloneable { /** * Returns a "color" type (a packed 32 bit int with the color. - * If the image is in RGB format (i.e. on a PVideo object), + * If the image is in RGB format (i.e. on a PVideo object), * the value will get its high bits set, because of the likely * case that they haven't been already. */ public int get(int x, int y) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return 0; - return (format == RGB) ? + return (format == RGB) ? (pixels[y*width + x] | 0xff000000) : pixels[y*width + x]; } @@ -301,13 +301,13 @@ public class PImage implements PConstants, Cloneable { * This honors imageMode() for the coordinates. */ public PImage get(int x, int y, int w, int h) { - if (image_mode == CORNERS) { // if CORNER, do nothing - //x2 += x1; y2 += y1; + 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); - } else if (image_mode == CENTER) { + } else if (imageMode == CENTER) { // w/h are the proper w/h, but x/y need to be moved x -= w/2; y -= h/2; @@ -324,7 +324,7 @@ public class PImage implements PConstants, Cloneable { int index = y*width + x; int index2 = 0; for (int row = y; row < y+h; row++) { - System.arraycopy(pixels, index, + System.arraycopy(pixels, index, newbie.pixels, index2, w); index+=width; index2+=w; @@ -341,7 +341,7 @@ public class PImage implements PConstants, Cloneable { ////////////////////////////////////////////////////////////// - + // REPLICATING & BLENDING (AREAS) OF PIXELS @@ -378,9 +378,9 @@ public class PImage implements PConstants, Cloneable { public void copy(PImage src, int dx, int dy) { // source - int sx = 0; + int sx = 0; int sy = 0; - int sw = src.width; + int sw = src.width; int sh = src.height; // target @@ -402,7 +402,7 @@ public class PImage implements PConstants, Cloneable { ty = 0; } if (tx + tw > width) { - int extra = (tx + tw) - width; + int extra = (tx + tw) - width; sw -= extra; tw -= extra; } @@ -413,17 +413,17 @@ public class PImage implements PConstants, Cloneable { } for (int row = sy; row < sy + sh; row++) { - System.arraycopy(src.pixels, row*src.width + sx, + System.arraycopy(src.pixels, row*src.width + sx, pixels, (dy+row)*width + tx, sw); } } /** - * Copy things from one area of this image + * Copy things from one area of this image * to another area in the same image. */ - public void copy(int sx1, int sy1, int sx2, int sy2, + public void copy(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { copy(this, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); } @@ -434,11 +434,11 @@ public class PImage implements PConstants, Cloneable { */ public void copy(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { - if (image_mode == CORNER) { // if CORNERS, do nothing - sx2 += sx1; sy2 += sy1; - dx2 += dx1; dy2 += dy1; + if (imageMode == CORNER) { // if CORNERS, do nothing + sx2 += sx1; sy2 += sy1; + dx2 += dx1; dy2 += dy1; - } else if (image_mode == CENTER) { + } else if (imageMode == CENTER) { sx2 /= 2f; sy2 /= 2f; dx2 /= 2f; dy2 /= 2f; } @@ -446,7 +446,7 @@ public class PImage implements PConstants, Cloneable { if ((src == this) && intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)) { // if src is me, and things intersect, make a copy of the data - blit_resize(get(sx1, sy1, sx2 - sx1, sy2 - sy1), + blit_resize(get(sx1, sy1, sx2 - sx1, sy2 - sy1), 0, 0, sx2 - sx1 - 1, sy2 - sy1 - 1, pixels, width, height, dx1, dy1, dx2, dy2, REPLACE); } else { @@ -473,14 +473,14 @@ public class PImage implements PConstants, Cloneable { } - /** + /** * Copies and blends 1 pixel with MODE to pixel in another image */ public void blend(PImage src, int sx, int sy, int dx, int dy, int mode) { if ((dx >= 0) && (dx < width) && (sx >= 0) && (sx < src.width) && (dy >= 0) && (dy < height) && (sy >= 0) && (sy < src.height)) { - pixels[dy * width + dx] = - blend(pixels[dy * width + dx], + pixels[dy * width + dx] = + blend(pixels[dy * width + dx], src.pixels[sy * src.width + sx], mode); } } @@ -488,7 +488,7 @@ public class PImage implements PConstants, Cloneable { public void blend(int sx, int sy, int dx, int dy, int mode) { if ((dx >= 0) && (dx < width) && (sx >= 0) && (sx < width) && (dy >= 0) && (dy < height) && (sy >= 0) && (sy < height)) { - pixels[dy * width + dx] = + pixels[dy * width + dx] = blend(pixels[dy * width + dx], pixels[sy * width + sx], mode); } } @@ -497,7 +497,7 @@ public class PImage implements PConstants, Cloneable { /** * Blends one area of this image to another area */ - public void blend(int sx1, int sy1, int sx2, int sy2, + public void blend(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { blend(this, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode); } @@ -506,20 +506,20 @@ public class PImage implements PConstants, Cloneable { /** * Copies area of one image into another PImage object */ - public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, + public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode) { - if (image_mode == CORNER) { // if CORNERS, do nothing - sx2 += sx1; sy2 += sy1; - dx2 += dx1; dy2 += dy1; + if (imageMode == CORNER) { // if CORNERS, do nothing + sx2 += sx1; sy2 += sy1; + dx2 += dx1; dy2 += dy1; - } else if (image_mode == CENTER) { + } else if (imageMode == CENTER) { sx2 /= 2f; sy2 /= 2f; dx2 /= 2f; dy2 /= 2f; } if ((src == this) && intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)) { - blit_resize(get(sx1, sy1, sx2 - sx1, sy2 - sy1), + blit_resize(get(sx1, sy1, sx2 - sx1, sy2 - sy1), 0, 0, sx2 - sx1 - 1, sy2 - sy1 - 1, pixels, width, height, dx1, dy1, dx2, dy2, mode); } else { @@ -532,7 +532,7 @@ public class PImage implements PConstants, Cloneable { /** * Check to see if two rectangles intersect one another */ - protected boolean intersect(int sx1, int sy1, int sx2, int sy2, + protected boolean intersect(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2) { int sw = sx2 - sx1 + 1; int sh = sy2 - sy1 + 1; @@ -567,18 +567,18 @@ public class PImage implements PConstants, Cloneable { ////////////////////////////////////////////////////////////// - + // COPYING IMAGE DATA /** - * Convenience method to avoid an extra cast, + * Convenience method to avoid an extra cast, * and the exception handling. */ public PImage get() { try { return (PImage) clone(); - } catch (CloneNotSupportedException e) { + } catch (CloneNotSupportedException e) { return null; } } @@ -618,7 +618,7 @@ public class PImage implements PConstants, Cloneable { */ /* public PImage duplicate(int newWidth, int newHeight) { - PImage dupe = new PImage(new int[newWidth * newHeight], + PImage dupe = new PImage(new int[newWidth * newHeight], newWidth, newHeight, format); dupe.copy(this, 0, 0, width - 1, height - 1, @@ -630,15 +630,15 @@ public class PImage implements PConstants, Cloneable { ////////////////////////////////////////////////////////////// - + /** * Internal blitter/resizer/copier from toxi. * Uses bilinear filtering if smooth() has been enabled * 'mode' determines the blending mode used in the process. */ - private void blit_resize(PImage img, - int srcX1, int srcY1, int srcX2, int srcY2, - int[] destPixels, int screenW, int screenH, + private void blit_resize(PImage img, + int srcX1, int srcY1, int srcX2, int srcY2, + int[] destPixels, int screenW, int screenH, int destX1, int destY1, int destX2, int destY2, int mode) { if (srcX1 < 0) srcX1 = 0; @@ -688,7 +688,7 @@ public class PImage implements PConstants, Cloneable { iw = img.width; iw1 = img.width - 1; ih1 = img.height - 1; - + switch (mode) { case BLEND: @@ -779,7 +779,7 @@ public class PImage implements PConstants, Cloneable { sY = (srcYOffset >> PRECISIONB) * img.width; for (int x = 0; x < destW; x++) { destPixels[destOffset + x] = - blend_multiply(destPixels[destOffset + x], + blend_multiply(destPixels[destOffset + x], srcBuffer[sY + (sX >> PRECISIONB)]); sX += dx; } @@ -794,7 +794,7 @@ public class PImage implements PConstants, Cloneable { sY = (srcYOffset >> PRECISIONB) * img.width; for (int x = 0; x < destW; x++) { destPixels[destOffset + x] = - blend_add_pin(destPixels[destOffset + x], + blend_add_pin(destPixels[destOffset + x], srcBuffer[sY + (sX >> PRECISIONB)]); sX += dx; } @@ -809,7 +809,7 @@ public class PImage implements PConstants, Cloneable { sY = (srcYOffset >> PRECISIONB) * img.width; for (int x = 0; x < destW; x++) { destPixels[destOffset + x] = - blend_sub_pin(destPixels[destOffset + x], + blend_sub_pin(destPixels[destOffset + x], srcBuffer[sY + (sX >> PRECISIONB)]); sX += dx; } @@ -824,7 +824,7 @@ public class PImage implements PConstants, Cloneable { sY = (srcYOffset >> PRECISIONB) * img.width; for (int x = 0; x < destW; x++) { destPixels[destOffset + x] = - blend_lightest(destPixels[destOffset + x], + blend_lightest(destPixels[destOffset + x], srcBuffer[sY + (sX >> PRECISIONB)]); sX += dx; } @@ -839,7 +839,7 @@ public class PImage implements PConstants, Cloneable { sY = (srcYOffset >> PRECISIONB) * img.width; for (int x = 0; x < destW; x++) { destPixels[destOffset + x] = - blend_darkest(destPixels[destOffset + x], + blend_darkest(destPixels[destOffset + x], srcBuffer[sY + (sX >> PRECISIONB)]); sX += dx; } @@ -890,20 +890,20 @@ public class PImage implements PConstants, Cloneable { cLL = srcBuffer[v2 + u1]; cLR = srcBuffer[v2 + u2]; - r = ((ul*((cUL&RED_MASK)>>16) + ll*((cLL&RED_MASK)>>16) + + r = ((ul*((cUL&RED_MASK)>>16) + ll*((cLL&RED_MASK)>>16) + ur*((cUR&RED_MASK)>>16) + lr*((cLR&RED_MASK)>>16)) << PREC_RED_SHIFT) & RED_MASK; g = ((ul*(cUL&GREEN_MASK) + ll*(cLL&GREEN_MASK) + - ur*(cUR&GREEN_MASK) + lr*(cLR&GREEN_MASK)) + ur*(cUR&GREEN_MASK) + lr*(cLR&GREEN_MASK)) >>> PRECISIONB) & GREEN_MASK; - b = (ul*(cUL&BLUE_MASK) + ll*(cLL&BLUE_MASK) + + b = (ul*(cUL&BLUE_MASK) + ll*(cLL&BLUE_MASK) + ur*(cUR&BLUE_MASK) + lr*(cLR&BLUE_MASK)) >>> PRECISIONB; - a = ((ul*((cUL&ALPHA_MASK)>>>24) + ll*((cLL&ALPHA_MASK)>>>24) + - ur*((cUR&ALPHA_MASK)>>>24) + lr*((cLR&ALPHA_MASK)>>>24)) + a = ((ul*((cUL&ALPHA_MASK)>>>24) + ll*((cLL&ALPHA_MASK)>>>24) + + ur*((cUR&ALPHA_MASK)>>>24) + lr*((cLR&ALPHA_MASK)>>>24)) << PREC_ALPHA_SHIFT) & ALPHA_MASK; return a | r | g | b; @@ -941,7 +941,7 @@ public class PImage implements PConstants, Cloneable { ///////////////////////////////////////////////////////////// - + // BLEND MODE IMPLEMENTIONS private static int blend_multiply(int a, int b) { @@ -949,7 +949,7 @@ public class PImage implements PConstants, Cloneable { return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | mix(a & RED_MASK, b & RED_MASK, f) & RED_MASK | - mix(a & GREEN_MASK, b & GREEN_MASK, f) & GREEN_MASK | + mix(a & GREEN_MASK, b & GREEN_MASK, f) & GREEN_MASK | mix(a & BLUE_MASK, b & BLUE_MASK, f)); } @@ -965,7 +965,7 @@ public class PImage implements PConstants, Cloneable { ((b & RED_MASK) >> 8) * f), RED_MASK) & RED_MASK | low(((a & GREEN_MASK) + ((b & GREEN_MASK) >> 8) * f), GREEN_MASK) & GREEN_MASK | - low((a & BLUE_MASK) + + low((a & BLUE_MASK) + (((b & BLUE_MASK) * f) >> 8), BLUE_MASK)); } @@ -1006,13 +1006,13 @@ public class PImage implements PConstants, Cloneable { return (low(((a & ALPHA_MASK) >>> 24) + f, 0xff) << 24 | mix(a & RED_MASK, - low(a & RED_MASK, + low(a & RED_MASK, ((b & RED_MASK) >> 8) * f), f) & RED_MASK | - mix(a & GREEN_MASK, - low(a & GREEN_MASK, + mix(a & GREEN_MASK, + low(a & GREEN_MASK, ((b & GREEN_MASK) >> 8) * f), f) & GREEN_MASK | - mix(a & BLUE_MASK, - low(a & BLUE_MASK, + mix(a & BLUE_MASK, + low(a & BLUE_MASK, ((b & BLUE_MASK) * f) >> 8), f)); } @@ -1064,12 +1064,12 @@ public class PImage implements PConstants, Cloneable { * [toxi 030902] * Creates a Targa32 formatted byte sequence of specified pixel buffer * - * [fry 030917] - * Modified to write directly to OutputStream, because of + * [fry 030917] + * Modified to write directly to OutputStream, because of * memory issues with first making an array of the data. * tga spec: http://organicbit.com/closecombat/formats/tga.html */ - static void write_targa(OutputStream output, int pixels[], + static void write_targa(OutputStream output, int pixels[], int width, int height) throws IOException { byte header[] = new byte[18]; @@ -1140,7 +1140,7 @@ public class PImage implements PConstants, Cloneable { * mode is one of CORNERS, CORNER, CENTER */ public void imageMode(int mode) { - image_mode = mode; + imageMode = mode; } } diff --git a/core/PMethods.java b/core/PMethods.java index cddd1a53d..8ee15f077 100755 --- a/core/PMethods.java +++ b/core/PMethods.java @@ -22,7 +22,7 @@ public interface PMethods { public void copy(PImage src, int dx, int dy); - public void copy(int sx1, int sy1, int sx2, int sy2, + public void copy(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2); public void copy(PImage src, int sx1, int sy1, int sx2, int sy2, @@ -32,10 +32,10 @@ public interface PMethods { public void blend(int sx, int sy, int dx, int dy, int mode); - public void blend(int sx1, int sy1, int sx2, int sy2, + public void blend(int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode); - public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, + public void blend(PImage src, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int mode); public PImage get(); @@ -272,14 +272,14 @@ public interface PMethods { float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33); - public void colorMode(int icolorMode); + public void colorMode(int mode); - public void colorMode(int icolorMode, float max); + public void colorMode(int mode, float max); - public void colorMode(int icolorMode, + public void colorMode(int mode, float maxX, float maxY, float maxZ); - public void colorMode(int icolorMode, + public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA); public void noTint(); diff --git a/core/todo.txt b/core/todo.txt index d78767683..7a453711a 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -5,6 +5,9 @@ X added focusGained() and focusLost() _ add to preprocessor X lots of changes to internal naming of vars +_ break apart functions into local (placement) and override (blitting) +_ just have a "thin_flat_line" option in opengl code + _ image("blah.jpg"); _ loadImage() is broken on some machines _ hacked for a fix in 72, but need to better coordinate with openStream() diff --git a/todo.txt b/todo.txt index 4f9f0439e..d7d5aa708 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,6 @@ 0073 pde +X change horizontal offset to 5 instead of 4 + //