类android.graphics.PathEffect源码实例Demo

下面列出了怎么用android.graphics.PathEffect的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: OXChart   文件: LinesChart.java
/**绘制X轴方向辅助网格*/
private void drawGrid(Canvas canvas){
    float yMarkSpace = (rectChart.bottom - rectChart.top)/(YMARK_NUM-1);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(lineWidth);
    paint.setColor(defColor);
    paintEffect.setStyle(Paint.Style.STROKE);
    paintEffect.setStrokeWidth(lineWidth);
    paintEffect.setColor(defColor);
    canvas.drawLine(rectChart.left, rectChart.top, rectChart.left, rectChart.bottom, paint);
    canvas.drawLine(rectChart.right, rectChart.top, rectChart.right, rectChart.bottom, paint);

    for (int i = 0; i < YMARK_NUM; i++) {
        if(i==0||i ==YMARK_NUM-1) {   //实线
            canvas.drawLine(rectChart.left, rectChart.bottom-yMarkSpace*i,
                    rectChart.right, rectChart.bottom-yMarkSpace*i, paint);
        } else {              //虚线
            Path path = new Path();
            path.moveTo(rectChart.left, rectChart.bottom-yMarkSpace*i);
            path.lineTo(rectChart.right,rectChart.bottom-yMarkSpace*i);
            PathEffect effects = new DashPathEffect(new float[]{15,8,15,8},0);
            paintEffect.setPathEffect(effects);
            canvas.drawPath(path, paintEffect);
        }
    }
}
 
public static @Nullable PathEffect getPathEffect(BorderStyle style, float borderWidth) {
  switch (style) {
    case SOLID:
      return null;

    case DASHED:
      return new DashPathEffect(
          new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);

    case DOTTED:
      return new DashPathEffect(
          new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);

    default:
      return null;
  }
}
 
源代码3 项目: weex   文件: WXBackgroundDrawable.java
public
@Nullable
PathEffect getPathEffect(float borderWidth) {
  switch (this) {
    case SOLID:
      return null;

    case DASHED:
      return new DashPathEffect(
          new float[]{borderWidth * 3, borderWidth * 3, borderWidth * 3, borderWidth * 3}, 0);

    case DOTTED:
      return new DashPathEffect(
          new float[]{borderWidth, borderWidth, borderWidth, borderWidth}, 0);

    default:
      return null;
  }
}
 
源代码4 项目: richmaps   文件: RichPolygon.java
RichPolygon(final int zIndex,
            final List<RichPoint> points,
            final List<List<RichPoint>> holes,
            final int strokeWidth,
            final Paint.Cap strokeCap,
            final Paint.Join strokeJoin,
            final PathEffect pathEffect,
            final MaskFilter maskFilter,
            final boolean linearGradient,
            final Integer strokeColor,
            final boolean antialias,
            final boolean closed,
            final Shader strokeShader,
            final Shader fillShader,
            final Paint.Style style,
            final Integer fillColor) {
    super(zIndex, points, strokeWidth, strokeCap, strokeJoin, pathEffect, maskFilter,
            strokeShader, linearGradient, strokeColor, antialias, closed);
    this.fillShader = fillShader;
    this.style = style;
    this.fillColor = fillColor;
    if (holes != null) {
        addHoles(holes);
    }
}
 
源代码5 项目: Bugstick   文件: BugView.java
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvas.drawColor(Color.BLACK);

    pathMeasure.setPath(path, false);
    float length = pathMeasure.getLength();

    if (length > BUG_TRAIL_DP * density) {
        // Note - this is likely a poor way to accomplish the result. Just for demo purposes.
        @SuppressLint("DrawAllocation")
        PathEffect effect = new DashPathEffect(new float[]{length, length}, -length + BUG_TRAIL_DP * density);
        paint.setPathEffect(effect);
    }

    paint.setStyle(Paint.Style.STROKE);
    canvas.drawPath(path, paint);

    paint.setStyle(Paint.Style.FILL);
    canvas.drawCircle(position.x, position.y, BUG_RADIUS_DP * density, paint);
}
 
源代码6 项目: OXChart   文件: NightingaleRoseChart.java
public void init(Context context, AttributeSet attrs, int defStyleAttr) {
    dataList = new ArrayList<>();
    DisplayMetrics dm = getResources().getDisplayMetrics();
    ScrHeight = dm.heightPixels;
    ScrWidth = dm.widthPixels;

    //画笔初始化
    paintArc = new Paint();
    paintArc.setAntiAlias(true);

    paintLabel = new Paint();
    paintLabel.setAntiAlias(true);

    paintSelected = new Paint();
    paintSelected.setColor(Color.LTGRAY);
    paintSelected.setStyle(Paint.Style.STROKE);//设置空心
    paintSelected.setStrokeWidth(lineWidth*5);
    paintSelected.setAntiAlias(true);

    mLinePaint = new Paint();
    mLinePaint.setStyle(Paint.Style.FILL);
    mLinePaint.setStrokeWidth(lineWidth);
    mLinePaint.setAntiAlias(true);


    mlableLinePaint = new Paint();
    mlableLinePaint.setStyle(Paint.Style.STROKE);
    mlableLinePaint.setColor(Color.DKGRAY);
    mlableLinePaint.setStrokeWidth(3);
    // PathEffect是用来控制绘制轮廓(线条)的方式
    // 代码中的float数组,必须是偶数长度,且>=2,指定了多少长度的实线之后再画多少长度的空白
    // .如本代码中,绘制长度5的实线,再绘制长度5的空白,再绘制长度5的实线,再绘制长度5的空白,依次重复.1是偏移量,可以不用理会.
    PathEffect effects = new DashPathEffect(new float[]{5,5,5,5},1);
    mlableLinePaint.setPathEffect(effects);


}
 
源代码7 项目: OXChart   文件: NorthSouthChart.java
/**绘制X轴方向辅助网格*/
private void drawGrid(Canvas canvas){
    float yMarkSpace = (rectChart.bottom - rectChart.top)/(YMARK_NUM-1);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(lineWidth);
    paint.setColor(defColor);
    paintEffect.setStyle(Paint.Style.STROKE);
    paintEffect.setStrokeWidth(lineWidth);
    paintEffect.setColor(defColor);
    canvas.drawLine(rectChart.left, rectChart.top, rectChart.left, rectChart.bottom, paint);
    canvas.drawLine(rectChart.right, rectChart.top, rectChart.right, rectChart.bottom, paint);
    if(chartType==ChartType.TYPE_T_SOUTH||chartType==ChartType.TYPE_T_NORTH){
        //今日图表,需要绘制x刻度线
        for(DataPoint lable : lableXPointList){
            canvas.drawLine(lable.getValueY(), rectChart.bottom, lable.getValueY(),
                    rectChart.bottom-DensityUtil.dip2px(getContext(), 3), paint);
        }
    }
    for (int i = 0; i < YMARK_NUM; i++) {
        if(i==0||i ==YMARK_NUM-1) {   //实线
            canvas.drawLine(rectChart.left, rectChart.bottom-yMarkSpace*i,
                    rectChart.right, rectChart.bottom-yMarkSpace*i, paint);
        } else {              //虚线
            Path path = new Path();
            path.moveTo(rectChart.left, rectChart.bottom-yMarkSpace*i);
            path.lineTo(rectChart.right,rectChart.bottom-yMarkSpace*i);
            PathEffect effects = new DashPathEffect(new float[]{15,8,15,8},0);
            paintEffect.setPathEffect(effects);
            canvas.drawPath(path, paintEffect);
        }
    }
}
 
源代码8 项目: ChannelManageDemo_Java   文件: ItemDragCallback.java
public ItemDragCallback(ChannelAdapter mAdapter, int mPadding) {
    this.mAdapter = mAdapter;
    this.mPadding = mPadding;
    mPaint = new Paint();
    mPaint.setColor(Color.GRAY);
    mPaint.setAntiAlias(true);
    mPaint.setStrokeWidth(1);
    mPaint.setStyle(Paint.Style.STROKE);
    PathEffect pathEffect = new DashPathEffect(new float[]{5f, 5f}, 5f);    //虚线
    mPaint.setPathEffect(pathEffect);
}
 
源代码9 项目: TicketView   文件: TicketView.java
private void setDividerPaint() {
    mDividerPaint.setAlpha(0);
    mDividerPaint.setAntiAlias(true);
    mDividerPaint.setColor(mDividerColor);
    mDividerPaint.setStrokeWidth(mDividerWidth);

    if (mDividerType == DividerType.DASH)
        mDividerPaint.setPathEffect(new DashPathEffect(new float[]{(float) mDividerDashLength, (float) mDividerDashGap}, 0.0f));
    else
        mDividerPaint.setPathEffect(new PathEffect());
}
 
源代码10 项目: JustDraw   文件: JustContext.java
public void setLineDash(V8Array intervals) {
    float[] floatIntervals = new float[intervals.length()];
    for (int i = 0; i < intervals.length(); i++) {
        floatIntervals[i] = (float)((double)intervals.getDouble(i));
    }

    PathEffect effects = new DashPathEffect(floatIntervals, 1);
    mPaintStroke.setPathEffect(effects);

    intervals.release();
}
 
源代码11 项目: LazyRecyclerAdapter   文件: BindNormalActivity.java
public void init() {

        normalAdapterManager = new BindSuperAdapterManager();
        normalAdapterManager
                .bind(BindImageModel.class, BindImageHolder.ID, BindImageHolder.class)
                .bind(BindTextModel.class, BindTextHolder.ID, BindTextHolder.class)
                .bind(BindMutliModel.class, BindMutliHolder.ID, BindMutliHolder.class)
                .bind(BindClickModel.class, BindClickHolder.ID, BindClickHolder.class)
                .bindEmpty(BindNoDataHolder.NoDataModel.class, BindNoDataHolder.ID, BindNoDataHolder.class)
                .setNeedAnimation(true)
                .setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(Context context, int position) {
                        Toast.makeText(context, "点击了!! " + position, Toast.LENGTH_SHORT).show();
                    }
                });


        adapter = new BindRecyclerAdapter(this, normalAdapterManager, datas);

        recycler.setLayoutManager(new LinearLayoutManager(this));


        //间隔线
        Paint paint = new Paint();
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(getResources().getColor(R.color.material_deep_teal_200));
        PathEffect effects = new DashPathEffect(new float[]{5, 5, 5, 5}, 1);
        paint.setPathEffect(effects);
        paint.setStrokeWidth(dip2px(this, 5));
        recycler.addItemDecoration(new BindDecorationBuilder(adapter).setPaint(paint).setSpace(dip2px(this, 5)).builder());

        recycler.setAdapter(adapter);

    }
 
源代码12 项目: GSYRickText   文件: CustomClickAtUserSpan.java
@Override
public void updateDrawState(TextPaint ds) {
    super.updateDrawState(ds);
    ds.setUnderlineText(true);
    //间隔线
    ds.setStyle(Paint.Style.STROKE);
    PathEffect effects = new DashPathEffect(new float[]{1, 1}, 1);
    ds.setPathEffect(effects);
    ds.setStrokeWidth(5);
}
 
源代码13 项目: GSYRickText   文件: CustomClickTopicSpan.java
@Override
public void updateDrawState(TextPaint ds) {
    super.updateDrawState(ds);
    ds.setUnderlineText(true);
    ds.setStyle(Paint.Style.FILL_AND_STROKE);
    PathEffect effects = new DashPathEffect(new float[]{1, 1}, 1);
    ds.setPathEffect(effects);
    ds.setStrokeWidth(2);
}
 
源代码14 项目: richmaps   文件: RichShape.java
RichShape(final int zIndex,
          final List<RichPoint> points,
          final int strokeWidth,
          final Paint.Cap strokeCap,
          final Paint.Join strokeJoin,
          final PathEffect pathEffect,
          final MaskFilter maskFilter,
          final Shader strokeShader,
          final boolean linearGradient,
          final Integer strokeColor,
          final boolean antialias,
          final boolean closed) {
    this.zIndex = zIndex;
    this.strokeWidth = strokeWidth;
    this.strokeCap = strokeCap;
    this.strokeJoin = strokeJoin;
    this.pathEffect = pathEffect;
    this.maskFilter = maskFilter;
    this.strokeShader = strokeShader;
    this.linearGradient = linearGradient;
    this.strokeColor = strokeColor;
    this.antialias = antialias;
    this.closed = closed;
    if (points != null) {
        for (RichPoint point : points) {
            add(point);
        }
    }
}
 
源代码15 项目: richmaps   文件: RichPolyline.java
RichPolyline(final int zIndex,
             final List<RichPoint> points,
             final int strokeWidth,
             final Paint.Cap strokeCap,
             final Paint.Join strokeJoin,
             final PathEffect pathEffect,
             final MaskFilter maskFilter,
             final Shader strokeShader,
             final boolean linearGradient,
             final Integer strokeColor,
             final boolean antialias,
             final boolean closed) {
    super(zIndex, points, strokeWidth, strokeCap, strokeJoin, pathEffect, maskFilter,
            strokeShader, linearGradient, strokeColor, antialias, closed);
}
 
源代码16 项目: SuntimesWidget   文件: WorldMapEquirectangular.java
@Override
public void drawMajorLatitudes(Canvas c, int w, int h, double[] mid, WorldMapTask.WorldMapOptions options)
{
    Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
    p.setXfermode(new PorterDuffXfermode( options.hasTransparentBaseMap ? PorterDuff.Mode.DST_OVER : PorterDuff.Mode.SRC_OVER ));

    Paint.Style prevStyle = p.getStyle();
    PathEffect prevEffect = p.getPathEffect();
    float prevStrokeWidth = p.getStrokeWidth();

    float strokeWidth = sunStroke(c, options) * options.latitudeLineScale;
    p.setStrokeWidth(strokeWidth);

    p.setColor(options.latitudeColors[0]);                    // equator
    p.setPathEffect((options.latitudeLinePatterns[0][0] > 0) ? new DashPathEffect(options.latitudeLinePatterns[0], 0) : null);
    c.drawLine(0, (int)mid[1], w, (int)mid[1], p);

    double tropics = r_tropics * mid[1];
    int tropicsY0 = (int)(mid[1] + tropics);
    int tropicsY1 = (int)(mid[1] - tropics);
    p.setColor(options.latitudeColors[1]);                    // tropics
    p.setPathEffect((options.latitudeLinePatterns[1][0] > 0) ? new DashPathEffect(options.latitudeLinePatterns[1], 0) : null);
    c.drawLine(0, tropicsY0, w, tropicsY0, p);
    c.drawLine(0, tropicsY1, w, tropicsY1, p);

    double polar = r_polar * mid[1];
    int polarY0 = (int)(mid[1] + polar);
    int polarY1 = (int)(mid[1] - polar);
    p.setColor(options.latitudeColors[2]);                    // polar
    p.setPathEffect((options.latitudeLinePatterns[2][0] > 0) ? new DashPathEffect(options.latitudeLinePatterns[2], 0) : null);
    c.drawLine(0, polarY0, w, polarY0, p);
    c.drawLine(0, polarY1, w, polarY1, p);

    p.setStyle(prevStyle);
    p.setPathEffect(prevEffect);
    p.setStrokeWidth(prevStrokeWidth);
    p.setXfermode(new PorterDuffXfermode( PorterDuff.Mode.SRC_OVER) );
}
 
源代码17 项目: SuntimesWidget   文件: WorldMapEquiazimuthal.java
@Override
public void drawMajorLatitudes(Canvas c, int w, int h, double[] mid, WorldMapTask.WorldMapOptions options)
{
    Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
    p.setXfermode(options.hasTransparentBaseMap ? new PorterDuffXfermode(PorterDuff.Mode.DST_OVER) : new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));

    Paint.Style prevStyle = p.getStyle();
    PathEffect prevEffect = p.getPathEffect();
    float prevStrokeWidth = p.getStrokeWidth();

    double equator = mid[1] * r_equator;
    double tropics = mid[1] * r_tropics;
    double polar = mid[1] * r_polar;

    float strokeWidth = sunStroke(c, options) * options.latitudeLineScale;
    p.setStrokeWidth(strokeWidth);
    p.setStyle(Paint.Style.STROKE);
    p.setStrokeCap(Paint.Cap.ROUND);

    p.setColor(options.latitudeColors[0]);
    p.setPathEffect((options.latitudeLinePatterns[0][0] > 0) ? new DashPathEffect(options.latitudeLinePatterns[0], 0) : null);

    c.drawCircle((int)mid[0], (int)mid[1], (int)equator, p);

    p.setColor(options.latitudeColors[1]);
    p.setPathEffect((options.latitudeLinePatterns[1][0] > 0) ? new DashPathEffect(options.latitudeLinePatterns[1], 0) : null);
    c.drawCircle((int)mid[0], (int)mid[1], (int)(equator + tropics), p);
    c.drawCircle((int)mid[0], (int)mid[1], (int)(equator - tropics), p);

    p.setColor(options.latitudeColors[2]);
    p.setPathEffect((options.latitudeLinePatterns[2][0] > 0) ? new DashPathEffect(options.latitudeLinePatterns[2], 0) : null);
    c.drawCircle((int)mid[0], (int)mid[1], (int)(equator + polar), p);
    c.drawCircle((int)mid[0], (int)mid[1], (int)(equator - polar), p);

    p.setStyle(prevStyle);
    p.setPathEffect(prevEffect);
    p.setStrokeWidth(prevStrokeWidth);
}
 
源代码18 项目: MiBandDecompiled   文件: XYChart.java
private void a(android.graphics.Paint.Cap cap, android.graphics.Paint.Join join, float f1, android.graphics.Paint.Style style, PathEffect patheffect, Paint paint)
{
    paint.setStrokeCap(cap);
    paint.setStrokeJoin(join);
    paint.setStrokeMiter(f1);
    paint.setPathEffect(patheffect);
    paint.setStyle(style);
}
 
源代码19 项目: nfcard   文件: SpanFormatter.java
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top,
		int y, int bottom, Paint paint) {

	canvas.save();
	canvas.translate(x, (bottom + top) / 2 - height);

	final int c = paint.getColor();
	final float w = paint.getStrokeWidth();
	final Style s = paint.getStyle();
	final PathEffect e = paint.getPathEffect();

	paint.setColor(color);
	paint.setStyle(Paint.Style.STROKE);
	paint.setStrokeWidth(height);
	paint.setPathEffect(effe);

	path.moveTo(x, 0);
	path.lineTo(x + width, 0);

	canvas.drawPath(path, paint);

	paint.setColor(c);
	paint.setStyle(s);
	paint.setStrokeWidth(w);
	paint.setPathEffect(e);

	canvas.restore();
}
 
源代码20 项目: RecyclerViewDecoration   文件: RVPaint.java
public static void drawDashLine(Canvas canvas, Paint paint, int dashWidth, int dashGap
        , int startX, int startY, int stopX, int stopY) {
    if (dashWidth == 0 && dashGap == 0) {
        PathEffect effects = new DashPathEffect(new float[]{0, 0, dashWidth, paint.getStrokeWidth()}, dashGap);
        paint.setPathEffect(effects);
    }
    canvas.drawLine(startX, startY, stopX, stopY, paint);

}
 
源代码21 项目: NFCard   文件: SpanFormatter.java
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top,
		int y, int bottom, Paint paint) {

	canvas.save();
	canvas.translate(x, (bottom + top) / 2 - height);

	final int c = paint.getColor();
	final float w = paint.getStrokeWidth();
	final Style s = paint.getStyle();
	final PathEffect e = paint.getPathEffect();

	paint.setColor(color);
	paint.setStyle(Paint.Style.STROKE);
	paint.setStrokeWidth(height);
	paint.setPathEffect(effe);

	path.moveTo(x, 0);
	path.lineTo(x + width, 0);

	canvas.drawPath(path, paint);

	paint.setColor(c);
	paint.setStyle(s);
	paint.setStrokeWidth(w);
	paint.setPathEffect(e);

	canvas.restore();
}
 
源代码22 项目: UltimateAndroid   文件: DiscrollvablePathLayout.java
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    makeAndMeasurePath();

    if(!isInEditMode()) {
        // Apply the dash effect
        float length = mPathMeasure.getLength();
        PathEffect effect = new DashPathEffect(new float[] {length, length }, length * (1 - mRatio));
        mPaint.setPathEffect(effect);
    }

    canvas.drawPath(mPath, mPaint);
}
 
源代码23 项目: UltimateAndroid   文件: HomeDiagram.java
/**
 * 绘制竖线
 * 
 * @param c
 */
public void drawStraightLine(Canvas c) {
	paint_dottedline.setColor(fineLineColor);
	int count_line = 0;
	for (int i = 0; i < milliliter.size(); i++) {
		if (count_line == 0) {
			c.drawLine(interval_left_right * i, 0, interval_left_right * i,
					getHeight(), paint_date);
		}
		if (count_line == 2) {
			c.drawLine(interval_left_right * i, tb * 1.5f,
					interval_left_right * i, getHeight(), paint_date);
		}
		if (count_line == 1 || count_line == 3) {
			Path path = new Path();
			path.moveTo(interval_left_right * i, tb * 1.5f);
			path.lineTo(interval_left_right * i, getHeight());
			PathEffect effects = new DashPathEffect(new float[] { tb * 0.3f,
					tb * 0.3f, tb * 0.3f, tb * 0.3f }, tb * 0.1f);
			paint_dottedline.setPathEffect(effects);
			c.drawPath(path, paint_dottedline);
		}
		count_line++;
		if (count_line >= 4) {
			count_line = 0;
		}
	}
	c.drawLine(0, getHeight() - tb * 0.2f, getWidth(), getHeight() - tb
			* 0.2f, paint_brokenline_big);
}
 
源代码24 项目: UltimateAndroid   文件: DiscrollvablePathLayout.java
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    makeAndMeasurePath();

    if(!isInEditMode()) {
        // Apply the dash effect
        float length = mPathMeasure.getLength();
        PathEffect effect = new DashPathEffect(new float[] {length, length }, length * (1 - mRatio));
        mPaint.setPathEffect(effect);
    }

    canvas.drawPath(mPath, mPaint);
}
 
源代码25 项目: AndroidLinkup   文件: PathView.java
public PathView(Activity linkup) {
    this((Context) linkup);

    // 根据屏幕分辨率设置path宽度
    Display mDisplay = linkup.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    mDisplay.getSize(size);
    pathWidth = size.x / 60;

    paint.setStrokeWidth(pathWidth);
    PathEffect effect = new DashPathEffect(new float[] { pathWidth, pathWidth }, 0);
    paint.setPathEffect(effect);
}
 
源代码26 项目: AndroidLinkup   文件: PathView.java
public PathView(Context context) {
    super(context);

    paint.setStyle(Style.STROKE);
    paint.setStrokeWidth(pathWidth);
    paint.setColor(getResources().getColor(R.color.path_color));
    PathEffect effect = new DashPathEffect(new float[] { pathWidth, pathWidth }, 0);
    paint.setPathEffect(effect);

    alphaAnim.setDuration(500);
    HideAnimation hideAnim = new HideAnimation(this);
    alphaAnim.setAnimationListener(hideAnim);

    setVisibility(View.GONE);
}
 
源代码27 项目: OpenMapKitAndroid   文件: SafePaint.java
@Override
public PathEffect setPathEffect(PathEffect effect) {
    if (effect instanceof DashPathEffect) {
        throw new RuntimeException(
                "Do not use DashPathEffect. Use SafeDashPathEffect instead.");
    }
    return super.setPathEffect(effect);
}
 
源代码28 项目: android-graphics-demo   文件: HollowTextActivity.java
private PathEffect getTrianglePathEffect(int strokeWidth) {
  return new PathDashPathEffect(
      getTriangle(strokeWidth),
      strokeWidth,
      0.0f,
      PathDashPathEffect.Style.ROTATE);
}
 
源代码29 项目: SimplePomodoro-android   文件: LineView.java
private void drawBackgroundLines(Canvas canvas){
        Paint paint = new Paint();
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(MyUtils.dip2px(getContext(),1f));
        paint.setColor(BACKGROUND_LINE_COLOR);
        PathEffect effects = new DashPathEffect(
                new float[]{10,5,10,5}, 1);

        //draw vertical lines
        for(int i=0;i<xCoordinateList.size();i++){
            canvas.drawLine(xCoordinateList.get(i),
                    0,
                    xCoordinateList.get(i),
                    mViewHeight - bottomTextTopMargin - bottomTextHeight-bottomTextDescent,
                    paint);
        }

        //draw dotted lines
//        paint.setPathEffect(effects);
//        Path dottedPath = new Path();
        for(int i=0;i<yCoordinateList.size();i++){
            if((yCoordinateList.size()-1-i)%dataOfAGird == 0){
//                dottedPath.moveTo(0, yCoordinateList.get(i));
//                dottedPath.lineTo(getWidth(), yCoordinateList.get(i));
                canvas.drawLine(0,yCoordinateList.get(i),getWidth(),yCoordinateList.get(i),paint);
//                canvas.drawPath(dottedPath, paint);
            }
        }

        //draw bottom text
        if(bottomTextList != null){
            for(int i=0;i<bottomTextList.size();i++){
                canvas.drawText(bottomTextList.get(i), sideLineLength+backgroundGridWidth*i,
                        mViewHeight-bottomTextDescent, bottomTextPaint);
            }
        }
    }
 
源代码30 项目: assertj-android   文件: AbstractPaintAssert.java
public S hasPathEffect(PathEffect effect) {
  isNotNull();
  PathEffect actualEffect = actual.getPathEffect();
  assertThat(actualEffect) //
      .overridingErrorMessage("Expected path effect <%s> but was <%s>.", effect, actualEffect) //
      .isSameAs(effect);
  return myself;
}
 
 类所在包
 类方法
 同包方法