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
    • 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 pWidth, int pHeight, boolean pUseCalloc)
    • NativeImage

      public NativeImage(NativeImage.Format pFormat, int pWidth, int pHeight, boolean pUseCalloc)
    • NativeImage

      private NativeImage(NativeImage.Format pFormat, int pWidth, int pHeight, boolean pUseStbFree, long pPixels)
  • Method Details

    • toString

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

      private boolean isOutsideBounds(int pX, int pY)
    • read

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

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

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

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

      public static NativeImage read(@Nullable NativeImage.Format pFormat, ByteBuffer pTextureData) throws IOException
      Throws:
      IOException
    • setFilter

      private static void setFilter(boolean pLinear, boolean pMipmap)
    • checkAllocated

      private void checkAllocated()
    • close

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

      public int getWidth()
    • getHeight

      public int getHeight()
    • format

      public NativeImage.Format format()
    • getPixelRGBA

      public int getPixelRGBA(int pX, int pY)
    • setPixelRGBA

      public void setPixelRGBA(int pX, int pY, int pAbgrColor)
    • mappedCopy

      public NativeImage mappedCopy(IntUnaryOperator pFunction)
    • applyToAllPixels

      public void applyToAllPixels(IntUnaryOperator pFunction)
    • getPixelsRGBA

      public int[] getPixelsRGBA()
    • setPixelLuminance

      public void setPixelLuminance(int pX, int pY, byte pLuminance)
    • getRedOrLuminance

      public byte getRedOrLuminance(int pX, int pY)
    • getGreenOrLuminance

      public byte getGreenOrLuminance(int pX, int pY)
    • getBlueOrLuminance

      public byte getBlueOrLuminance(int pX, int pY)
    • getLuminanceOrAlpha

      public byte getLuminanceOrAlpha(int pX, int pY)
    • blendPixel

      public void blendPixel(int pX, int pY, int pAbgrColor)
    • makePixelArray

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

      public void upload(int pLevel, int pXOffset, int pYOffset, boolean pMipmap)
    • upload

      public void upload(int pLevel, int pXOffset, int pYOffset, int pUnpackSkipPixels, int pUnpackSkipRows, int pWidth, int pHeight, boolean pMipmap, boolean pAutoClose)
    • upload

      public void upload(int pLevel, int pXOffset, int pYOffset, int pUnpackSkipPixels, int pUnpackSkipRows, int pWidth, int pHeight, boolean pBlur, boolean pClamp, boolean pMipmap, boolean pAutoClose)
    • _upload

      private void _upload(int pLevel, int pXOffset, int pYOffset, int pUnpackSkipPixels, int pUnpackSkipRows, int pWidth, int pHeight, boolean pBlur, boolean pClamp, boolean pMipmap, boolean pAutoClose)
    • downloadTexture

      public void downloadTexture(int pLevel, boolean pOpaque)
    • downloadDepthBuffer

      public void downloadDepthBuffer(float pUnused)
    • drawPixels

      public void drawPixels()
    • writeToFile

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

      public boolean copyFromFont(org.lwjgl.util.freetype.FT_Face p_320757_, int p_85070_)
    • writeToFile

      public void writeToFile(Path pPath) throws IOException
      Throws:
      IOException
    • asByteArray

      public byte[] asByteArray() throws IOException
      Throws:
      IOException
    • writeToChannel

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

      public void copyFrom(NativeImage pOther)
    • fillRect

      public void fillRect(int pX, int pY, int pWidth, int pHeight, int pValue)
    • copyRect

      public void copyRect(int pXFrom, int pYFrom, int pXToDelta, int pYToDelta, int pWidth, int pHeight, boolean pMirrorX, boolean pMirrorY)
    • copyRect

      public void copyRect(NativeImage pSource, int pXFrom, int pYFrom, int pXTo, int pYTo, int pWidth, int pHeight, boolean pMirrorX, boolean pMirrorY)
    • flipY

      public void flipY()
    • resizeSubRectTo

      public void resizeSubRectTo(int pX, int pY, int pWidth, int pHeight, NativeImage pImage)
    • untrack

      public void untrack()