Interface Canvas


public interface Canvas
A CanvasElement's image data.
  • Method Summary

    Modifier and Type
    Method
    Description
    getColor(int x, int y)
    Get a pixel's color.
    @NotNull org.joml.Vector4f
    getColorf(int x, int y)
    Get a pixel's color value in range [0..1]
    org.joml.Vector4f
    getColorf(int x, int y, @NotNull org.joml.Vector4f out)
    Get a pixel's color value in range [0..1]
    @NotNull org.joml.Vector4i
    getColori(int x, int y)
    Get a pixel's color value in range [0..255]
    org.joml.Vector4i
    getColori(int x, int y, @NotNull org.joml.Vector4i out)
    Get a pixel's color value in range [0..255]
    @NotNull CanvasElement
    Get the element this canvas belongs to.
    int
    The height of the canvas.
    int
    The width of the canvas.
    void
    setColor(int x, int y, Color color)
    Set a pixel's color value.
    void
    setColorf(int x, int y, @NotNull org.joml.Vector3fc color)
    Set a pixel's color value in range [0..1] Color components Color Channel Vector Component Red x Green y Blue z
    void
    setColorf(int x, int y, @NotNull org.joml.Vector4fc color)
    Set a pixel's color value in range [0..1] Color components Color Channel Vector Component Red x Green y Blue z Alpha w
    void
    setColori(int x, int y, @NotNull org.joml.Vector3ic color)
    Set a pixel's color value in range [0..255] Color components Color Channel Vector Component Red x Green y Blue z
    void
    setColori(int x, int y, @NotNull org.joml.Vector4ic color)
    Set a pixel's color value in range [0..255] Color components Color Channel Vector Component Red x Green y Blue z Alpha w
  • Method Details

    • getWidth

      int getWidth()
      The width of the canvas.
      Returns:
      Canvas width
      See Also:
    • getHeight

      int getHeight()
      The height of the canvas.
      Returns:
      Canvas height
      See Also:
    • getElement

      @NotNull @NotNull CanvasElement getElement()
      Get the element this canvas belongs to.
      Returns:
      Canvas element
    • getColorf

      org.joml.Vector4f getColorf(int x, int y, @NotNull @NotNull org.joml.Vector4f out) throws NullPointerException, IllegalArgumentException
      Get a pixel's color value in range [0..1]
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      out - Vector to store color value in.
      Returns:
      The out argument
      Throws:
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
      NullPointerException - If out is null
    • getColori

      org.joml.Vector4i getColori(int x, int y, @NotNull @NotNull org.joml.Vector4i out)
      Get a pixel's color value in range [0..255]
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      out - Vector to store color value in.
      Returns:
      The out argument
      Throws:
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
      NullPointerException - If out is null
    • getColorf

      @NotNull @NotNull org.joml.Vector4f getColorf(int x, int y) throws IllegalArgumentException
      Get a pixel's color value in range [0..1]
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      Returns:
      Color value
      Throws:
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • getColori

      @NotNull @NotNull org.joml.Vector4i getColori(int x, int y) throws IllegalArgumentException
      Get a pixel's color value in range [0..255]
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      Returns:
      Color value
      Throws:
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • getColor

      Color getColor(int x, int y) throws IllegalArgumentException
      Get a pixel's color.
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      Returns:
      Color value
      Throws:
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • setColor

      void setColor(int x, int y, Color color) throws NullPointerException, IllegalArgumentException
      Set a pixel's color value.
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      color - Color values.
      Throws:
      NullPointerException - If color is null
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • setColorf

      void setColorf(int x, int y, @NotNull @NotNull org.joml.Vector4fc color) throws IllegalArgumentException, NullPointerException
      Set a pixel's color value in range [0..1]
      Color components
      Color Channel Vector Component
      Red x
      Green y
      Blue z
      Alpha w
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      color - Color values.
      Throws:
      NullPointerException - If color is null
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • setColorf

      void setColorf(int x, int y, @NotNull @NotNull org.joml.Vector3fc color) throws IllegalArgumentException, NullPointerException
      Set a pixel's color value in range [0..1]
      Color components
      Color Channel Vector Component
      Red x
      Green y
      Blue z
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      color - Color values.
      Throws:
      NullPointerException - If color is null
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • setColori

      void setColori(int x, int y, @NotNull @NotNull org.joml.Vector4ic color) throws IllegalArgumentException, NullPointerException
      Set a pixel's color value in range [0..255]
      Color components
      Color Channel Vector Component
      Red x
      Green y
      Blue z
      Alpha w
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      color - Color values.
      Throws:
      NullPointerException - If color is null
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.
    • setColori

      void setColori(int x, int y, @NotNull @NotNull org.joml.Vector3ic color) throws IllegalArgumentException, NullPointerException
      Set a pixel's color value in range [0..255]
      Color components
      Color Channel Vector Component
      Red x
      Green y
      Blue z
      Parameters:
      x - Pixel X coordinate
      y - Pixel Y coordinate
      color - Color values.
      Throws:
      NullPointerException - If color is null
      IllegalArgumentException - If either x or y is below 0 or above the width or height, respectively.