/** * Return a Raster containing the colors generated for the graphics * operation. * @param x,y,w,h The area in device space for which colors are * generated. */ public Raster getRaster(int x, int y, int w, int h) { double rowrel = (x - x1) * dx + (y - y1) * dy; Raster rast = saved; if (rast == null || rast.getWidth() < w || rast.getHeight() < h) { rast = getCachedRaster(model, w, h); saved = rast; } IntegerComponentRaster irast = (IntegerComponentRaster) rast; int off = irast.getDataOffset(0); int adjust = irast.getScanlineStride() - w; int[] pixels = irast.getDataStorage(); if (cyclic) { cycleFillRaster(pixels, off, adjust, w, h, rowrel, dx, dy); } else { clipFillRaster(pixels, off, adjust, w, h, rowrel, dx, dy); } irast.markDirty(); return rast; }
public synchronized Raster getRaster(int x, int y, int w, int h) { WritableRaster t = savedTile; if (t == null || w > t.getWidth() || h > t.getHeight()) { t = getColorModel().createCompatibleWritableRaster(w, h); IntegerComponentRaster icr = (IntegerComponentRaster) t; Arrays.fill(icr.getDataStorage(), color); // Note - markDirty is probably unnecessary since icr is brand new icr.markDirty(); if (w <= 64 && h <= 64) { savedTile = t; } } return t; }
void createNativeImage(BufferedImage bimage) { Raster raster = bimage.getRaster(); byte[] andMask = new byte[TRAY_ICON_MASK_SIZE]; int pixels[] = ((DataBufferInt)raster.getDataBuffer()).getData(); int npixels = pixels.length; int ficW = raster.getWidth(); for (int i = 0; i < npixels; i++) { int ibyte = i / 8; int omask = 1 << (7 - (i % 8)); if ((pixels[i] & 0xff000000) == 0) { // Transparent bit if (ibyte < andMask.length) { andMask[ibyte] |= omask; } } } if (raster instanceof IntegerComponentRaster) { ficW = ((IntegerComponentRaster)raster).getScanlineStride(); } setNativeIcon(((DataBufferInt)bimage.getRaster().getDataBuffer()).getData(), andMask, ficW, raster.getWidth(), raster.getHeight()); }
/** * Return a Raster containing the colors generated for the graphics * operation. * @param x,y,w,h The area in device space for which colors are * generated. */ public Raster getRaster(int x, int y, int w, int h) { double rowrel = (x - x1) * dx + (y - y1) * dy; Raster rast = saved; if (rast == null || rast.getWidth() < w || rast.getHeight() < h) { rast = getCachedRaster(model, w, h); saved = rast; } IntegerComponentRaster irast = (IntegerComponentRaster) rast; int off = irast.getDataOffset(0); int adjust = irast.getScanlineStride() - w; int[] pixels = irast.getDataStorage(); if (cyclic) { cycleFillRaster(pixels, off, adjust, w, h, rowrel, dx, dy); } else { clipFillRaster(pixels, off, adjust, w, h, rowrel, dx, dy); } return rast; }
public Raster getRaster(int x, int y, int w, int h) { double rowrel = (x - myX1) * myDx + (y - myY1) * myDy; Raster rast = saved; if (rast == null || rast.getWidth() < w || rast.getHeight() < h) { rast = getCachedRaster(model, w, h); saved = rast; } IntegerComponentRaster irast = (IntegerComponentRaster)rast; int off = irast.getDataOffset(0); int adjust = irast.getScanlineStride() - w; int[] pixels = irast.getDataStorage(); clipFillRaster(pixels, off, adjust, w, h, rowrel, myDx, myDy); return rast; }