protected void updateTexture(PImage img, Texture tex) { if (tex != null) { if (img.isModified()) { int x = img.getModifiedX1(); int y = img.getModifiedY1(); int w = img.getModifiedX2() - x; int h = img.getModifiedY2() - y; tex.set(img.pixels, x, y, w, h, img.format); } } img.setModified(false); }
protected void updateTexture(PImage img, Texture tex) { if (tex != null) { if (img.isModified()) { int x = img.getModifiedX1(); int y = img.getModifiedY1(); int w = img.getModifiedX2() - x; int h = img.getModifiedY2() - y; tex.set(img.pixels, x, y, w, h, img.format); } } img.setModified(false); }
/** * Not an approved function, this will change or be removed in the future. * This utility method returns the texture associated to the image. * creating and/or updating it if needed. * * @param img the image to have a texture metadata associated to it */ public Texture getTexture(PImage img) { Texture tex = (Texture)initCache(img); if (tex == null) return null; if (img.isModified()) { if (img.width != tex.width || img.height != tex.height) { tex.init(img.width, img.height); } updateTexture(img, tex); } if (tex.hasBuffers()) { tex.bufferUpdate(); } checkTexture(tex); return tex; }
/** * Not an approved function, this will change or be removed in the future. * This utility method returns the texture associated to the image. * creating and/or updating it if needed. * * @param img the image to have a texture metadata associated to it */ public Texture getTexture(PImage img) { Texture tex = (Texture)initCache(img); if (tex == null) return null; if (img.isModified()) { if (img.pixelWidth != tex.width || img.pixelHeight != tex.height) { tex.init(img.pixelWidth, img.pixelHeight); } updateTexture(img, tex); } if (tex.hasBuffers()) { tex.bufferUpdate(); } checkTexture(tex); return tex; }
if (who.isModified()) { if (who.pixels == null) {
if (who.isModified()) { if (who.pixels == null) {