public static IntBuffer directCopy(IntBuffer b, ByteOrder order) { return directCopy((Buffer)b, order).asIntBuffer(); } public static LongBuffer directCopy(LongBuffer b, ByteOrder order) {
public static FloatBuffer directCopy(FloatBuffer b, ByteOrder order) { return directCopy((Buffer)b, order).asFloatBuffer(); } public static ByteBuffer directCopy(Buffer b, ByteOrder order) {
public static LongBuffer directCopy(LongBuffer b, ByteOrder order) { return directCopy((Buffer)b, order).asLongBuffer(); } public static ShortBuffer directCopy(ShortBuffer b, ByteOrder order) {
public static ShortBuffer directCopy(ShortBuffer b, ByteOrder order) { return directCopy((Buffer)b, order).asShortBuffer(); } public static CharBuffer directCopy(CharBuffer b, ByteOrder order) {
public static DoubleBuffer directCopy(DoubleBuffer b, ByteOrder order) { return directCopy((Buffer)b, order).asDoubleBuffer(); } public static FloatBuffer directCopy(FloatBuffer b, ByteOrder order) {
public static CharBuffer directCopy(CharBuffer b, ByteOrder order) { return directCopy((Buffer)b, order).asCharBuffer(); } public static DoubleBuffer directCopy(DoubleBuffer b, ByteOrder order) {
public Buffer getData(Image image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int[] intData = null; int width = image.getWidth(null), height = image.getHeight(null); PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, height, true); try { grabber.grabPixels(); intData = (int[])grabber.getPixels(); } catch (InterruptedException ex) { throw new RuntimeException("Pixel read operation was interrupted", ex); } IntBuffer output = IntBuffer.wrap(intData); if (directBuffer) return NIOUtils.directCopy(output, byteOrder); else return output; } },
public Buffer getData(BufferedImage image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int width = image.getWidth(), height = image.getHeight(); WritableRaster raster = checkWritableRaster(image); checkSinglePixelPackedSampleModel(raster); byte[] existingArray = getIndirectArray(optionalExistingOutput, width * height, byte[].class); byte[] array; ByteBuffer output = null; if (!allowDeoptimizingDirectRead || isSubRaster(raster)) array = (byte[])raster.getDataElements(0, 0, width, height, existingArray); else { array = checkDataBuffer(raster, DataBufferByte.class).getData(); if (optionalExistingOutput instanceof ByteBuffer) { output = (ByteBuffer)optionalExistingOutput; if (output != null && output.capacity() == width * height) { if (!output.isDirect()) System.arraycopy(array, 0, output.array(), 0, width * height); else { output.duplicate().put(array); } } } } if (output == null) output = ByteBuffer.wrap(array); return directBuffer && !output.isDirect() ? NIOUtils.directCopy(output, byteOrder) : output; } },
public Buffer getData(Image image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int[] intData = null; int width = image.getWidth(null), height = image.getHeight(null); PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, height, true); try { grabber.grabPixels(); intData = (int[])grabber.getPixels(); } catch (InterruptedException ex) { throw new RuntimeException("Pixel read operation was interrupted", ex); } IntBuffer output = IntBuffer.wrap(intData); if (directBuffer) return NIOUtils.directCopy(output, byteOrder); else return output; } },
public Buffer getData(BufferedImage image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int width = image.getWidth(), height = image.getHeight(); WritableRaster raster = checkWritableRaster(image); checkSinglePixelPackedSampleModel(raster); byte[] existingArray = getIndirectArray(optionalExistingOutput, width * height, byte[].class); byte[] array; ByteBuffer output = null; if (!allowDeoptimizingDirectRead || isSubRaster(raster)) array = (byte[])raster.getDataElements(0, 0, width, height, existingArray); else { array = checkDataBuffer(raster, DataBufferByte.class).getData(); if (optionalExistingOutput instanceof ByteBuffer) { output = (ByteBuffer)optionalExistingOutput; if (output != null && output.capacity() == width * height) { if (!output.isDirect()) System.arraycopy(array, 0, output.array(), 0, width * height); else { output.duplicate().put(array); } } } } if (output == null) output = ByteBuffer.wrap(array); return directBuffer && !output.isDirect() ? NIOUtils.directCopy(output, byteOrder) : output; } },
public Buffer getData(BufferedImage image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int width = image.getWidth(), height = image.getHeight(); WritableRaster raster = checkWritableRaster(image); checkSinglePixelPackedSampleModel(raster); short[] existingArray = getIndirectArray(optionalExistingOutput, width * height, short[].class); short[] array; ShortBuffer output = null; if (!allowDeoptimizingDirectRead || isSubRaster(raster)) array = (short[])raster.getDataElements(0, 0, width, height, existingArray); else { array = checkDataBuffer(raster, DataBufferShort.class).getData(); if (optionalExistingOutput instanceof ShortBuffer) { output = (ShortBuffer)optionalExistingOutput; if (output != null && output.capacity() == width * height) { if (!output.isDirect()) System.arraycopy(array, 0, output.array(), 0, width * height); else { output.duplicate().put(array); } } } } if (output == null) output = ShortBuffer.wrap(array); return directBuffer && !output.isDirect() ? NIOUtils.directCopy(output, byteOrder) : output; } },
public Buffer getData(BufferedImage image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int width = image.getWidth(), height = image.getHeight(); WritableRaster raster = checkWritableRaster(image); checkSinglePixelPackedSampleModel(raster); int[] existingArray = getIndirectArray(optionalExistingOutput, width * height, int[].class); int[] array; IntBuffer output = null; if (!allowDeoptimizingDirectRead || isSubRaster(raster)) array = (int[])raster.getDataElements(0, 0, width, height, existingArray); else { array = checkDataBuffer(raster, DataBufferInt.class).getData(); if (optionalExistingOutput instanceof IntBuffer) { output = (IntBuffer)optionalExistingOutput; if (output != null && output.capacity() == width * height) { if (output.array() != null) System.arraycopy(array, 0, output.array(), 0, width * height); else { output.duplicate().put(array); } } } } if (output == null) output = IntBuffer.wrap(array); return directBuffer && !output.isDirect() ? NIOUtils.directCopy(output, byteOrder) : output; } },
public Buffer getData(BufferedImage image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int width = image.getWidth(), height = image.getHeight(); WritableRaster raster = checkWritableRaster(image); checkSinglePixelPackedSampleModel(raster); short[] existingArray = getIndirectArray(optionalExistingOutput, width * height, short[].class); short[] array; ShortBuffer output = null; if (!allowDeoptimizingDirectRead || isSubRaster(raster)) array = (short[])raster.getDataElements(0, 0, width, height, existingArray); else { array = checkDataBuffer(raster, DataBufferShort.class).getData(); if (optionalExistingOutput instanceof ShortBuffer) { output = (ShortBuffer)optionalExistingOutput; if (output != null && output.capacity() == width * height) { if (!output.isDirect()) System.arraycopy(array, 0, output.array(), 0, width * height); else { output.duplicate().put(array); } } } } if (output == null) output = ShortBuffer.wrap(array); return directBuffer && !output.isDirect() ? NIOUtils.directCopy(output, byteOrder) : output; } },
public Buffer getData(BufferedImage image, Buffer optionalExistingOutput, boolean directBuffer, boolean allowDeoptimizingDirectRead, ByteOrder byteOrder) { int width = image.getWidth(), height = image.getHeight(); WritableRaster raster = checkWritableRaster(image); checkSinglePixelPackedSampleModel(raster); int[] existingArray = getIndirectArray(optionalExistingOutput, width * height, int[].class); int[] array; IntBuffer output = null; if (!allowDeoptimizingDirectRead || isSubRaster(raster)) array = (int[])raster.getDataElements(0, 0, width, height, existingArray); else { array = checkDataBuffer(raster, DataBufferInt.class).getData(); if (optionalExistingOutput instanceof IntBuffer) { output = (IntBuffer)optionalExistingOutput; if (output != null && output.capacity() == width * height) { if (output.array() != null) System.arraycopy(array, 0, output.array(), 0, width * height); else { output.duplicate().put(array); } } } } if (output == null) output = IntBuffer.wrap(array); return directBuffer && !output.isDirect() ? NIOUtils.directCopy(output, byteOrder) : output; } },
ByteBuffer texData = NIOUtils.directCopy(ByteBuffer.wrap(new byte[] { bMin1,bMin1,bMin1,bMin1, bMin1,bMin1,bMin1,bMin1, bMin1,bMin1,bMin1,bMin1, bMin1,bMin1,bMin1,bMin1,