-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.context.Extras,com.patrykandpatrick.vico.core.context.MeasureContext
public interface DrawContext implements MeasureContext
DrawContext is an extension of MeasureContext that stores a Canvas and other properties. It also defines helpful drawing functions.
-
-
Method Summary
Modifier and Type Method Description IntegersaveCanvas()Saves the Canvas state. abstract UnitwithOtherCanvas(Canvas canvas, Function1<DrawContext, Unit> block)Temporarily swaps the Canvas and yields DrawContext as the block’s receiver. UnitclipRect(Float left, Float top, Float right, Float bottom)Clips the Canvas to the specified rectangle. UnitclipRect(RectF rectF)Clips the Canvas to the specified rectF. UnitrestoreCanvas()Restores the Canvas state. UnitrestoreCanvasToCount(Integer count)Restores the Canvas state to the given save level. IntegersaveLayer(Float left, Float top, Float right, Float bottom)A convenience function for Canvas.saveLayer. abstract LonggetElevationOverlayColor()The elevation overlay color, applied to ShapeComponents that cast shadows. abstract CanvasgetCanvas()The canvas to draw the chart on. abstract RectFgetCanvasBounds()The bounds of the canvas that will be used to draw the chart and its components. abstract ChartValuesManagergetChartValuesManager()Manages the associated Chart’s ChartValues. abstract FloatgetDensity()The pixel density. abstract FloatgetFontScale()The font scale. abstract BooleangetIsLtr()Whether the layout direction is left-to-right. abstract BooleangetIsHorizontalScrollEnabled()Whether horizontal scrolling is enabled. abstract FloatgetChartScale()The scale of the chart. abstract HorizontalLayoutgetHorizontalLayout()Defines how the chart’s content is positioned horizontally. FloatgetLayoutDirectionMultiplier()FloatgetPixels(Float $self)IntegergetWholePixels(Float $self)-
Methods inherited from class com.patrykandpatrick.vico.core.context.DrawContext
reset, toFontSize, toPixels -
Methods inherited from class com.patrykandpatrick.vico.core.context.MeasureContext
clearExtras, consumeExtra, get, getExtra, hasExtra, putExtra, set -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
saveCanvas
Integer saveCanvas()
Saves the Canvas state.
-
withOtherCanvas
abstract Unit withOtherCanvas(Canvas canvas, Function1<DrawContext, Unit> block)
Temporarily swaps the Canvas and yields DrawContext as the block’s receiver.
-
clipRect
Unit clipRect(Float left, Float top, Float right, Float bottom)
Clips the Canvas to the specified rectangle.
-
restoreCanvas
Unit restoreCanvas()
Restores the Canvas state.
-
restoreCanvasToCount
Unit restoreCanvasToCount(Integer count)
Restores the Canvas state to the given save level.
-
saveLayer
Integer saveLayer(Float left, Float top, Float right, Float bottom)
A convenience function for Canvas.saveLayer.
-
getElevationOverlayColor
abstract Long getElevationOverlayColor()
The elevation overlay color, applied to ShapeComponents that cast shadows.
-
getCanvasBounds
abstract RectF getCanvasBounds()
The bounds of the canvas that will be used to draw the chart and its components.
-
getChartValuesManager
abstract ChartValuesManager getChartValuesManager()
Manages the associated Chart’s ChartValues.
-
getDensity
abstract Float getDensity()
The pixel density.
-
getFontScale
abstract Float getFontScale()
The font scale.
-
getIsHorizontalScrollEnabled
abstract Boolean getIsHorizontalScrollEnabled()
Whether horizontal scrolling is enabled.
-
getChartScale
abstract Float getChartScale()
The scale of the chart. Used to handle zooming in and out.
-
getHorizontalLayout
abstract HorizontalLayout getHorizontalLayout()
Defines how the chart’s content is positioned horizontally.
-
getLayoutDirectionMultiplier
Float getLayoutDirectionMultiplier()
-
getWholePixels
Integer getWholePixels(Float $self)
-
-
-
-