android.graphics
Class Canvas

java.lang.Object
  extended by android.graphics.Canvas

public class Canvas
extends Object


Nested Class Summary
static class Canvas.EdgeType
           
static class Canvas.VertexMode
           
 
Field Summary
static int ALL_SAVE_FLAG
           
static int CLIP_SAVE_FLAG
           
static int CLIP_TO_LAYER_SAVE_FLAG
           
static int FULL_COLOR_LAYER_SAVE_FLAG
           
static int HAS_ALPHA_LAYER_SAVE_FLAG
           
static int MATRIX_SAVE_FLAG
           
 
Constructor Summary
Canvas()
           
Canvas(Bitmap bitmap)
           
 
Method Summary
 boolean clipPath(Path path)
           
 boolean clipPath(Path path, Region.Op op)
           
 boolean clipRect(float left, float top, float right, float bottom)
           
 boolean clipRect(float left, float top, float right, float bottom, Region.Op op)
           
 boolean clipRect(int left, int top, int right, int bottom)
           
 boolean clipRect(Rect rect)
           
 boolean clipRect(RectF rect)
           
 boolean clipRect(RectF rect, Region.Op op)
           
 boolean clipRect(Rect rect, Region.Op op)
           
 boolean clipRegion(Region region)
           
 boolean clipRegion(Region region, Region.Op op)
           
 void concat(Matrix matrix)
           
 void drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)
           
 void drawARGB(int a, int r, int g, int b)
           
 void drawBitmap(Bitmap bitmap, float left, float top, Paint paint)
           
 void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint)
           
 void drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint)
           
 void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)
           
 void drawBitmap(int[] colors, int offset, int stride, float x, float y, int width, int height, boolean hasAlpha, Paint paint)
           
 void drawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, boolean hasAlpha, Paint paint)
           
 void drawBitmapMesh(Bitmap bitmap, int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors, int colorOffset, Paint paint)
           
 void drawCircle(float cx, float cy, float radius, Paint paint)
           
 void drawColor(int color)
           
 void drawColor(int color, PorterDuff.Mode mode)
           
 void drawLine(float startX, float startY, float stopX, float stopY, Paint paint)
           
 void drawLines(float[] pts, int offset, int count, Paint paint)
           
 void drawLines(float[] pts, Paint paint)
           
 void drawOval(RectF oval, Paint paint)
           
 void drawPaint(Paint paint)
           
 void drawPath(Path path, Paint paint)
           
 void drawPicture(Picture picture)
           
 void drawPicture(Picture picture, Rect dst)
           
 void drawPicture(Picture picture, RectF dst)
           
 void drawPoint(float x, float y, Paint paint)
           
 void drawPoints(float[] pts, int offset, int count, Paint paint)
           
 void drawPoints(float[] pts, Paint paint)
           
 void drawPosText(char[] text, int index, int count, float[] pos, Paint paint)
           
 void drawPosText(String text, float[] pos, Paint paint)
           
 void drawRect(float left, float top, float right, float bottom, Paint paint)
           
 void drawRect(RectF rect, Paint paint)
           
 void drawRect(Rect r, Paint paint)
           
 void drawRGB(int r, int g, int b)
           
 void drawRoundRect(RectF rect, float rx, float ry, Paint paint)
           
 void drawText(char[] text, int index, int count, float x, float y, Paint paint)
           
 void drawText(CharSequence text, int start, int end, float x, float y, Paint paint)
           
 void drawText(String text, float x, float y, Paint paint)
           
 void drawText(String text, int start, int end, float x, float y, Paint paint)
           
 void drawTextOnPath(char[] text, int index, int count, Path path, float hOffset, float vOffset, Paint paint)
           
 void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint)
           
 void drawVertices(Canvas.VertexMode mode, int vertexCount, float[] verts, int vertOffset, float[] texs, int texOffset, int[] colors, int colorOffset, short[] indices, int indexOffset, int indexCount, Paint paint)
           
 Rect getClipBounds()
           
 boolean getClipBounds(Rect bounds)
           
 int getDensity()
           
 DrawFilter getDrawFilter()
           
 int getHeight()
           
 Matrix getMatrix()
           
 void getMatrix(Matrix ctm)
           
 int getMaximumBitmapHeight()
           
 int getMaximumBitmapWidth()
           
 int getSaveCount()
           
 int getWidth()
           
 boolean isHardwareAccelerated()
           
 boolean isOpaque()
           
 boolean quickReject(float left, float top, float right, float bottom, Canvas.EdgeType type)
           
 boolean quickReject(Path path, Canvas.EdgeType type)
           
 boolean quickReject(RectF rect, Canvas.EdgeType type)
           
 void restore()
           
 void restoreToCount(int saveCount)
           
 void rotate(float degrees)
           
 void rotate(float degrees, float px, float py)
           
 int save()
           
 int save(int saveFlags)
           
 int saveLayer(float left, float top, float right, float bottom, Paint paint, int saveFlags)
           
 int saveLayer(RectF bounds, Paint paint, int saveFlags)
           
 int saveLayerAlpha(float left, float top, float right, float bottom, int alpha, int saveFlags)
           
 int saveLayerAlpha(RectF bounds, int alpha, int saveFlags)
           
 void scale(float sx, float sy)
           
 void scale(float sx, float sy, float px, float py)
           
 void setBitmap(Bitmap bitmap)
           
 void setDensity(int density)
           
 void setDrawFilter(DrawFilter filter)
           
 void setMatrix(Matrix matrix)
           
 void skew(float sx, float sy)
           
 void translate(float dx, float dy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MATRIX_SAVE_FLAG

public static final int MATRIX_SAVE_FLAG
See Also:
Constant Field Values

CLIP_SAVE_FLAG

public static final int CLIP_SAVE_FLAG
See Also:
Constant Field Values

HAS_ALPHA_LAYER_SAVE_FLAG

public static final int HAS_ALPHA_LAYER_SAVE_FLAG
See Also:
Constant Field Values

FULL_COLOR_LAYER_SAVE_FLAG

public static final int FULL_COLOR_LAYER_SAVE_FLAG
See Also:
Constant Field Values

CLIP_TO_LAYER_SAVE_FLAG

public static final int CLIP_TO_LAYER_SAVE_FLAG
See Also:
Constant Field Values

ALL_SAVE_FLAG

public static final int ALL_SAVE_FLAG
See Also:
Constant Field Values
Constructor Detail

Canvas

public Canvas()

Canvas

public Canvas(Bitmap bitmap)
Method Detail

isHardwareAccelerated

public boolean isHardwareAccelerated()

setBitmap

public void setBitmap(Bitmap bitmap)

isOpaque

public boolean isOpaque()

getWidth

public int getWidth()

getHeight

public int getHeight()

getDensity

public int getDensity()

setDensity

public void setDensity(int density)

getMaximumBitmapWidth

public int getMaximumBitmapWidth()

getMaximumBitmapHeight

public int getMaximumBitmapHeight()

save

public int save()

save

public int save(int saveFlags)

saveLayer

public int saveLayer(RectF bounds,
                     Paint paint,
                     int saveFlags)

saveLayer

public int saveLayer(float left,
                     float top,
                     float right,
                     float bottom,
                     Paint paint,
                     int saveFlags)

saveLayerAlpha

public int saveLayerAlpha(RectF bounds,
                          int alpha,
                          int saveFlags)

saveLayerAlpha

public int saveLayerAlpha(float left,
                          float top,
                          float right,
                          float bottom,
                          int alpha,
                          int saveFlags)

restore

public void restore()

getSaveCount

public int getSaveCount()

restoreToCount

public void restoreToCount(int saveCount)

translate

public void translate(float dx,
                      float dy)

scale

public void scale(float sx,
                  float sy)

scale

public final void scale(float sx,
                        float sy,
                        float px,
                        float py)

rotate

public void rotate(float degrees)

rotate

public final void rotate(float degrees,
                         float px,
                         float py)

skew

public void skew(float sx,
                 float sy)

concat

public void concat(Matrix matrix)

setMatrix

public void setMatrix(Matrix matrix)

getMatrix

public void getMatrix(Matrix ctm)

getMatrix

public final Matrix getMatrix()

clipRect

public boolean clipRect(RectF rect,
                        Region.Op op)

clipRect

public boolean clipRect(Rect rect,
                        Region.Op op)

clipRect

public boolean clipRect(RectF rect)

clipRect

public boolean clipRect(Rect rect)

clipRect

public boolean clipRect(float left,
                        float top,
                        float right,
                        float bottom,
                        Region.Op op)

clipRect

public boolean clipRect(float left,
                        float top,
                        float right,
                        float bottom)

clipRect

public boolean clipRect(int left,
                        int top,
                        int right,
                        int bottom)

clipPath

public boolean clipPath(Path path,
                        Region.Op op)

clipPath

public boolean clipPath(Path path)

clipRegion

public boolean clipRegion(Region region,
                          Region.Op op)

clipRegion

public boolean clipRegion(Region region)

getDrawFilter

public DrawFilter getDrawFilter()

setDrawFilter

public void setDrawFilter(DrawFilter filter)

quickReject

public boolean quickReject(RectF rect,
                           Canvas.EdgeType type)

quickReject

public boolean quickReject(Path path,
                           Canvas.EdgeType type)

quickReject

public boolean quickReject(float left,
                           float top,
                           float right,
                           float bottom,
                           Canvas.EdgeType type)

getClipBounds

public boolean getClipBounds(Rect bounds)

getClipBounds

public final Rect getClipBounds()

drawRGB

public void drawRGB(int r,
                    int g,
                    int b)

drawARGB

public void drawARGB(int a,
                     int r,
                     int g,
                     int b)

drawColor

public void drawColor(int color)

drawColor

public void drawColor(int color,
                      PorterDuff.Mode mode)

drawPaint

public void drawPaint(Paint paint)

drawPoints

public void drawPoints(float[] pts,
                       int offset,
                       int count,
                       Paint paint)

drawPoints

public void drawPoints(float[] pts,
                       Paint paint)

drawPoint

public void drawPoint(float x,
                      float y,
                      Paint paint)

drawLine

public void drawLine(float startX,
                     float startY,
                     float stopX,
                     float stopY,
                     Paint paint)

drawLines

public void drawLines(float[] pts,
                      int offset,
                      int count,
                      Paint paint)

drawLines

public void drawLines(float[] pts,
                      Paint paint)

drawRect

public void drawRect(RectF rect,
                     Paint paint)

drawRect

public void drawRect(Rect r,
                     Paint paint)

drawRect

public void drawRect(float left,
                     float top,
                     float right,
                     float bottom,
                     Paint paint)

drawOval

public void drawOval(RectF oval,
                     Paint paint)

drawCircle

public void drawCircle(float cx,
                       float cy,
                       float radius,
                       Paint paint)

drawArc

public void drawArc(RectF oval,
                    float startAngle,
                    float sweepAngle,
                    boolean useCenter,
                    Paint paint)

drawRoundRect

public void drawRoundRect(RectF rect,
                          float rx,
                          float ry,
                          Paint paint)

drawPath

public void drawPath(Path path,
                     Paint paint)

drawBitmap

public void drawBitmap(Bitmap bitmap,
                       float left,
                       float top,
                       Paint paint)

drawBitmap

public void drawBitmap(Bitmap bitmap,
                       Rect src,
                       RectF dst,
                       Paint paint)

drawBitmap

public void drawBitmap(Bitmap bitmap,
                       Rect src,
                       Rect dst,
                       Paint paint)

drawBitmap

public void drawBitmap(int[] colors,
                       int offset,
                       int stride,
                       float x,
                       float y,
                       int width,
                       int height,
                       boolean hasAlpha,
                       Paint paint)

drawBitmap

public void drawBitmap(int[] colors,
                       int offset,
                       int stride,
                       int x,
                       int y,
                       int width,
                       int height,
                       boolean hasAlpha,
                       Paint paint)

drawBitmap

public void drawBitmap(Bitmap bitmap,
                       Matrix matrix,
                       Paint paint)

drawBitmapMesh

public void drawBitmapMesh(Bitmap bitmap,
                           int meshWidth,
                           int meshHeight,
                           float[] verts,
                           int vertOffset,
                           int[] colors,
                           int colorOffset,
                           Paint paint)

drawVertices

public void drawVertices(Canvas.VertexMode mode,
                         int vertexCount,
                         float[] verts,
                         int vertOffset,
                         float[] texs,
                         int texOffset,
                         int[] colors,
                         int colorOffset,
                         short[] indices,
                         int indexOffset,
                         int indexCount,
                         Paint paint)

drawText

public void drawText(char[] text,
                     int index,
                     int count,
                     float x,
                     float y,
                     Paint paint)

drawText

public void drawText(String text,
                     float x,
                     float y,
                     Paint paint)

drawText

public void drawText(String text,
                     int start,
                     int end,
                     float x,
                     float y,
                     Paint paint)

drawText

public void drawText(CharSequence text,
                     int start,
                     int end,
                     float x,
                     float y,
                     Paint paint)

drawPosText

public void drawPosText(char[] text,
                        int index,
                        int count,
                        float[] pos,
                        Paint paint)

drawPosText

public void drawPosText(String text,
                        float[] pos,
                        Paint paint)

drawTextOnPath

public void drawTextOnPath(char[] text,
                           int index,
                           int count,
                           Path path,
                           float hOffset,
                           float vOffset,
                           Paint paint)

drawTextOnPath

public void drawTextOnPath(String text,
                           Path path,
                           float hOffset,
                           float vOffset,
                           Paint paint)

drawPicture

public void drawPicture(Picture picture)

drawPicture

public void drawPicture(Picture picture,
                        RectF dst)

drawPicture

public void drawPicture(Picture picture,
                        Rect dst)


Copyright © 2008-2012. All Rights Reserved.