Class Shapes

java.lang.Object
fr.formiko.kokcinelo.tools.Shapes

public class Shapes extends Object
Tools to get Shapes that ShapeRenderer is not able to create.
Since:
0.2
Version:
2.4
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.badlogic.gdx.graphics.Pixmap
    createPixmap(int width, int height, com.badlogic.gdx.graphics.Color color, com.badlogic.gdx.graphics.Color color2)
    Create a pixmap with a single color.
    static space.earlygrey.shapedrawer.ShapeDrawer
    createShapeDrawer(com.badlogic.gdx.graphics.g2d.Batch batch)
     
    static void
    drawGradientOnPixmap(com.badlogic.gdx.graphics.Pixmap toDraw, com.badlogic.gdx.graphics.Color topColor, com.badlogic.gdx.graphics.Color bottomColor)
    Draw a gradiant over a pixmap.
    static com.badlogic.gdx.graphics.Texture
    getCircle(int radius, int edgeLength, int color)
    Return a circle with a thik border.
    static com.badlogic.gdx.graphics.Texture
    getCircle(int radius, int edgeLength, com.badlogic.gdx.graphics.Color color)
    Return a circle with a thik border.
    static com.badlogic.gdx.graphics.Texture
    getCircle(int radius, com.badlogic.gdx.graphics.Color color)
     
    static com.badlogic.gdx.graphics.g2d.Sprite
    getCircledSprite(int radius, com.badlogic.gdx.graphics.Color color, Creature... creatures)
    Return a sprite that fit into a circle.
    static com.badlogic.gdx.graphics.Texture
    getCircledTexture(int radius, com.badlogic.gdx.graphics.Color color, com.badlogic.gdx.graphics.Texture texture, float zoom)
    Return a texture that fit into a circle.
    static com.badlogic.gdx.graphics.Pixmap
    getMaskPixmap(float radius, float width, float height)
    Return pixmap without a centered circle of pixel.
    static com.badlogic.gdx.scenes.scene2d.utils.Drawable
    getOveredRectangle(int width, int height, com.badlogic.gdx.graphics.Color backgroundColor, int borderWidth, com.badlogic.gdx.graphics.Color borderColor)
     
    static com.badlogic.gdx.scenes.scene2d.utils.Drawable
    getRectangle(int width, int height, com.badlogic.gdx.graphics.Color color)
     
    static space.earlygrey.shapedrawer.ShapeDrawer
     
    static com.badlogic.gdx.graphics.glutils.ShapeRenderer
     
    static com.badlogic.gdx.scenes.scene2d.utils.Drawable
    Return a white background with transparency.
    static com.badlogic.gdx.scenes.scene2d.utils.Drawable
    getWhiteBackground(float alpha)
    Return a white background with transparency.
    static com.badlogic.gdx.graphics.Pixmap
    outLine(com.badlogic.gdx.graphics.Pixmap inPm)
    Add a black border over the shapes in a texture.
    static com.badlogic.gdx.graphics.Texture
    outLine(com.badlogic.gdx.graphics.Texture in)
    Add a black border over the shapes in a texture.
    static com.badlogic.gdx.graphics.Pixmap
    resize(com.badlogic.gdx.graphics.Pixmap inPm, int outWidth, int outheight)
    Resize a Pixmap.
    static com.badlogic.gdx.graphics.Texture
    resize(com.badlogic.gdx.graphics.Texture in, int outWidth, int outheight)
    Resize a Texture.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getShapeRenderer

      public static com.badlogic.gdx.graphics.glutils.ShapeRenderer getShapeRenderer()
    • getShapeDrawer

      public static space.earlygrey.shapedrawer.ShapeDrawer getShapeDrawer()
    • drawGradientOnPixmap

      public static void drawGradientOnPixmap(com.badlogic.gdx.graphics.Pixmap toDraw, com.badlogic.gdx.graphics.Color topColor, com.badlogic.gdx.graphics.Color bottomColor)
      Draw a gradiant over a pixmap.
      Parameters:
      toDraw - Pixmap to draw
      topColor - color of the top
      bottomColor - color of the bottom
    • getCircle

      public static com.badlogic.gdx.graphics.Texture getCircle(int radius, int edgeLength, int color)
      Return a circle with a thik border.
      Parameters:
      radius - radius of the circle
      edgeLength - length of the edge of the circle
      color - color of the circle
      Returns:
      a Pixmap with the circle in it
    • getCircle

      public static com.badlogic.gdx.graphics.Texture getCircle(int radius, com.badlogic.gdx.graphics.Color color)
    • getCircle

      public static com.badlogic.gdx.graphics.Texture getCircle(int radius, int edgeLength, com.badlogic.gdx.graphics.Color color)
      Return a circle with a thik border.
      Parameters:
      radius - radius of the circle
      edgeLength - length of the edge of the circle
      color - color of the circle
      Returns:
      a Pixmap with the circle in it
    • getCircledTexture

      public static com.badlogic.gdx.graphics.Texture getCircledTexture(int radius, com.badlogic.gdx.graphics.Color color, com.badlogic.gdx.graphics.Texture texture, float zoom)
      Return a texture that fit into a circle.
      Parameters:
      radius - radius of the circle
      color - color of the circle
      texture - texture to put into the circle
      zoom - zoom of the texture
      Returns:
      a texture that fit into a circle
    • resize

      public static com.badlogic.gdx.graphics.Texture resize(com.badlogic.gdx.graphics.Texture in, int outWidth, int outheight)
      Resize a Texture.
      Parameters:
      in - texture to resize
      outWidth - new width
      outheight - new height
      Returns:
      resized texture
    • resize

      public static com.badlogic.gdx.graphics.Pixmap resize(com.badlogic.gdx.graphics.Pixmap inPm, int outWidth, int outheight)
      Resize a Pixmap.
      Parameters:
      inPm - Pixmap to resize
      outWidth - new width
      outheight - new height
      Returns:
      resized Pixmap
    • outLine

      public static com.badlogic.gdx.graphics.Texture outLine(com.badlogic.gdx.graphics.Texture in)
      Add a black border over the shapes in a texture. For each pixel It check if the 4 next pixels are colored. If they are it, save location to be colored. For each location to color, it place a black pixel.
      Parameters:
      in - Texture to outline
      Returns:
      a new Texture with a black border over the shapes
    • outLine

      public static com.badlogic.gdx.graphics.Pixmap outLine(com.badlogic.gdx.graphics.Pixmap inPm)
      Add a black border over the shapes in a texture. For each pixel It check if the 4 next pixels are colored. If they are it, save location to be colored. For each location to color, it place a black pixel.
      Parameters:
      inPm - PixelMap to outline
      Returns:
      a new Pixmap with a black border over the shapes
    • createPixmap

      public static com.badlogic.gdx.graphics.Pixmap createPixmap(int width, int height, com.badlogic.gdx.graphics.Color color, @Null com.badlogic.gdx.graphics.Color color2)
      Create a pixmap with a single color.
      Parameters:
      width - width of pixmap
      height - height of pixmap
      color - color of pixmap
      color2 - 2a color of pixmap for gradient (optional)
    • createShapeDrawer

      public static space.earlygrey.shapedrawer.ShapeDrawer createShapeDrawer(com.badlogic.gdx.graphics.g2d.Batch batch)
    • getMaskPixmap

      public static com.badlogic.gdx.graphics.Pixmap getMaskPixmap(float radius, float width, float height)
      Return pixmap without a centered circle of pixel.
      Returns:
      pixmap without a centered circle of pixel
    • getCircledSprite

      public static com.badlogic.gdx.graphics.g2d.Sprite getCircledSprite(int radius, com.badlogic.gdx.graphics.Color color, Creature... creatures)
      Return a sprite that fit into a circle.
      Parameters:
      radius - radius of the circle
      color - color of the circle
      creatures - list of creatures to draw
      Returns:
      a sprite that fit into a circle
    • getWhiteBackground

      public static com.badlogic.gdx.scenes.scene2d.utils.Drawable getWhiteBackground(float alpha)
      Return a white background with transparency.
      Parameters:
      alpha - alpha of the background
      Returns:
      a white background
    • getWhiteBackground

      public static com.badlogic.gdx.scenes.scene2d.utils.Drawable getWhiteBackground()
      Return a white background with transparency.
      Returns:
      a white background
    • getOveredRectangle

      public static com.badlogic.gdx.scenes.scene2d.utils.Drawable getOveredRectangle(int width, int height, com.badlogic.gdx.graphics.Color backgroundColor, int borderWidth, @Null com.badlogic.gdx.graphics.Color borderColor)
    • getRectangle

      public static com.badlogic.gdx.scenes.scene2d.utils.Drawable getRectangle(int width, int height, com.badlogic.gdx.graphics.Color color)