Class AwtTextureRenderer

java.lang.Object
juuxel.libninepatch.AwtTextureRenderer
All Implemented Interfaces:
ContextualTextureRenderer<BufferedImage,​Void>, TextureRenderer<BufferedImage>

public final class AwtTextureRenderer extends Object implements TextureRenderer<BufferedImage>
Renders a BufferedImage using AWT's Graphics.
  • Constructor Details

    • AwtTextureRenderer

      public AwtTextureRenderer​(Graphics g)
      Constructs an AwtTextureRenderer from a Graphics object.
      Parameters:
      g - the Graphics used for drawing
  • Method Details

    • draw

      public void draw​(BufferedImage texture, int x, int y, int width, int height, float u1, float v1, float u2, float v2)
      Description copied from interface: TextureRenderer
      Draws rectangular region of a texture.
      Specified by:
      draw in interface TextureRenderer<BufferedImage>
      Parameters:
      texture - the texture
      x - the leftmost X coordinate of the target drawing region
      y - the topmost Y coordinate of the target drawing region
      width - the width of the target region
      height - the height of the target region
      u1 - the left edge of the input region as a fraction from 0 to 1
      v1 - the top edge of the input region as a fraction from 0 to 1
      u2 - the right edge of the input region as a fraction from 0 to 1
      v2 - the bottom edge of the input region as a fraction from 0 to 1