Skip to main content

Drawable

declare class Drawable {}

Drawable

Instance Method

constructor

declare class Drawable {
constructor();
constructor(drawable: Drawable);
}
  • Description

    Create a new Drawable

draw

declare class Drawable {
draw(canvas: Canvas): void
}
  • Description

    Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).

setAlpha

declare class Drawable {
setAlpha(alpha: number): void
}
  • Description

    Specify an alpha value for the drawable.

onBoundsChange

declare class Drawable {
onBoundsChange(bounds: Rect): void
}
  • Description

    Override this in your subclass to change appearance if you vary based on the bounds.

copyBounds

declare class Drawable {
copyBounds() : Rect
}
  • Description

    Return a copy of the drawable's bounds in a new Rect.

copyBounds

declare class Drawable {
copyBounds(bounds: Rect): void
}
  • Description

    Return a copy of the drawable's bounds in the specified Rect (allocated by the caller).

getMinimumWidth

declare class Drawable {
getMinimumWidth(): number
}
  • Description

    Returns the minimum width suggested by this Drawable.

getMinimumHeight

declare class Drawable {
getMinimumHeight(): number
}
  • Description

    Returns the minimum height suggested by this Drawable.

getBounds

declare class Drawable {
getBounds(): Rect
}
  • Description

    Return the drawable's bounds Rect.

getOutline

declare class Drawable {
getOutline(outline:Outline):void
}
  • Description

    Called to get the drawable to populate the Outline that defines its drawing area.

getCallback

declare class Drawable {
getCallback() :Drawable.Callback
}
  • Description

    Return the current Callback implementation attached to this Drawable.

getIntrinsicWidth

declare class Drawable {
getIntrinsicWidth(): number
}
  • Description

    Returns the drawable's intrinsic width.

getIntrinsicHeight

declare class Drawable {
getIntrinsicHeight():number
}
  • Description

    Returns the drawable's intrinsic height.

getIntrinsicHeight

declare class Drawable {
setBounds(bounds: Rect): void;
setBounds(left: number, top: number, right: number, bottom: number): void;
}
  • Description

    Specify a bounding rectangle for the Drawable.

setCallback

declare class Drawable {
setCallback(callback: Drawable.Callback): void
}
  • Description

    Bind a Callback object to this Drawable.

Drawable.ConstantState

ConstantState

declare abstract class ConstantState {
public abstract newDrawable(): Drawable;

public newResourcesDrawable(res: Resources): Drawable;

public abstract getChangingConfigurations(): number;
}

Instance Method

newDrawable

declare class ConstantState {
newDrawable(): Drawable
}
  • Description

    Creates a new Drawable instance from its constant state.

newResourcesDrawable

declare class ConstantState {
newResourcesDrawable(res: Resources): Drawable
}
  • Description

    Creates a new Drawable instance from its constant state using the specified resources.

getChangingConfigurations

declare class ConstantState {
getChangingConfigurations(): number
}
  • Description

    Return a bit mask of configuration changes that will impact this drawable (and thus require completely reloading it).

Drawable.Callback

Callback

declare interface Callback {
invalidateDrawable(who:Drawable): void

scheduleDrawable(who: Drawable, what: Runnable, when: number): void

unScheduleDrawable(who: Drawable, what: Runnable): void
}

Instance Method

invalidateDrawable

declare class ConstantState {
invalidateDrawable(who:Drawable): void
}
  • Description

    Called when the drawable needs to be redrawn.

scheduleDrawable

declare class ConstantState {
scheduleDrawable(who: Drawable, what: Runnable, when: number): void
}
  • Description

    A Drawable can call this to schedule the next frame of its animation.

unScheduleDrawable

declare class ConstantState {
unScheduleDrawable(who: Drawable, what: Runnable): void
}
  • Description

    A Drawable can call this to unschedule an action previously scheduled with scheduleDrawable(Drawable, Runnable, long).