Android UI开发专题之界面设计(2)

  同时Canvas类的一些字段保存着重要的绘制方法定义,比如Canvas.HAS_ALPHA_LAYER_SAVE_FLAG保存时需要alpha层,对于Canvas类提供的方法很多,每个都很重要,下面我们一一作介绍

  boolean clipPath(Path path)

  boolean clipPath(Path path,Region.Op op)

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

  boolean clipRect(Rect rect)

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

  boolean clipRect(Rect rect,Region.Op op)

  boolean clipRect(RectF rect)

  boolean clipRect(RectF rect,Region.Op op)

  boolean clipRect(int left, inttop, int right, int bottom)

  boolean clipRegion(Regionregion, Region.Op op)

  boolean clipRegion(Regionregion)

  void concat(Matrix matrix)

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

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

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

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

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

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

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

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

  void drawBitmapMesh(Bitmapbitmap, 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,Paint paint)

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

  void drawOval(RectF oval,Paint paint)

  void drawPaint(Paint paint)

  void drawPath(Path path, Paintpaint)

  void drawPicture(Picturepicture, RectF dst)

  void drawPicture(Picturepicture, Rect dst)

  void drawPicture(Picturepicture)

  void drawPoint(float x, floaty, 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 drawRGB(int r, int g, intb)

  void drawRect(RectF rect,Paint paint)

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

  void drawRect(Rect r, Paintpaint)

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

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

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

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

  void drawText(CharSequencetext, int start, int end, float x, float y, Paint paint)

  void drawTextOnPath(Stringtext, Path path, float hOffset, float vOffset, Paint paint)

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

  voiddrawVertices(Canvas.VertexMode mode, int vertexCount, float[] verts, intvertOffset, float[] texs, int texOffset, int[] colors, int colorOffset, short[]indices, int indexOffset, int indexCount, Paint paint)

  static void freeGlCaches()

  boolean getClipBounds(Rectbounds)

  final Rect getClipBounds()

  int getDensity()

  DrawFilter getDrawFilter()

  GL getGL()

  int getHeight()

  void getMatrix(Matrix ctm)

  final Matrix getMatrix()

  int getSaveCount()

  int getWidth()

  boolean isOpaque()

  boolean quickReject(Path path,Canvas.EdgeType type)

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

  boolean quickReject(RectFrect, Canvas.EdgeType type)

  void restore()

  void restoreToCount(intsaveCount)

  final void rotate(floatdegrees, float px, float py)

  void rotate(float degrees)

  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(RectFbounds, int alpha, int saveFlags)

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

  void scale(float sx, float sy)

  void setBitmap(Bitmap bitmap)

  void setDensity(int density)

  void setDrawFilter(DrawFilterfilter)

  void setMatrix(Matrix matrix)

  void setViewport(int width,int height)

  void skew(float sx, float sy)

  void translate(float dx, floatdy)

  五、android.graphics.Color

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwdzwz.html