Package ae.sun.awt.image

Examples of ae.sun.awt.image.IntegerComponentRaster


    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;
            }
        }
View Full Code Here


            return;
        }

        if ((raster instanceof IntegerComponentRaster) &&
            (numBands == 3 || numBands == 4)) {
            IntegerComponentRaster iraster =
                (IntegerComponentRaster) raster;
            // Check if the raster params and the color model
            // are correct
            int pixSize = cm.getPixelSize();
            if (iraster.getPixelStride() == 1 &&
                cm instanceof DirectColorModel  &&
                (pixSize == 32 || pixSize == 24))
            {
                // Now check on the DirectColorModel params
                DirectColorModel dcm = (DirectColorModel) cm;
View Full Code Here

    {
        Raster srcRast = src.getRaster(srcx, srcy, w, h);
        ColorModel srcCM = src.getColorModel();

        Raster dstRast = dst.getRaster(dstx, dsty, w, h);
        IntegerComponentRaster icr = (IntegerComponentRaster) dstRast;
        int[] dstPix = icr.getDataStorage();

        Region roi = CustomComponent.getRegionOfInterest(src, dst, clip,
                                                         srcx, srcy,
                                                         dstx, dsty, w, h);
        SpanIterator si = roi.getSpanIterator();

        Object srcPix = null;

        int dstScan = icr.getScanlineStride();
        // assert(icr.getPixelStride() == 1);
        srcx -= dstx;
        srcy -= dsty;
        int span[] = new int[4];
        while (si.nextSpan(span)) {
            int rowoff = icr.getDataOffset(0) + span[1] * dstScan + span[0];
            for (int y = span[1]; y < span[3]; y++) {
                int off = rowoff;
                for (int x = span[0]; x < span[2]; x++) {
                    srcPix = srcRast.getDataElements(x+srcx, y+srcy, srcPix);
                    dstPix[off++] = srcCM.getRGB(srcPix);
                }
                rowoff += dstScan;
            }
        }
        // Pixels in the dest were modified directly, we must
        // manually notify the raster that it was modified
        icr.markDirty();
        // REMIND: We need to do something to make sure that dstRast
        // is put back to the destination (as in the native Release
        // function)
        // src.releaseRaster(srcRast);  // NOP?
        // dst.releaseRaster(dstRast);
View Full Code Here

    public void Blit(SurfaceData src, SurfaceData dst,
                     Composite comp, Region clip,
                     int srcx, int srcy, int dstx, int dsty, int w, int h)
    {
        Raster srcRast = src.getRaster(srcx, srcy, w, h);
        IntegerComponentRaster icr = (IntegerComponentRaster) srcRast;
        int[] srcPix = icr.getDataStorage();

        WritableRaster dstRast =
            (WritableRaster) dst.getRaster(dstx, dsty, w, h);
        ColorModel dstCM = dst.getColorModel();

        Region roi = CustomComponent.getRegionOfInterest(src, dst, clip,
                                                         srcx, srcy,
                                                         dstx, dsty, w, h);
        SpanIterator si = roi.getSpanIterator();

        Object dstPix = null;

        int srcScan = icr.getScanlineStride();
        // assert(icr.getPixelStride() == 1);
        srcx -= dstx;
        srcy -= dsty;
        int span[] = new int[4];
        while (si.nextSpan(span)) {
            int rowoff = (icr.getDataOffset(0) +
                          (srcy + span[1]) * srcScan +
                          (srcx + span[0]));
            for (int y = span[1]; y < span[3]; y++) {
                int off = rowoff;
                for (int x = span[0]; x < span[2]; x++) {
View Full Code Here

    public void Blit(SurfaceData src, SurfaceData dst,
                     Composite comp, Region clip,
                     int srcx, int srcy, int dstx, int dsty, int w, int h)
    {
        Raster srcRast = src.getRaster(srcx, srcy, w, h);
        IntegerComponentRaster icr = (IntegerComponentRaster) srcRast;
        int[] srcPix = icr.getDataStorage();

        WritableRaster dstRast =
            (WritableRaster) dst.getRaster(dstx, dsty, w, h);
        ColorModel dstCM = dst.getColorModel();

        Region roi = CustomComponent.getRegionOfInterest(src, dst, clip,
                                                         srcx, srcy,
                                                         dstx, dsty, w, h);
        SpanIterator si = roi.getSpanIterator();

        int xorrgb = ((XORComposite)comp).getXorColor().getRGB();
        Object xorPixel = dstCM.getDataElements(xorrgb, null);

        Object srcPixel = null;
        Object dstPixel = null;

        int srcScan = icr.getScanlineStride();
        // assert(icr.getPixelStride() == 1);
        srcx -= dstx;
        srcy -= dsty;
        int span[] = new int[4];
        while (si.nextSpan(span)) {
            int rowoff = (icr.getDataOffset(0) +
                          (srcy + span[1]) * srcScan +
                          (srcx + span[0]));
            for (int y = span[1]; y < span[3]; y++) {
                int off = rowoff;
                for (int x = span[0]; x < span[2]; x++) {
View Full Code Here

        dataArray = data;
    }

    public LCMSImageLayout(BufferedImage image) {
        ShortComponentRaster shortRaster;
        IntegerComponentRaster intRaster;
        ByteComponentRaster byteRaster;
        switch (image.getType()) {
            case BufferedImage.TYPE_INT_RGB:
                pixelType = PT_ARGB_8;
                isIntPacked = true;
                break;
            case BufferedImage.TYPE_INT_ARGB:
                pixelType = PT_ARGB_8;
                isIntPacked = true;
                break;
            case BufferedImage.TYPE_INT_BGR:
                pixelType = PT_ABGR_8;
                isIntPacked = true;
                break;
            case BufferedImage.TYPE_3BYTE_BGR:
                pixelType = PT_BGR_8;
                break;
            case BufferedImage.TYPE_4BYTE_ABGR:
                pixelType = PT_ABGR_8;
                break;
            case BufferedImage.TYPE_BYTE_GRAY:
                pixelType = PT_GRAY_8;
                break;
            case BufferedImage.TYPE_USHORT_GRAY:
                pixelType = PT_GRAY_16;
                break;
            default:
            // TODO: Add support for some images having
            // SinglePixelPackedModel and ComponentSampleModel
                throw new IllegalArgumentException(
                    "CMMImageLayout - bad image type passed to constructor");
        }

        width = image.getWidth();
        height = image.getHeight();

        switch (image.getType()) {
            case BufferedImage.TYPE_INT_RGB:
            case BufferedImage.TYPE_INT_ARGB:
            case BufferedImage.TYPE_INT_BGR:
                intRaster = (IntegerComponentRaster)image.getRaster();
                nextRowOffset = intRaster.getScanlineStride()*4;
                offset = intRaster.getDataOffset(0)*4;
                dataArray = intRaster.getDataStorage();
                dataType = DT_INT;
                break;

            case BufferedImage.TYPE_3BYTE_BGR:
            case BufferedImage.TYPE_4BYTE_ABGR:
View Full Code Here

                }
            }

            if (isDefaultBI) {
                int pixel;
                IntegerComponentRaster iraster =
                                          (IntegerComponentRaster) biRaster;
                if (srcLUT != null && model instanceof IndexColorModel) {
                    if (model != srcModel) {
                        // Fill in the new lut
                        ((IndexColorModel)model).getRGBs(srcLUT);
                        srcModel = model;
                    }

                    if (s_useNative) {
                        // Note that setICMpixels modifies the raster directly
                        // so we must mark it as changed afterwards
                        setICMpixels(x, y, w, h, srcLUT, pix, off, scansize,
                                     iraster);
                        iraster.markDirty();
                    }
                    else {
                        int[] storage = new int[w*h];
                        int soff = 0;
                        // It is an IndexColorModel
                        for (int yoff=0; yoff < h; yoff++,
                                 lineOff += scansize) {
                            poff = lineOff;
                            for (int i=0; i < w; i++) {
                                storage[soff++] = srcLUT[pix[poff++]&0xff];
                            }
                        }
                        iraster.setDataElements(x, y, w, h, storage);
                    }
                }
                else {
                    int[] storage = new int[w];
                    for (int yoff=y; yoff < y+h; yoff++, lineOff += scansize) {
                        poff = lineOff;
                        for (int i=0; i < w; i++) {
                            storage[i] = model.getRGB(pix[poff++]&0xff);
                        }
                        iraster.setDataElements(x, yoff, w, 1, storage);
                    }
                    availinfo |= ImageObserver.SOMEBITS;
                }
            }
            else if ((cmodel == model) &&
View Full Code Here

                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;
                }
View Full Code Here

        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;
    }
View Full Code Here

TOP

Related Classes of ae.sun.awt.image.IntegerComponentRaster

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.