DrawableControlDrawer

public class DrawableControlDrawer implements ControlDrawer

A ControlDrawer that draws an drawable resource.

Types

Link copied to clipboard
public class DrawableProperties

Properties

Link copied to clipboard
private final Bitmap bitmap

Gets the bitmap to draw.

Link copied to clipboard
Link copied to clipboard
private final Float halfHeight

Gets half the value of height.

Link copied to clipboard
private final Float halfWidth

Gets half the value of width.

Link copied to clipboard
private final Float height

Gets for the scaled height dimension of the drawable.

Link copied to clipboard
private final Paint paint

Gets the drawer paint.

Link copied to clipboard
private Float scale
Link copied to clipboard
private final Float width

Gets the scaled width dimension of the drawable.

Functions

Link copied to clipboard
protected final Unit checkDrawableSize()

Check whether the dimensions of the drawable are similar, if not log an error message.

Link copied to clipboard
protected final Unit convertDrawableToBitmap()

Convert the drawable to a bitmap according the width and height dimensions.

Link copied to clipboard
public Unit draw(Canvas canvas, Control control)

Draw the control representation.

Link copied to clipboard
public final static DrawableControlDrawer fromDrawableRes(Context context, @DrawableRes() Integer id)
public final static DrawableControlDrawer fromDrawableRes(Context context, @DrawableRes() Integer id, Paint paint)
public final static DrawableControlDrawer fromDrawableRes(Context context, @DrawableRes() Integer id, Float scale)
public final static DrawableControlDrawer fromDrawableRes(Context context, @DrawableRes() Integer id, Float scale, Paint paint)

Instance a DrawableControlDrawer from context and a DrawableRes id.

Link copied to clipboard
protected Bitmap getBitmap()
Link copied to clipboard
protected RectF getDestination(Control control)

Gets the rectangle that the drawable will be scaled/translated to fit into.

Link copied to clipboard

Gets the drawable resource.

public final static Drawable getDrawable(Context context, @DrawableRes() Integer resourceId)

Obtains a drawable from a context and a DrawableRes id.

Link copied to clipboard
protected final Float getHalfHeight()
Link copied to clipboard
protected final Float getHalfWidth()
Link copied to clipboard
protected final Float getHeight()
Link copied to clipboard
protected Paint getPaint()
Link copied to clipboard

Gets the current position where the control is located and that the drawer will take as center to draw the drawable.

Link copied to clipboard
public Float getScale()

Gets the scale for the dimensions of the size of the drawable resource.

Link copied to clipboard
protected final Float getWidth()
Link copied to clipboard
public Unit setDrawable(Drawable drawable)

Sets the drawable resource.

Link copied to clipboard
public Unit setScale(Float scale)

Sets the scale for the dimensions of the size of the drawable resource.