當前位置: 首頁>>代碼示例>>Java>>正文


Java PathEffect類代碼示例

本文整理匯總了Java中android.graphics.PathEffect的典型用法代碼示例。如果您正苦於以下問題:Java PathEffect類的具體用法?Java PathEffect怎麽用?Java PathEffect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PathEffect類屬於android.graphics包,在下文中一共展示了PathEffect類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: WidgetTextFrame

import android.graphics.PathEffect; //導入依賴的package包/類
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);
}
 
開發者ID:MaYatKit,項目名稱:Rotatable-Scalable-Font,代碼行數:23,代碼來源:WidgetTextFrame.java

示例2: getPathEffect

import android.graphics.PathEffect; //導入依賴的package包/類
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;
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:18,代碼來源:ReactViewBackgroundDrawable.java

示例3: withDrawnDivider

import android.graphics.PathEffect; //導入依賴的package包/類
/**
 * 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 information.
 * @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 information.
 * @param style the divider's target {@link Paint.Style}.
 *              See {@link Paint#setStyle(Paint.Style)} for more information.
 * @param pathEffect the divider's target {@link PathEffect}.
 *                   See {@link Paint#setPathEffect(PathEffect)} for more information.
 * @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;
}
 
開發者ID:Simdea,項目名稱:gmlrva,代碼行數:29,代碼來源:SimpleDividerItemDecorationSpec.java

示例4: getPathEffect

import android.graphics.PathEffect; //導入依賴的package包/類
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;
  }
}
 
開發者ID:Laisly,項目名稱:weex,代碼行數:20,代碼來源:WXBackgroundDrawable.java

示例5: createFailedPath

import android.graphics.PathEffect; //導入依賴的package包/類
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);
    }
 
開發者ID:StevenDXC,項目名稱:DxLoadingButton,代碼行數:27,代碼來源:LoadingButton.java

示例6: RichPolygon

import android.graphics.PathEffect; //導入依賴的package包/類
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);
    }
}
 
開發者ID:antoniocarlon,項目名稱:richmaps,代碼行數:26,代碼來源:RichPolygon.java

示例7: setPoints

import android.graphics.PathEffect; //導入依賴的package包/類
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();
}
 
開發者ID:DifferentialEq,項目名稱:DirectionFieldAndroid,代碼行數:17,代碼來源:PhasePlane.java

示例8: onDraw

import android.graphics.PathEffect; //導入依賴的package包/類
@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);
}
 
開發者ID:justasm,項目名稱:Bugstick,代碼行數:23,代碼來源:BugView.java

示例9: SampleView

import android.graphics.PathEffect; //導入依賴的package包/類
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
                        };
}
 
開發者ID:garlicG,項目名稱:CUT-IN-material,代碼行數:20,代碼來源:PathEffectsCutin.java

示例10: draw

import android.graphics.PathEffect; //導入依賴的package包/類
void draw(Canvas canvas) {
    RectF rectF = new RectF(mLeftX, mY, mRightX, mY);
    canvas.drawRoundRect(rectF, mBarWeight / 2, 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, 5}, 1);
    mEffectPaint.setPathEffect(effects);
    canvas.drawPath(path, mEffectPaint);
}
 
開發者ID:hidetag,項目名稱:DistanceRangeBar,代碼行數:12,代碼來源:DistanceRangeBar.java

示例11: setStroke

import android.graphics.PathEffect; //導入依賴的package包/類
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);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:9,代碼來源:XYChart.java

示例12: setDividerPaint

import android.graphics.PathEffect; //導入依賴的package包/類
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());
}
 
開發者ID:vipulasri,項目名稱:TicketView,代碼行數:12,代碼來源:TicketView.java

示例13: PathEffectView

import android.graphics.PathEffect; //導入依賴的package包/類
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];
}
 
開發者ID:liuguoquan727,項目名稱:android-study,代碼行數:14,代碼來源:PathEffectView.java

示例14: onDraw

import android.graphics.PathEffect; //導入依賴的package包/類
@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);
}
 
開發者ID:ficiverson,項目名稱:radiocom-android,代碼行數:15,代碼來源:DiscrollvablePathLayout.java

示例15: HexagonDrawable

import android.graphics.PathEffect; //導入依賴的package包/類
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);
}
 
開發者ID:tyzlmjj,項目名稱:Tools,代碼行數:32,代碼來源:HexagonDrawable.java


注:本文中的android.graphics.PathEffect類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。