/* */ public void Blit( SurfaceData paramSurfaceData1, SurfaceData paramSurfaceData2, Composite paramComposite, Region paramRegion, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6) /* */ { /* 120 */ Raster localRaster1 = paramSurfaceData1.getRaster(paramInt1, paramInt2, paramInt5, paramInt6); /* 121 */ ColorModel localColorModel = paramSurfaceData1.getColorModel(); /* */ /* 123 */ Raster localRaster2 = paramSurfaceData2.getRaster(paramInt3, paramInt4, paramInt5, paramInt6); /* 124 */ IntegerComponentRaster localIntegerComponentRaster = (IntegerComponentRaster) localRaster2; /* 125 */ int[] arrayOfInt1 = localIntegerComponentRaster.getDataStorage(); /* */ /* 127 */ Region localRegion = CustomComponent.getRegionOfInterest( paramSurfaceData1, paramSurfaceData2, paramRegion, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6); /* */ /* 130 */ SpanIterator localSpanIterator = localRegion.getSpanIterator(); /* */ /* 132 */ Object localObject = null; /* */ /* 134 */ int i = localIntegerComponentRaster.getScanlineStride(); /* */ /* 136 */ paramInt1 -= paramInt3; /* 137 */ paramInt2 -= paramInt4; /* 138 */ int[] arrayOfInt2 = new int[4]; /* 139 */ while (localSpanIterator.nextSpan(arrayOfInt2)) { /* 140 */ int j = localIntegerComponentRaster.getDataOffset(0) + arrayOfInt2[1] * i + arrayOfInt2[0]; /* 141 */ for (int k = arrayOfInt2[1]; k < arrayOfInt2[3]; k++) { /* 142 */ int m = j; /* 143 */ for (int n = arrayOfInt2[0]; n < arrayOfInt2[2]; n++) { /* 144 */ localObject = localRaster1.getDataElements(n + paramInt1, k + paramInt2, localObject); /* 145 */ arrayOfInt1[(m++)] = localColorModel.getRGB(localObject); /* */ } /* 147 */ j += i; /* */ } /* */ /* */ } /* */ /* 152 */ localIntegerComponentRaster.markDirty(); /* */ }
/** * Stores the Raster data at the specified location. * * @param dstX The absolute X coordinate of the destination pixel that will receive a copy of the * upper-left pixel of the inRaster * @param dstY The absolute Y coordinate of the destination pixel that will receive a copy of the * upper-left pixel of the inRaster * @param width The number of pixels to store horizontally * @param height The number of pixels to store vertically * @param inRaster Raster of data to place at x,y location. */ private void setDataElements(int dstX, int dstY, int width, int height, Raster inRaster) { // Assume bounds checking has been performed previously if (width <= 0 || height <= 0) { return; } // Write inRaster (minX, minY) to (dstX, dstY) int srcOffX = inRaster.getMinX(); int srcOffY = inRaster.getMinY(); int tdata[] = null; if (inRaster instanceof IntegerComponentRaster && (pixelStride == 1) && (numDataElements == 1)) { IntegerComponentRaster ict = (IntegerComponentRaster) inRaster; if (ict.getNumDataElements() != 1) { throw new ArrayIndexOutOfBoundsException("Number of bands" + " does not match"); } // Extract the raster parameters tdata = ict.getDataStorage(); int tss = ict.getScanlineStride(); int toff = ict.getDataOffset(0); int srcOffset = toff; int dstOffset = dataOffsets[0] + (dstY - minY) * scanlineStride + (dstX - minX); // Fastest case. We can copy scanlines if (ict.getPixelStride() == pixelStride) { width *= pixelStride; // Loop through all of the scanlines and copy the data for (int startY = 0; startY < height; startY++) { System.arraycopy(tdata, srcOffset, data, dstOffset, width); srcOffset += tss; dstOffset += scanlineStride; } markDirty(); return; } } Object odata = null; for (int startY = 0; startY < height; startY++) { odata = inRaster.getDataElements(srcOffX, srcOffY + startY, width, 1, odata); setDataElements(dstX, dstY + startY, width, 1, odata); } }
public void setPixels( int x, int y, int w, int h, ColorModel model, int pix[], int off, int scansize) { int lineOff = off; int poff; if (src != null) { src.checkSecurity(null, false); } // REMIND: What if the model doesn't fit in default color model? synchronized (this) { if (bimage == null) { if (cmodel == null) { cmodel = model; } createBufferedImage(); } int[] storage = new int[w]; int yoff; int pixel; if (cmodel instanceof IndexColorModel) { // REMIND: Right now we don't support writing back into ICM // images. convertToRGB(); } if ((model == cmodel) && (biRaster instanceof IntegerComponentRaster)) { IntegerComponentRaster iraster = (IntegerComponentRaster) biRaster; if (off == 0 && scansize == w) { iraster.setDataElements(x, y, w, h, pix); } else { // Need to pack the data for (yoff = y; yoff < y + h; yoff++, lineOff += scansize) { System.arraycopy(pix, lineOff, storage, 0, w); iraster.setDataElements(x, yoff, w, 1, storage); } } } else { if (model.getTransparency() != model.OPAQUE && cmodel.getTransparency() == cmodel.OPAQUE) { convertToRGB(); } if (isDefaultBI) { IntegerComponentRaster iraster = (IntegerComponentRaster) biRaster; int[] data = iraster.getDataStorage(); if (cmodel.equals(model)) { int sstride = iraster.getScanlineStride(); int doff = y * sstride + x; for (yoff = 0; yoff < h; yoff++, lineOff += scansize) { System.arraycopy(pix, lineOff, data, doff, w); doff += sstride; } // Note: manual modification of pixels, mark the // raster as changed iraster.markDirty(); } else { for (yoff = y; yoff < y + h; yoff++, lineOff += scansize) { poff = lineOff; for (int i = 0; i < w; i++) { storage[i] = model.getRGB(pix[poff++]); } iraster.setDataElements(x, yoff, w, 1, storage); } } availinfo |= ImageObserver.SOMEBITS; } else { Object tmp = null; for (yoff = y; yoff < y + h; yoff++, lineOff += scansize) { poff = lineOff; for (int xoff = x; xoff < x + w; xoff++) { pixel = model.getRGB(pix[poff++]); tmp = cmodel.getDataElements(pixel, tmp); biRaster.setDataElements(xoff, yoff, tmp); } } availinfo |= ImageObserver.SOMEBITS; } } } // Can't do this here since we might need to transform/clip // the region if (((availinfo & ImageObserver.FRAMEBITS) == 0)) { newInfo(image, ImageObserver.SOMEBITS, x, y, w, h); } }