Package org.lwjgl.stb

Class STBImageResize



  • public class STBImageResize
    extends java.lang.Object
    Native bindings to stb_image_resize.h from the stb library.

    Written with emphasis on usability, portability, and efficiency. (No SIMD or threads, so it be easily outperformed by libs that use those.) Only scaling and translation is supported, no rotations or shears. Easy API downsamples w/Mitchell filter, upsamples w/cubic interpolation.

    QUICKSTART

    stbir_resize_uint8(      input_pixels , in_w , in_h , 0,
                             output_pixels, out_w, out_h, 0, num_channels)
    stbir_resize_float(...)
    stbir_resize_uint8_srgb( input_pixels , in_w , in_h , 0,
                             output_pixels, out_w, out_h, 0,
                             num_channels , alpha_chan  , 0)
    stbir_resize_uint8_srgb_edgemode(
                             input_pixels , in_w , in_h , 0,
                             output_pixels, out_w, out_h, 0,
                             num_channels , alpha_chan  , 0, STBIR_EDGE_CLAMP)
                                                          // WRAP/REFLECT/ZERO

    ALPHA CHANNEL

    Most of the resizing functions provide the ability to control how the alpha channel of an image is processed. The important things to know about this:

    1. The best mathematically-behaved version of alpha to use is called "premultiplied alpha", in which the other color channels have had the alpha value multiplied in. If you use premultiplied alpha, linear filtering (such as image resampling done by this library, or performed in texture units on GPUs) does the "right thing". While premultiplied alpha is standard in the movie CGI industry, it is still uncommon in the videogame/real-time world. If you linearly filter non-premultiplied alpha, strange effects occur. (For example, the average of 1% opaque bright green and 99% opaque black produces 50% transparent dark green when non-premultiplied, whereas premultiplied it produces 50% transparent near-black. The former introduces green energy that doesn't exist in the source image.)
    2. Artists should not edit premultiplied-alpha images; artists want non-premultiplied alpha images. Thus, art tools generally output non-premultiplied alpha images.
    3. You will get best results in most cases by converting images to premultiplied alpha before processing them mathematically.
    4. If you pass the flag FLAG_ALPHA_PREMULTIPLIED, the resizer does not do anything special for the alpha channel; it is resampled identically to other channels. This produces the correct results for premultiplied-alpha images, but produces less-than-ideal results for non-premultiplied-alpha images.
    5. If you do not pass the flag FLAG_ALPHA_PREMULTIPLIED, then the resizer weights the contribution of input pixels based on their alpha values, or, equivalently, it multiplies the alpha value into the color channels, resamples, then divides by the resultant alpha value. Input pixels which have alpha=0 do not contribute at all to output pixels unless all of the input pixels affecting that output pixel have alpha=0, in which case the result for that pixel is the same as it would be without FLAG_ALPHA_PREMULTIPLIED. However, this is only true for input images in integer formats. For input images in float format, input pixels with alpha=0 have no effect, and output pixels which have alpha=0 will be 0 in all channels. (For float images, you can manually achieve the same result by adding a tiny epsilon value to the alpha channel of every image, and then subtracting or clamping it at the end.)
    6. You can separately control whether the alpha channel is interpreted as linear or affected by the colorspace. By default it is linear; you almost never want to apply the colorspace. (For example, graphics hardware does not apply sRGB conversion to the alpha channel.)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean stbir_resize_float_generic(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
      Array version of: resize_float_generic
      static boolean stbir_resize_float_generic(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
      Array version of: resize_float_generic
      static boolean stbir_resize_float_generic(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
      Float version of resize_uint8_generic.
      static boolean stbir_resize_float_generic(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
      Float version of resize_uint8_generic.
      static boolean stbir_resize_float(float[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, float[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
      Array version of: resize_float
      static boolean stbir_resize_float(java.nio.FloatBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.FloatBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
      Float version of resize_uint8.
      static boolean stbir_resize_region(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, float s0, float t0, float s1, float t1)
      Region version of resize, using texture coordinates.
      static boolean stbir_resize_region(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context, float s0, float t0, float s1, float t1)
      Region version of resize, using texture coordinates.
      static boolean stbir_resize_subpixel(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, float x_scale, float y_scale, float x_offset, float y_offset)
      Subpixel version of resize.
      static boolean stbir_resize_subpixel(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context, float x_scale, float y_scale, float x_offset, float y_offset)
      Subpixel version of resize.
      static boolean stbir_resize_uint16_generic(short[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, short[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
      Array version of: resize_uint16_generic
      static boolean stbir_resize_uint16_generic(short[] input_pixels, int input_w, int input_h, int input_stride_in_bytes, short[] output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
      Array version of: resize_uint16_generic
      static boolean stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ShortBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
      Short version of resize_uint8_generic.
      static boolean stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ShortBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
      Short version of resize_uint8_generic.
      static boolean stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space)
      Medium-complexity version of resize_uint8.
      static boolean stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode, int filter, int space, long alloc_context)
      Medium-complexity version of resize_uint8.
      static boolean stbir_resize_uint8_srgb_edgemode(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags, int edge_wrap_mode)
      Same as resize_uint8_srgb, but adds the ability to specify how requests to sample off the edge of the image are handled.
      static boolean stbir_resize_uint8_srgb(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels, int alpha_channel, int flags)
      Easy-to-use API for resizing images.
      static boolean stbir_resize_uint8(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int num_channels)
      Easy-to-use API for resizing images.
      static boolean stbir_resize(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space)
      Full-complexity version of resize_uint8_generic.
      static boolean stbir_resize(java.nio.ByteBuffer input_pixels, int input_w, int input_h, int input_stride_in_bytes, java.nio.ByteBuffer output_pixels, int output_w, int output_h, int output_stride_in_bytes, int datatype, int num_channels, int alpha_channel, int flags, int edge_mode_horizontal, int edge_mode_vertical, int filter_horizontal, int filter_vertical, int space, long alloc_context)
      Full-complexity version of resize_uint8_generic.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • stbir_resize_uint8

        public static boolean stbir_resize_uint8(java.nio.ByteBuffer input_pixels,
                                                 int input_w,
                                                 int input_h,
                                                 int input_stride_in_bytes,
                                                 java.nio.ByteBuffer output_pixels,
                                                 int output_w,
                                                 int output_h,
                                                 int output_stride_in_bytes,
                                                 int num_channels)
        Easy-to-use API for resizing images.
        • The colorspace is linear.
        • The alpha channel is treated identically to other channels.
        • Memory required grows approximately linearly with input and output size, but with discontinuities at input_w == output_w and input_h == output_h.

        This function uses the default resampling filter defined at compile time. For a different filter, use the medium-complexity API.

        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        Returns:
        1 on success, 0 on failure
      • stbir_resize_float

        public static boolean stbir_resize_float(java.nio.FloatBuffer input_pixels,
                                                 int input_w,
                                                 int input_h,
                                                 int input_stride_in_bytes,
                                                 java.nio.FloatBuffer output_pixels,
                                                 int output_w,
                                                 int output_h,
                                                 int output_stride_in_bytes,
                                                 int num_channels)
        Float version of resize_uint8.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        Returns:
        1 on success, 0 on failure
      • stbir_resize_uint8_srgb

        public static boolean stbir_resize_uint8_srgb(java.nio.ByteBuffer input_pixels,
                                                      int input_w,
                                                      int input_h,
                                                      int input_stride_in_bytes,
                                                      java.nio.ByteBuffer output_pixels,
                                                      int output_w,
                                                      int output_h,
                                                      int output_stride_in_bytes,
                                                      int num_channels,
                                                      int alpha_channel,
                                                      int flags)
        Easy-to-use API for resizing images.
        • The image data is interpreted as gamma-corrected sRGB.
        • Memory required grows approximately linearly with input and output size, but with discontinuities at input_w == output_w and input_h == output_h.

        This function uses the default resampling filter defined at compile time. For a different filter, use the medium-complexity API.

        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        Returns:
        1 on success, 0 on failure
      • stbir_resize_uint8_srgb_edgemode

        public static boolean stbir_resize_uint8_srgb_edgemode(java.nio.ByteBuffer input_pixels,
                                                               int input_w,
                                                               int input_h,
                                                               int input_stride_in_bytes,
                                                               java.nio.ByteBuffer output_pixels,
                                                               int output_w,
                                                               int output_h,
                                                               int output_stride_in_bytes,
                                                               int num_channels,
                                                               int alpha_channel,
                                                               int flags,
                                                               int edge_wrap_mode)
        Same as resize_uint8_srgb, but adds the ability to specify how requests to sample off the edge of the image are handled.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        Returns:
        1 on success, 0 on failure
      • stbir_resize_uint8_generic

        public static boolean stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels,
                                                         int input_w,
                                                         int input_h,
                                                         int input_stride_in_bytes,
                                                         java.nio.ByteBuffer output_pixels,
                                                         int output_w,
                                                         int output_h,
                                                         int output_stride_in_bytes,
                                                         int num_channels,
                                                         int alpha_channel,
                                                         int flags,
                                                         int edge_wrap_mode,
                                                         int filter,
                                                         int space,
                                                         long alloc_context)
        Medium-complexity version of resize_uint8.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        filter - the scale filter. One of:
        FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
        FILTER_MITCHELL
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        alloc_context - pointer to the allocation context
        Returns:
        1 on success, 0 on failure
      • stbir_resize_uint8_generic

        public static boolean stbir_resize_uint8_generic(java.nio.ByteBuffer input_pixels,
                                                         int input_w,
                                                         int input_h,
                                                         int input_stride_in_bytes,
                                                         java.nio.ByteBuffer output_pixels,
                                                         int output_w,
                                                         int output_h,
                                                         int output_stride_in_bytes,
                                                         int num_channels,
                                                         int alpha_channel,
                                                         int flags,
                                                         int edge_wrap_mode,
                                                         int filter,
                                                         int space)
        Medium-complexity version of resize_uint8.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        filter - the scale filter. One of:
        FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
        FILTER_MITCHELL
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        Returns:
        1 on success, 0 on failure
      • stbir_resize_uint16_generic

        public static boolean stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels,
                                                          int input_w,
                                                          int input_h,
                                                          int input_stride_in_bytes,
                                                          java.nio.ShortBuffer output_pixels,
                                                          int output_w,
                                                          int output_h,
                                                          int output_stride_in_bytes,
                                                          int num_channels,
                                                          int alpha_channel,
                                                          int flags,
                                                          int edge_wrap_mode,
                                                          int filter,
                                                          int space,
                                                          long alloc_context)
        Short version of resize_uint8_generic.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        filter - the scale filter. One of:
        FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
        FILTER_MITCHELL
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        alloc_context - pointer to the allocation context
        Returns:
        1 on success, 0 on failure
      • stbir_resize_uint16_generic

        public static boolean stbir_resize_uint16_generic(java.nio.ShortBuffer input_pixels,
                                                          int input_w,
                                                          int input_h,
                                                          int input_stride_in_bytes,
                                                          java.nio.ShortBuffer output_pixels,
                                                          int output_w,
                                                          int output_h,
                                                          int output_stride_in_bytes,
                                                          int num_channels,
                                                          int alpha_channel,
                                                          int flags,
                                                          int edge_wrap_mode,
                                                          int filter,
                                                          int space)
        Short version of resize_uint8_generic.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        filter - the scale filter. One of:
        FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
        FILTER_MITCHELL
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        Returns:
        1 on success, 0 on failure
      • stbir_resize_float_generic

        public static boolean stbir_resize_float_generic(java.nio.FloatBuffer input_pixels,
                                                         int input_w,
                                                         int input_h,
                                                         int input_stride_in_bytes,
                                                         java.nio.FloatBuffer output_pixels,
                                                         int output_w,
                                                         int output_h,
                                                         int output_stride_in_bytes,
                                                         int num_channels,
                                                         int alpha_channel,
                                                         int flags,
                                                         int edge_wrap_mode,
                                                         int filter,
                                                         int space,
                                                         long alloc_context)
        Float version of resize_uint8_generic.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        filter - the scale filter. One of:
        FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
        FILTER_MITCHELL
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        alloc_context - pointer to the allocation context
        Returns:
        1 on success, 0 on failure
      • stbir_resize_float_generic

        public static boolean stbir_resize_float_generic(java.nio.FloatBuffer input_pixels,
                                                         int input_w,
                                                         int input_h,
                                                         int input_stride_in_bytes,
                                                         java.nio.FloatBuffer output_pixels,
                                                         int output_w,
                                                         int output_h,
                                                         int output_stride_in_bytes,
                                                         int num_channels,
                                                         int alpha_channel,
                                                         int flags,
                                                         int edge_wrap_mode,
                                                         int filter,
                                                         int space)
        Float version of resize_uint8_generic.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_wrap_mode - the edge wrap mode. One of:
        EDGE_CLAMPEDGE_REFLECTEDGE_WRAPEDGE_ZERO
        filter - the scale filter. One of:
        FILTER_DEFAULTFILTER_BOXFILTER_TRIANGLEFILTER_CUBICBSPLINEFILTER_CATMULLROM
        FILTER_MITCHELL
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        Returns:
        1 on success, 0 on failure
      • stbir_resize

        public static boolean stbir_resize(java.nio.ByteBuffer input_pixels,
                                           int input_w,
                                           int input_h,
                                           int input_stride_in_bytes,
                                           java.nio.ByteBuffer output_pixels,
                                           int output_w,
                                           int output_h,
                                           int output_stride_in_bytes,
                                           int datatype,
                                           int num_channels,
                                           int alpha_channel,
                                           int flags,
                                           int edge_mode_horizontal,
                                           int edge_mode_vertical,
                                           int filter_horizontal,
                                           int filter_vertical,
                                           int space,
                                           long alloc_context)
        Full-complexity version of resize_uint8_generic.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        datatype - the image data type. One of:
        TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_mode_horizontal - the horizontal edge wrap mode
        edge_mode_vertical - the vertical edge wrap mode
        filter_horizontal - the horizontal scale filter
        filter_vertical - the vertical scale filter
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        alloc_context - pointer to the allocation context
        Returns:
        1 on success, 0 on failure
      • stbir_resize

        public static boolean stbir_resize(java.nio.ByteBuffer input_pixels,
                                           int input_w,
                                           int input_h,
                                           int input_stride_in_bytes,
                                           java.nio.ByteBuffer output_pixels,
                                           int output_w,
                                           int output_h,
                                           int output_stride_in_bytes,
                                           int datatype,
                                           int num_channels,
                                           int alpha_channel,
                                           int flags,
                                           int edge_mode_horizontal,
                                           int edge_mode_vertical,
                                           int filter_horizontal,
                                           int filter_vertical,
                                           int space)
        Full-complexity version of resize_uint8_generic.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        datatype - the image data type. One of:
        TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_mode_horizontal - the horizontal edge wrap mode
        edge_mode_vertical - the vertical edge wrap mode
        filter_horizontal - the horizontal scale filter
        filter_vertical - the vertical scale filter
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        Returns:
        1 on success, 0 on failure
      • stbir_resize_subpixel

        public static boolean stbir_resize_subpixel(java.nio.ByteBuffer input_pixels,
                                                    int input_w,
                                                    int input_h,
                                                    int input_stride_in_bytes,
                                                    java.nio.ByteBuffer output_pixels,
                                                    int output_w,
                                                    int output_h,
                                                    int output_stride_in_bytes,
                                                    int datatype,
                                                    int num_channels,
                                                    int alpha_channel,
                                                    int flags,
                                                    int edge_mode_horizontal,
                                                    int edge_mode_vertical,
                                                    int filter_horizontal,
                                                    int filter_vertical,
                                                    int space,
                                                    long alloc_context,
                                                    float x_scale,
                                                    float y_scale,
                                                    float x_offset,
                                                    float y_offset)
        Subpixel version of resize.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        datatype - the image data type. One of:
        TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_mode_horizontal - the horizontal edge wrap mode
        edge_mode_vertical - the vertical edge wrap mode
        filter_horizontal - the horizontal scale filter
        filter_vertical - the vertical scale filter
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        alloc_context - pointer to the allocation context
        x_scale - horizontal scale for subpixel correctness
        y_scale - vertical scale for subpixel correctness
        x_offset - horizontal offset for subpixel correctness
        y_offset - vertical offset for subpixel correctness
        Returns:
        1 on success, 0 on failure
      • stbir_resize_subpixel

        public static boolean stbir_resize_subpixel(java.nio.ByteBuffer input_pixels,
                                                    int input_w,
                                                    int input_h,
                                                    int input_stride_in_bytes,
                                                    java.nio.ByteBuffer output_pixels,
                                                    int output_w,
                                                    int output_h,
                                                    int output_stride_in_bytes,
                                                    int datatype,
                                                    int num_channels,
                                                    int alpha_channel,
                                                    int flags,
                                                    int edge_mode_horizontal,
                                                    int edge_mode_vertical,
                                                    int filter_horizontal,
                                                    int filter_vertical,
                                                    int space,
                                                    float x_scale,
                                                    float y_scale,
                                                    float x_offset,
                                                    float y_offset)
        Subpixel version of resize.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        datatype - the image data type. One of:
        TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_mode_horizontal - the horizontal edge wrap mode
        edge_mode_vertical - the vertical edge wrap mode
        filter_horizontal - the horizontal scale filter
        filter_vertical - the vertical scale filter
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        x_scale - horizontal scale for subpixel correctness
        y_scale - vertical scale for subpixel correctness
        x_offset - horizontal offset for subpixel correctness
        y_offset - vertical offset for subpixel correctness
        Returns:
        1 on success, 0 on failure
      • stbir_resize_region

        public static boolean stbir_resize_region(java.nio.ByteBuffer input_pixels,
                                                  int input_w,
                                                  int input_h,
                                                  int input_stride_in_bytes,
                                                  java.nio.ByteBuffer output_pixels,
                                                  int output_w,
                                                  int output_h,
                                                  int output_stride_in_bytes,
                                                  int datatype,
                                                  int num_channels,
                                                  int alpha_channel,
                                                  int flags,
                                                  int edge_mode_horizontal,
                                                  int edge_mode_vertical,
                                                  int filter_horizontal,
                                                  int filter_vertical,
                                                  int space,
                                                  long alloc_context,
                                                  float s0,
                                                  float t0,
                                                  float s1,
                                                  float t1)
        Region version of resize, using texture coordinates.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        datatype - the image data type. One of:
        TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_mode_horizontal - the horizontal edge wrap mode
        edge_mode_vertical - the vertical edge wrap mode
        filter_horizontal - the horizontal scale filter
        filter_vertical - the vertical scale filter
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        alloc_context - pointer to the allocation context
        s0 - the left texture coordinate of the region to scale
        t0 - the top texture coordinate of the region to scale
        s1 - the right texture coordinate of the region to scale
        t1 - the bottom texture coordinate of the region to scale
        Returns:
        1 on success, 0 on failure
      • stbir_resize_region

        public static boolean stbir_resize_region(java.nio.ByteBuffer input_pixels,
                                                  int input_w,
                                                  int input_h,
                                                  int input_stride_in_bytes,
                                                  java.nio.ByteBuffer output_pixels,
                                                  int output_w,
                                                  int output_h,
                                                  int output_stride_in_bytes,
                                                  int datatype,
                                                  int num_channels,
                                                  int alpha_channel,
                                                  int flags,
                                                  int edge_mode_horizontal,
                                                  int edge_mode_vertical,
                                                  int filter_horizontal,
                                                  int filter_vertical,
                                                  int space,
                                                  float s0,
                                                  float t0,
                                                  float s1,
                                                  float t1)
        Region version of resize, using texture coordinates.
        Parameters:
        input_pixels - the source image data
        input_w - the source image width
        input_h - the source image height
        input_stride_in_bytes - the offset between successive rows of the source image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        output_pixels - returns the scaled image data
        output_w - the resized image width
        output_h - the resized image height
        output_stride_in_bytes - the offset between successive rows of the resized image data in memory, in bytes. You can specify 0 to mean packed continuously in memory
        datatype - the image data type. One of:
        TYPE_UINT8TYPE_UINT16TYPE_UINT32TYPE_FLOAT
        num_channels - the number of channels in the image (e.g. RGB=3, RGBA=4)
        alpha_channel - the alpha channel index, or ALPHA_CHANNEL_NONE if there is no alpha channel
        flags - the alpha channel flags. 0 will propably do the right thing if you're not sure what the flags mean. One of:
        FLAG_ALPHA_PREMULTIPLIEDFLAG_ALPHA_USES_COLORSPACE
        edge_mode_horizontal - the horizontal edge wrap mode
        edge_mode_vertical - the vertical edge wrap mode
        filter_horizontal - the horizontal scale filter
        filter_vertical - the vertical scale filter
        space - the image colorspace. One of:
        COLORSPACE_LINEARCOLORSPACE_SRGB
        s0 - the left texture coordinate of the region to scale
        t0 - the top texture coordinate of the region to scale
        s1 - the right texture coordinate of the region to scale
        t1 - the bottom texture coordinate of the region to scale
        Returns:
        1 on success, 0 on failure
      • stbir_resize_float

        public static boolean stbir_resize_float(float[] input_pixels,
                                                 int input_w,
                                                 int input_h,
                                                 int input_stride_in_bytes,
                                                 float[] output_pixels,
                                                 int output_w,
                                                 int output_h,
                                                 int output_stride_in_bytes,
                                                 int num_channels)
        Array version of: resize_float
      • stbir_resize_uint16_generic

        public static boolean stbir_resize_uint16_generic(short[] input_pixels,
                                                          int input_w,
                                                          int input_h,
                                                          int input_stride_in_bytes,
                                                          short[] output_pixels,
                                                          int output_w,
                                                          int output_h,
                                                          int output_stride_in_bytes,
                                                          int num_channels,
                                                          int alpha_channel,
                                                          int flags,
                                                          int edge_wrap_mode,
                                                          int filter,
                                                          int space,
                                                          long alloc_context)
        
        public static boolean stbir_resize_uint16_generic(short[] input_pixels,
                                                          int input_w,
                                                          int input_h,
                                                          int input_stride_in_bytes,
                                                          short[] output_pixels,
                                                          int output_w,
                                                          int output_h,
                                                          int output_stride_in_bytes,
                                                          int num_channels,
                                                          int alpha_channel,
                                                          int flags,
                                                          int edge_wrap_mode,
                                                          int filter,
                                                          int space)
        
        Array version of: resize_uint16_generic
      • stbir_resize_float_generic

        public static boolean stbir_resize_float_generic(float[] input_pixels,
                                                         int input_w,
                                                         int input_h,
                                                         int input_stride_in_bytes,
                                                         float[] output_pixels,
                                                         int output_w,
                                                         int output_h,
                                                         int output_stride_in_bytes,
                                                         int num_channels,
                                                         int alpha_channel,
                                                         int flags,
                                                         int edge_wrap_mode,
                                                         int filter,
                                                         int space,
                                                         long alloc_context)
        
        public static boolean stbir_resize_float_generic(float[] input_pixels,
                                                         int input_w,
                                                         int input_h,
                                                         int input_stride_in_bytes,
                                                         float[] output_pixels,
                                                         int output_w,
                                                         int output_h,
                                                         int output_stride_in_bytes,
                                                         int num_channels,
                                                         int alpha_channel,
                                                         int flags,
                                                         int edge_wrap_mode,
                                                         int filter,
                                                         int space)
        
        Array version of: resize_float_generic