Refine search
public Rect (BufferedImage source, int left, int top, int newWidth, int newHeight, boolean isPatch) { image = new BufferedImage(source.getColorModel(), source.getRaster().createWritableChild(left, top, newWidth, newHeight, 0, 0, null), source.getColorModel().isAlphaPremultiplied(), null); offsetX = left; offsetY = top; regionWidth = newWidth; regionHeight = newHeight; originalWidth = source.getWidth(); originalHeight = source.getHeight(); width = newWidth; height = newHeight; this.isPatch = isPatch; }
public Rect (BufferedImage source, int left, int top, int newWidth, int newHeight, boolean isPatch) { image = new BufferedImage(source.getColorModel(), source.getRaster().createWritableChild(left, top, newWidth, newHeight, 0, 0, null), source.getColorModel().isAlphaPremultiplied(), null); offsetX = left; offsetY = top; regionWidth = newWidth; regionHeight = newHeight; originalWidth = source.getWidth(); originalHeight = source.getHeight(); width = newWidth; height = newHeight; this.isPatch = isPatch; }
@Override public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) { if (dstCM == null) dstCM = src.getColorModel(); return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); }
@Override public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) { if (dstCM == null) { dstCM = src.getColorModel(); } return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); }
public static BufferedImage convertImage(Image original) { ColorModel cm = ColorModel.getRGBdefault(); int width = original.getWidth(null); int height = original.getHeight(null); BufferedImage image = new BufferedImage (cm,cm.createCompatibleWritableRaster(width, height),cm.isAlphaPremultiplied(), null); Graphics2D bg = image.createGraphics(); bg.drawImage(original, 0, 0, width, height, null); bg.dispose(); return image; } }
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM) { if (destCM == null) { destCM = src.getColorModel(); if (destCM instanceof IndexColorModel) { destCM = ColorModel.getRGBdefault(); } } return new BufferedImage(destCM, destCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), destCM.isAlphaPremultiplied(), null); }
private static BufferedImage deepCopy(BufferedImage bi) { final ColorModel cm = bi.getColorModel(); final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied(); final WritableRaster raster = bi.copyData(bi.getRaster().createCompatibleWritableRaster()); return new BufferedImage(cm, raster, isAlphaPremultiplied, null); } }
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM, int width, int height) { BufferedImage image; if (destCM == null) { destCM = src.getColorModel(); // Not much support for ICM if (destCM instanceof IndexColorModel) { destCM = ColorModel.getRGBdefault(); } } image = new BufferedImage (destCM, destCM.createCompatibleWritableRaster(width, height), destCM.isAlphaPremultiplied(), null); return image; }
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM) { BufferedImage image; if (destCM == null) { destCM = src.getColorModel(); // Not much support for ICM if (destCM instanceof IndexColorModel) { destCM = ColorModel.getRGBdefault(); } } int w = src.getWidth(); int h = src.getHeight(); image = new BufferedImage (destCM, destCM.createCompatibleWritableRaster(w, h), destCM.isAlphaPremultiplied(), null); return image; }
/** Creates BufferedImage with Transparency.TRANSLUCENT */ static final java.awt.image.BufferedImage createBufferedImage(int width, int height) { if (Utilities.isMac()) { return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE); } ColorModel model = colorModel(java.awt.Transparency.TRANSLUCENT); java.awt.image.BufferedImage buffImage = new java.awt.image.BufferedImage( model, model.createCompatibleWritableRaster(width, height), model.isAlphaPremultiplied(), null ); return buffImage; }
@Override public BufferedImage filter(BufferedImage src, BufferedImage dst) { int width = src.getWidth(); int height = src.getHeight(); int type = src.getType(); WritableRaster srcRaster = src.getRaster(); originalSpace = new Rectangle(0, 0, width, height); transformedSpace = new Rectangle(0, 0, width, height); transformSpace(transformedSpace); if (dst == null) { ColorModel dstCM = src.getColorModel(); dst = new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(transformedSpace.width, transformedSpace.height), dstCM.isAlphaPremultiplied(), null); } WritableRaster dstRaster = dst.getRaster(); int[] inPixels = getRGB(src, 0, 0, width, height, null); inPixels = filterPixels(width, height, inPixels, transformedSpace); setRGB(dst, 0, 0, transformedSpace.width, transformedSpace.height, inPixels); return dst; }
dst = new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(newW, newH), dstCM.isAlphaPremultiplied(), null);
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM) { ColorModel cm = destCM != null ? destCM : src.getColorModel(); return new BufferedImage(cm, ImageUtil.createCompatibleWritableRaster(src, cm, src.getWidth(), src.getHeight()), cm.isAlphaPremultiplied(), null); }
/** * Creates compatible image for @param src image. */ public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dest) { if (dest == null) { dest = src.getColorModel(); } return new BufferedImage(dest, dest.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dest.isAlphaPremultiplied(), null); }
public static BufferedImage deepCopy(BufferedImage bi) { ColorModel cm = bi.getColorModel(); boolean isAlphaPremultiplied = cm.isAlphaPremultiplied(); WritableRaster raster = bi.copyData(null); return new BufferedImage(cm, raster, isAlphaPremultiplied, null); }
public final BufferedImage createCompatibleDestImage(final BufferedImage pInput, final ColorModel pModel) { if (pInput == null) { throw new NullPointerException("pInput == null"); } ColorModel cm = pModel != null ? pModel : pInput.getColorModel(); // TODO: Might not work with all colormodels.. // If indexcolormodel, we probably don't want to use that... // NOTE: Either BOTH or NONE of the images must have ALPHA return new BufferedImage(cm, ImageUtil.createCompatibleWritableRaster(pInput, cm, width, height), cm.isAlphaPremultiplied(), null); }
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM) { ColorModel cm = destCM != null ? destCM : src.getColorModel(); return new BufferedImage(cm, ImageUtil.createCompatibleWritableRaster(src, cm, width, height), cm.isAlphaPremultiplied(), null); }
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) { if ( dstCM == null ) dstCM = src.getColorModel(); return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); }
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) { if ( dstCM == null ) dstCM = src.getColorModel(); return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); }
/** * Clones an image. * http://stackoverflow.com/questions/3514158/how-do-you-clone-a-bufferedimage * * @param bi * @return */ public static BufferedImage cloneImage(BufferedImage bi) { ColorModel cm = bi.getColorModel(); boolean isAlphaPremultiplied = cm.isAlphaPremultiplied(); WritableRaster raster = bi.copyData(null); return new BufferedImage(cm, raster, isAlphaPremultiplied, null); } }