Package com.jogamp.opengl.util
Class PNGPixelRect
- java.lang.Object
-
- com.jogamp.nativewindow.util.PixelRectangle.GenericPixelRect
-
- com.jogamp.opengl.util.PNGPixelRect
-
- All Implemented Interfaces:
PixelRectangle
public class PNGPixelRect extends PixelRectangle.GenericPixelRect
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jogamp.nativewindow.util.PixelRectangle
PixelRectangle.GenericPixelRect
-
-
Constructor Summary
Constructors Constructor Description PNGPixelRect(PixelFormat pixelformat, DimensionImmutable size, int strideInBytes, boolean isGLOriented, ByteBuffer pixels, double dpiX, double dpiY)Creates a PNGPixelRect from data supplied by the end user.PNGPixelRect(PixelRectangle src, double dpiX, double dpiY)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]getDpi()Returns the dpi of the image.static PNGPixelRectread(InputStream in, PixelFormat ddestFmt, boolean destDirectBuffer, int destMinStrideInBytes, boolean destIsGLOriented)Reads a PNG image from the specified InputStream.static voidwrite(PixelFormat pixelformat, DimensionImmutable size, int strideInPixels, boolean isGLOriented, IntBuffer pixels, double dpiX, double dpiY, OutputStream outstream, boolean closeOutstream)voidwrite(OutputStream outstream, boolean closeOutstream)-
Methods inherited from class com.jogamp.nativewindow.util.PixelRectangle.GenericPixelRect
getPixelformat, getPixels, getSize, getStride, hashCode, isGLOriented, toString
-
-
-
-
Constructor Detail
-
PNGPixelRect
public PNGPixelRect(PixelFormat pixelformat, DimensionImmutable size, int strideInBytes, boolean isGLOriented, ByteBuffer pixels, double dpiX, double dpiY)
Creates a PNGPixelRect from data supplied by the end user. Shares data with the passed ByteBuffer.- Parameters:
pixelformat-size-strideInBytes-isGLOriented- seePixelRectangle.GenericPixelRect.isGLOriented().pixels-dpiX-dpiY-
-
PNGPixelRect
public PNGPixelRect(PixelRectangle src, double dpiX, double dpiY)
-
-
Method Detail
-
read
public static PNGPixelRect read(InputStream in, PixelFormat ddestFmt, boolean destDirectBuffer, int destMinStrideInBytes, boolean destIsGLOriented) throws IOException
Reads a PNG image from the specified InputStream.Implicitly converts the image to match the desired:
PixelFormat, seePixelRectangle.GenericPixelRect.getPixelformat()destStrideInBytes, seePixelRectangle.GenericPixelRect.getStride()destIsGLOriented, seePixelRectangle.GenericPixelRect.isGLOriented()
- Parameters:
in- input streamdestFmt- desired destinationPixelFormatincl. conversion, maybenullto use sourcePixelFormatdestDirectBuffer- if true, using a direct NIO buffer, otherwise an array backed bufferdestMinStrideInBytes- used if greater than PNG's stride, otherwise using PNG's stride. Stride is width * bytes-per-pixel.destIsGLOriented-- Returns:
- the newly created PNGPixelRect instance
- Throws:
IOException
-
getDpi
public double[] getDpi()
Returns the dpi of the image.
-
write
public void write(OutputStream outstream, boolean closeOutstream) throws IOException
- Throws:
IOException
-
write
public static void write(PixelFormat pixelformat, DimensionImmutable size, int strideInPixels, boolean isGLOriented, IntBuffer pixels, double dpiX, double dpiY, OutputStream outstream, boolean closeOutstream) throws IOException
- Throws:
IOException
-
-