Java Code Examples for java.awt.image.DataBufferShort
The following are top voted examples for showing how to use
java.awt.image.DataBufferShort. These examples are extracted from open source projects.
You can vote up the examples you like and your votes will be used in our system to generate
more good examples.
Example 1
Project: OpenJSharp File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 2
Project: OpenJSharp File: Buffers.java View source code | 6 votes |
/** * Create a data buffer of a particular type. * * @param dataType the desired data type of the buffer. * @param size the size of the data buffer bank * @param numBanks the number of banks the buffer should have */ public static DataBuffer createBuffer(int dataType, int size, int numBanks) { switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte(size, numBanks); case DataBuffer.TYPE_SHORT: return new DataBufferShort(size, numBanks); case DataBuffer.TYPE_USHORT: return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: return new DataBufferInt(size, numBanks); case DataBuffer.TYPE_FLOAT: return new DataBufferFloat(size, numBanks); case DataBuffer.TYPE_DOUBLE: return new DataBufferDouble(size, numBanks); default: throw new UnsupportedOperationException(); } }
Example 3
Project: OpenJSharp File: Buffers.java View source code | 6 votes |
/** * Create a data buffer of a particular type. * * @param dataType the desired data type of the buffer * @param data an array containing the data * @param size the size of the data buffer bank */ public static DataBuffer createBufferFromData(int dataType, Object data, int size) { switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte((byte[]) data, size); case DataBuffer.TYPE_SHORT: return new DataBufferShort((short[]) data, size); case DataBuffer.TYPE_USHORT: return new DataBufferUShort((short[]) data, size); case DataBuffer.TYPE_INT: return new DataBufferInt((int[]) data, size); case DataBuffer.TYPE_FLOAT: return new DataBufferFloat((float[]) data, size); case DataBuffer.TYPE_DOUBLE: return new DataBufferDouble((double[]) data, size); default: throw new UnsupportedOperationException(); } }
Example 4
Project: jdk8u-jdk File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 5
Project: jdk8u-jdk File: IncorrectAlphaConversionBicubic.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc, int type) { BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type); Graphics2D g2d = img.createGraphics(); g2d.setColor(RGB); g2d.fillRect(0, 0, SIZE, SIZE); g2d.dispose(); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 6
Project: jdk8u-jdk File: UnmanagedDrawImagePerformance.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage img = new BufferedImage(SIZE, SIZE, type); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 7
Project: jdk8u-jdk File: IncorrectClipXorModeSW2Surface.java View source code | 6 votes |
private static BufferedImage getBufferedImage(int sw) { final BufferedImage bi = new BufferedImage(sw, sw, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bi.createGraphics(); g2d.setColor(Color.RED); g2d.fillRect(0, 0, sw, sw); g2d.dispose(); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 8
Project: jdk8u-jdk File: IncorrectUnmanagedImageRotatedClip.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI() { final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 9
Project: jdk8u-jdk File: IncorrectUnmanagedImageSourceOffset.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage bi = new BufferedImage(511, 255, type); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 10
Project: openjdk-jdk10 File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 11
Project: openjdk-jdk10 File: IncorrectAlphaConversionBicubic.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc, int type) { BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type); Graphics2D g2d = img.createGraphics(); g2d.setColor(RGB); g2d.fillRect(0, 0, SIZE, SIZE); g2d.dispose(); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 12
Project: openjdk-jdk10 File: UnmanagedDrawImagePerformance.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage img = new BufferedImage(SIZE, SIZE, type); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 13
Project: openjdk-jdk10 File: IncorrectClipXorModeSW2Surface.java View source code | 6 votes |
private static BufferedImage getBufferedImage(int sw) { final BufferedImage bi = new BufferedImage(sw, sw, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bi.createGraphics(); g2d.setColor(Color.RED); g2d.fillRect(0, 0, sw, sw); g2d.dispose(); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 14
Project: openjdk-jdk10 File: IncorrectUnmanagedImageRotatedClip.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI() { final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 15
Project: openjdk-jdk10 File: IncorrectUnmanagedImageSourceOffset.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage bi = new BufferedImage(511, 255, type); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 16
Project: openjdk9 File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 17
Project: openjdk9 File: IncorrectAlphaConversionBicubic.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc, int type) { BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type); Graphics2D g2d = img.createGraphics(); g2d.setColor(RGB); g2d.fillRect(0, 0, SIZE, SIZE); g2d.dispose(); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 18
Project: openjdk9 File: UnmanagedDrawImagePerformance.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage img = new BufferedImage(SIZE, SIZE, type); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 19
Project: openjdk9 File: IncorrectClipXorModeSW2Surface.java View source code | 6 votes |
private static BufferedImage getBufferedImage(int sw) { final BufferedImage bi = new BufferedImage(sw, sw, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bi.createGraphics(); g2d.setColor(Color.RED); g2d.fillRect(0, 0, sw, sw); g2d.dispose(); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 20
Project: openjdk9 File: IncorrectUnmanagedImageRotatedClip.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI() { final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 21
Project: openjdk9 File: IncorrectUnmanagedImageSourceOffset.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage bi = new BufferedImage(511, 255, type); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 22
Project: jdk8u_jdk File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 23
Project: jdk8u_jdk File: IncorrectAlphaConversionBicubic.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc, int type) { BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type); Graphics2D g2d = img.createGraphics(); g2d.setColor(RGB); g2d.fillRect(0, 0, SIZE, SIZE); g2d.dispose(); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 24
Project: jdk8u_jdk File: UnmanagedDrawImagePerformance.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage img = new BufferedImage(SIZE, SIZE, type); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 25
Project: jdk8u_jdk File: IncorrectClipXorModeSW2Surface.java View source code | 6 votes |
private static BufferedImage getBufferedImage(int sw) { final BufferedImage bi = new BufferedImage(sw, sw, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bi.createGraphics(); g2d.setColor(Color.RED); g2d.fillRect(0, 0, sw, sw); g2d.dispose(); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 26
Project: jdk8u_jdk File: IncorrectUnmanagedImageRotatedClip.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI() { final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 27
Project: jdk8u_jdk File: IncorrectUnmanagedImageSourceOffset.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage bi = new BufferedImage(511, 255, type); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 28
Project: lookaside_java-1.8.0-openjdk File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 29
Project: lookaside_java-1.8.0-openjdk File: IncorrectAlphaConversionBicubic.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc, int type) { BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type); Graphics2D g2d = img.createGraphics(); g2d.setColor(RGB); g2d.fillRect(0, 0, SIZE, SIZE); g2d.dispose(); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 30
Project: lookaside_java-1.8.0-openjdk File: UnmanagedDrawImagePerformance.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage img = new BufferedImage(SIZE, SIZE, type); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 31
Project: lookaside_java-1.8.0-openjdk File: IncorrectClipXorModeSW2Surface.java View source code | 6 votes |
private static BufferedImage getBufferedImage(int sw) { final BufferedImage bi = new BufferedImage(sw, sw, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bi.createGraphics(); g2d.setColor(Color.RED); g2d.fillRect(0, 0, sw, sw); g2d.dispose(); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 32
Project: lookaside_java-1.8.0-openjdk File: IncorrectUnmanagedImageRotatedClip.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI() { final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 33
Project: lookaside_java-1.8.0-openjdk File: IncorrectUnmanagedImageSourceOffset.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage bi = new BufferedImage(511, 255, type); final DataBuffer db = bi.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { bi.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return bi; }
Example 34
Project: javify File: Buffers.java View source code | 6 votes |
/** * Create a data buffer of a particular type. * * @param dataType the desired data type of the buffer. * @param size the size of the data buffer bank * @param numBanks the number of banks the buffer should have */ public static DataBuffer createBuffer(int dataType, int size, int numBanks) { switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte(size, numBanks); case DataBuffer.TYPE_SHORT: return new DataBufferShort(size, numBanks); case DataBuffer.TYPE_USHORT: return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: return new DataBufferInt(size, numBanks); case DataBuffer.TYPE_FLOAT: return new DataBufferFloat(size, numBanks); case DataBuffer.TYPE_DOUBLE: return new DataBufferDouble(size, numBanks); default: throw new UnsupportedOperationException(); } }
Example 35
Project: javify File: Buffers.java View source code | 6 votes |
/** * Create a data buffer of a particular type. * * @param dataType the desired data type of the buffer * @param data an array containing the data * @param size the size of the data buffer bank */ public static DataBuffer createBufferFromData(int dataType, Object data, int size) { switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte((byte[]) data, size); case DataBuffer.TYPE_SHORT: return new DataBufferShort((short[]) data, size); case DataBuffer.TYPE_USHORT: return new DataBufferUShort((short[]) data, size); case DataBuffer.TYPE_INT: return new DataBufferInt((int[]) data, size); case DataBuffer.TYPE_FLOAT: return new DataBufferFloat((float[]) data, size); case DataBuffer.TYPE_DOUBLE: return new DataBufferDouble((double[]) data, size); default: throw new UnsupportedOperationException(); } }
Example 36
Project: jvm-stm File: Buffers.java View source code | 6 votes |
/** * Create a data buffer of a particular type. * * @param dataType the desired data type of the buffer. * @param size the size of the data buffer bank * @param numBanks the number of banks the buffer should have */ public static DataBuffer createBuffer(int dataType, int size, int numBanks) { switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte(size, numBanks); case DataBuffer.TYPE_SHORT: return new DataBufferShort(size, numBanks); case DataBuffer.TYPE_USHORT: return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: return new DataBufferInt(size, numBanks); case DataBuffer.TYPE_FLOAT: return new DataBufferFloat(size, numBanks); case DataBuffer.TYPE_DOUBLE: return new DataBufferDouble(size, numBanks); default: throw new UnsupportedOperationException(); } }
Example 37
Project: jvm-stm File: Buffers.java View source code | 6 votes |
/** * Create a data buffer of a particular type. * * @param dataType the desired data type of the buffer * @param data an array containing the data * @param size the size of the data buffer bank */ public static DataBuffer createBufferFromData(int dataType, Object data, int size) { switch (dataType) { case DataBuffer.TYPE_BYTE: return new DataBufferByte((byte[]) data, size); case DataBuffer.TYPE_SHORT: return new DataBufferShort((short[]) data, size); case DataBuffer.TYPE_USHORT: return new DataBufferUShort((short[]) data, size); case DataBuffer.TYPE_INT: return new DataBufferInt((int[]) data, size); case DataBuffer.TYPE_FLOAT: return new DataBufferFloat((float[]) data, size); case DataBuffer.TYPE_DOUBLE: return new DataBufferDouble((double[]) data, size); default: throw new UnsupportedOperationException(); } }
Example 38
Project: infobip-open-jdk-8 File: ImageTests.java View source code | 6 votes |
public Image makeImage(TestEnvironment env, int w, int h) { BufferedImage img = new BufferedImage(w, h, type); if (unmanaged) { DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt)db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort)db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte)db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (Throwable e) {} } } return img; }
Example 39
Project: infobip-open-jdk-8 File: IncorrectAlphaConversionBicubic.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc, int type) { BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type); Graphics2D g2d = img.createGraphics(); g2d.setColor(RGB); g2d.fillRect(0, 0, SIZE, SIZE); g2d.dispose(); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }
Example 40
Project: infobip-open-jdk-8 File: UnmanagedDrawImagePerformance.java View source code | 6 votes |
private static BufferedImage makeUnmanagedBI(final int type) { final BufferedImage img = new BufferedImage(SIZE, SIZE, type); final DataBuffer db = img.getRaster().getDataBuffer(); if (db instanceof DataBufferInt) { ((DataBufferInt) db).getData(); } else if (db instanceof DataBufferShort) { ((DataBufferShort) db).getData(); } else if (db instanceof DataBufferByte) { ((DataBufferByte) db).getData(); } else { try { img.setAccelerationPriority(0.0f); } catch (final Throwable ignored) { } } return img; }