微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.graphics.PathEffect的实例源码

项目:Rotatable-scalable-Font    文件WidgetTextFrame.java   
public WidgetTextFrame(Context context,@Nullable AttributeSet attrs) {
    super(context,attrs);
    setClipChildren(false);
    setClipToPadding(false);
    mContext = context.getApplicationContext();
    mPaddingSpace = context.getResources().getDimensionPixelSize(R.dimen.edit_text_space);

    mRoundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    PathEffect effect = new DashPathEffect(new float[]{20,20},1);
    mRoundPaint.setAntiAlias(true);
    mRoundPaint.setColor(getResources().getColor(R.color.edit_text_background_color));
    mRoundPaint.setPathEffect(effect);
    mRoundPaint.setStyle(Paint.Style.stroke);
    mRoundPaint.setstrokeWidth(3);

    mDeletePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mDeletePaint.setAntiAlias(true);
    mDeletePaint.setFilterBitmap(true);
    mDeletePaint.setDither(true);

    setwillNotDraw(false);
}
项目:RNLearn_Project1    文件ReactViewBackgroundDrawable.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},0);

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

    default:
      return null;
  }
}
项目:gmlrva    文件SimpleDividerItemdecorationSpec.java   
/**
 * Procedure meant to set the value for {@link #mDrawnDivider} optional parameter.
 * @param color the divider's target {@link Color} value.
 *              See {@link Paint#setColor(int)} for more @R_264_4045@ion.
 * @param thickness the divider's target line thickness value. This value must be greater or equal than 0.
 *                  See {@link Paint#setstrokeWidth(float)} for more @R_264_4045@ion.
 * @param style the divider's target {@link Paint.Style}.
 *              See {@link Paint#setStyle(Paint.Style)} for more @R_264_4045@ion.
 * @param pathEffect the divider's target {@link PathEffect}.
 *                   See {@link Paint#setPathEffect(PathEffect)} for more @R_264_4045@ion.
 * @return the same object builder object after setting the optional attribute.
 */
@NonNull
public decorationSpecBuilder withDrawnDivider(@ColorInt int color,@FloatRange(from = 0,fromInclusive = false) float thickness,@Nullable final Paint.Style style,@Nullable final PathEffect pathEffect) {
    mDrawnDivider = new Paint();
    mDrawnDivider.setColor(color);
    mDrawnDivider.setstrokeWidth(thickness);
    if (style != null) {
        mDrawnDivider.setStyle(style);
    }
    if (pathEffect != null) {
        mDrawnDivider.setPathEffect(pathEffect);
    }
    return this;
}
项目:ReactNativeSignatureExample    文件ReactViewBackgroundDrawable.java   
public @Nullable PathEffect getPathEffect(float borderWidth) {
  switch (this) {
    case SOLID:
      return null;

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

    default:
      return null;
  }
}
项目:react-native-ibeacon-android    文件ReactViewBackgroundDrawable.java   
public @Nullable PathEffect getPathEffect(float borderWidth) {
  switch (this) {
    case SOLID:
      return null;

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

    default:
      return null;
  }
}
项目:react-native-Box-loaders    文件ReactViewBackgroundDrawable.java   
public @Nullable PathEffect getPathEffect(float borderWidth) {
  switch (this) {
    case SOLID:
      return null;

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

    default:
      return null;
  }
}
项目:Ironman    文件ReactViewBackgroundDrawable.java   
public @Nullable PathEffect getPathEffect(float borderWidth) {
  switch (this) {
    case SOLID:
      return null;

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

    default:
      return null;
  }
}
项目: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},0);

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

    default:
      return null;
  }
}
项目:DxLoadingButton    文件LoadingButton.java   
private void createFailedPath(){

        if(mFailedPath != null){
            mFailedPath.reset();
            mFailedPath2.reset();
        }else{
            mFailedPath = new Path();
            mFailedPath2 = new Path();
        }

        float left = width/2 - mRadius + mRadius/2;
        float top = mRadius/2 + mPadding;

        mFailedPath.moveto(left,top);
        mFailedPath.lineto(left+mRadius,top+mRadius);

        mFailedPath2.moveto(width/2 + mRadius/2,top);
        mFailedPath2.lineto(width/2 - mRadius + mRadius/2,top+mRadius);

        PathMeasure measure = new PathMeasure(mFailedPath,false);
        mFailedPathLength = measure.getLength();
        mFailedPathIntervals = new float[]{mFailedPathLength,mFailedPathLength};

        PathEffect PathEffect = new DashPathEffect(mFailedPathIntervals,mFailedPathLength);
        mPathEffectPaint2.setPathEffect(PathEffect);
    }
项目: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);
    }
}
项目:DirectionFieldAndroid    文件PhasePlane.java   
public void setPoints(ArrayList<float[]> pointsToPath){
    synchronized (pointsToPath) {
        this.points = pointsToPath;
        float[] startPoint = convertXYToLinePoint(points.get(0));
        path.moveto(startPoint[0],startPoint[1]);
        for (int i = 0; i<this.points.size(); i++) {
            float[] linePoint = convertXYToLinePoint(points.get(i));
            path.lineto(linePoint[0],linePoint[1]);
        }
    }
    pathMeasure = new PathMeasure(path,false);
    pathLength = pathMeasure.getLength(); // the interpolated length of the entire path as it would be drawn on the screen in dp
    PathEffect pathEffect = new PathDashPathEffect(makeConvexArrow(15.0f,15.0f),5.0f,0.0f,PathDashPathEffect.Style.ROTATE);
    paintSettings.setPathEffect(pathEffect);
    invalidate();
}
项目: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);
}
项目:CUT-IN-material    文件PathEffectsCutin.java   
public SampleView(Context context) {
    super(context);
    setFocusable(true);
    setFocusableInTouchMode(true);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.stroke);
    mPaint.setstrokeWidth(6);

    mPath = makeFollowPath();

    mEffects = new PathEffect[6];

    mBonds = new RectF();

    mColors = new int[] { Color.BLACK,Color.RED,Color.BLUE,Color.GREEN,Color.magenta,Color.BLACK
                        };
}
项目:distanceRangeBar    文件distanceRangeBar.java   
void draw(Canvas canvas) {
    RectF rectF = new RectF(mLeftX,mY,mRightX,mY);
    canvas.drawRoundRect(rectF,mBarWeight / 2,mBarPaint);

    Path path = new Path();
    path.moveto(mLeftX + mMargin,mY);
    path.lineto(mRightX - mMargin,mY);
    PathEffect effects = new DashPathEffect(new float[]{5,5,5},1);
    mEffectPaint.setPathEffect(effects);
    canvas.drawPath(path,mEffectPaint);
}
项目:buildAPKsApps    文件XYChart.java   
private void setstroke(Cap cap,Join join,float miter,Style style,PathEffect pathEffect,Paint paint) {
  paint.setstrokeCap(cap);
  paint.setstrokeJoin(join);
  paint.setstrokeMiter(miter);
  paint.setPathEffect(pathEffect);
  paint.setStyle(style);
}
项目: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());
}
项目:android-study    文件PathEffectView.java   
public PathEffectView(Context context,AttributeSet attrs) {
  super(context,attrs);
  mPaint = new Paint();
  mPaint.setStyle(Paint.Style.stroke);
  mPaint.setstrokeWidth(5);
  mPaint.setColor(Color.DKGRAY);
  mPath = new Path();
  mPath.moveto(0,0);
  for (int i = 0; i <= 30; i++) {
    mPath.lineto(i * 35,(float) (Math.random() * 100));
  }
  mEffects = new PathEffect[6];
}
项目:radiocom-android    文件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 * (1 - mRatio));
        mPaint.setPathEffect(effect);
    }

    canvas.drawPath(mPath,mPaint);
}
项目:Tools    文件HexagonDrawable.java   
public HexagonDrawable(@ColorInt int color,float width,float height,float padding)
{
    mWidth = width;
    mHeight = height;
    mPadding = padding;

    mLenght = width/2 - mPadding*2;

    mOrigin_x = mWidth/2;
    mOrigin_y = mHeight/2;

    //六边形路径
    mPath = new Path();
    mPath.moveto(mOrigin_x,mOrigin_y - mLenght);
    mPath.lineto((float) (mOrigin_x + Math.sqrt(3f)*mLenght/2),mOrigin_y - mLenght/2);
    mPath.lineto((float) (mOrigin_x + Math.sqrt(3f)*mLenght/2),mOrigin_y + mLenght/2);
    mPath.lineto(mOrigin_x,mOrigin_y + mLenght);
    mPath.lineto((float) (mOrigin_x - Math.sqrt(3f)*mLenght/2),mOrigin_y + mLenght/2);
    mPath.lineto((float) (mOrigin_x - Math.sqrt(3f)*mLenght/2),mOrigin_y - mLenght/2);
    mPath.close();

    //初始化画笔
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(color);
    mPaint.setStyle(Paint.Style.FILL_AND_stroke);
    mPaint.setstrokeWidth(1f);
    //连线节点平滑处理
    PathEffect pathEffect = new CornerPathEffect(10);
    mPaint.setPathEffect(pathEffect);
}
项目:CircleProgressView    文件CustomView.java   
@Override
protected void onDraw(final Canvas canvas) {
    super.onDraw(canvas);
    canvas.drawCircle(100,100,mPaint);
    PathEffect pathEffect = new DashPathEffect(new float[]{10,0);
    mPaint.setstrokeWidth(100);
    mPaint.setPathEffect(pathEffect);
    canvas.drawLine(200,200,mPaint);
}
项目: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();
}
项目:truth-android    文件AbstractPaintSubject.java   
public S hasPathEffect(PathEffect effect) {
  assertthat(actual().getPathEffect())
      .named("path effect")
      .isSameAs(effect);
  //noinspection unchecked
  return (S) this;
}
项目: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,1);
        paint.setPathEffect(effects);
        paint.setstrokeWidth(dip2px(this,5));
        recycler.addItemdecoration(new BinddecorationBuilder(adapter).setPaint(paint).setSpace(dip2px(this,5)).builder());

        recycler.setAdapter(adapter);

    }
项目:iOffice    文件SheetView.java   
/**
 * draw moving header line when changing header height or width
 * @param canvas
 */
private void drawMovingHeaderLine(Canvas canvas)
{
    if(isDrawMovingHeaderLine && selectedHeaderInfor != null)
    {

        Paint paint = PaintKit.instance().getPaint();
        //save paint property      
        int oldColor = paint.getColor();
        PathEffect oldpathEffect = paint.getPathEffect();
        Rect clipRect = canvas.getClipBounds();

        paint.setColor(Color.BLACK);
        paint.setStyle(Paint.Style.stroke);
        Path path = new Path();        
        if(selectedHeaderInfor.getType() == FocusCell.ROWHEADER)
        {    
            //Rect rect = ModelUtil.instance().getCellAnchor(this,selectedHeaderInfor.getRow(),0);
            path.moveto(0,selectedHeaderInfor.getRect().bottom);       
            path.lineto(clipRect.right,selectedHeaderInfor.getRect().bottom);

        }
        else if(selectedHeaderInfor.getType() == FocusCell.COLUMNHEADER)
        {  
            path.moveto(selectedHeaderInfor.getRect().right,0);       
            path.lineto(selectedHeaderInfor.getRect().right,clipRect.bottom);
        }

        paint.setPathEffect(effects);       
        canvas.drawPath(path,paint); 

        //restore
        paint.setPathEffect(oldpathEffect);
        paint.setStyle(Paint.Style.FILL);
        paint.setColor(oldColor);

    }
}
项目:iOffice    文件XYChart.java   
private void setstroke(Cap cap,Paint paint) 
{
    paint.setstrokeCap(cap);
    paint.setstrokeJoin(join);
    paint.setstrokeMiter(miter);
    paint.setPathEffect(pathEffect);
    paint.setStyle(style);
}
项目:RickText    文件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);
}
项目:RickText    文件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);
    ds.setPathEffect(effects);
    ds.setstrokeWidth(2);
}
项目:richmaps    文件RichShape.java   
RichShape(final int zIndex,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);
        }
    }
}
项目:richmaps    文件Richpolyline.java   
Richpolyline(final int zIndex,final boolean closed) {
    super(zIndex,closed);
}
项目:WiCamera3D    文件AuxiliaryLine.java   
public AuxiliaryLine(Context context,AttributeSet attributeSet) {
    super(context,attributeSet);
    previewwidth = getWidth();
    previewheight = getHeight();
    Log.e("AuxiliaryLine"," 长宽为" + previewwidth + "*" + previewheight);
    type = 0;
    myPaint = new Paint();
    myPaint.setColor(Color.rgb(230,230,230));
    myPaint.setStyle(Paint.Style.stroke);
    myPaint.setstrokeWidth(1);
    myPaint.setAntiAlias(true);
    PathEffect effects = new DashPathEffect(new float[]{8,8,8},0.5f);  
    myPaint.setPathEffect(effects);  
}
项目:WiCamera3D    文件PanoramaProgressIndicator.java   
@Override
protected void onDraw(Canvas canvas) {
    //画背景图片
    if(mType==0)
    {
        if(isToFast||isWrongPose)
        {
            canvas.drawBitmap(backgroundWrongImage,src,des,null);
        }
        else
        {
            canvas.drawBitmap(backgroundImage,null);
        }
    }
    else
    {
        canvas.drawBitmap(backgroundImage,null);
    }

    float rate_src= getRate();
    //画进度条
    canvas.drawBitmap(progressImage,getSrcRect(src,rate_src),getDesRect(des,null);
    if(mType==0)
    {
         canvas.drawLine(0,0.5f*viewheight,viewwidth,mLinePaint_);
          Path path = new Path();       
            path.moveto(0,linestart);  
            path.lineto(viewwidth,viewheight-linestart);        
            PathEffect effects = new DashPathEffect(new float[]{6,6,6},1);  
            mLinePaint.setPathEffect(effects);  
            canvas.drawPath(path,mLinePaint);  


        // canvas.drawLine(0,linestart,viewheight-linestart,mLinePaint);
    }

    }
项目:ioiometer    文件XYChart.java   
private void setstroke(Cap cap,Paint paint) {
  paint.setstrokeCap(cap);
  paint.setstrokeJoin(join);
  paint.setstrokeMiter(miter);
  paint.setPathEffect(pathEffect);
  paint.setStyle(style);
}
项目:topodroid    文件SymbolLine.java   
SymbolLine( String name,String th_name,String fname,String group,int color,PathEffect effect_dir,PathEffect effect_rev )
{
  super( th_name,fname );
  init( name,group,color,width );
  mPaint.setPathEffect( effect_dir );
  mRevPaint.setPathEffect( effect_rev );
  mHasEffect = true;
  makePath();
}
项目:achartengine    文件XYChart.java   
/**
 * Draws the series.
 * 
 * @param series the series
 * @param canvas the canvas
 * @param paint the paint object
 * @param pointsList the points to be rendered
 * @param seriesRenderer the series renderer
 * @param yAxisValue the y axis value in pixels
 * @param seriesIndex the series index
 * @param or the orientation
 * @param startIndex the start index of the rendering points
 */
protected void drawSeries(XYSeries series,Canvas canvas,Paint paint,List<Float> pointsList,XYSeriesRenderer seriesRenderer,float yAxisValue,int seriesIndex,Orientation or,int startIndex) {
  Basicstroke stroke = seriesRenderer.getstroke();
  Cap cap = paint.getstrokeCap();
  Join join = paint.getstrokeJoin();
  float miter = paint.getstrokeMiter();
  PathEffect pathEffect = paint.getPathEffect();
  Style style = paint.getStyle();
  if (stroke != null) {
    PathEffect effect = null;
    if (stroke.getIntervals() != null) {
      effect = new DashPathEffect(stroke.getIntervals(),stroke.getPhase());
    }
    setstroke(stroke.getCap(),stroke.getJoin(),stroke.getMiter(),Style.FILL_AND_stroke,effect,paint);
  }
  // float[] points = MathHelper.getFloats(pointsList);
  drawSeries(canvas,paint,pointsList,seriesRenderer,yAxisValue,seriesIndex,startIndex);
  drawPoints(canvas,startIndex);
  paint.setTextSize(seriesRenderer.getChartValuesTextSize());
  if (or == Orientation.HORIZONTAL) {
    paint.setTextAlign(Align.CENTER);
  } else {
    paint.setTextAlign(Align.LEFT);
  }
  if (seriesRenderer.isdisplayChartValues()) {
    paint.setTextAlign(seriesRenderer.getChartValuesTextAlign());
    drawChartValuesText(canvas,series,startIndex);
  }
  if (stroke != null) {
    setstroke(cap,join,miter,style,paint);
  }
}
项目:achartengine    文件XYChart.java   
private void setstroke(Cap cap,Paint paint) {
  paint.setstrokeCap(cap);
  paint.setstrokeJoin(join);
  paint.setstrokeMiter(miter);
  paint.setPathEffect(pathEffect);
  paint.setStyle(style);
}
项目:FxExplorer    文件CodeEditText.java   
private void init(Context context,AttributeSet attrs,int defStyleAttr,int defStyleRes) {
    if (attrs != null && !isInEditMode()) {
        TypedArray ta;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            ta = context.obtainStyledAttributes(attrs,R.styleable.CodeEditText,defStyleAttr,defStyleRes);
        } else {
            ta = context.obtainStyledAttributes(attrs,R.styleable.CodeEditText);
        }
        fontFamily = ta.getString(R.styleable.CodeEditText_fontFamily);
        if (!TextUtils.isEmpty(fontFamily)) {
            setTypeface(Typeface.createFromAsset(context.getAssets(),fontFamily));
        } else {
            setTypeface(Typeface.MONOSPACE);
        }
        showLineNumber = ta.getBoolean(R.styleable.CodeEditText_showLineNumber,true);
        lineNumberColor = ta.getColor(R.styleable.CodeEditText_numberColor,Color.BLACK);
        ta.recycle();
    }
    numberMargin = (int) (context.getResources().getdisplayMetrics().density * 3 + 0.5);
    mRect = new Rect();
    lineNumberPaint = new Paint();
    lineNumberPaint.setStyle(Paint.Style.stroke);
    lineNumberPaint.setTypeface(getTypeface());
    lineNumberPaint.setAntiAlias(true);
    lineNumberPaint.setFakeBoldText(false);
    lineNumberPaint.setSubpixelText(true);
    PathEffect effect = new DashPathEffect(new float[]{4,4,4},1);
    lineNumberPaint.setPathEffect(effect);
    lineNumberPaint.setColor(lineNumberColor);
}
项目:FxExplorer    文件CodeEditText.java   
@Override
protected void onDraw(Canvas canvas) {
    long st = System.currentTimeMillis();
    if (showLineNumber) {
        int height = getHeight();
        int line_height = getLineHeight();
        int count = height / line_height;
        if (getLineCount() > count) {
            count = getLineCount();//for long text with scrolling
        }
        Rect r = mRect;
        Paint paint = lineNumberPaint;
        String maxnumber = String.format("%0" + String.valueOf(count).length() + "d",8);
        paint.getTextBounds(maxnumber,maxnumber.length(),mRect);
        int baseLeft = getScrollX();
        int lineNumberWidth = r.width() + 2 * numberMargin;
        int baseline = getLineBounds(0,r);//first line
        //draw split line
        canvas.drawLine(baseLeft + lineNumberWidth,baseLeft + lineNumberWidth,count * line_height,paint);
        getLocalVisibleRect(r);
        int startLine = r.top / line_height;
        baseline += startLine * line_height;
        int endLine = (r.bottom + line_height - 1) / line_height;
        Rect tRect = new Rect();
        PathEffect pathEffect = paint.getPathEffect();
        paint.setPathEffect(null);
        for (int i = startLine; i < endLine; i++) {
            String number = String.valueOf(i + 1);
            paint.getTextBounds(number,number.length(),tRect);
            canvas.drawText(number,baseLeft + lineNumberWidth - tRect.width() - numberMargin,baseline + 1,paint);
            baseline += line_height;
        }
        paint.setPathEffect(pathEffect);
    }
    Log.d(null,"C Cost:" + (System.currentTimeMillis() - st));
    st = System.currentTimeMillis();
    super.onDraw(canvas);
    Log.d(null,"S Cost:" + (System.currentTimeMillis() - st));
}
项目: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);
}
项目:binea_project_for_android    文件PathEffectView.java   
private void initPaint() {
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    mPaint.setStyle(Paint.Style.stroke);
    mPaint.setstrokeWidth(5);
    mPaint.setColor(Color.RED);

    mPath = new Path();

    mPath.moveto(0,0);

    for(int i = 0;i<=30;i++){
        mPath.lineto(i*35,(float)Math.random()*100);
    }

    mEffects = new PathEffect[7];
    mEffects[0] = null;
    mEffects[1] = new CornerPathEffect(10);
    mEffects[2] = new discretePathEffect(3.0F,5.0F);
    mEffects[3] = new DashPathEffect(new float[] { 20,10,10 },mPhase);
    Path path = new Path();
    path.addRect(0,Path.Direction.ccw);
    mEffects[4] = new PathDashPathEffect(path,12,mPhase,PathDashPathEffect.Style.ROTATE);
    mEffects[5] = new ComposePathEffect(mEffects[2],mEffects[4]);
    mEffects[6] = new SumPathEffect(mEffects[4],mEffects[3]);

}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。