Class StbUtils

java.lang.Object
org.ngengine.stbimage.StbUtils

public final class StbUtils extends Object
  • Constructor Details

    • StbUtils

      public StbUtils()
  • Method Details

    • convertChannels

      public static ByteBuffer convertChannels(IntFunction<ByteBuffer> allocator, ByteBuffer src, int srcChannels, int width, int height, int desiredChannels, boolean is16Bit)
      Converts interleaved pixel channels between 1/2/3/4-channel layouts.
      Parameters:
      allocator - destination allocator
      src - source interleaved pixel buffer
      srcChannels - source channel count
      width - image width
      height - image height
      desiredChannels - target channel count
      is16Bit - true for 16-bit channel elements
      Returns:
      converted buffer
    • verticalFlip

      public static ByteBuffer verticalFlip(IntFunction<ByteBuffer> allocator, ByteBuffer src, int width, int height, int channels, boolean is16Bit)
      Flips interleaved pixel data vertically.
      Parameters:
      allocator - destination allocator
      src - source pixels
      width - image width
      height - image height
      channels - channel count
      is16Bit - true for 16-bit elements (2 bytes per channel)
      Returns:
      vertically flipped buffer
    • verticalFlip

      public static ByteBuffer verticalFlip(IntFunction<ByteBuffer> allocator, ByteBuffer src, int width, int height, int channels, int bytesPerChannel)
      Flips interleaved pixel data vertically using explicit channel byte width.
      Parameters:
      allocator - destination allocator
      src - source pixels
      width - image width
      height - image height
      channels - channel count
      bytesPerChannel - bytes per channel element
      Returns:
      vertically flipped buffer