All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.stb.STBImage Maven / Gradle / Ivy

/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.stb;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * Native bindings to stb_image.h from the stb library.
 * 
 * 

Quick notes

* *

Primarily of interest to game developers and other people who can avoid problematic images and only need the trivial interface. Supported formats:

* *
    *
  • JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib
  • *
  • PNG 1/2/4/8/16-bit-per-channel
  • *
  • TGA (not sure what subset, if a subset)
  • *
  • BMP non-1bpp, non-RLE
  • *
  • PSD (composited view only, no extra channels, 8/16 bit-per-channel)
  • *
  • GIF (*desired_channels always reports as 4-channel)
  • *
  • HDR (radiance rgbE format)
  • *
  • PIC (Softimage PIC)
  • *
  • PNM (PPM and PGM binary only)
  • *
* *

Animated GIF still needs a proper API, but here's one way to do it.

* *

Features:

* *
    *
  • decode from memory or through FILE (define STBI_NO_STDIO to remove code)
  • *
  • decode from arbitrary I/O callbacks
  • *
  • SIMD acceleration on x86/x64 (SSE2) and ARM (NEON)
  • *
* *

Limitations:

* *
    *
  • no 12-bit-per-channel JPEG
  • *
  • no JPEGs with arithmetic coding
  • *
  • GIF always returns *channels_in_file=4
  • *
* *

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)
* *

HDR image support

* *

stb_image now supports loading HDR images in general, and currently the Radiance .HDR file format, although the support is provided generically. 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);
* *

iPhone PNG support

* *

By default we convert iphone-formatted PNGs back to RGB, even though they are internally encoded differently. You can disable this conversion by * calling {@link #stbi_convert_iphone_png_to_rgb 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 {@link #stbi_set_unpremultiply_on_load 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).

*/ public class STBImage { /** * Component count. * *
Enum values:
* *
    *
  • {@link #STBI_default default} - Default component count, used as an argument to {@code desired_channels}.
  • *
  • {@link #STBI_grey grey}
  • *
  • {@link #STBI_grey_alpha grey_alpha}
  • *
  • {@link #STBI_rgb rgb}
  • *
  • {@link #STBI_rgb_alpha rgb_alpha}
  • *
*/ public static final int STBI_default = 0, STBI_grey = 1, STBI_grey_alpha = 2, STBI_rgb = 3, STBI_rgb_alpha = 4; static { LibSTB.initialize(); } protected STBImage() { throw new UnsupportedOperationException(); } // --- [ stbi_load ] --- /** Unsafe version of: {@link #stbi_load load} */ public static native long nstbi_load(long filename, long x, long y, long channels_in_file, int desired_channels); /** * Loads an image from the specified file. * *

The return value from an image loader is an {@code 'unsigned char *'} which points to the pixel data, or {@code NULL} on an allocation failure or if the image * is corrupt or invalid. The pixel data consists of {@code *y} scanlines of {@code *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 {@code 'desired_channels'} if {@code desired_channels} is non-zero, or {@code *channels_in_file} otherwise. If * {@code desired_channels} is non-zero, {@code *channels_in_file} has the number of components that would have been output otherwise. E.g. if you * set {@code desired_channels} to 4, you will always get RGBA output, but you can check {@code *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 {@code NULL}, and {@code *x}, {@code *y}, {@code *channels_in_file} will be unchanged. The * function {@link #stbi_failure_reason 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.

* * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load(memAddress(filename), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memByteBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } /** * Loads an image from the specified file. * *

The return value from an image loader is an {@code 'unsigned char *'} which points to the pixel data, or {@code NULL} on an allocation failure or if the image * is corrupt or invalid. The pixel data consists of {@code *y} scanlines of {@code *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 {@code 'desired_channels'} if {@code desired_channels} is non-zero, or {@code *channels_in_file} otherwise. If * {@code desired_channels} is non-zero, {@code *channels_in_file} has the number of components that would have been output otherwise. E.g. if you * set {@code desired_channels} to 4, you will always get RGBA output, but you can check {@code *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 {@code NULL}, and {@code *x}, {@code *y}, {@code *channels_in_file} will be unchanged. The * function {@link #stbi_failure_reason 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.

* * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load(@NativeType("const char *") CharSequence filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); long __result = nstbi_load(memAddress(filenameEncoded), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memByteBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_load_from_memory ] --- /** * Unsafe version of: {@link #stbi_load_from_memory load_from_memory} * * @param len the buffer length, in bytes */ public static native long nstbi_load_from_memory(long buffer, int len, long x, long y, long channels_in_file, int desired_channels); /** * In-memory version of {@link #stbi_load load}. * * @param buffer the buffer from which to load the image data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load_from_memory(memAddress(buffer), buffer.remaining(), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memByteBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_load_from_callbacks ] --- /** Unsafe version of: {@link #stbi_load_from_callbacks load_from_callbacks} */ public static native long nstbi_load_from_callbacks(long clbk, long user, long x, long y, long channels_in_file, int desired_channels); /** * Callback version of {@link #stbi_load 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).

* * @param clbk an {@link STBIIOCallbacks} struct * @param user a pointer to user data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); STBIIOCallbacks.validate(clbk.address()); } long __result = nstbi_load_from_callbacks(clbk.address(), user, memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memByteBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_load_gif_from_memory ] --- /** * Unsafe version of: {@link #stbi_load_gif_from_memory load_gif_from_memory} * * @param len the buffer length, in bytes */ public static native 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); /** * gif version of {@link #stbi_load_from_memory load_from_memory}. * * @param buffer the buffer from which to load the image data * @param delays output the delays of each layer in the image * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param z outputs the number of layers in the image * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load_gif_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int **") PointerBuffer delays, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer z, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(delays, 1); check(x, 1); check(y, 1); check(z, 1); check(channels_in_file, 1); } long __result = nstbi_load_gif_from_memory(memAddress(buffer), buffer.remaining(), memAddress(delays), memAddress(x), memAddress(y), memAddress(z), memAddress(channels_in_file), desired_channels); return memByteBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * z.get(z.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_load_16 ] --- /** Unsafe version of: {@link #stbi_load_16 load_16} */ public static native long nstbi_load_16(long filename, long x, long y, long channels_in_file, int desired_channels); /** * 16-bits-per-channel version of {@link #stbi_load load}. * * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load_16(memAddress(filename), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memShortBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } /** * 16-bits-per-channel version of {@link #stbi_load load}. * * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16(@NativeType("const char *") CharSequence filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); long __result = nstbi_load_16(memAddress(filenameEncoded), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memShortBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_load_16_from_memory ] --- /** * Unsafe version of: {@link #stbi_load_16_from_memory load_16_from_memory} * * @param len the buffer length, in bytes */ public static native long nstbi_load_16_from_memory(long buffer, int len, long x, long y, long channels_in_file, int desired_channels); /** * In-memory version of {@link #stbi_load_16 load_16}. * * @param buffer the buffer from which to load the image data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load_16_from_memory(memAddress(buffer), buffer.remaining(), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memShortBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_load_16_from_callbacks ] --- /** Unsafe version of: {@link #stbi_load_16_from_callbacks load_16_from_callbacks} */ public static native long nstbi_load_16_from_callbacks(long clbk, long user, long x, long y, long channels_in_file, int desired_channels); /** * Callback version of {@link #stbi_load_16 load_16}. * * @param clbk an {@link STBIIOCallbacks} struct * @param user a pointer to user data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); STBIIOCallbacks.validate(clbk.address()); } long __result = nstbi_load_16_from_callbacks(clbk.address(), user, memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memShortBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_loadf ] --- /** Unsafe version of: {@link #stbi_loadf loadf} */ public static native long nstbi_loadf(long filename, long x, long y, long channels_in_file, int desired_channels); /** * Floating-point version of {@link #stbi_load load}. * * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_loadf(memAddress(filename), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memFloatBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } /** * Floating-point version of {@link #stbi_load load}. * * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf(@NativeType("const char *") CharSequence filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); long __result = nstbi_loadf(memAddress(filenameEncoded), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memFloatBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_loadf_from_memory ] --- /** * Unsafe version of: {@link #stbi_loadf_from_memory loadf_from_memory} * * @param len the buffer length, in bytes */ public static native long nstbi_loadf_from_memory(long buffer, int len, long x, long y, long channels_in_file, int desired_channels); /** * Floating-point version of {@link #stbi_load_from_memory load_from_memory}. * * @param buffer the buffer from which to load the image data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_loadf_from_memory(memAddress(buffer), buffer.remaining(), memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memFloatBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_loadf_from_callbacks ] --- /** Unsafe version of: {@link #stbi_loadf_from_callbacks loadf_from_callbacks} */ public static native long nstbi_loadf_from_callbacks(long clbk, long user, long x, long y, long channels_in_file, int desired_channels); /** * Floating-point version of {@link #stbi_load_from_callbacks load_from_callbacks}. * * @param clbk an {@link STBIIOCallbacks} struct * @param user a pointer to user data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param channels_in_file outputs number of components in image * @param desired_channels 0 or 1..4 to force that many components per pixel. One of:
01234
*/ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); STBIIOCallbacks.validate(clbk.address()); } long __result = nstbi_loadf_from_callbacks(clbk.address(), user, memAddress(x), memAddress(y), memAddress(channels_in_file), desired_channels); return memFloatBufferSafe(__result, x.get(x.position()) * y.get(y.position()) * (desired_channels != 0 ? desired_channels : channels_in_file.get(channels_in_file.position()))); } // --- [ stbi_hdr_to_ldr_gamma ] --- /** * Changes the gamma value used when converting HDR images to LDR. The default value is 2.2f * * @param gamma the gamma value */ public static native void stbi_hdr_to_ldr_gamma(float gamma); // --- [ stbi_hdr_to_ldr_scale ] --- /** * Changes the scale factor used when converting HDR images to LDR. The default value is 1.0f * * @param scale the scale factor */ public static native void stbi_hdr_to_ldr_scale(float scale); // --- [ stbi_ldr_to_hdr_gamma ] --- /** * Changes the gamma value used when converting LDR images to HDR. The default value is 2.2f * * @param gamma the gamma value */ public static native void stbi_ldr_to_hdr_gamma(float gamma); // --- [ stbi_ldr_to_hdr_scale ] --- /** * Changes the scale value used when converting LDR images to HDR. The default value is 1.0f * * @param scale the scale factor */ public static native void stbi_ldr_to_hdr_scale(float scale); // --- [ stbi_is_hdr ] --- /** Unsafe version of: {@link #stbi_is_hdr is_hdr} */ public static native int nstbi_is_hdr(long filename); /** * Checks if the specified file contains an HDR image. * * @param filename the file name * * @return 1 if the image is HDR, 0 otherwise */ @NativeType("int") public static boolean stbi_is_hdr(@NativeType("const char *") ByteBuffer filename) { if (CHECKS) { checkNT1(filename); } return nstbi_is_hdr(memAddress(filename)) != 0; } /** * Checks if the specified file contains an HDR image. * * @param filename the file name * * @return 1 if the image is HDR, 0 otherwise */ @NativeType("int") public static boolean stbi_is_hdr(@NativeType("const char *") CharSequence filename) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); return nstbi_is_hdr(memAddress(filenameEncoded)) != 0; } finally { stack.setPointer(stackPointer); } } // --- [ stbi_is_hdr_from_memory ] --- /** * Unsafe version of: {@link #stbi_is_hdr_from_memory is_hdr_from_memory} * * @param len the buffer length, in bytes */ public static native int nstbi_is_hdr_from_memory(long buffer, int len); /** * In-memory version of {@link #stbi_is_hdr is_hdr}. * * @param buffer the buffer from which to load the image data */ @NativeType("int") public static boolean stbi_is_hdr_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer) { return nstbi_is_hdr_from_memory(memAddress(buffer), buffer.remaining()) != 0; } // --- [ stbi_is_hdr_from_callbacks ] --- /** Unsafe version of: {@link #stbi_is_hdr_from_callbacks is_hdr_from_callbacks} */ public static native int nstbi_is_hdr_from_callbacks(long clbk, long user); /** * Callback version of {@link #stbi_is_hdr is_hdr}. * * @param clbk an {@link STBIIOCallbacks} struct * @param user a pointer to user data */ @NativeType("int") public static boolean stbi_is_hdr_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user) { if (CHECKS) { STBIIOCallbacks.validate(clbk.address()); } return nstbi_is_hdr_from_callbacks(clbk.address(), user) != 0; } // --- [ stbi_failure_reason ] --- /** Unsafe version of: {@link #stbi_failure_reason failure_reason} */ public static native long nstbi_failure_reason(); /** Returns a brief reason for failure. */ @Nullable @NativeType("const char *") public static String stbi_failure_reason() { long __result = nstbi_failure_reason(); return memASCIISafe(__result); } // --- [ stbi_image_free ] --- /** Unsafe version of: {@link #stbi_image_free image_free} */ public static native void nstbi_image_free(long retval_from_stbi_load); /** * Frees a loaded image * * @param retval_from_stbi_load an stb image */ public static void stbi_image_free(@NativeType("void *") ByteBuffer retval_from_stbi_load) { nstbi_image_free(memAddress(retval_from_stbi_load)); } /** * Frees a loaded image * * @param retval_from_stbi_load an stb image */ public static void stbi_image_free(@NativeType("void *") ShortBuffer retval_from_stbi_load) { nstbi_image_free(memAddress(retval_from_stbi_load)); } /** * Frees a loaded image * * @param retval_from_stbi_load an stb image */ public static void stbi_image_free(@NativeType("void *") FloatBuffer retval_from_stbi_load) { nstbi_image_free(memAddress(retval_from_stbi_load)); } // --- [ stbi_info ] --- /** Unsafe version of: {@link #stbi_info info} */ public static native int nstbi_info(long filename, long x, long y, long comp); /** * Returns image dimensions & components without fully decoding the image. * * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param comp outputs number of components in image * * @return 1 on success, 0 on failure */ @NativeType("int") public static boolean stbi_info(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer comp) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(comp, 1); } return nstbi_info(memAddress(filename), memAddress(x), memAddress(y), memAddress(comp)) != 0; } /** * Returns image dimensions & components without fully decoding the image. * * @param filename the file name * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param comp outputs number of components in image * * @return 1 on success, 0 on failure */ @NativeType("int") public static boolean stbi_info(@NativeType("const char *") CharSequence filename, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer comp) { if (CHECKS) { check(x, 1); check(y, 1); check(comp, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); return nstbi_info(memAddress(filenameEncoded), memAddress(x), memAddress(y), memAddress(comp)) != 0; } finally { stack.setPointer(stackPointer); } } // --- [ stbi_info_from_memory ] --- /** * Unsafe version of: {@link #stbi_info_from_memory info_from_memory} * * @param len the buffer length, in bytes */ public static native int nstbi_info_from_memory(long buffer, int len, long x, long y, long comp); /** * In-memory version of {@link #stbi_info info}. * * @param buffer the buffer from which to load the image data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param comp outputs number of components in image */ @NativeType("int") public static boolean stbi_info_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer comp) { if (CHECKS) { check(x, 1); check(y, 1); check(comp, 1); } return nstbi_info_from_memory(memAddress(buffer), buffer.remaining(), memAddress(x), memAddress(y), memAddress(comp)) != 0; } // --- [ stbi_info_from_callbacks ] --- /** Unsafe version of: {@link #stbi_info_from_callbacks info_from_callbacks} */ public static native int nstbi_info_from_callbacks(long clbk, long user, long x, long y, long comp); /** * Callback version of {@link #stbi_info info}. * * @param clbk an {@link STBIIOCallbacks} struct * @param user a pointer to user data * @param x outputs the image width in pixels * @param y outputs the image height in pixels * @param comp outputs number of components in image */ @NativeType("int") public static boolean stbi_info_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") IntBuffer x, @NativeType("int *") IntBuffer y, @NativeType("int *") IntBuffer comp) { if (CHECKS) { check(x, 1); check(y, 1); check(comp, 1); STBIIOCallbacks.validate(clbk.address()); } return nstbi_info_from_callbacks(clbk.address(), user, memAddress(x), memAddress(y), memAddress(comp)) != 0; } // --- [ stbi_is_16_bit ] --- /** Unsafe version of: {@link #stbi_is_16_bit is_16_bit} */ public static native int nstbi_is_16_bit(long filename); /** * Returns {@code true} if the file contains a 16-bit image. * * @param filename the file name */ @NativeType("int") public static boolean stbi_is_16_bit(@NativeType("const char *") ByteBuffer filename) { if (CHECKS) { checkNT1(filename); } return nstbi_is_16_bit(memAddress(filename)) != 0; } /** * Returns {@code true} if the file contains a 16-bit image. * * @param filename the file name */ @NativeType("int") public static boolean stbi_is_16_bit(@NativeType("const char *") CharSequence filename) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); return nstbi_is_16_bit(memAddress(filenameEncoded)) != 0; } finally { stack.setPointer(stackPointer); } } // --- [ stbi_is_16_bit_from_memory ] --- /** * Unsafe version of: {@link #stbi_is_16_bit_from_memory is_16_bit_from_memory} * * @param len the buffer length, in bytes */ public static native int nstbi_is_16_bit_from_memory(long buffer, int len); /** * In-memory version of {@link #stbi_is_16_bit is_16_bit}. * * @param buffer the buffer from which to load the image data */ @NativeType("int") public static boolean stbi_is_16_bit_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer) { return nstbi_is_16_bit_from_memory(memAddress(buffer), buffer.remaining()) != 0; } // --- [ stbi_is_16_bit_from_callbacks ] --- /** Unsafe version of: {@link #stbi_is_16_bit_from_callbacks is_16_bit_from_callbacks} */ public static native int nstbi_is_16_bit_from_callbacks(long clbk, long user); /** * Callback version of {@link #stbi_is_16_bit is_16_bit}. * * @param clbk an {@link STBIIOCallbacks} struct * @param user a pointer to user data */ @NativeType("int") public static boolean stbi_is_16_bit_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user) { if (CHECKS) { STBIIOCallbacks.validate(clbk.address()); } return nstbi_is_16_bit_from_callbacks(clbk.address(), user) != 0; } // --- [ stbi_set_unpremultiply_on_load ] --- /** Unsafe version of: {@link #stbi_set_unpremultiply_on_load set_unpremultiply_on_load} */ public static native void nstbi_set_unpremultiply_on_load(int 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. Set this flag to force * unpremultiplication. Results are undefined if the unpremultiply overflows. * * @param flag_true_if_should_unpremultiply the unpremultiply flag */ public static void stbi_set_unpremultiply_on_load(@NativeType("int") boolean flag_true_if_should_unpremultiply) { nstbi_set_unpremultiply_on_load(flag_true_if_should_unpremultiply ? 1 : 0); } // --- [ stbi_convert_iphone_png_to_rgb ] --- /** Unsafe version of: {@link #stbi_convert_iphone_png_to_rgb convert_iphone_png_to_rgb} */ public static native void nstbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert); /** * Indicate whether we should process iPhone images back to canonical format, or just pass them through "as-is". * * @param flag_true_if_should_convert the convert iPhone PNG to RGB flag */ public static void stbi_convert_iphone_png_to_rgb(@NativeType("int") boolean flag_true_if_should_convert) { nstbi_convert_iphone_png_to_rgb(flag_true_if_should_convert ? 1 : 0); } // --- [ stbi_set_flip_vertically_on_load ] --- /** Unsafe version of: {@link #stbi_set_flip_vertically_on_load set_flip_vertically_on_load} */ public static native void nstbi_set_flip_vertically_on_load(int flag_true_if_should_flip); /** * Flips the image vertically, so the first pixel in the output array is the bottom left. * * @param flag_true_if_should_flip the flip vertically on load flag */ public static void stbi_set_flip_vertically_on_load(@NativeType("int") boolean flag_true_if_should_flip) { nstbi_set_flip_vertically_on_load(flag_true_if_should_flip ? 1 : 0); } // --- [ stbi_zlib_decode_malloc_guesssize ] --- /** Unsafe version of: {@link #stbi_zlib_decode_malloc_guesssize zlib_decode_malloc_guesssize} */ public static native long nstbi_zlib_decode_malloc_guesssize(long buffer, int len, int initial_size, long outlen); /** * ZLIB client - used by PNG, available for other purposes * * @param buffer * @param initial_size */ @Nullable @NativeType("char *") public static ByteBuffer stbi_zlib_decode_malloc_guesssize(@NativeType("const char *") ByteBuffer buffer, int initial_size) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { IntBuffer outlen = stack.callocInt(1); long __result = nstbi_zlib_decode_malloc_guesssize(memAddress(buffer), buffer.remaining(), initial_size, memAddress(outlen)); return memByteBufferSafe(__result, outlen.get(0)); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_zlib_decode_malloc_guesssize_headerflag ] --- /** Unsafe version of: {@link #stbi_zlib_decode_malloc_guesssize_headerflag zlib_decode_malloc_guesssize_headerflag} */ public static native long nstbi_zlib_decode_malloc_guesssize_headerflag(long buffer, int len, int initial_size, long outlen, int parse_header); /** * ZLIB client - used by PNG, available for other purposes * * @param buffer * @param initial_size * @param parse_header */ @Nullable @NativeType("char *") public static ByteBuffer stbi_zlib_decode_malloc_guesssize_headerflag(@NativeType("const char *") ByteBuffer buffer, int initial_size, @NativeType("int") boolean parse_header) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { IntBuffer outlen = stack.callocInt(1); long __result = nstbi_zlib_decode_malloc_guesssize_headerflag(memAddress(buffer), buffer.remaining(), initial_size, memAddress(outlen), parse_header ? 1 : 0); return memByteBufferSafe(__result, outlen.get(0)); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_zlib_decode_malloc ] --- /** Unsafe version of: {@link #stbi_zlib_decode_malloc zlib_decode_malloc} */ public static native long nstbi_zlib_decode_malloc(long buffer, int len, long outlen); /** * ZLIB client - used by PNG, available for other purposes * * @param buffer */ @Nullable @NativeType("char *") public static ByteBuffer stbi_zlib_decode_malloc(@NativeType("const char *") ByteBuffer buffer) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { IntBuffer outlen = stack.callocInt(1); long __result = nstbi_zlib_decode_malloc(memAddress(buffer), buffer.remaining(), memAddress(outlen)); return memByteBufferSafe(__result, outlen.get(0)); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_zlib_decode_buffer ] --- /** Unsafe version of: {@link #stbi_zlib_decode_buffer zlib_decode_buffer} */ public static native int nstbi_zlib_decode_buffer(long obuffer, int olen, long ibuffer, int ilen); /** * ZLIB client - used by PNG, available for other purposes * * @param obuffer * @param ibuffer */ public static int stbi_zlib_decode_buffer(@NativeType("char *") ByteBuffer obuffer, @NativeType("const char *") ByteBuffer ibuffer) { return nstbi_zlib_decode_buffer(memAddress(obuffer), obuffer.remaining(), memAddress(ibuffer), ibuffer.remaining()); } // --- [ stbi_zlib_decode_noheader_malloc ] --- /** Unsafe version of: {@link #stbi_zlib_decode_noheader_malloc zlib_decode_noheader_malloc} */ public static native long nstbi_zlib_decode_noheader_malloc(long buffer, int len, long outlen); /** * ZLIB client - used by PNG, available for other purposes * * @param buffer */ @Nullable @NativeType("char *") public static ByteBuffer stbi_zlib_decode_noheader_malloc(@NativeType("const char *") ByteBuffer buffer) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { IntBuffer outlen = stack.callocInt(1); long __result = nstbi_zlib_decode_noheader_malloc(memAddress(buffer), buffer.remaining(), memAddress(outlen)); return memByteBufferSafe(__result, outlen.get(0)); } finally { stack.setPointer(stackPointer); } } // --- [ stbi_zlib_decode_noheader_buffer ] --- /** Unsafe version of: {@link #stbi_zlib_decode_noheader_buffer zlib_decode_noheader_buffer} */ public static native int nstbi_zlib_decode_noheader_buffer(long obuffer, int olen, long ibuffer, int ilen); /** * ZLIB client - used by PNG, available for other purposes * * @param obuffer * @param ibuffer */ public static int stbi_zlib_decode_noheader_buffer(@NativeType("char *") ByteBuffer obuffer, @NativeType("const char *") ByteBuffer ibuffer) { return nstbi_zlib_decode_noheader_buffer(memAddress(obuffer), obuffer.remaining(), memAddress(ibuffer), ibuffer.remaining()); } /** Array version of: {@link #nstbi_load} */ public static native long nstbi_load(long filename, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_load load} */ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load(memAddress(filename), x, y, channels_in_file, desired_channels); return memByteBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #stbi_load load} */ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load(@NativeType("const char *") CharSequence filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); long __result = nstbi_load(memAddress(filenameEncoded), x, y, channels_in_file, desired_channels); return memByteBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } finally { stack.setPointer(stackPointer); } } /** Array version of: {@link #nstbi_load_from_memory} */ public static native long nstbi_load_from_memory(long buffer, int len, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_load_from_memory load_from_memory} */ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load_from_memory(memAddress(buffer), buffer.remaining(), x, y, channels_in_file, desired_channels); return memByteBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_load_from_callbacks} */ public static native long nstbi_load_from_callbacks(long clbk, long user, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_load_from_callbacks load_from_callbacks} */ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); STBIIOCallbacks.validate(clbk.address()); } long __result = nstbi_load_from_callbacks(clbk.address(), user, x, y, channels_in_file, desired_channels); return memByteBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_load_gif_from_memory} */ public static native 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: {@link #stbi_load_gif_from_memory load_gif_from_memory} */ @Nullable @NativeType("stbi_uc *") public static ByteBuffer stbi_load_gif_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int **") PointerBuffer delays, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] z, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(delays, 1); check(x, 1); check(y, 1); check(z, 1); check(channels_in_file, 1); } long __result = nstbi_load_gif_from_memory(memAddress(buffer), buffer.remaining(), memAddress(delays), x, y, z, channels_in_file, desired_channels); return memByteBufferSafe(__result, x[0] * y[0] * z[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_load_16} */ public static native long nstbi_load_16(long filename, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_load_16 load_16} */ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load_16(memAddress(filename), x, y, channels_in_file, desired_channels); return memShortBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #stbi_load_16 load_16} */ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16(@NativeType("const char *") CharSequence filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); long __result = nstbi_load_16(memAddress(filenameEncoded), x, y, channels_in_file, desired_channels); return memShortBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } finally { stack.setPointer(stackPointer); } } /** Array version of: {@link #nstbi_load_16_from_memory} */ public static native long nstbi_load_16_from_memory(long buffer, int len, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_load_16_from_memory load_16_from_memory} */ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_load_16_from_memory(memAddress(buffer), buffer.remaining(), x, y, channels_in_file, desired_channels); return memShortBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_load_16_from_callbacks} */ public static native long nstbi_load_16_from_callbacks(long clbk, long user, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_load_16_from_callbacks load_16_from_callbacks} */ @Nullable @NativeType("stbi_us *") public static ShortBuffer stbi_load_16_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); STBIIOCallbacks.validate(clbk.address()); } long __result = nstbi_load_16_from_callbacks(clbk.address(), user, x, y, channels_in_file, desired_channels); return memShortBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_loadf} */ public static native long nstbi_loadf(long filename, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_loadf loadf} */ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_loadf(memAddress(filename), x, y, channels_in_file, desired_channels); return memFloatBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #stbi_loadf loadf} */ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf(@NativeType("const char *") CharSequence filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); long __result = nstbi_loadf(memAddress(filenameEncoded), x, y, channels_in_file, desired_channels); return memFloatBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } finally { stack.setPointer(stackPointer); } } /** Array version of: {@link #nstbi_loadf_from_memory} */ public static native long nstbi_loadf_from_memory(long buffer, int len, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_loadf_from_memory loadf_from_memory} */ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); } long __result = nstbi_loadf_from_memory(memAddress(buffer), buffer.remaining(), x, y, channels_in_file, desired_channels); return memFloatBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_loadf_from_callbacks} */ public static native long nstbi_loadf_from_callbacks(long clbk, long user, int[] x, int[] y, int[] channels_in_file, int desired_channels); /** Array version of: {@link #stbi_loadf_from_callbacks loadf_from_callbacks} */ @Nullable @NativeType("float *") public static FloatBuffer stbi_loadf_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] channels_in_file, int desired_channels) { if (CHECKS) { check(x, 1); check(y, 1); check(channels_in_file, 1); STBIIOCallbacks.validate(clbk.address()); } long __result = nstbi_loadf_from_callbacks(clbk.address(), user, x, y, channels_in_file, desired_channels); return memFloatBufferSafe(__result, x[0] * y[0] * (desired_channels != 0 ? desired_channels : channels_in_file[0])); } /** Array version of: {@link #nstbi_info} */ public static native int nstbi_info(long filename, int[] x, int[] y, int[] comp); /** Array version of: {@link #stbi_info info} */ @NativeType("int") public static boolean stbi_info(@NativeType("const char *") ByteBuffer filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] comp) { if (CHECKS) { checkNT1(filename); check(x, 1); check(y, 1); check(comp, 1); } return nstbi_info(memAddress(filename), x, y, comp) != 0; } /** Array version of: {@link #stbi_info info} */ @NativeType("int") public static boolean stbi_info(@NativeType("const char *") CharSequence filename, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] comp) { if (CHECKS) { check(x, 1); check(y, 1); check(comp, 1); } MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { ByteBuffer filenameEncoded = stack.ASCII(filename); return nstbi_info(memAddress(filenameEncoded), x, y, comp) != 0; } finally { stack.setPointer(stackPointer); } } /** Array version of: {@link #nstbi_info_from_memory} */ public static native int nstbi_info_from_memory(long buffer, int len, int[] x, int[] y, int[] comp); /** Array version of: {@link #stbi_info_from_memory info_from_memory} */ @NativeType("int") public static boolean stbi_info_from_memory(@NativeType("const stbi_uc *") ByteBuffer buffer, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] comp) { if (CHECKS) { check(x, 1); check(y, 1); check(comp, 1); } return nstbi_info_from_memory(memAddress(buffer), buffer.remaining(), x, y, comp) != 0; } /** Array version of: {@link #nstbi_info_from_callbacks} */ public static native int nstbi_info_from_callbacks(long clbk, long user, int[] x, int[] y, int[] comp); /** Array version of: {@link #stbi_info_from_callbacks info_from_callbacks} */ @NativeType("int") public static boolean stbi_info_from_callbacks(@NativeType("const stbi_io_callbacks *") STBIIOCallbacks clbk, @NativeType("void *") long user, @NativeType("int *") int[] x, @NativeType("int *") int[] y, @NativeType("int *") int[] comp) { if (CHECKS) { check(x, 1); check(y, 1); check(comp, 1); STBIIOCallbacks.validate(clbk.address()); } return nstbi_info_from_callbacks(clbk.address(), user, x, y, comp) != 0; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy