4632N/A static DirectColorModel dcmBackup = new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, true, DataBuffer.TYPE_INT);
4632N/A // Note: Eventually, we should switch to using the same mechanism (CachingSurfaceManager) that Sun uses
4632N/A case TRANSLUCENT:
4632N/A // we try to fit a custom image into one of the predefined BufferedImages (BufferedImage does that
4632N/A // we can do that because a pointer in C is a pointer (pixel pointer not dependent on DataBuffer type)
4632N/A if ((numOfComponents == 3) && (cm instanceof ComponentColorModel) && (sm instanceof PixelInterleavedSampleModel)) {
4632N/A boolean bigendian = (offs[0] == numBands - 3) && (offs[1] == numBands - 2) && (offs[2] == numBands - 1);
4632N/A boolean littleendian = (offs[0] == numBands - 1) && (offs[1] == numBands - 2) && (offs[2] == numBands - 3);
4632N/A if (validsizes && bigendian && cm.hasAlpha() && cm.isAlphaPremultiplied() && sizes[3] == 8) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } else if (validsizes && littleendian && cm.hasAlpha() && cm.isAlphaPremultiplied() && sizes[3] == 8) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A if (validsizes && bigendian && cm.hasAlpha() && cm.isAlphaPremultiplied() && sizes[3] == 8) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } else if (validsizes && littleendian && cm.hasAlpha() && cm.isAlphaPremultiplied() && sizes[3] == 8) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A } catch (ClassCastException e) {
4632N/A // 2004_03_26 cmc: We used to use createCompatibleImage here. Now that createCompatibleImage returns
4632N/A // an INT_ARGB_PRE instead of an NIO-based image, we need to explicitly create an NIO-based image.
4632N/A IntegerNIORaster backupRaster = (IntegerNIORaster) IntegerNIORaster.createNIORaster(bufImg.getWidth(), bufImg.getHeight(), dcmBackup.getMasks(), null);
4632N/A offsd.bimBackup = new BufferedImage(dcmBackup, backupRaster, dcmBackup.isAlphaPremultiplied(), null);
4632N/A // the trick that makes it work - assign the raster from backup to the surface data of the original image
4632N/A private static SurfaceData createDataSC(BufferedImage bImg, SurfaceType sType, IndexColorModel icm, int iType) {
4632N/A public static SurfaceData createDataSC(BufferedImage bImg, SurfaceType sType, IndexColorModel icm) {
4632N/A private static SurfaceData createDataBC(BufferedImage bImg, SurfaceType sType, int primaryBank, int iType) {
4632N/A public static SurfaceData createDataBC(BufferedImage bImg, SurfaceType sType, int primaryBank) {
4632N/A protected native void initRaster(Object theArray, int offset, int width, int height, int pixStr, int scanStr, IndexColorModel icm, int type, ByteBuffer graphicsStates, Object graphicsStatesObjects, ByteBuffer imageInfo);
4632N/A protected native void initCustomRaster(IntBuffer buffer, int width, int height, ByteBuffer graphicsStates, Object graphicsStatesObjects, ByteBuffer imageInfo);
4632N/A this.fImageInfoInt.put(kNeedToSyncFromJavaPixelsIndex, 1); // need to sync from Java the very first time
4632N/A // <rdar://problem/4488745> For the Sun2D renderer we should rely on the implementation of the super class.
4632N/A // BufImageSurfaceData.java doesn't have an implementation of copyArea() and relies on the super class.
4632N/A // the rectangle returned from clipCopyArea() is in the coordinate space of the surface (image)
4632N/A // we need to substract the offsetX and offsetY to move it to the coordinate space of the graphics2d.
4632N/A // sg2d.drawImage expects the destination rect to be in the coord space of the graphics2d. <rdar://3746194>
4632N/A sg2d.drawImage(this.bim, x + dx, y + dy, x + dx + w, y + dy + h, x + offsetX, y + offsetY, x + w + offsetX, y + h + offsetY, null);
4632N/A * Performs a copyarea from this surface to a buffered image. If null is passed in for the image a new image will be
4632N/A public BufferedImage copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, BufferedImage dstImage) {
4632N/A public boolean xorSurfacePixels(SunGraphics2D sg2d, BufferedImage srcPixels, int x, int y, int w, int h, int colorXOR) {
4632N/A if ((type == BufferedImage.TYPE_INT_ARGB_PRE) || (type == BufferedImage.TYPE_INT_ARGB) || (type == BufferedImage.TYPE_INT_RGB)) { return xorSurfacePixels(createData(srcPixels), colorXOR, x, y, w, h); }
4632N/A OSXOffScreenSurfaceData offsd = (OSXOffScreenSurfaceData) (OSXOffScreenSurfaceData.createData(bim));
4632N/A // color. Called by blitImage in OSXSurfaceData.java.
4632N/A || (this.copyWithBgColor_cache.getWidth() < bimW) || (this.copyWithBgColor_cache.getHeight() < bimH)) {
4632N/A GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
4632N/A * Invoked before the raster's contents are to be read (via one of the modifier methods in Raster such as
4632N/A * Invoked before the raster's contents are to be written to (via one of the modifier methods in Raster such as
4632N/A// * Invoked when the raster's contents will be taken (via the Raster.getDataBuffer() method)
4632N/A// fImageInfoInt.put(kImageStolenIndex, 1); // this means we must convert between Java and native pixels every
4632N/A// // mark subimages stolen to turn off lazy pixel conversion (gznote: can we do better here?)