@Environment(value=CLIENT) public final class NativeImage extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
NativeImage.Format |
static class |
NativeImage.GLFormat |
(package private) static class |
NativeImage.WriteCallback |
Modifier and Type | Field and Description |
---|---|
private NativeImage.Format |
format |
private int |
height |
private boolean |
isStbImage |
private static Logger |
LOGGER |
private long |
pointer |
private long |
sizeBytes |
private int |
width |
private static Set<StandardOpenOption> |
WRITE_TO_FILE_OPEN_OPTIONS |
Modifier | Constructor and Description |
---|---|
|
NativeImage(int width,
int height,
boolean useStb) |
|
NativeImage(NativeImage.Format format,
int width,
int height,
boolean useStb) |
private |
NativeImage(NativeImage.Format format,
int width,
int height,
boolean useStb,
long pointer) |
Modifier and Type | Method and Description |
---|---|
private void |
checkAllocated() |
void |
close() |
void |
copyFrom(NativeImage image) |
void |
copyRect(int x,
int y,
int translateX,
int translateY,
int width,
int height,
boolean flipX,
boolean flipY) |
void |
fillRect(int x,
int y,
int width,
int height,
int color) |
static int |
getAbgrColor(int alpha,
int blue,
int green,
int red)
The resulting color of this operation is stored as least to most significant bits.
|
static int |
getAlpha(int color) |
static int |
getBlue(int color) |
byte[] |
getBytes() |
NativeImage.Format |
getFormat() |
static int |
getGreen(int color) |
int |
getHeight() |
int |
getPixelColor(int x,
int y)
Gets the color of a pixel on this native image.
|
byte |
getPixelOpacity(int x,
int y) |
static int |
getRed(int color) |
int |
getWidth() |
void |
loadFromTextureImage(int level,
boolean removeAlpha) |
void |
makeGlyphBitmapSubpixel(org.lwjgl.stb.STBTTFontinfo fontInfo,
int glyphIndex,
int width,
int height,
float scaleX,
float scaleY,
float shiftX,
float shiftY,
int startX,
int startY) |
int[] |
makePixelArray()
Deprecated.
|
void |
mirrorVertically() |
static NativeImage |
read(ByteBuffer byteBuffer) |
static NativeImage |
read(InputStream inputStream) |
static NativeImage |
read(NativeImage.Format format,
ByteBuffer byteBuffer) |
static NativeImage |
read(NativeImage.Format format,
InputStream inputStream) |
static NativeImage |
read(String dataUri) |
void |
resizeSubRectTo(int x,
int y,
int width,
int height,
NativeImage targetImage) |
void |
setPixelColor(int x,
int y,
int color)
Sets the color of a pixel on this native image.
|
private static void |
setTextureClamp(boolean clamp) |
private static void |
setTextureFilter(boolean blur,
boolean mipmap) |
String |
toString() |
void |
untrack() |
void |
upload(int level,
int offsetX,
int offsetY,
boolean close) |
void |
upload(int level,
int offsetX,
int offsetY,
int unpackSkipPixels,
int unpackSkipRows,
int width,
int height,
boolean mipmap,
boolean close) |
void |
upload(int level,
int offsetX,
int offsetY,
int unpackSkipPixels,
int unpackSkipRows,
int width,
int height,
boolean blur,
boolean clamp,
boolean mipmap,
boolean close) |
private void |
uploadInternal(int level,
int xOffset,
int yOffset,
int unpackSkipPixels,
int unpackSkipRows,
int width,
int height,
boolean blur,
boolean clamp,
boolean mipmap,
boolean close) |
private boolean |
write(WritableByteChannel writableByteChannel) |
void |
writeFile(File file) |
void |
writeFile(Path path) |
private static final Logger LOGGER
private static final Set<StandardOpenOption> WRITE_TO_FILE_OPEN_OPTIONS
private final NativeImage.Format format
private final int width
private final int height
private final boolean isStbImage
private long pointer
private final long sizeBytes
public NativeImage(int width, int height, boolean useStb)
public NativeImage(NativeImage.Format format, int width, int height, boolean useStb)
private NativeImage(NativeImage.Format format, int width, int height, boolean useStb, long pointer)
public static NativeImage read(InputStream inputStream) throws IOException
IOException
public static NativeImage read(@Nullable NativeImage.Format format, InputStream inputStream) throws IOException
IOException
public static NativeImage read(ByteBuffer byteBuffer) throws IOException
IOException
public static NativeImage read(@Nullable NativeImage.Format format, ByteBuffer byteBuffer) throws IOException
IOException
private static void setTextureClamp(boolean clamp)
private static void setTextureFilter(boolean blur, boolean mipmap)
private void checkAllocated()
public void close()
close
in interface AutoCloseable
public int getWidth()
public int getHeight()
public NativeImage.Format getFormat()
public int getPixelColor(int x, int y)
This is only supported when this native image's format is ABGR
.
public void setPixelColor(int x, int y, int color)
This is only supported when this native image's format is ABGR
public byte getPixelOpacity(int x, int y)
@Deprecated public int[] makePixelArray()
public void upload(int level, int offsetX, int offsetY, boolean close)
public void upload(int level, int offsetX, int offsetY, int unpackSkipPixels, int unpackSkipRows, int width, int height, boolean mipmap, boolean close)
public void upload(int level, int offsetX, int offsetY, int unpackSkipPixels, int unpackSkipRows, int width, int height, boolean blur, boolean clamp, boolean mipmap, boolean close)
private void uploadInternal(int level, int xOffset, int yOffset, int unpackSkipPixels, int unpackSkipRows, int width, int height, boolean blur, boolean clamp, boolean mipmap, boolean close)
public void loadFromTextureImage(int level, boolean removeAlpha)
public void writeFile(File file) throws IOException
IOException
public void makeGlyphBitmapSubpixel(org.lwjgl.stb.STBTTFontinfo fontInfo, int glyphIndex, int width, int height, float scaleX, float scaleY, float shiftX, float shiftY, int startX, int startY)
public void writeFile(Path path) throws IOException
IOException
public byte[] getBytes() throws IOException
IOException
private boolean write(WritableByteChannel writableByteChannel) throws IOException
IOException
public void copyFrom(NativeImage image)
public void fillRect(int x, int y, int width, int height, int color)
public void copyRect(int x, int y, int translateX, int translateY, int width, int height, boolean flipX, boolean flipY)
public void mirrorVertically()
public void resizeSubRectTo(int x, int y, int width, int height, NativeImage targetImage)
public void untrack()
public static NativeImage read(String dataUri) throws IOException
IOException
public static int getAlpha(int color)
public static int getRed(int color)
public static int getGreen(int color)
public static int getBlue(int color)
public static int getAbgrColor(int alpha, int blue, int green, int red)