public class STBImage
extends java.lang.Object
Primarily of interest to game developers and other people who can avoid problematic images and only need the trivial interface. Supported formats:
Animated GIF still needs a proper API, but here's one way to do it.
Features:
Limitations:
Basic usage (see HDR discussion below for HDR usage):
int x,y,n;
unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
// ... process data if not NULL ...
// ... x = width, y = height, n = # 8-bit components per pixel ...
// ... replace '0' with '1'..'4' to force that many components per pixel
// ... but 'n' will always be the number that it would have been if you said 0
stbi_image_free(data)
stb_image supports loading HDR images in general, and currently the Radiance .HDR file format specifically. You can still load any file through the existing interface; if you attempt to load an HDR file, it will be automatically remapped to LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; both of these constants can be reconfigured through this interface:
stbi_hdr_to_ldr_gamma(2.2f);
stbi_hdr_to_ldr_scale(1.0f);
(note, do not use inverse constants; stbi_image will invert them appropriately).
Additionally, there is a new, parallel interface for loading files as (linear) floats to preserve the full dynamic range:
float *data = stbi_loadf(filename, &x, &y, &n, 0);
If you load LDR images through this interface, those images will be promoted to floating point values, run through the inverse of constants corresponding to the above:
stbi_ldr_to_hdr_scale(1.0f);
stbi_ldr_to_hdr_gamma(2.2f);
Finally, given a filename (or an open file or memory block) containing image data, you can query for the "most appropriate" interface to use (that is, whether the image is HDR or not), using:
stbi_is_hdr(char *filename);
By default we convert iphone-formatted PNGs back to RGB, even though they are internally encoded differently. You can disable this conversion by
calling convert_iphone_png_to_rgb(0), in which case you will always just get the native iphone "format" through (which is BGR stored in RGB).
Call set_unpremultiply_on_load(1) as well to force a divide per pixel to remove any premultiplied alpha *only* if the image file explicitly says
there's premultiplied data (currently only happens in iPhone images, and only if iPhone convert-to-rgb processing is on).
| Modifier and Type | Field and Description |
|---|---|
static int |
STBI_default
Component count.
|
static int |
STBI_grey
Component count.
|
static int |
STBI_grey_alpha
Component count.
|
static int |
STBI_rgb
Component count.
|
static int |
STBI_rgb_alpha
Component count.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
nstbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)
Unsafe version of:
convert_iphone_png_to_rgb |
static long |
nstbi_failure_reason()
Unsafe version of:
failure_reason |
static void |
nstbi_image_free(long retval_from_stbi_load)
Unsafe version of:
image_free |
static int |
nstbi_info_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] comp)
Array version of:
nstbi_info_from_callbacks(long, long, long, long, long) |
static int |
nstbi_info_from_callbacks(long clbk,
long user,
long x,
long y,
long comp)
Unsafe version of:
info_from_callbacks |
static int |
nstbi_info_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] comp)
Array version of:
nstbi_info_from_memory(long, int, long, long, long) |
static int |
nstbi_info_from_memory(long buffer,
int len,
long x,
long y,
long comp)
Unsafe version of:
info_from_memory |
static int |
nstbi_info(long filename,
int[] x,
int[] y,
int[] comp)
Array version of:
nstbi_info(long, long, long, long) |
static int |
nstbi_info(long filename,
long x,
long y,
long comp)
Unsafe version of:
info |
static int |
nstbi_is_16_bit_from_callbacks(long clbk,
long user)
Unsafe version of:
is_16_bit_from_callbacks |
static int |
nstbi_is_16_bit_from_memory(long buffer,
int len)
Unsafe version of:
is_16_bit_from_memory |
static int |
nstbi_is_16_bit(long filename)
Unsafe version of:
is_16_bit |
static int |
nstbi_is_hdr_from_callbacks(long clbk,
long user)
Unsafe version of:
is_hdr_from_callbacks |
static int |
nstbi_is_hdr_from_memory(long buffer,
int len)
Unsafe version of:
is_hdr_from_memory |
static int |
nstbi_is_hdr(long filename)
Unsafe version of:
is_hdr |
static long |
nstbi_load_16_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load_16_from_callbacks(long, long, long, long, long, int) |
static long |
nstbi_load_16_from_callbacks(long clbk,
long user,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
load_16_from_callbacks |
static long |
nstbi_load_16_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load_16_from_memory(long, int, long, long, long, int) |
static long |
nstbi_load_16_from_memory(long buffer,
int len,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
load_16_from_memory |
static long |
nstbi_load_16(long filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load_16(long, long, long, long, int) |
static long |
nstbi_load_16(long filename,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
load_16 |
static long |
nstbi_load_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load_from_callbacks(long, long, long, long, long, int) |
static long |
nstbi_load_from_callbacks(long clbk,
long user,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
load_from_callbacks |
static long |
nstbi_load_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load_from_memory(long, int, long, long, long, int) |
static long |
nstbi_load_from_memory(long buffer,
int len,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
load_from_memory |
static long |
nstbi_load_gif_from_memory(long buffer,
int len,
long delays,
int[] x,
int[] y,
int[] z,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load_gif_from_memory(long, int, long, long, long, long, long, int) |
static long |
nstbi_load_gif_from_memory(long buffer,
int len,
long delays,
long x,
long y,
long z,
long channels_in_file,
int desired_channels)
Unsafe version of:
load_gif_from_memory |
static long |
nstbi_load(long filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_load(long, long, long, long, int) |
static long |
nstbi_load(long filename,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
load |
static long |
nstbi_loadf_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_loadf_from_callbacks(long, long, long, long, long, int) |
static long |
nstbi_loadf_from_callbacks(long clbk,
long user,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
loadf_from_callbacks |
static long |
nstbi_loadf_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_loadf_from_memory(long, int, long, long, long, int) |
static long |
nstbi_loadf_from_memory(long buffer,
int len,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
loadf_from_memory |
static long |
nstbi_loadf(long filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
nstbi_loadf(long, long, long, long, int) |
static long |
nstbi_loadf(long filename,
long x,
long y,
long channels_in_file,
int desired_channels)
Unsafe version of:
loadf |
static void |
nstbi_set_flip_vertically_on_load(int flag_true_if_should_flip)
Unsafe version of:
set_flip_vertically_on_load |
static void |
nstbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply)
Unsafe version of:
set_unpremultiply_on_load |
static int |
nstbi_zlib_decode_buffer(long obuffer,
int olen,
long ibuffer,
int ilen)
Unsafe version of:
zlib_decode_buffer |
static long |
nstbi_zlib_decode_malloc_guesssize_headerflag(long buffer,
int len,
int initial_size,
long outlen,
int parse_header)
Unsafe version of:
zlib_decode_malloc_guesssize_headerflag |
static long |
nstbi_zlib_decode_malloc_guesssize(long buffer,
int len,
int initial_size,
long outlen)
Unsafe version of:
zlib_decode_malloc_guesssize |
static long |
nstbi_zlib_decode_malloc(long buffer,
int len,
long outlen)
Unsafe version of:
zlib_decode_malloc |
static int |
nstbi_zlib_decode_noheader_buffer(long obuffer,
int olen,
long ibuffer,
int ilen)
Unsafe version of:
zlib_decode_noheader_buffer |
static long |
nstbi_zlib_decode_noheader_malloc(long buffer,
int len,
long outlen)
Unsafe version of:
zlib_decode_noheader_malloc |
static void |
stbi_convert_iphone_png_to_rgb(boolean flag_true_if_should_convert)
Indicate whether we should process iPhone images back to canonical format, or just pass them through "as-is".
|
static java.lang.String |
stbi_failure_reason()
Returns a brief reason for failure.
|
static void |
stbi_hdr_to_ldr_gamma(float gamma)
Changes the gamma value used when converting HDR images to LDR.
|
static void |
stbi_hdr_to_ldr_scale(float scale)
Changes the scale factor used when converting HDR images to LDR.
|
static void |
stbi_image_free(java.nio.ByteBuffer retval_from_stbi_load)
Frees a loaded image
|
static void |
stbi_image_free(java.nio.FloatBuffer retval_from_stbi_load)
Frees a loaded image
|
static void |
stbi_image_free(java.nio.ShortBuffer retval_from_stbi_load)
Frees a loaded image
|
static boolean |
stbi_info_from_callbacks(STBIIOCallbacks clbk,
long user,
int[] x,
int[] y,
int[] comp)
Array version of:
info_from_callbacks |
static boolean |
stbi_info_from_callbacks(STBIIOCallbacks clbk,
long user,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
Callback version of
info. |
static boolean |
stbi_info_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] comp)
Array version of:
info_from_memory |
static boolean |
stbi_info_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
In-memory version of
info. |
static boolean |
stbi_info(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] comp)
Array version of:
info |
static boolean |
stbi_info(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
Returns image dimensions & components without fully decoding the image.
|
static boolean |
stbi_info(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] comp)
Array version of:
info |
static boolean |
stbi_info(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
Returns image dimensions & components without fully decoding the image.
|
static boolean |
stbi_is_16_bit_from_callbacks(STBIIOCallbacks clbk,
long user)
Callback version of
is_16_bit. |
static boolean |
stbi_is_16_bit_from_memory(java.nio.ByteBuffer buffer)
In-memory version of
is_16_bit. |
static boolean |
stbi_is_16_bit(java.nio.ByteBuffer filename)
Returns
true if the file contains a 16-bit image. |
static boolean |
stbi_is_16_bit(java.lang.CharSequence filename)
Returns
true if the file contains a 16-bit image. |
static boolean |
stbi_is_hdr_from_callbacks(STBIIOCallbacks clbk,
long user)
Callback version of
is_hdr. |
static boolean |
stbi_is_hdr_from_memory(java.nio.ByteBuffer buffer)
In-memory version of
is_hdr. |
static boolean |
stbi_is_hdr(java.nio.ByteBuffer filename)
Checks if the specified file contains an HDR image.
|
static boolean |
stbi_is_hdr(java.lang.CharSequence filename)
Checks if the specified file contains an HDR image.
|
static void |
stbi_ldr_to_hdr_gamma(float gamma)
Changes the gamma value used when converting LDR images to HDR.
|
static void |
stbi_ldr_to_hdr_scale(float scale)
Changes the scale value used when converting LDR images to HDR.
|
static java.nio.ShortBuffer |
stbi_load_16_from_callbacks(STBIIOCallbacks clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load_16_from_callbacks |
static java.nio.ShortBuffer |
stbi_load_16_from_callbacks(STBIIOCallbacks clbk,
long user,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Callback version of
load_16. |
static java.nio.ShortBuffer |
stbi_load_16_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load_16_from_memory |
static java.nio.ShortBuffer |
stbi_load_16_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
In-memory version of
load_16. |
static java.nio.ShortBuffer |
stbi_load_16(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load_16 |
static java.nio.ShortBuffer |
stbi_load_16(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
16-bits-per-channel version of
load. |
static java.nio.ShortBuffer |
stbi_load_16(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load_16 |
static java.nio.ShortBuffer |
stbi_load_16(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
16-bits-per-channel version of
load. |
static java.nio.ByteBuffer |
stbi_load_from_callbacks(STBIIOCallbacks clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load_from_callbacks |
static java.nio.ByteBuffer |
stbi_load_from_callbacks(STBIIOCallbacks clbk,
long user,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Callback version of
load. |
static java.nio.ByteBuffer |
stbi_load_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load_from_memory |
static java.nio.ByteBuffer |
stbi_load_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
In-memory version of
load. |
static java.nio.ByteBuffer |
stbi_load_gif_from_memory(java.nio.ByteBuffer buffer,
org.lwjgl.PointerBuffer delays,
int[] x,
int[] y,
int[] z,
int[] channels_in_file,
int desired_channels)
Array version of:
load_gif_from_memory |
static java.nio.ByteBuffer |
stbi_load_gif_from_memory(java.nio.ByteBuffer buffer,
org.lwjgl.PointerBuffer delays,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer z,
java.nio.IntBuffer channels_in_file,
int desired_channels)
gif version of
load_from_memory. |
static java.nio.ByteBuffer |
stbi_load(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load |
static java.nio.ByteBuffer |
stbi_load(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Loads an image from the specified file.
|
static java.nio.ByteBuffer |
stbi_load(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
load |
static java.nio.ByteBuffer |
stbi_load(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Loads an image from the specified file.
|
static java.nio.FloatBuffer |
stbi_loadf_from_callbacks(STBIIOCallbacks clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
loadf_from_callbacks |
static java.nio.FloatBuffer |
stbi_loadf_from_callbacks(STBIIOCallbacks clbk,
long user,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Floating-point version of
load_from_callbacks. |
static java.nio.FloatBuffer |
stbi_loadf_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
loadf_from_memory |
static java.nio.FloatBuffer |
stbi_loadf_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Floating-point version of
load_from_memory. |
static java.nio.FloatBuffer |
stbi_loadf(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
loadf |
static java.nio.FloatBuffer |
stbi_loadf(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Floating-point version of
load. |
static java.nio.FloatBuffer |
stbi_loadf(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
Array version of:
loadf |
static java.nio.FloatBuffer |
stbi_loadf(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
Floating-point version of
load. |
static void |
stbi_set_flip_vertically_on_load(boolean flag_true_if_should_flip)
Flips the image vertically, so the first pixel in the output array is the bottom left.
|
static void |
stbi_set_unpremultiply_on_load(boolean flag_true_if_should_unpremultiply)
For image formats that explicitly notate that they have premultiplied alpha, we just return the colors as stored in the file.
|
static int |
stbi_zlib_decode_buffer(java.nio.ByteBuffer obuffer,
java.nio.ByteBuffer ibuffer)
ZLIB client - used by PNG, available for other purposes
|
static java.nio.ByteBuffer |
stbi_zlib_decode_malloc_guesssize_headerflag(java.nio.ByteBuffer buffer,
int initial_size,
boolean parse_header)
ZLIB client - used by PNG, available for other purposes
|
static java.nio.ByteBuffer |
stbi_zlib_decode_malloc_guesssize(java.nio.ByteBuffer buffer,
int initial_size)
ZLIB client - used by PNG, available for other purposes
|
static java.nio.ByteBuffer |
stbi_zlib_decode_malloc(java.nio.ByteBuffer buffer)
ZLIB client - used by PNG, available for other purposes
|
static int |
stbi_zlib_decode_noheader_buffer(java.nio.ByteBuffer obuffer,
java.nio.ByteBuffer ibuffer)
ZLIB client - used by PNG, available for other purposes
|
static java.nio.ByteBuffer |
stbi_zlib_decode_noheader_malloc(java.nio.ByteBuffer buffer)
ZLIB client - used by PNG, available for other purposes
|
public static final int STBI_default
default - Default component count, used as an argument to desired_channels.greygrey_alphargbrgb_alphapublic static final int STBI_grey
default - Default component count, used as an argument to desired_channels.greygrey_alphargbrgb_alphapublic static final int STBI_grey_alpha
default - Default component count, used as an argument to desired_channels.greygrey_alphargbrgb_alphapublic static final int STBI_rgb
default - Default component count, used as an argument to desired_channels.greygrey_alphargbrgb_alphapublic static final int STBI_rgb_alpha
default - Default component count, used as an argument to desired_channels.greygrey_alphargbrgb_alphapublic static long nstbi_load(long filename,
long x,
long y,
long channels_in_file,
int desired_channels)
load@Nullable
public static java.nio.ByteBuffer stbi_load(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
The return value from an image loader is an 'unsigned char *' which points to the pixel data, or NULL on an allocation failure or if the image
is corrupt or invalid. The pixel data consists of *y scanlines of *x pixels, with each pixel consisting of N interleaved 8-bit
components; the first pixel pointed to is top-left-most in the image. There is no padding between image scanlines or between pixels, regardless of
format. The number of components N is 'desired_channels' if desired_channels is non-zero, or *channels_in_file otherwise. If
desired_channels is non-zero, *channels_in_file has the number of components that would have been output otherwise. E.g. if you
set desired_channels to 4, you will always get RGBA output, but you can check *channels_in_file to see if it's trivially opaque because
e.g. there were only 3 channels in the source image.
An output image with N components has the following components interleaved in this order in each pixel:
N=#channels_in_file components
1 grey
2 grey, alpha
3 red, green, blue
4 red, green, blue, alpha
If image loading fails for any reason, the return value will be NULL, and *x, *y, *channels_in_file will be unchanged. The
function failure_reason can be queried for an extremely brief, end-user unfriendly explanation of why the load failed.
Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.
filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
@Nullable
public static java.nio.ByteBuffer stbi_load(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
The return value from an image loader is an 'unsigned char *' which points to the pixel data, or NULL on an allocation failure or if the image
is corrupt or invalid. The pixel data consists of *y scanlines of *x pixels, with each pixel consisting of N interleaved 8-bit
components; the first pixel pointed to is top-left-most in the image. There is no padding between image scanlines or between pixels, regardless of
format. The number of components N is 'desired_channels' if desired_channels is non-zero, or *channels_in_file otherwise. If
desired_channels is non-zero, *channels_in_file has the number of components that would have been output otherwise. E.g. if you
set desired_channels to 4, you will always get RGBA output, but you can check *channels_in_file to see if it's trivially opaque because
e.g. there were only 3 channels in the source image.
An output image with N components has the following components interleaved in this order in each pixel:
N=#channels_in_file components
1 grey
2 grey, alpha
3 red, green, blue
4 red, green, blue, alpha
If image loading fails for any reason, the return value will be NULL, and *x, *y, *channels_in_file will be unchanged. The
function failure_reason can be queried for an extremely brief, end-user unfriendly explanation of why the load failed.
Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.
filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_load_from_memory(long buffer,
int len,
long x,
long y,
long channels_in_file,
int desired_channels)
load_from_memorylen - the buffer length, in bytes@Nullable
public static java.nio.ByteBuffer stbi_load_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load.buffer - the buffer from which to load the image datax - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_load_from_callbacks(long clbk,
long user,
long x,
long y,
long channels_in_file,
int desired_channels)
load_from_callbacks@Nullable public static java.nio.ByteBuffer stbi_load_from_callbacks(STBIIOCallbacks clbk, long user, java.nio.IntBuffer x, java.nio.IntBuffer y, java.nio.IntBuffer channels_in_file, int desired_channels)
load.
I/O callbacks allow you to read from arbitrary sources, like packaged files or some other source. Data read from callbacks are processed through a small internal buffer (currently 128 bytes) to try to reduce overhead.
The three functions you must define are "read" (reads some bytes of data), "skip" (skips some bytes of data), "eof" (reports if the stream is at the end).
clbk - an STBIIOCallbacks structuser - a pointer to user datax - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_load_gif_from_memory(long buffer,
int len,
long delays,
long x,
long y,
long z,
long channels_in_file,
int desired_channels)
load_gif_from_memorylen - the buffer length, in bytes@Nullable
public static java.nio.ByteBuffer stbi_load_gif_from_memory(java.nio.ByteBuffer buffer,
org.lwjgl.PointerBuffer delays,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer z,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load_from_memory.buffer - the buffer from which to load the image datadelays - output the delays of each layer in the imagex - outputs the image width in pixelsy - outputs the image height in pixelsz - outputs the number of layers in the imagechannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_load_16(long filename,
long x,
long y,
long channels_in_file,
int desired_channels)
load_16@Nullable
public static java.nio.ShortBuffer stbi_load_16(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load.filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
@Nullable
public static java.nio.ShortBuffer stbi_load_16(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load.filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_load_16_from_memory(long buffer,
int len,
long x,
long y,
long channels_in_file,
int desired_channels)
load_16_from_memorylen - the buffer length, in bytes@Nullable
public static java.nio.ShortBuffer stbi_load_16_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load_16.buffer - the buffer from which to load the image datax - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_load_16_from_callbacks(long clbk,
long user,
long x,
long y,
long channels_in_file,
int desired_channels)
load_16_from_callbacks@Nullable public static java.nio.ShortBuffer stbi_load_16_from_callbacks(STBIIOCallbacks clbk, long user, java.nio.IntBuffer x, java.nio.IntBuffer y, java.nio.IntBuffer channels_in_file, int desired_channels)
load_16.clbk - an STBIIOCallbacks structuser - a pointer to user datax - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_loadf(long filename,
long x,
long y,
long channels_in_file,
int desired_channels)
loadf@Nullable
public static java.nio.FloatBuffer stbi_loadf(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load.filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
@Nullable
public static java.nio.FloatBuffer stbi_loadf(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load.filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_loadf_from_memory(long buffer,
int len,
long x,
long y,
long channels_in_file,
int desired_channels)
loadf_from_memorylen - the buffer length, in bytes@Nullable
public static java.nio.FloatBuffer stbi_loadf_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer channels_in_file,
int desired_channels)
load_from_memory.buffer - the buffer from which to load the image datax - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static long nstbi_loadf_from_callbacks(long clbk,
long user,
long x,
long y,
long channels_in_file,
int desired_channels)
loadf_from_callbacks@Nullable public static java.nio.FloatBuffer stbi_loadf_from_callbacks(STBIIOCallbacks clbk, long user, java.nio.IntBuffer x, java.nio.IntBuffer y, java.nio.IntBuffer channels_in_file, int desired_channels)
load_from_callbacks.clbk - an STBIIOCallbacks structuser - a pointer to user datax - outputs the image width in pixelsy - outputs the image height in pixelschannels_in_file - outputs number of components in imagedesired_channels - 0 or 1..4 to force that many components per pixel. One of:| 0 | 1 | 2 | 3 | 4 |
public static void stbi_hdr_to_ldr_gamma(float gamma)
gamma - the gamma valuepublic static void stbi_hdr_to_ldr_scale(float scale)
scale - the scale factorpublic static void stbi_ldr_to_hdr_gamma(float gamma)
gamma - the gamma valuepublic static void stbi_ldr_to_hdr_scale(float scale)
scale - the scale factorpublic static int nstbi_is_hdr(long filename)
is_hdrpublic static boolean stbi_is_hdr(java.nio.ByteBuffer filename)
filename - the file namepublic static boolean stbi_is_hdr(java.lang.CharSequence filename)
filename - the file namepublic static int nstbi_is_hdr_from_memory(long buffer,
int len)
is_hdr_from_memorylen - the buffer length, in bytespublic static boolean stbi_is_hdr_from_memory(java.nio.ByteBuffer buffer)
is_hdr.buffer - the buffer from which to load the image datapublic static int nstbi_is_hdr_from_callbacks(long clbk,
long user)
is_hdr_from_callbackspublic static boolean stbi_is_hdr_from_callbacks(STBIIOCallbacks clbk, long user)
is_hdr.clbk - an STBIIOCallbacks structuser - a pointer to user datapublic static long nstbi_failure_reason()
failure_reason@Nullable public static java.lang.String stbi_failure_reason()
public static void nstbi_image_free(long retval_from_stbi_load)
image_freepublic static void stbi_image_free(java.nio.ByteBuffer retval_from_stbi_load)
retval_from_stbi_load - an stb imagepublic static void stbi_image_free(java.nio.ShortBuffer retval_from_stbi_load)
retval_from_stbi_load - an stb imagepublic static void stbi_image_free(java.nio.FloatBuffer retval_from_stbi_load)
retval_from_stbi_load - an stb imagepublic static int nstbi_info(long filename,
long x,
long y,
long comp)
infopublic static boolean stbi_info(java.nio.ByteBuffer filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelscomp - outputs number of components in imagepublic static boolean stbi_info(java.lang.CharSequence filename,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
filename - the file namex - outputs the image width in pixelsy - outputs the image height in pixelscomp - outputs number of components in imagepublic static int nstbi_info_from_memory(long buffer,
int len,
long x,
long y,
long comp)
info_from_memorylen - the buffer length, in bytespublic static boolean stbi_info_from_memory(java.nio.ByteBuffer buffer,
java.nio.IntBuffer x,
java.nio.IntBuffer y,
java.nio.IntBuffer comp)
info.buffer - the buffer from which to load the image datax - outputs the image width in pixelsy - outputs the image height in pixelscomp - outputs number of components in imagepublic static int nstbi_info_from_callbacks(long clbk,
long user,
long x,
long y,
long comp)
info_from_callbackspublic static boolean stbi_info_from_callbacks(STBIIOCallbacks clbk, long user, java.nio.IntBuffer x, java.nio.IntBuffer y, java.nio.IntBuffer comp)
info.clbk - an STBIIOCallbacks structuser - a pointer to user datax - outputs the image width in pixelsy - outputs the image height in pixelscomp - outputs number of components in imagepublic static int nstbi_is_16_bit(long filename)
is_16_bitpublic static boolean stbi_is_16_bit(java.nio.ByteBuffer filename)
true if the file contains a 16-bit image.filename - the file namepublic static boolean stbi_is_16_bit(java.lang.CharSequence filename)
true if the file contains a 16-bit image.filename - the file namepublic static int nstbi_is_16_bit_from_memory(long buffer,
int len)
is_16_bit_from_memorylen - the buffer length, in bytespublic static boolean stbi_is_16_bit_from_memory(java.nio.ByteBuffer buffer)
is_16_bit.buffer - the buffer from which to load the image datapublic static int nstbi_is_16_bit_from_callbacks(long clbk,
long user)
is_16_bit_from_callbackspublic static boolean stbi_is_16_bit_from_callbacks(STBIIOCallbacks clbk, long user)
is_16_bit.clbk - an STBIIOCallbacks structuser - a pointer to user datapublic static void nstbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply)
set_unpremultiply_on_loadpublic static void stbi_set_unpremultiply_on_load(boolean flag_true_if_should_unpremultiply)
flag_true_if_should_unpremultiply - the unpremultiply flagpublic static void nstbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)
convert_iphone_png_to_rgbpublic static void stbi_convert_iphone_png_to_rgb(boolean flag_true_if_should_convert)
flag_true_if_should_convert - the convert iPhone PNG to RGB flagpublic static void nstbi_set_flip_vertically_on_load(int flag_true_if_should_flip)
set_flip_vertically_on_loadpublic static void stbi_set_flip_vertically_on_load(boolean flag_true_if_should_flip)
flag_true_if_should_flip - the flip vertically on load flagpublic static long nstbi_zlib_decode_malloc_guesssize(long buffer,
int len,
int initial_size,
long outlen)
zlib_decode_malloc_guesssize@Nullable
public static java.nio.ByteBuffer stbi_zlib_decode_malloc_guesssize(java.nio.ByteBuffer buffer,
int initial_size)
public static long nstbi_zlib_decode_malloc_guesssize_headerflag(long buffer,
int len,
int initial_size,
long outlen,
int parse_header)
zlib_decode_malloc_guesssize_headerflag@Nullable
public static java.nio.ByteBuffer stbi_zlib_decode_malloc_guesssize_headerflag(java.nio.ByteBuffer buffer,
int initial_size,
boolean parse_header)
public static long nstbi_zlib_decode_malloc(long buffer,
int len,
long outlen)
zlib_decode_malloc@Nullable public static java.nio.ByteBuffer stbi_zlib_decode_malloc(java.nio.ByteBuffer buffer)
public static int nstbi_zlib_decode_buffer(long obuffer,
int olen,
long ibuffer,
int ilen)
zlib_decode_bufferpublic static int stbi_zlib_decode_buffer(java.nio.ByteBuffer obuffer,
java.nio.ByteBuffer ibuffer)
public static long nstbi_zlib_decode_noheader_malloc(long buffer,
int len,
long outlen)
zlib_decode_noheader_malloc@Nullable public static java.nio.ByteBuffer stbi_zlib_decode_noheader_malloc(java.nio.ByteBuffer buffer)
public static int nstbi_zlib_decode_noheader_buffer(long obuffer,
int olen,
long ibuffer,
int ilen)
zlib_decode_noheader_bufferpublic static int stbi_zlib_decode_noheader_buffer(java.nio.ByteBuffer obuffer,
java.nio.ByteBuffer ibuffer)
public static long nstbi_load(long filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_load(long, long, long, long, int)@Nullable
public static java.nio.ByteBuffer stbi_load(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
load@Nullable
public static java.nio.ByteBuffer stbi_load(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
loadpublic static long nstbi_load_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_load_from_memory(long, int, long, long, long, int)@Nullable
public static java.nio.ByteBuffer stbi_load_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
load_from_memorypublic static long nstbi_load_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_load_from_callbacks(long, long, long, long, long, int)@Nullable public static java.nio.ByteBuffer stbi_load_from_callbacks(STBIIOCallbacks clbk, long user, int[] x, int[] y, int[] channels_in_file, int desired_channels)
load_from_callbackspublic static long nstbi_load_gif_from_memory(long buffer,
int len,
long delays,
int[] x,
int[] y,
int[] z,
int[] channels_in_file,
int desired_channels)
nstbi_load_gif_from_memory(long, int, long, long, long, long, long, int)@Nullable
public static java.nio.ByteBuffer stbi_load_gif_from_memory(java.nio.ByteBuffer buffer,
org.lwjgl.PointerBuffer delays,
int[] x,
int[] y,
int[] z,
int[] channels_in_file,
int desired_channels)
load_gif_from_memorypublic static long nstbi_load_16(long filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_load_16(long, long, long, long, int)@Nullable
public static java.nio.ShortBuffer stbi_load_16(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
load_16@Nullable
public static java.nio.ShortBuffer stbi_load_16(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
load_16public static long nstbi_load_16_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_load_16_from_memory(long, int, long, long, long, int)@Nullable
public static java.nio.ShortBuffer stbi_load_16_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
load_16_from_memorypublic static long nstbi_load_16_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_load_16_from_callbacks(long, long, long, long, long, int)@Nullable public static java.nio.ShortBuffer stbi_load_16_from_callbacks(STBIIOCallbacks clbk, long user, int[] x, int[] y, int[] channels_in_file, int desired_channels)
load_16_from_callbackspublic static long nstbi_loadf(long filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_loadf(long, long, long, long, int)@Nullable
public static java.nio.FloatBuffer stbi_loadf(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
loadf@Nullable
public static java.nio.FloatBuffer stbi_loadf(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
loadfpublic static long nstbi_loadf_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_loadf_from_memory(long, int, long, long, long, int)@Nullable
public static java.nio.FloatBuffer stbi_loadf_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
loadf_from_memorypublic static long nstbi_loadf_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] channels_in_file,
int desired_channels)
nstbi_loadf_from_callbacks(long, long, long, long, long, int)@Nullable public static java.nio.FloatBuffer stbi_loadf_from_callbacks(STBIIOCallbacks clbk, long user, int[] x, int[] y, int[] channels_in_file, int desired_channels)
loadf_from_callbackspublic static int nstbi_info(long filename,
int[] x,
int[] y,
int[] comp)
nstbi_info(long, long, long, long)public static boolean stbi_info(java.nio.ByteBuffer filename,
int[] x,
int[] y,
int[] comp)
infopublic static boolean stbi_info(java.lang.CharSequence filename,
int[] x,
int[] y,
int[] comp)
infopublic static int nstbi_info_from_memory(long buffer,
int len,
int[] x,
int[] y,
int[] comp)
nstbi_info_from_memory(long, int, long, long, long)public static boolean stbi_info_from_memory(java.nio.ByteBuffer buffer,
int[] x,
int[] y,
int[] comp)
info_from_memorypublic static int nstbi_info_from_callbacks(long clbk,
long user,
int[] x,
int[] y,
int[] comp)
nstbi_info_from_callbacks(long, long, long, long, long)public static boolean stbi_info_from_callbacks(STBIIOCallbacks clbk, long user, int[] x, int[] y, int[] comp)
info_from_callbacksCopyright LWJGL. All Rights Reserved. License terms.