SketchbookController

class SketchbookController

SketchbookController interacts with Sketchbook and it allows you to control the canvas and all of the components with it.

Constructors

Link copied to clipboard
fun SketchbookController()

Functions

Link copied to clipboard
fun clear()

Clear drawn paths and the bitmap image.

Link copied to clipboard
fun clearImageBitmap()

Clear the image bitmap.

Link copied to clipboard
fun clearPaths()

Clear the drawn paths and redo paths on canvas..

Link copied to clipboard
fun getSketchbookBitmap(): ImageBitmap

Returns the current Sketchbook's bitmap.

Link copied to clipboard
fun redo()

Executes redo the drawn path if possible.

Link copied to clipboard
fun setBackgroundColor(color: Color)

Sets a background color.

Link copied to clipboard
fun setEraseMode(isEraseMode: Boolean)

Sets the erase mode or not.

Link copied to clipboard
fun setEraseRadius(eraseRadius: Float)

Sets the radius size of the erase circle.

Link copied to clipboard
fun setImageBitmap(bitmap: ImageBitmap?)

Sets an ImageBitmap to draw on the canvas as a background.

Link copied to clipboard
fun setLinearShader(colors: List<Color>)

Sets a color list as a linear shader to the paint.

Link copied to clipboard
fun setPaint(paint: Paint)

Sets a new Paint.

Link copied to clipboard
fun setPaintAlpha(alpha: Float)

Sets an alpha to the drawPaint.

Link copied to clipboard
fun setPaintColor(color: Color)

Sets a Color to the drawPaint.

Link copied to clipboard
fun setPaintingStyle(paintingStyle: PaintingStyle)

Sets a PaintingStyle to the drawPaint.

Link copied to clipboard
fun setPaintShader(shader: Shader?)

Sets a Shader to the drawPaint.

Link copied to clipboard
fun setPaintStrokeWidth(strokeWidth: Float)

Sets a stroke width to the drawPaint.

Link copied to clipboard
fun setPathEffect(pathEffect: PathEffect?)

Sets a PathEffect to the drawPaint.

Link copied to clipboard
fun setRainbowShader()

Sets a rainbow shader to the paint.

Link copied to clipboard
fun setSelectedColorIndex(index: Int)

Sets an index of the selected color.

Link copied to clipboard
fun toggleEraseMode()

Toggles the erase mode.

Link copied to clipboard
fun undo()

Executes undo the drawn path if possible.

Properties

Link copied to clipboard
val canRedo: State<Boolean>

Indicates can execute redo or not.

Link copied to clipboard
val canUndo: State<Boolean>

Indicates can execute undo or not.

Link copied to clipboard
val currentPaint: Paint

The current Paint to draws paths on canvas.

Link copied to clipboard
val currentPaintColor: State<Color>

MutableState of the current color of the Paint.

Link copied to clipboard
val isEraseMode: State<Boolean>

Indicates whether erase mode or not.