Package fr.formiko.kokcinelo.tools
Class Shapes
java.lang.Object
fr.formiko.kokcinelo.tools.Shapes
Tools to get Shapes that ShapeRenderer is not able to create.
- Since:
- 0.2
- Version:
- 2.4
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
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 drawtopColor
- color of the topbottomColor
- 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 circleedgeLength
- length of the edge of the circlecolor
- 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 circleedgeLength
- length of the edge of the circlecolor
- 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 circlecolor
- color of the circletexture
- texture to put into the circlezoom
- 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 resizeoutWidth
- new widthoutheight
- 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 resizeoutWidth
- new widthoutheight
- 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 pixmapheight
- height of pixmapcolor
- color of pixmapcolor2
- 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 circlecolor
- color of the circlecreatures
- 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)
-