Android
android.graphics.drawable.shapes
public abstract class

android.graphics.drawable.shapes.Shape

java.lang.Object
android.graphics.drawable.shapes.Shape

Defines a generic graphical "shape." Any Shape can be drawn to a Canvas with its own draw() method, but more graphical control is available if you instead pass it to a ShapeDrawable.

Known Direct Subclasses
Known Indirect Subclasses

Summary

Public Constructors

            Shape()

Public Methods

abstract          void  draw(Canvas canvas, Paint paint)
Draw this shape into the provided Canvas, with the provided Paint.
    final      float  getHeight()
Returns the height of the Shape.
    final      float  getWidth()
Returns the width of the Shape.
          boolean  hasAlpha()
Checks whether the Shape is opaque.
    final      void  resize(float width, float height)
Resizes the dimensions of this shape.

Protected Methods

          void  onResize(float width, float height)
Callback method called when resize(float, float) is executed.
Methods inherited from class java.lang.Object

Details

Public Constructors

public Shape()

Public Methods

public abstract void draw(Canvas canvas, Paint paint)

Draw this shape into the provided Canvas, with the provided Paint. Before calling this, you must call resize(float, float).

Parameters

canvas the Canvas within which this shape should be drawn
paint the Paint object that defines this shape's characteristics

public final float getHeight()

Returns the height of the Shape.

public final float getWidth()

Returns the width of the Shape.

public boolean hasAlpha()

Checks whether the Shape is opaque. Default impl returns true. Override if your subclass can be opaque.

Returns

  • true if any part of the drawable is not opaque.

public final void resize(float width, float height)

Resizes the dimensions of this shape. Must be called before draw(Canvas, Paint).

Parameters

width the width of the shape (in pixels)
height the height of the shape (in pixels)

Protected Methods

protected void onResize(float width, float height)

Callback method called when resize(float, float) is executed.

Parameters

width the new width of the Shape
height the new height of the Shape
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48