swap how image cache is handled, and use weak reference

This commit is contained in:
benfry
2012-09-01 23:54:32 +00:00
parent a0bdd0d44b
commit 8ae1831c33
10 changed files with 951 additions and 860 deletions
+85 -71
View File
@@ -1695,13 +1695,18 @@ public class PApplet extends Applet
* @see PGraphics#PGraphics
*/
public PImage createImage(int w, int h, int format) {
return createImage(w, h, format, null);
PImage image = new PImage(w, h, format);
image.parent = this; // make save() work
return image;
}
/**
* @nowebref
*/
/*
public PImage createImage(int w, int h, int format) {
return createImage(w, h, format, null);
}
// unapproved
public PImage createImage(int w, int h, int format, Object params) {
PImage image = new PImage(w, h, format);
if (params != null) {
@@ -1710,6 +1715,7 @@ public class PApplet extends Applet
image.parent = this; // make save() work
return image;
}
*/
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -4841,27 +4847,28 @@ public class PApplet extends Applet
* @see PGraphics#background(float, float, float, float)
*/
public PImage loadImage(String filename) {
return loadImage(filename, null, null);
// return loadImage(filename, null, null);
return loadImage(filename, null);
}
/**
* @param extension the type of image to load, for example "png", "gif", "jpg"
*/
public PImage loadImage(String filename, String extension) {
return loadImage(filename, extension, null);
}
// /**
// * @param extension the type of image to load, for example "png", "gif", "jpg"
// */
// public PImage loadImage(String filename, String extension) {
// return loadImage(filename, extension, null);
// }
// /**
// * @nowebref
// */
// public PImage loadImage(String filename, Object params) {
// return loadImage(filename, null, params);
// }
/**
* @nowebref
*/
public PImage loadImage(String filename, Object params) {
return loadImage(filename, null, params);
}
/**
* @nowebref
*/
public PImage loadImage(String filename, String extension, Object params) {
public PImage loadImage(String filename, String extension) { //, Object params) {
if (extension == null) {
String lower = filename.toLowerCase();
int dot = filename.lastIndexOf('.');
@@ -4884,9 +4891,9 @@ public class PApplet extends Applet
if (extension.equals("tga")) {
try {
PImage image = loadImageTGA(filename);
if (params != null) {
image.setParams(g, params);
}
// if (params != null) {
// image.setParams(g, params);
// }
return image;
} catch (IOException e) {
e.printStackTrace();
@@ -4897,9 +4904,9 @@ public class PApplet extends Applet
if (extension.equals("tif") || extension.equals("tiff")) {
byte bytes[] = loadBytes(filename);
PImage image = (bytes == null) ? null : PImage.loadTIFF(bytes);
if (params != null) {
image.setParams(g, params);
}
// if (params != null) {
// image.setParams(g, params);
// }
return image;
}
@@ -4925,9 +4932,9 @@ public class PApplet extends Applet
image.checkAlpha();
}
if (params != null) {
image.setParams(g, params);
}
// if (params != null) {
// image.setParams(g, params);
// }
return image;
}
}
@@ -4944,9 +4951,9 @@ public class PApplet extends Applet
if (extension.equals(loadImageFormats[i])) {
PImage image;
image = loadImageIO(filename);
if (params != null) {
image.setParams(g, params);
}
// if (params != null) {
// image.setParams(g, params);
// }
return image;
}
}
@@ -4957,10 +4964,13 @@ public class PApplet extends Applet
return null;
}
public PImage requestImage(String filename) {
return requestImage(filename, null, null);
// return requestImage(filename, null, null);
return requestImage(filename, null);
}
/**
* ( begin auto-generated from requestImage.xml )
*
@@ -4984,15 +4994,7 @@ public class PApplet extends Applet
* @see PImage#PImage
*/
public PImage requestImage(String filename, String extension) {
return requestImage(filename, extension, null);
}
/**
* @nowebref
*/
public PImage requestImage(String filename, String extension, Object params) {
PImage vessel = createImage(0, 0, ARGB, params);
PImage vessel = createImage(0, 0, ARGB);
AsyncImageLoader ail =
new AsyncImageLoader(filename, extension, vessel);
ail.start();
@@ -5000,6 +5002,18 @@ public class PApplet extends Applet
}
// /**
// * @nowebref
// */
// public PImage requestImage(String filename, String extension, Object params) {
// PImage vessel = createImage(0, 0, ARGB, params);
// AsyncImageLoader ail =
// new AsyncImageLoader(filename, extension, vessel);
// ail.start();
// return vessel;
// }
/**
* By trial and error, four image loading threads seem to work best when
* loading images from online. This is consistent with the number of open
@@ -14040,36 +14054,36 @@ public class PApplet extends Applet
}
/**
* Store parameters for a renderer that requires extra metadata of
* some kind.
* @param renderer The PGraphics renderer associated to the image
* @param storage The parameters required by the renderer
*/
public void setParams(PGraphics renderer, Object params) {
if (recorder != null) recorder.setParams(renderer, params);
g.setParams(renderer, params);
}
/**
* Get the parameters for the specified renderer.
* @param renderer The PGraphics renderer associated to the image
* @return parameters stored for the specified renderer
*/
public Object getParams(PGraphics renderer) {
return g.getParams(renderer);
}
/**
* Remove information associated with this renderer from the cache, if any.
* @param renderer The PGraphics renderer whose parameters should be removed
*/
public void removeParams(PGraphics renderer) {
if (recorder != null) recorder.removeParams(renderer);
g.removeParams(renderer);
}
// /**
// * Store parameters for a renderer that requires extra metadata of
// * some kind.
// * @param renderer The PGraphics renderer associated to the image
// * @param storage The parameters required by the renderer
// */
// public void setParams(PGraphics renderer, Object params) {
// if (recorder != null) recorder.setParams(renderer, params);
// g.setParams(renderer, params);
// }
//
//
// /**
// * Get the parameters for the specified renderer.
// * @param renderer The PGraphics renderer associated to the image
// * @return parameters stored for the specified renderer
// */
// public Object getParams(PGraphics renderer) {
// return g.getParams(renderer);
// }
//
//
// /**
// * Remove information associated with this renderer from the cache, if any.
// * @param renderer The PGraphics renderer whose parameters should be removed
// */
// public void removeParams(PGraphics renderer) {
// if (recorder != null) recorder.removeParams(renderer);
// g.removeParams(renderer);
// }
/**
+53
View File
@@ -26,6 +26,7 @@ package processing.core;
import java.awt.*;
import java.util.HashMap;
import java.util.WeakHashMap;
import processing.opengl.PGL;
import processing.opengl.PShader;
@@ -196,6 +197,17 @@ public class PGraphics extends PImage implements PConstants {
*/
protected boolean[] hints = new boolean[HINT_COUNT];
// ........................................................
/**
* Storage for renderer-specific image data. In 1.x, renderers wrote cache
* data into the image object. In 2.x, the renderer has a weak-referenced
* map that points at any of the images it has worked on already. When the
* images go out of scope, they will be properly garbage collected.
*/
protected WeakHashMap<PImage, Object> cacheMap =
new WeakHashMap<PImage, Object>();
////////////////////////////////////////////////////////////
@@ -746,6 +758,47 @@ public class PGraphics extends PImage implements PConstants {
//////////////////////////////////////////////////////////////
// IMAGE METADATA FOR THIS RENDERER
/**
* Store data of some kind for the renderer that requires extra metadata of
* some kind. Usually this is a renderer-specific representation of the
* image data, for instance a BufferedImage with tint() settings applied for
* PGraphicsJava2D, or resized image data and OpenGL texture indices for
* PGraphicsOpenGL.
* @param renderer The PGraphics renderer associated to the image
* @param storage The metadata required by the renderer
*/
public void setCache(PImage image, Object storage) {
cacheMap.put(image, storage);
}
/**
* Get cache storage data for the specified renderer. Because each renderer
* will cache data in different formats, it's necessary to store cache data
* keyed by the renderer object. Otherwise, attempting to draw the same
* image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
* @param renderer The PGraphics renderer associated to the image
* @return metadata stored for the specified renderer
*/
public Object getCache(PImage image) {
return cacheMap.get(image);
}
/**
* Remove information associated with this renderer from the cache, if any.
* @param renderer The PGraphics renderer whose cache data should be removed
*/
public void removeCache(PImage image) {
cacheMap.remove(image);
}
//////////////////////////////////////////////////////////////
// FRAME
@@ -943,14 +943,14 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
// Image not ready yet, or an error
if (who.width <= 0 || who.height <= 0) return;
if (who.getCache(this) == null) {
if (getCache(who) == null) {
//System.out.println("making new image cache");
who.setCache(this, new ImageCache(who));
this.setCache(who, new ImageCache(who));
who.updatePixels(); // mark the whole thing for update
who.modified = true;
}
ImageCache cash = (ImageCache) who.getCache(this);
ImageCache cash = (ImageCache) getCache(who);
// if image previously was tinted, or the color changed
// or the image was tinted, and tint is now disabled
if ((tint && !cash.tinted) ||
@@ -965,7 +965,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
who.modified = false;
}
g2.drawImage(((ImageCache) who.getCache(this)).image,
g2.drawImage(((ImageCache) getCache(who)).image,
(int) x1, (int) y1, (int) x2, (int) y2,
u1, v1, u2, v2, null);
+77 -77
View File
@@ -27,7 +27,6 @@ package processing.core;
import java.awt.image.*;
import java.io.*;
import java.lang.reflect.Method;
import java.util.HashMap;
import javax.imageio.ImageIO;
@@ -126,10 +125,11 @@ public class PImage implements PConstants, Cloneable {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/** for renderers that need to store info about the image */
protected HashMap<PGraphics, Object> cacheMap;
//protected HashMap<PGraphics, Object> cacheMap;
// protected WeakHashMap<PGraphics, Object> cacheMap;
/** for renderers that need to store parameters about the image */
protected HashMap<PGraphics, Object> paramMap;
// protected HashMap<PGraphics, Object> paramMap;
/** modified portion of the image */
protected boolean modified;
@@ -305,82 +305,82 @@ public class PImage implements PConstants, Cloneable {
}
//////////////////////////////////////////////////////////////
// METADATA/PARAMETERS REQUIRED BY RENDERERS
/**
* Store data of some kind for a renderer that requires extra metadata of
* some kind. Usually this is a renderer-specific representation of the
* image data, for instance a BufferedImage with tint() settings applied for
* PGraphicsJava2D, or resized image data and OpenGL texture indices for
* PGraphicsOpenGL.
* @param renderer The PGraphics renderer associated to the image
* @param storage The metadata required by the renderer
*/
public void setCache(PGraphics renderer, Object storage) {
if (cacheMap == null) cacheMap = new HashMap<PGraphics, Object>();
cacheMap.put(renderer, storage);
}
// //////////////////////////////////////////////////////////////
//
// // METADATA/PARAMETERS REQUIRED BY RENDERERS
//
// /**
// * Store data of some kind for a renderer that requires extra metadata of
// * some kind. Usually this is a renderer-specific representation of the
// * image data, for instance a BufferedImage with tint() settings applied for
// * PGraphicsJava2D, or resized image data and OpenGL texture indices for
// * PGraphicsOpenGL.
// * @param renderer The PGraphics renderer associated to the image
// * @param storage The metadata required by the renderer
// */
// public void setCache(PGraphics renderer, Object storage) {
// if (cacheMap == null) cacheMap = new WeakHashMap<PGraphics, Object>();
// cacheMap.put(renderer, storage);
// }
//
//
// /**
// * Get cache storage data for the specified renderer. Because each renderer
// * will cache data in different formats, it's necessary to store cache data
// * keyed by the renderer object. Otherwise, attempting to draw the same
// * image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
// * @param renderer The PGraphics renderer associated to the image
// * @return metadata stored for the specified renderer
// */
// public Object getCache(PGraphics renderer) {
// if (cacheMap == null) return null;
// return cacheMap.get(renderer);
// }
//
//
// /**
// * Remove information associated with this renderer from the cache, if any.
// * @param renderer The PGraphics renderer whose cache data should be removed
// */
// public void removeCache(PGraphics renderer) {
// if (cacheMap != null) {
// cacheMap.remove(renderer);
// }
// }
/**
* Get cache storage data for the specified renderer. Because each renderer
* will cache data in different formats, it's necessary to store cache data
* keyed by the renderer object. Otherwise, attempting to draw the same
* image to both a PGraphicsJava2D and a PGraphicsOpenGL will cause errors.
* @param renderer The PGraphics renderer associated to the image
* @return metadata stored for the specified renderer
*/
public Object getCache(PGraphics renderer) {
if (cacheMap == null) return null;
return cacheMap.get(renderer);
}
/**
* Remove information associated with this renderer from the cache, if any.
* @param renderer The PGraphics renderer whose cache data should be removed
*/
public void removeCache(PGraphics renderer) {
if (cacheMap != null) {
cacheMap.remove(renderer);
}
}
/**
* Store parameters for a renderer that requires extra metadata of
* some kind.
* @param renderer The PGraphics renderer associated to the image
* @param storage The parameters required by the renderer
*/
public void setParams(PGraphics renderer, Object params) {
if (paramMap == null) paramMap = new HashMap<PGraphics, Object>();
paramMap.put(renderer, params);
}
/**
* Get the parameters for the specified renderer.
* @param renderer The PGraphics renderer associated to the image
* @return parameters stored for the specified renderer
*/
public Object getParams(PGraphics renderer) {
if (paramMap == null) return null;
return paramMap.get(renderer);
}
/**
* Remove information associated with this renderer from the cache, if any.
* @param renderer The PGraphics renderer whose parameters should be removed
*/
public void removeParams(PGraphics renderer) {
if (paramMap != null) {
paramMap.remove(renderer);
}
}
// /**
// * Store parameters for a renderer that requires extra metadata of
// * some kind.
// * @param renderer The PGraphics renderer associated to the image
// * @param storage The parameters required by the renderer
// */
// public void setParams(PGraphics renderer, Object params) {
// if (paramMap == null) paramMap = new HashMap<PGraphics, Object>();
// paramMap.put(renderer, params);
// }
//
//
// /**
// * Get the parameters for the specified renderer.
// * @param renderer The PGraphics renderer associated to the image
// * @return parameters stored for the specified renderer
// */
// public Object getParams(PGraphics renderer) {
// if (paramMap == null) return null;
// return paramMap.get(renderer);
// }
//
//
// /**
// * Remove information associated with this renderer from the cache, if any.
// * @param renderer The PGraphics renderer whose parameters should be removed
// */
// public void removeParams(PGraphics renderer) {
// if (paramMap != null) {
// paramMap.remove(renderer);
// }
// }
//////////////////////////////////////////////////////////////
+23 -23
View File
@@ -65,7 +65,7 @@ class PFontTexture implements PConstants {
protected TextureInfo[] glyphTexinfos;
protected HashMap<PFont.Glyph, TextureInfo> texinfoMap;
public PFontTexture(PApplet parent, PFont font, int maxw, int maxh,
public PFontTexture(PApplet parent, PFont font, int maxw, int maxh,
boolean is3D) {
this.parent = parent;
this.font = font;
@@ -113,23 +113,23 @@ class PFontTexture implements PConstants {
h = PApplet.min(2 * textures[currentTex].glHeight, maxTexHeight);
resize = true;
} else {
h = PApplet.min(PGraphicsOpenGL.maxTextureSize, PGL.MAX_FONT_TEX_SIZE / 2,
h = PApplet.min(PGraphicsOpenGL.maxTextureSize, PGL.MAX_FONT_TEX_SIZE / 2,
maxTexHeight / 4);
resize = false;
}
Texture tex;
if (is3D) {
// Bilinear sampling ensures that the texture doesn't look pixelated
// Bilinear sampling ensures that the texture doesn't look pixelated
// either when it is magnified or minified...
tex = new Texture(parent, w, h,
tex = new Texture(parent, w, h,
new Texture.Parameters(ARGB, Texture.BILINEAR, false));
} else {
// ...however, the effect of bilinear sampling is to add some blurriness
// to the text in its original size. In 2D, we assume that text will be
// shown at its original size, so linear sampling is chosen instead (which
// ...however, the effect of bilinear sampling is to add some blurriness
// to the text in its original size. In 2D, we assume that text will be
// shown at its original size, so linear sampling is chosen instead (which
// only affects minimized text).
tex = new Texture(parent, w, h,
tex = new Texture(parent, w, h,
new Texture.Parameters(ARGB, Texture.LINEAR, false));
}
@@ -147,7 +147,7 @@ class PFontTexture implements PConstants {
tex.put(tex0);
textures[currentTex] = tex;
images[currentTex].setCache(pg, tex);
pg.setCache(images[currentTex], tex);
images[currentTex].width = tex.width;
images[currentTex].height = tex.height;
} else {
@@ -176,13 +176,13 @@ class PFontTexture implements PConstants {
setTexture(0);
}
public void end() {
for (int i = 0; i < textures.length; i++) {
pgl.disableTexturing(textures[i].glTarget);
}
}
public void setTexture(int idx) {
if (0 <= idx && idx < textures.length) {
@@ -258,18 +258,18 @@ class PFontTexture implements PConstants {
// Adds this glyph to the opengl texture in PFont.
protected void addToTexture(int idx, PFont.Glyph glyph) {
// We add one pixel to avoid issues when sampling the font texture at
// fractional screen positions. I.e.: the pixel on the screen only contains
// half of the font rectangle, so it would sample half of the color from the
// glyph area in the texture, and the other half from the contiguous pixel.
// If the later contains a portion of the neighbor glyph and the former
// doesn't, this would result in a shaded pixel when the correct output is
// blank. This is a consequence of putting all the glyphs in a common
// We add one pixel to avoid issues when sampling the font texture at
// fractional screen positions. I.e.: the pixel on the screen only contains
// half of the font rectangle, so it would sample half of the color from the
// glyph area in the texture, and the other half from the contiguous pixel.
// If the later contains a portion of the neighbor glyph and the former
// doesn't, this would result in a shaded pixel when the correct output is
// blank. This is a consequence of putting all the glyphs in a common
// texture with bilinear sampling.
int w = 1 + glyph.width + 1;
int h = 1 + glyph.height + 1;
// Converting the pixels array from the PImage into a valid RGBA array for
// Converting the pixels array from the PImage into a valid RGBA array for
// OpenGL.
int[] rgba = new int[w * h];
int t = 0;
@@ -332,7 +332,7 @@ class PFontTexture implements PConstants {
currentTex = idx;
}
TextureInfo tinfo = new TextureInfo(currentTex, offsetX, offsetY,
TextureInfo tinfo = new TextureInfo(currentTex, offsetX, offsetY,
w, h, rgba);
offsetX += w;
@@ -356,12 +356,12 @@ class PFontTexture implements PConstants {
public float v0, v1;
public int[] pixels;
public TextureInfo(int tidx, int cropX, int cropY, int cropW, int cropH,
public TextureInfo(int tidx, int cropX, int cropY, int cropW, int cropH,
int[] pix) {
texIndex = tidx;
crop = new int[4];
// The region of the texture corresponding to the glyph is surrounded by a
// 1-pixel wide border to avoid artifacts due to bilinear sampling. This
// 1-pixel wide border to avoid artifacts due to bilinear sampling. This
// is why the additions and subtractions to the crop values.
crop[0] = cropX + 1;
crop[1] = cropY + 1 + cropH - 2;
@@ -384,7 +384,7 @@ class PFontTexture implements PConstants {
void updateTex() {
textures[texIndex].setNative(pixels, crop[0] - 1, crop[1] + crop[3] - 1,
textures[texIndex].setNative(pixels, crop[0] - 1, crop[1] + crop[3] - 1,
crop[2] + 2, -crop[3] + 2);
}
}
+50 -26
View File
@@ -22,24 +22,12 @@
package processing.opengl;
import processing.core.PApplet;
import processing.core.PFont;
import processing.core.PGraphics;
import processing.core.PImage;
import processing.core.PMatrix;
import processing.core.PMatrix2D;
import processing.core.PMatrix3D;
import processing.core.PShape;
import processing.core.PVector;
import processing.core.*;
import java.net.URL;
import java.nio.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;
import java.util.regex.*;
/**
* OpenGL renderer.
@@ -55,6 +43,10 @@ public class PGraphicsOpenGL extends PGraphics {
/** The renderer currently in use. */
protected static PGraphicsOpenGL pgCurrent = null;
/** Additional image parameters not covered by the cache. */
protected WeakHashMap<PImage, Object> paramMap =
new WeakHashMap<PImage, Object>();
// ........................................................
// Basic rendering parameters:
@@ -618,6 +610,38 @@ public class PGraphicsOpenGL extends PGraphics {
}
//////////////////////////////////////////////////////////////
/**
* Store parameters for a renderer that requires extra metadata of
* some kind.
* @param renderer The PGraphics renderer associated to the image
* @param storage The parameters required by the renderer
*/
public void setParams(PImage image, Object params) {
paramMap.put(image, params);
}
/**
* Get the parameters for the specified renderer.
* @param renderer The PGraphics renderer associated to the image
* @return parameters stored for the specified renderer
*/
public Object getParams(PImage image) {
return paramMap.get(image);
}
/**
* Remove information associated with this renderer from the cache, if any.
* @param renderer The PGraphics renderer whose parameters should be removed
*/
public void removeParams(PImage image) {
paramMap.remove(image);
}
//////////////////////////////////////////////////////////////
// RESOURCE HANDLING
@@ -1631,7 +1655,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (texture != null) {
// The screen texture should be deleted because it
// corresponds to the old window size.
this.removeCache(pgPrimary);
pgPrimary.removeCache(this);
this.removeParams(pgPrimary);
texture = null;
loadTexture();
@@ -5443,8 +5467,8 @@ public class PGraphicsOpenGL extends PGraphics {
return;
}
if (texture == null || texture != img.getCache(pgPrimary)) {
Texture tex = (Texture)img.getCache(pgPrimary);
if (texture == null || texture != pgPrimary.getCache(img)) {
Texture tex = (Texture)pgPrimary.getCache(img);
Texture.Parameters params = tex != null ? tex.getParameters() : null;
if (tex == null || tex.contextIsOutdated() || !validSurfaceTex(tex)) {
if (primarySurface) {
@@ -5457,8 +5481,8 @@ public class PGraphicsOpenGL extends PGraphics {
if (tex != null) {
texture = tex;
texture.setFlippedY(true);
this.setCache(pgPrimary, texture);
this.setParams(pgPrimary, params);
pgPrimary.setCache(this, texture);
pgPrimary.setParams(this, params);
if (!primarySurface && offscreenFramebuffer != null) {
// Attach as the color buffer for this offscreen surface
@@ -5883,7 +5907,7 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public Object initCache(PImage img) {
Texture tex = (Texture)img.getCache(pgPrimary);
Texture tex = (Texture)pgPrimary.getCache(img);
if (tex == null || tex.contextIsOutdated()) {
tex = addTexture(img);
if (tex != null) {
@@ -5901,7 +5925,7 @@ public class PGraphicsOpenGL extends PGraphics {
* @param img the image to have a texture metadata associated to it
*/
protected Texture addTexture(PImage img) {
Texture.Parameters params = (Texture.Parameters)img.getParams(pgPrimary);
Texture.Parameters params = (Texture.Parameters)pgPrimary.getParams(img);
if (params == null) {
params = new Texture.Parameters();
if (hints[DISABLE_TEXTURE_MIPMAPS]) {
@@ -5929,8 +5953,8 @@ public class PGraphicsOpenGL extends PGraphics {
img.parent = parent;
}
Texture tex = new Texture(img.parent, img.width, img.height, params);
img.setCache(pgPrimary, tex);
img.setParams(pgPrimary, params);
pgPrimary.setCache(img, tex);
pgPrimary.setParams(img, params);
return tex;
}
@@ -5963,8 +5987,8 @@ public class PGraphicsOpenGL extends PGraphics {
img.width = tex.width;
img.height = tex.height;
img.format = ARGB;
img.setCache(pgPrimary, tex);
img.setParams(pgPrimary, tex.getParameters());
pgPrimary.setCache(img, tex);
pgPrimary.setParams(img, tex.getParameters());
return img;
}
+2 -2
View File
@@ -230,13 +230,13 @@ public class Texture implements PConstants {
public void set(PImage img) {
Texture tex = (Texture)img.getCache(pg);
Texture tex = (Texture)pg.getCache(img);
set(tex);
}
public void set(PImage img, int x, int y, int w, int h) {
Texture tex = (Texture)img.getCache(pg);
Texture tex = (Texture)pg.getCache(img);
set(tex, x, y, w, h);
}
+23 -23
View File
@@ -5,6 +5,29 @@ X maybe getResource() fails because spaces are not encoded?
X PVector limit() is inefficient
X http://code.google.com/p/processing/issues/detail?id=1122
_ memory leak when many createGraphics(..., JAVA2D) calls are used
_ http://code.google.com/p/processing/issues/detail?id=507
_ need to add clear() method so clear out ARGB surfaces
C clear() ok to add
X decided clear(r, g, b, a) problematic since it's an exception to color model
X and that people should use background() anyway
o or background(r, g, b, a) would be the thing
_ clear() with a color doesn't make (verbal) sense
_ provide a way to clear the PGraphics with plain alpha
api to be fixed/removed
_ remove PImage.delete() and friends from PImage, Movie, etc.
_ delete()/dispose() being used in the movie
_ buffer sink methods in movie
_ 'newFrame' is 'available', and ready() is part of that
_ loadShape() mess
_ get things out of PGraphics
_ separate PShape2/3D from OpenGL
_ incorporate SVG loader into the 2D class
_ loadPixels() implementation
_ Jagged / Glitchy JAVA2D shape strokes in Java 1.6
_ g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
_ RenderingHints.VALUE_STROKE_PURE);
@@ -47,19 +70,6 @@ void iconLoaded(PImage image, String filename) {
}
api to be fixed/removed
_ remove PImage.delete() and friends from PImage, Movie, etc.
_ delete()/dispose() being used in the movie
_ buffer sink methods in movie
_ 'newFrame' is 'available', and ready() is part of that
_ loadShape() mess
_ get things out of PGraphics
_ separate PShape2/3D from OpenGL
_ incorporate SVG loader into the 2D class
_ loadPixels() implementation
_ standardize PGL behavior
PGL pgl = beginPGL();
pgl.vertex3f(...)
@@ -134,16 +144,6 @@ _ maybe catch RuntimeExceptions in the called sub-functions
_ that way more stuff can be static w/o losing useful error handling
_ (emitting errors when closest to source.. i.e. w/ the filename)
_ memory leak when many createGraphics(..., JAVA2D) calls are used
_ http://code.google.com/p/processing/issues/detail?id=507
_ need to add clear() method so clear out ARGB surfaces
C clear() ok to add
X decided clear(r, g, b, a) problematic since it's an exception to color model
X and that people should use background() anyway
o or background(r, g, b, a) would be the thing
_ clear() with a color doesn't make (verbal) sense
_ provide a way to clear the PGraphics with plain alpha
_ sort out edge + 1 issue on stroke/fill for rectangles
_ http://code.google.com/p/processing/issues/detail?id=509
_ exactly how should pixel filling work with single pixel strokes?
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff