Java Code Examples for sun.awt.image.ByteInterleavedRaster#getDataStorage()
The following examples show how to use
sun.awt.image.ByteInterleavedRaster#getDataStorage() .
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: TexturePaintContext.java From hottub with GNU General Public License v2.0 | 5 votes |
public ByteFilter(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super((cm.getTransparency() == Transparency.OPAQUE ? xrgbmodel : argbmodel), xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.inPalette = new int[256]; ((IndexColorModel) cm).getRGBs(this.inPalette); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 2
Source File: TexturePaintContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public WritableRaster makeRaster(int w, int h) { WritableRaster ras = makeByteRaster(srcRas, w, h); ByteInterleavedRaster biRas = (ByteInterleavedRaster) ras; outData = biRas.getDataStorage(); outSpan = biRas.getScanlineStride(); outOff = biRas.getDataOffset(0); return ras; }
Example 3
Source File: TexturePaintContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 4
Source File: TexturePaintContext.java From Bytecoder with Apache License 2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 5
Source File: TexturePaintContext.java From JDKSourceCode1.8 with MIT License | 5 votes |
public WritableRaster makeRaster(int w, int h) { WritableRaster ras = makeByteRaster(srcRas, w, h); ByteInterleavedRaster biRas = (ByteInterleavedRaster) ras; outData = biRas.getDataStorage(); outSpan = biRas.getScanlineStride(); outOff = biRas.getDataOffset(0); return ras; }
Example 6
Source File: TexturePaintContext.java From JDKSourceCode1.8 with MIT License | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 7
Source File: TexturePaintContext.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public ByteFilter(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super((cm.getTransparency() == Transparency.OPAQUE ? xrgbmodel : argbmodel), xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.inPalette = new int[256]; ((IndexColorModel) cm).getRGBs(this.inPalette); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 8
Source File: TexturePaintContext.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 9
Source File: TexturePaintContext.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 10
Source File: TexturePaintContext.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ByteFilter(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super((cm.getTransparency() == Transparency.OPAQUE ? xrgbmodel : argbmodel), xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.inPalette = new int[256]; ((IndexColorModel) cm).getRGBs(this.inPalette); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 11
Source File: TexturePaintContext.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public WritableRaster makeRaster(int w, int h) { WritableRaster ras = makeByteRaster(srcRas, w, h); ByteInterleavedRaster biRas = (ByteInterleavedRaster) ras; outData = biRas.getDataStorage(); outSpan = biRas.getScanlineStride(); outOff = biRas.getDataOffset(0); return ras; }
Example 12
Source File: TexturePaintContext.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 13
Source File: TexturePaintContext.java From hottub with GNU General Public License v2.0 | 5 votes |
public WritableRaster makeRaster(int w, int h) { WritableRaster ras = makeByteRaster(srcRas, w, h); ByteInterleavedRaster biRas = (ByteInterleavedRaster) ras; outData = biRas.getDataStorage(); outSpan = biRas.getScanlineStride(); outOff = biRas.getDataOffset(0); return ras; }
Example 14
Source File: TexturePaintContext.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 15
Source File: TexturePaintContext.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public WritableRaster makeRaster(int w, int h) { WritableRaster ras = makeByteRaster(srcRas, w, h); ByteInterleavedRaster biRas = (ByteInterleavedRaster) ras; outData = biRas.getDataStorage(); outSpan = biRas.getScanlineStride(); outOff = biRas.getDataOffset(0); return ras; }
Example 16
Source File: TexturePaintContext.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public Byte(ByteInterleavedRaster srcRas, ColorModel cm, AffineTransform xform, int maxw) { super(cm, xform, srcRas.getWidth(), srcRas.getHeight(), maxw); this.srcRas = srcRas; this.inData = srcRas.getDataStorage(); this.inSpan = srcRas.getScanlineStride(); this.inOff = srcRas.getDataOffset(0); }
Example 17
Source File: TexturePaintContext.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public WritableRaster makeRaster(int w, int h) { WritableRaster ras = makeByteRaster(srcRas, w, h); ByteInterleavedRaster biRas = (ByteInterleavedRaster) ras; outData = biRas.getDataStorage(); outSpan = biRas.getScanlineStride(); outOff = biRas.getDataOffset(0); return ras; }
Example 18
Source File: WEmbeddedFrame.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
void print(long hdc) { BufferedImage bandImage = null; int xscale = 1; int yscale = 1; /* Is this is either a printer DC or an enhanced meta file DC ? * Mozilla passes in a printer DC, IE passes plug-in a DC for an * enhanced meta file. Its possible we may be passed to a memory * DC. If we here create a larger image, draw in to it and have * that memory DC then lose the image resolution only to scale it * back up again when sending to a printer it will look really bad. * So, is this is either a printer DC or an enhanced meta file DC ? * Scale only if it is. Use a 4x scale factor, partly since for * an enhanced meta file we don't know anything about the * real resolution of the destination. * * For a printer DC we could probably derive the scale factor to use * by querying LOGPIXELSX/Y, and dividing that by the screen * resolution (typically 96 dpi or 120 dpi) but that would typically * make for even bigger output for marginal extra quality. * But for enhanced meta file we don't know anything about the * real resolution of the destination so */ if (isPrinterDC(hdc)) { xscale = yscale = getPrintScaleFactor(); } int frameHeight = getHeight(); if (bandImage == null) { bandWidth = getWidth(); if (bandWidth % 4 != 0) { bandWidth += (4 - (bandWidth % 4)); } if (bandWidth <= 0) { return; } bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight); imgWid = bandWidth * xscale; imgHgt = bandHeight * yscale; bandImage = new BufferedImage(imgWid, imgHgt, BufferedImage.TYPE_3BYTE_BGR); } Graphics clearGraphics = bandImage.getGraphics(); clearGraphics.setColor(Color.white); Graphics2D g2d = (Graphics2D)bandImage.getGraphics(); g2d.translate(0, imgHgt); g2d.scale(xscale, -yscale); ByteInterleavedRaster ras = (ByteInterleavedRaster)bandImage.getRaster(); byte[] data = ras.getDataStorage(); for (int bandTop = 0; bandTop < frameHeight; bandTop += bandHeight) { clearGraphics.fillRect(0, 0, bandWidth, bandHeight); printComponents(g2d); int imageOffset =0; int currBandHeight = bandHeight; int currImgHeight = imgHgt; if ((bandTop+bandHeight) > frameHeight) { // last band currBandHeight = frameHeight - bandTop; currImgHeight = currBandHeight*yscale; // multiply by 3 because the image is a 3 byte BGR imageOffset = imgWid*(imgHgt-currImgHeight)*3; } printBand(hdc, data, imageOffset, 0, 0, imgWid, currImgHeight, 0, bandTop, bandWidth, currBandHeight); g2d.translate(0, -bandHeight); } }
Example 19
Source File: WEmbeddedFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
void print(long hdc) { BufferedImage bandImage = null; int xscale = 1; int yscale = 1; /* Is this is either a printer DC or an enhanced meta file DC ? * Mozilla passes in a printer DC, IE passes plug-in a DC for an * enhanced meta file. Its possible we may be passed to a memory * DC. If we here create a larger image, draw in to it and have * that memory DC then lose the image resolution only to scale it * back up again when sending to a printer it will look really bad. * So, is this is either a printer DC or an enhanced meta file DC ? * Scale only if it is. Use a 4x scale factor, partly since for * an enhanced meta file we don't know anything about the * real resolution of the destination. * * For a printer DC we could probably derive the scale factor to use * by querying LOGPIXELSX/Y, and dividing that by the screen * resolution (typically 96 dpi or 120 dpi) but that would typically * make for even bigger output for marginal extra quality. * But for enhanced meta file we don't know anything about the * real resolution of the destination so */ if (isPrinterDC(hdc)) { xscale = yscale = getPrintScaleFactor(); } int frameHeight = getHeight(); if (bandImage == null) { bandWidth = getWidth(); if (bandWidth % 4 != 0) { bandWidth += (4 - (bandWidth % 4)); } if (bandWidth <= 0) { return; } bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight); imgWid = bandWidth * xscale; imgHgt = bandHeight * yscale; bandImage = new BufferedImage(imgWid, imgHgt, BufferedImage.TYPE_3BYTE_BGR); } Graphics clearGraphics = bandImage.getGraphics(); clearGraphics.setColor(Color.white); Graphics2D g2d = (Graphics2D)bandImage.getGraphics(); g2d.translate(0, imgHgt); g2d.scale(xscale, -yscale); ByteInterleavedRaster ras = (ByteInterleavedRaster)bandImage.getRaster(); byte[] data = ras.getDataStorage(); for (int bandTop = 0; bandTop < frameHeight; bandTop += bandHeight) { clearGraphics.fillRect(0, 0, bandWidth, bandHeight); printComponents(g2d); int imageOffset =0; int currBandHeight = bandHeight; int currImgHeight = imgHgt; if ((bandTop+bandHeight) > frameHeight) { // last band currBandHeight = frameHeight - bandTop; currImgHeight = currBandHeight*yscale; // multiply by 3 because the image is a 3 byte BGR imageOffset = imgWid*(imgHgt-currImgHeight)*3; } printBand(hdc, data, imageOffset, 0, 0, imgWid, currImgHeight, 0, bandTop, bandWidth, currBandHeight); g2d.translate(0, -bandHeight); } }
Example 20
Source File: WEmbeddedFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
void print(long hdc) { BufferedImage bandImage = null; int xscale = 1; int yscale = 1; /* Is this is either a printer DC or an enhanced meta file DC ? * Mozilla passes in a printer DC, IE passes plug-in a DC for an * enhanced meta file. Its possible we may be passed to a memory * DC. If we here create a larger image, draw in to it and have * that memory DC then lose the image resolution only to scale it * back up again when sending to a printer it will look really bad. * So, is this is either a printer DC or an enhanced meta file DC ? * Scale only if it is. Use a 4x scale factor, partly since for * an enhanced meta file we don't know anything about the * real resolution of the destination. * * For a printer DC we could probably derive the scale factor to use * by querying LOGPIXELSX/Y, and dividing that by the screen * resolution (typically 96 dpi or 120 dpi) but that would typically * make for even bigger output for marginal extra quality. * But for enhanced meta file we don't know anything about the * real resolution of the destination so */ if (isPrinterDC(hdc)) { xscale = yscale = getPrintScaleFactor(); } int frameHeight = getHeight(); if (bandImage == null) { bandWidth = getWidth(); if (bandWidth % 4 != 0) { bandWidth += (4 - (bandWidth % 4)); } if (bandWidth <= 0) { return; } bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight); imgWid = bandWidth * xscale; imgHgt = bandHeight * yscale; bandImage = new BufferedImage(imgWid, imgHgt, BufferedImage.TYPE_3BYTE_BGR); } Graphics clearGraphics = bandImage.getGraphics(); clearGraphics.setColor(Color.white); Graphics2D g2d = (Graphics2D)bandImage.getGraphics(); g2d.translate(0, imgHgt); g2d.scale(xscale, -yscale); ByteInterleavedRaster ras = (ByteInterleavedRaster)bandImage.getRaster(); byte[] data = ras.getDataStorage(); for (int bandTop = 0; bandTop < frameHeight; bandTop += bandHeight) { clearGraphics.fillRect(0, 0, bandWidth, bandHeight); printComponents(g2d); int imageOffset =0; int currBandHeight = bandHeight; int currImgHeight = imgHgt; if ((bandTop+bandHeight) > frameHeight) { // last band currBandHeight = frameHeight - bandTop; currImgHeight = currBandHeight*yscale; // multiply by 3 because the image is a 3 byte BGR imageOffset = imgWid*(imgHgt-currImgHeight)*3; } printBand(hdc, data, imageOffset, 0, 0, imgWid, currImgHeight, 0, bandTop, bandWidth, currBandHeight); g2d.translate(0, -bandHeight); } }