Search in sources :

Example 6 with ByteInterleavedRaster

use of sun.awt.image.ByteInterleavedRaster in project jdk8u_jdk by JetBrains.

the class TexturePaintContext method getContext.

public static PaintContext getContext(BufferedImage bufImg, AffineTransform xform, RenderingHints hints, Rectangle devBounds) {
    WritableRaster raster = bufImg.getRaster();
    ColorModel cm = bufImg.getColorModel();
    int maxw = devBounds.width;
    Object val = hints.get(RenderingHints.KEY_INTERPOLATION);
    boolean filter = (val == null ? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY) : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
    if (raster instanceof IntegerInterleavedRaster && (!filter || isFilterableDCM(cm))) {
        IntegerInterleavedRaster iir = (IntegerInterleavedRaster) raster;
        if (iir.getNumDataElements() == 1 && iir.getPixelStride() == 1) {
            return new Int(iir, cm, xform, maxw, filter);
        }
    } else if (raster instanceof ByteInterleavedRaster) {
        ByteInterleavedRaster bir = (ByteInterleavedRaster) raster;
        if (bir.getNumDataElements() == 1 && bir.getPixelStride() == 1) {
            if (filter) {
                if (isFilterableICM(cm)) {
                    return new ByteFilter(bir, cm, xform, maxw);
                }
            } else {
                return new Byte(bir, cm, xform, maxw);
            }
        }
    }
    return new Any(raster, cm, xform, maxw, filter);
}
Also used : ByteInterleavedRaster(sun.awt.image.ByteInterleavedRaster) SunWritableRaster(sun.awt.image.SunWritableRaster) WritableRaster(java.awt.image.WritableRaster) ColorModel(java.awt.image.ColorModel) DirectColorModel(java.awt.image.DirectColorModel) IndexColorModel(java.awt.image.IndexColorModel) IntegerInterleavedRaster(sun.awt.image.IntegerInterleavedRaster)

Aggregations

ByteInterleavedRaster (sun.awt.image.ByteInterleavedRaster)6 Point (java.awt.Point)3 WritableRaster (java.awt.image.WritableRaster)2 IntegerInterleavedRaster (sun.awt.image.IntegerInterleavedRaster)2 ShortInterleavedRaster (sun.awt.image.ShortInterleavedRaster)2 Graphics2D (java.awt.Graphics2D)1 HeadlessException (java.awt.HeadlessException)1 Rectangle (java.awt.Rectangle)1 AffineTransform (java.awt.geom.AffineTransform)1 Rectangle2D (java.awt.geom.Rectangle2D)1 BufferedImage (java.awt.image.BufferedImage)1 ColorModel (java.awt.image.ColorModel)1 DataBuffer (java.awt.image.DataBuffer)1 DirectColorModel (java.awt.image.DirectColorModel)1 IndexColorModel (java.awt.image.IndexColorModel)1 PageFormat (java.awt.print.PageFormat)1 Paper (java.awt.print.Paper)1 Printable (java.awt.print.Printable)1 PrinterAbortException (java.awt.print.PrinterAbortException)1 PrinterException (java.awt.print.PrinterException)1