-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.component.shape.Shape
public class CorneredShape implements Shape
A Shape implementation with customizable corners.
-
-
Field Summary
Fields Modifier and Type Field Description private final CornertopLeftprivate final CornertopRightprivate final CornerbottomRightprivate final CornerbottomLeft
-
Constructor Summary
Constructors Constructor Description CorneredShape(Corner topLeft, Corner topRight, Corner bottomRight, Corner bottomLeft)
-
Method Summary
Modifier and Type Method Description final CornergetTopLeft()final CornergetTopRight()final CornergetBottomRight()final CornergetBottomLeft()final FloatgetCornerScale(Float width, Float height, Float density)Returns a scale factor for the corner size, which will prevent graphical glitches in case the size of the corners is larger than the shape’s dimensions. UnitdrawShape(DrawContext context, Paint paint, Path path, Float left, Float top, Float right, Float bottom)Draws the Shape on the canvas. UnitcreatePath(Float density, Path path, Float left, Float top, Float right, Float bottom)Adds a contour of this CorneredShape to the provided Path. -
-
Method Detail
-
getTopLeft
final Corner getTopLeft()
-
getTopRight
final Corner getTopRight()
-
getBottomRight
final Corner getBottomRight()
-
getBottomLeft
final Corner getBottomLeft()
-
getCornerScale
final Float getCornerScale(Float width, Float height, Float density)
Returns a scale factor for the corner size, which will prevent graphical glitches in case the size of the corners is larger than the shape’s dimensions.
-
drawShape
Unit drawShape(DrawContext context, Paint paint, Path path, Float left, Float top, Float right, Float bottom)
Draws the Shape on the canvas.
- Parameters:
context- holds environment data.paint- the Paint used to draw the shape.path- the Path defining the shape.left- the x coordinate of the left edge of the bounds in which the shape should be drawn.top- the y coordinate of the top edge of the bounds in which the shape should be drawn.right- the x coordinate of the right edge of the bounds in which the shape should be drawn.bottom- the y coordinate of the bottom edge of the bounds in which the shape should be drawn.
-
createPath
Unit createPath(Float density, Path path, Float left, Float top, Float right, Float bottom)
Adds a contour of this CorneredShape to the provided Path.
- Parameters:
density- the screen density.path- the Path to use.left- the left edge of the CorneredShape.top- the top edge of the CorneredShape.right- the right edge of the CorneredShape.bottom- the bottom edge of the CorneredShape.
-
-
-
-