sun.awt.image.IntegerComponentRaster Java Examples

The following examples show how to use sun.awt.image.IntegerComponentRaster. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WTrayIconPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #2
Source File: ColorPaintContext.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: GradientPaintContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: GradientPaintContext.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #5
Source File: ColorPaintContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: GradientPaintContext.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: ColorPaintContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #8
Source File: WTrayIconPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #9
Source File: GradientPaintContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: ColorPaintContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #11
Source File: WTrayIconPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #12
Source File: GradientPaintContext.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #13
Source File: GradientPaintContext.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #14
Source File: GradientPaintContext.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #15
Source File: ColorPaintContext.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #16
Source File: ColorPaintContext.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #17
Source File: ColorPaintContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #18
Source File: WTrayIconPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #19
Source File: WTrayIconPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #20
Source File: GradientPaintContext.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #21
Source File: ColorPaintContext.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #22
Source File: GradientPaintContext.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #23
Source File: ColorPaintContext.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #24
Source File: WTrayIconPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #25
Source File: GradientPaintContext.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: ColorPaintContext.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #27
Source File: WTrayIconPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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());
}
 
Example #28
Source File: GradientPaintContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #29
Source File: ColorPaintContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #30
Source File: WTrayIconPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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());
}