Class Texture


  • public class Texture
    extends java.lang.Object
    Represents a 2D texture, typically used by shaders.
    • Constructor Summary

      Constructors 
      Constructor Description
      Texture​(java.lang.String filename, boolean isLinear)
      Creates a new texture from the specfied file.
    • Field Detail

      • filename

        private java.lang.String filename
      • isLinear

        private boolean isLinear
      • bitmap

        private Bitmap bitmap
      • loaded

        private int loaded
    • Constructor Detail

      • Texture

        Texture​(java.lang.String filename,
                boolean isLinear)
        Creates a new texture from the specfied file.
        Parameters:
        filename - image file to load
        isLinear - is the texture gamma corrected already?
    • Method Detail

      • load

        private void load()
      • getBitmap

        public Bitmap getBitmap()
      • getPixel

        public Color getPixel​(float x,
                              float y)
        Gets the color at location (x,y) in the texture. The lookup is performed using the fractional component of the coordinates, treating the texture as a unit square tiled in both directions. Bicubic filtering is performed on the four nearest pixels to the lookup point.
        Parameters:
        x - x coordinate into the texture
        y - y coordinate into the texture
        Returns:
        filtered color at location (x,y)
      • getAlpha

        public float getAlpha​(float x,
                              float y)