Java Code Examples for java.awt.image.DataBufferInt#getBankData()
The following examples show how to use
java.awt.image.DataBufferInt#getBankData() .
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: WebP.java From webp-imageio with Apache License 2.0 | 6 votes |
private static byte[] extractDirectRGBInt( int aWidth, int aHeight, DirectColorModel aColorModel, SinglePixelPackedSampleModel aSampleModel, DataBufferInt aDataBuffer ) { byte[] out = new byte[ aWidth * aHeight * 3 ]; int rMask = aColorModel.getRedMask(); int gMask = aColorModel.getGreenMask(); int bMask = aColorModel.getBlueMask(); int rShift = getShift( rMask ); int gShift = getShift( gMask ); int bShift = getShift( bMask ); int[] bank = aDataBuffer.getBankData()[ 0 ]; int scanlineStride = aSampleModel.getScanlineStride(); int scanIx = 0; for ( int b = 0, y = 0; y < aHeight; y++ ) { int pixIx = scanIx; for ( int x = 0; x < aWidth; x++, b += 3 ) { int pixel = bank[ pixIx++ ]; out[ b ] = ( byte ) ( ( pixel & rMask ) >>> rShift ); out[ b + 1 ] = ( byte ) ( ( pixel & gMask ) >>> gShift ); out[ b + 2 ] = ( byte ) ( ( pixel & bMask ) >>> bShift ); } scanIx += scanlineStride; } return out; }
Example 2
Source File: CustomCompositeTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 3
Source File: CustomCompositeTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 4
Source File: CustomCompositeTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 5
Source File: CustomCompositeTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 6
Source File: CustomCompositeTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 7
Source File: CustomCompositeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 8
Source File: CustomCompositeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 9
Source File: CustomCompositeTest.java From hottub with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 10
Source File: CustomCompositeTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 11
Source File: CustomCompositeTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 12
Source File: CustomCompositeTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 13
Source File: CustomCompositeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 14
Source File: CustomCompositeTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w = src.getWidth(); int h = src.getHeight(); DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer(); DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer(); int srcRGB[] = srcDB.getBankData()[0]; int dstOutRGB[] = dstOutDB.getBankData()[0]; int srcOffset = srcDB.getOffset(); int dstOutOffset = dstOutDB.getOffset(); int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride(); int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride(); int srcAdjust = srcScanStride - w; int dstOutAdjust = dstOutScanStride - w; int si = srcOffset; int doi = dstOutOffset; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff; si++; doi++; } si += srcAdjust; doi += dstOutAdjust; } }
Example 15
Source File: WebP.java From webp-imageio with Apache License 2.0 | 5 votes |
private static byte[] extractDirectRGBAInt( int aWidth, int aHeight, DirectColorModel aColorModel, SinglePixelPackedSampleModel aSampleModel, DataBufferInt aDataBuffer ) { byte[] out = new byte[ aWidth * aHeight * 4 ]; int rMask = aColorModel.getRedMask(); int gMask = aColorModel.getGreenMask(); int bMask = aColorModel.getBlueMask(); int aMask = aColorModel.getAlphaMask(); int rShift = getShift( rMask ); int gShift = getShift( gMask ); int bShift = getShift( bMask ); int aShift = getShift( aMask ); int[] bank = aDataBuffer.getBankData()[ 0 ]; int scanlineStride = aSampleModel.getScanlineStride(); int scanIx = 0; for ( int b = 0, y = 0; y < aHeight; y++ ) { int pixIx = scanIx; for ( int x = 0; x < aWidth; x++, b += 4 ) { int pixel = bank[ pixIx++ ]; out[ b ] = ( byte ) ( ( pixel & rMask ) >>> rShift ); out[ b + 1 ] = ( byte ) ( ( pixel & gMask ) >>> gShift ); out[ b + 2 ] = ( byte ) ( ( pixel & bMask ) >>> bShift ); out[ b + 3 ] = ( byte ) ( ( pixel & aMask ) >>> aShift ); } scanIx += scanlineStride; } return out; }