Class NativeImage

java.lang.Object
com.mojang.blaze3d.platform.NativeImage
All Implemented Interfaces:
AutoCloseable

public final class NativeImage extends Object implements AutoCloseable
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • MEMORY_POOL

      private static final com.mojang.jtracy.MemoryPool MEMORY_POOL
    • OPEN_OPTIONS

      private static final Set<StandardOpenOption> OPEN_OPTIONS
    • format

      private final NativeImage.Format format
    • width

      private final int width
    • height

      private final int height
    • useStbFree

      private final boolean useStbFree
    • pixels

      private long pixels
    • size

      private final long size
  • Constructor Details

    • NativeImage

      public NativeImage(int width, int height, boolean zero)
    • NativeImage

      public NativeImage(NativeImage.Format format, int width, int height, boolean zero)
    • NativeImage

      public NativeImage(NativeImage.Format format, int width, int height, boolean useStbFree, long pixels)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isOutsideBounds

      private boolean isOutsideBounds(int x, int y)
    • read

      public static NativeImage read(InputStream inputStream) throws IOException
      Throws:
      IOException
    • read

      public static NativeImage read(@Nullable NativeImage.Format format, InputStream inputStream) throws IOException
      Throws:
      IOException
    • read

      public static NativeImage read(ByteBuffer bytes) throws IOException
      Throws:
      IOException
    • read

      public static NativeImage read(byte[] bytes) throws IOException
      Throws:
      IOException
    • putAndRead

      private static NativeImage putAndRead(ByteBuffer nativeBuffer, byte[] bytes) throws IOException
      Throws:
      IOException
    • read

      public static NativeImage read(@Nullable NativeImage.Format format, ByteBuffer bytes) throws IOException
      Throws:
      IOException
    • checkAllocated

      private void checkAllocated()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • isClosed

      public boolean isClosed()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • format

      public NativeImage.Format format()
    • getPixelABGR

      private int getPixelABGR(int x, int y)
    • getPixel

      public int getPixel(int x, int y)
    • setPixelABGR

      public void setPixelABGR(int x, int y, int pixel)
    • setPixel

      public void setPixel(int x, int y, int pixel)
    • mappedCopy

      public NativeImage mappedCopy(IntUnaryOperator function)
    • getPixelsABGR

      public int[] getPixelsABGR()
    • getPixels

      public int[] getPixels()
    • getLuminanceOrAlpha

      public byte getLuminanceOrAlpha(int x, int y)
    • makePixelArray

      @Deprecated public int[] makePixelArray()
      Deprecated.
    • writeToFile

      public void writeToFile(File file) throws IOException
      Throws:
      IOException
    • copyFromFont

      public boolean copyFromFont(org.lwjgl.util.freetype.FT_Face face, int index)
    • writeToFile

      public void writeToFile(Path file) throws IOException
      Throws:
      IOException
    • writeToChannel

      private boolean writeToChannel(WritableByteChannel output) throws IOException
      Throws:
      IOException
    • copyFrom

      public void copyFrom(NativeImage from)
    • fillRect

      public void fillRect(int xs, int ys, int width, int height, int pixel)
    • copyRect

      public void copyRect(int startX, int startY, int offsetX, int offsetY, int sizeX, int sizeY, boolean swapX, boolean swapY)
    • copyRect

      public void copyRect(NativeImage target, int sourceX, int sourceY, int targetX, int targetY, int sizeX, int sizeY, boolean swapX, boolean swapY)
    • resizeSubRectTo

      public void resizeSubRectTo(int sourceX, int sourceY, int sizeX, int sizeY, NativeImage to)
    • untrack

      public void untrack()
    • getPointer

      public long getPointer()
    • computeTransparency

      public Transparency computeTransparency(int x0, int y0, int x1, int y1)
    • computeTransparency

      public Transparency computeTransparency()