public class Image extends Object implements PlatformImage
Modifier and Type | Method and Description |
---|---|
static Image |
convertImageFrame(ImageFrame frame) |
static Buffer |
createPackedBuffer(Buffer pixels,
PixelFormat format,
int minX,
int minY,
int width,
int height,
int scanlineStride)
Returns a new
Buffer instance that contains a tightly packed
copy of the given Buffer 's pixel data. |
Image |
createPackedCopy()
Returns a new
Image instance with a newly allocated pixel
buffer that contains a tightly packed copy of this image's pixels. |
Image |
createPackedCopyIfNeeded()
Returns a
Image instance with a newly allocated pixel
buffer that contains a tightly packed copy of this image's pixels or
if this image is already tightly packed, itself. |
Image |
createSubImage(int x,
int y,
int w,
int h)
Returns a new
Image instance that shares the underlying pixel
buffer of this Image . |
static Image |
fromByteAlphaData(byte[] pixels,
int width,
int height) |
static Image |
fromByteAlphaData(ByteBuffer pixels,
int width,
int height) |
static Image |
fromByteAlphaData(ByteBuffer pixels,
int width,
int height,
int scanlineStride) |
static Image |
fromByteApple422Data(byte[] pixels,
int width,
int height) |
static Image |
fromByteApple422Data(ByteBuffer pixels,
int width,
int height) |
static Image |
fromByteApple422Data(ByteBuffer pixels,
int width,
int height,
int scanlineStride) |
static Image |
fromByteBgraPreData(byte[] pixels,
int width,
int height) |
static Image |
fromByteBgraPreData(byte[] pixels,
int width,
int height,
float pixelScale) |
static Image |
fromByteBgraPreData(ByteBuffer pixels,
int width,
int height) |
static Image |
fromByteBgraPreData(ByteBuffer pixels,
int width,
int height,
int scanlineStride) |
static Image |
fromByteBgraPreData(ByteBuffer pixels,
int width,
int height,
int scanlineStride,
float pixelScale) |
static Image |
fromByteGrayData(byte[] pixels,
int width,
int height) |
static Image |
fromByteGrayData(ByteBuffer pixels,
int width,
int height) |
static Image |
fromByteGrayData(ByteBuffer pixels,
int width,
int height,
int scanlineStride) |
static Image |
fromByteGrayData(ByteBuffer pixels,
int width,
int height,
int scanlineStride,
float pixelScale) |
static Image |
fromByteRgbData(byte[] pixels,
int width,
int height) |
static Image |
fromByteRgbData(ByteBuffer pixels,
int width,
int height) |
static Image |
fromByteRgbData(ByteBuffer pixels,
int width,
int height,
int scanlineStride) |
static Image |
fromByteRgbData(ByteBuffer pixels,
int width,
int height,
int scanlineStride,
float pixelScale) |
static Image |
fromFloatMapData(FloatBuffer pixels,
int width,
int height) |
static Image |
fromIntArgbPreData(int[] pixels,
int width,
int height) |
static Image |
fromIntArgbPreData(IntBuffer pixels,
int width,
int height) |
static Image |
fromIntArgbPreData(IntBuffer pixels,
int width,
int height,
int scanlineStride) |
static Image |
fromIntArgbPreData(IntBuffer pixels,
int width,
int height,
int scanlineStride,
float pixelScale) |
int |
getArgb(int x,
int y) |
int |
getBytesPerPixelUnit() |
PixelFormat.DataType |
getDataType() |
int |
getHeight() |
int |
getMinX() |
int |
getMinY() |
Buffer |
getPixelBuffer() |
PixelFormat |
getPixelFormat() |
void |
getPixels(int x,
int y,
int w,
int h,
WritablePixelFormat<ByteBuffer> pixelformat,
byte[] pixels,
int offset,
int scanlineBytes) |
void |
getPixels(int x,
int y,
int w,
int h,
WritablePixelFormat<IntBuffer> pixelformat,
int[] pixels,
int offset,
int scanlineInts) |
<T extends Buffer> |
getPixels(int x,
int y,
int w,
int h,
WritablePixelFormat<T> pixelformat,
T pixels,
int scanlineBytes) |
float |
getPixelScale()
Gets the scale representing how large an area a 72DPI virtual
pixel covers in terms of the pixels of this image.
|
PixelFormat<?> |
getPlatformPixelFormat() |
int |
getRowLength() |
int |
getScanlineStride() |
int |
getSerial() |
int |
getWidth() |
Image |
iconify(ByteBuffer iconBuffer,
int twidth,
int theight) |
boolean |
isOpaque() |
boolean |
isTightlyPacked() |
boolean |
isWritable() |
Image |
promoteByteRgbToByteBgra() |
PlatformImage |
promoteToWritableImage() |
void |
setArgb(int x,
int y,
int argb) |
void |
setPixels(int x,
int y,
int w,
int h,
PixelFormat<ByteBuffer> pixelformat,
byte[] pixels,
int offset,
int scanlineBytes) |
void |
setPixels(int x,
int y,
int w,
int h,
PixelFormat<IntBuffer> pixelformat,
int[] pixels,
int offset,
int scanlineInts) |
<T extends Buffer> |
setPixels(int x,
int y,
int w,
int h,
PixelFormat<T> pixelformat,
T pixels,
int scanlineBytes) |
void |
setPixels(int dstx,
int dsty,
int w,
int h,
PixelReader reader,
int srcx,
int srcy) |
String |
toString() |
public static Image fromIntArgbPreData(int[] pixels, int width, int height)
public static Image fromIntArgbPreData(IntBuffer pixels, int width, int height, int scanlineStride)
public static Image fromIntArgbPreData(IntBuffer pixels, int width, int height, int scanlineStride, float pixelScale)
public static Image fromByteBgraPreData(byte[] pixels, int width, int height)
public static Image fromByteBgraPreData(byte[] pixels, int width, int height, float pixelScale)
public static Image fromByteBgraPreData(ByteBuffer pixels, int width, int height)
public static Image fromByteBgraPreData(ByteBuffer pixels, int width, int height, int scanlineStride)
public static Image fromByteBgraPreData(ByteBuffer pixels, int width, int height, int scanlineStride, float pixelScale)
public static Image fromByteRgbData(byte[] pixels, int width, int height)
public static Image fromByteRgbData(ByteBuffer pixels, int width, int height)
public static Image fromByteRgbData(ByteBuffer pixels, int width, int height, int scanlineStride)
public static Image fromByteRgbData(ByteBuffer pixels, int width, int height, int scanlineStride, float pixelScale)
public static Image fromByteGrayData(byte[] pixels, int width, int height)
public static Image fromByteGrayData(ByteBuffer pixels, int width, int height)
public static Image fromByteGrayData(ByteBuffer pixels, int width, int height, int scanlineStride)
public static Image fromByteGrayData(ByteBuffer pixels, int width, int height, int scanlineStride, float pixelScale)
public static Image fromByteAlphaData(byte[] pixels, int width, int height)
public static Image fromByteAlphaData(ByteBuffer pixels, int width, int height)
public static Image fromByteAlphaData(ByteBuffer pixels, int width, int height, int scanlineStride)
public static Image fromByteApple422Data(byte[] pixels, int width, int height)
public static Image fromByteApple422Data(ByteBuffer pixels, int width, int height)
public static Image fromByteApple422Data(ByteBuffer pixels, int width, int height, int scanlineStride)
public static Image fromFloatMapData(FloatBuffer pixels, int width, int height)
public static Image convertImageFrame(ImageFrame frame)
public PixelFormat getPixelFormat()
public PixelFormat.DataType getDataType()
public int getBytesPerPixelUnit()
public Buffer getPixelBuffer()
public int getMinX()
public int getMinY()
public int getWidth()
public int getHeight()
public int getScanlineStride()
public float getPixelScale()
PlatformImage
getPixelScale
in interface PlatformImage
public int getRowLength()
public boolean isTightlyPacked()
public Image createSubImage(int x, int y, int w, int h)
Image
instance that shares the underlying pixel
buffer of this Image
. The new image will have the same
scanline stride, pixel format, etc of the original image, except
with the provided minX/minY and dimensions.x
- the x offset of the upper-left corner of the new subimage,
relative to the minX of this imagey
- the y offset of the upper-left corner of the new subimage,
relative to the minY of this imagew
- the width of the new subimageh
- the height of the new subimageImage
representing a sub-region of this imagepublic Image createPackedCopy()
Image
instance with a newly allocated pixel
buffer that contains a tightly packed copy of this image's pixels.
This method is useful in cases where having extra pixels at the
end of a scanline is not desirable. The new image will have the same
pixel format, width, and height of the original image, except with
a new scanline stride and with minX == minY == 0
.Image
this is a tightly packed copy of this imagepublic Image createPackedCopyIfNeeded()
Image
instance with a newly allocated pixel
buffer that contains a tightly packed copy of this image's pixels or
if this image is already tightly packed, itself.Image
this is a tightly packed copy of this image
or itself if this image is packed already.createPackedCopy()
public static Buffer createPackedBuffer(Buffer pixels, PixelFormat format, int minX, int minY, int width, int height, int scanlineStride)
Buffer
instance that contains a tightly packed
copy of the given Buffer
's pixel data. This method is useful
in cases where having extra pixels at the end of a scanline is not
desirable.pixels
- the buffer containing the pixels to copyformat
- the format of the given bufferminX
- the x offset of the upper-left corner of the pixel regionminY
- the y offset of the upper-left corner of the pixel regionwidth
- the width of the pixel region to be copied, in pixelsheight
- the height of the pixel region to be copied, in pixelsscanlineStride
- the scanline stride of the given buffer, in bytesBuffer
public Image iconify(ByteBuffer iconBuffer, int twidth, int theight)
public int getSerial()
public Image promoteByteRgbToByteBgra()
public PixelFormat<?> getPlatformPixelFormat()
getPlatformPixelFormat
in interface PlatformImage
public boolean isWritable()
isWritable
in interface PlatformImage
public PlatformImage promoteToWritableImage()
promoteToWritableImage
in interface PlatformImage
public int getArgb(int x, int y)
getArgb
in interface PlatformImage
x
- X coordinate of pixely
- Y coordinate of pixelpublic void setArgb(int x, int y, int argb)
setArgb
in interface PlatformImage
x
- X coordinate of pixely
- Y coordinate of pixelpublic <T extends Buffer> void getPixels(int x, int y, int w, int h, WritablePixelFormat<T> pixelformat, T pixels, int scanlineBytes)
getPixels
in interface PlatformImage
public void getPixels(int x, int y, int w, int h, WritablePixelFormat<ByteBuffer> pixelformat, byte[] pixels, int offset, int scanlineBytes)
getPixels
in interface PlatformImage
public void getPixels(int x, int y, int w, int h, WritablePixelFormat<IntBuffer> pixelformat, int[] pixels, int offset, int scanlineInts)
getPixels
in interface PlatformImage
public <T extends Buffer> void setPixels(int x, int y, int w, int h, PixelFormat<T> pixelformat, T pixels, int scanlineBytes)
setPixels
in interface PlatformImage
public void setPixels(int x, int y, int w, int h, PixelFormat<ByteBuffer> pixelformat, byte[] pixels, int offset, int scanlineBytes)
setPixels
in interface PlatformImage
public void setPixels(int x, int y, int w, int h, PixelFormat<IntBuffer> pixelformat, int[] pixels, int offset, int scanlineInts)
setPixels
in interface PlatformImage
public void setPixels(int dstx, int dsty, int w, int h, PixelReader reader, int srcx, int srcy)
setPixels
in interface PlatformImage
public boolean isOpaque()
Copyright © 2020. All rights reserved.