Drawable

作者: MalDev | 来源:发表于2016-04-02 16:36 被阅读0次
    //设置去锯齿
    paint.setAntiAlias()
    //设置线条宽度
    paint.setStrokeWidth:
    
    canvas.drawCircle(40,40,30,paint)//画圆
    //public void drawCircle (float cx, float cy, float radius, Paint paint)
    /*
    cx  The x-coordinate of the center of the cirle to be drawn
    cy  The y-coordinate of the center of the cirle to be drawn
    radius  The radius of the cirle to be drawn
    paint   The paint used to draw the circle*/
    
    canvas.drawRect (float left, float top, float right, float bottom, Paint paint)//矩形
    
    //画多边形
    path.moveTo(float x, float y)
    //Set the beginning of the next contour to the point (x,y).
    path.lineTo(float x, float y)
    //Add a line from the last point to the specified point (x,y).
    path.Close();
    /*Close the current contour. If the current point is not equal to the first point of the contour, 
          a line segment is automatically added.*/
    canvas.drawPath (Path path, Paint paint)
    
    /*--------------设置渐变器后绘制-------------------*/
    
    
    Shader shader=public LinearGradient (float x0, float y0, float x1, float y1, int[] colors, float[] positions, Shader.TileMode tile)
    paint.setShader(shader);
    //设置阴影层
    paint.setShaderLayer();
    
    
    
    
    ---------------------Path类-----------------------------
    
    PathEffect effects=new PathEffect();
    effects[1]=new CornerPathEffect(10);
    effects[2]=new 
    
    /*
    public CornerPathEffect (float radius)
    Transforms geometries that are drawn (either STROKE or FILL styles) by replacing any sharp angles between line segments into rounded angles of the specified radius.
    Parameters
    radius  Amount to round sharp angles between line segments.  */
    
    
    /*public DashPathEffect (float[] intervals, float phase)
    The intervals array must contain an even number of entries (>=2), with the even indices specifying the "on" intervals, and the odd indices specifying the "off" intervals. phase is an offset into the intervals array (mod the sum of all of the intervals). The intervals array controls the length of the dashes. The paint's strokeWidth controls the thickness of the dashes. Note: this patheffect only affects drawing with the paint's style is set to STROKE or FILL_AND_STROKE. It is ignored if the drawing is done with style == FILL.
    
    Parameters
    intervals   array of ON and OFF distances
    phase   offset into the intervals array
    */
    
    

    相关文章

      网友评论

          本文标题:Drawable

          本文链接:https://www.haomeiwen.com/subject/xtkelttx.html