FileDocCategorySizeDatePackage
PathShape.javaAPI DocAndroid 1.5 API2606Wed May 06 22:42:00 BST 2009android.graphics.drawable.shapes

PathShape

public class PathShape extends Shape
Creates geometric paths, utilizing the {@link android.graphics.Path} class. The path can be drawn to a Canvas with its own draw() method, but more graphical control is available if you instead pass the PathShape to a {@link android.graphics.drawable.ShapeDrawable}.

Fields Summary
private android.graphics.Path
mPath
private float
mStdWidth
private float
mStdHeight
private float
mScaleX
private float
mScaleY
Constructors Summary
public PathShape(android.graphics.Path path, float stdWidth, float stdHeight)
PathShape constructor.

param
path a Path that defines the geometric paths for this shape
param
stdWidth the standard width for the shape. Any changes to the width with resize() will result in a width scaled based on the new width divided by this width.
param
stdHeight the standard height for the shape. Any changes to the height with resize() will result in a height scaled based on the new height divided by this height.

        mPath = path;
        mStdWidth = stdWidth;
        mStdHeight = stdHeight;
    
Methods Summary
public android.graphics.drawable.shapes.PathShapeclone()

        PathShape shape = (PathShape) super.clone();
        shape.mPath = new Path(mPath);
        return shape;
    
public voiddraw(android.graphics.Canvas canvas, android.graphics.Paint paint)

        canvas.save();
        canvas.scale(mScaleX, mScaleY);
        canvas.drawPath(mPath, paint);
        canvas.restore();
    
protected voidonResize(float width, float height)

        mScaleX = width / mStdWidth;
        mScaleY = height / mStdHeight;