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


Java CornerPathEffect類代碼示例

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


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

示例1: addArrowView

import android.graphics.CornerPathEffect; //導入依賴的package包/類
/**
 * Adds an arrow view pointing at the original icon.
 * @param horizontalOffset the horizontal offset of the arrow, so that it
 *                              points at the center of the original icon
 */
private View addArrowView(int horizontalOffset, int verticalOffset, int width, int height) {
    LayoutParams layoutParams = new LayoutParams(width, height);
    if (mIsLeftAligned) {
        layoutParams.gravity = Gravity.START;
        layoutParams.leftMargin = horizontalOffset;
    } else {
        layoutParams.gravity = Gravity.END;
        layoutParams.rightMargin = horizontalOffset;
    }
    if (mIsAboveIcon) {
        layoutParams.topMargin = verticalOffset;
    } else {
        layoutParams.bottomMargin = verticalOffset;
    }

    View arrowView = new View(getContext());
    if (Gravity.isVertical(((FrameLayout.LayoutParams) getLayoutParams()).gravity)) {
        // This is only true if there wasn't room for the container next to the icon,
        // so we centered it instead. In that case we don't want to show the arrow.
        arrowView.setVisibility(INVISIBLE);
    } else {
        ShapeDrawable arrowDrawable = new ShapeDrawable(TriangleShape.create(
                width, height, !mIsAboveIcon));
        Paint arrowPaint = arrowDrawable.getPaint();
        // Note that we have to use getChildAt() instead of getItemViewAt(),
        // since the latter expects the arrow which hasn't been added yet.
        PopupItemView itemAttachedToArrow = (PopupItemView)
                (getChildAt(mIsAboveIcon ? getChildCount() - 1 : 0));
        arrowPaint.setColor(itemAttachedToArrow.getArrowColor(mIsAboveIcon));
        // The corner path effect won't be reflected in the shadow, but shouldn't be noticeable.
        int radius = getResources().getDimensionPixelSize(R.dimen.popup_arrow_corner_radius);
        arrowPaint.setPathEffect(new CornerPathEffect(radius));
        arrowView.setBackground(arrowDrawable);
        arrowView.setElevation(getElevation());
    }
    addView(arrowView, mIsAboveIcon ? getChildCount() : 0, layoutParams);
    return arrowView;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:44,代碼來源:PopupContainerWithArrow.java

示例2: init

import android.graphics.CornerPathEffect; //導入依賴的package包/類
private void init() {
        mCornerPathEffect = new CornerPathEffect(mCorner);

        mContentPaint = new Paint();
        mContentPaint.setStyle(Paint.Style.STROKE);
        mContentPaint.setColor(mContentColor);
        mContentPaint.setStrokeWidth(mStrokeWidth);
        mContentPaint.setPathEffect(mCornerPathEffect);

        mBackgroundPaint = new Paint();
//        mBackgroundPaint.setColor(mFillColor);

        mXAxisPaint = new TextPaint();
        mXAxisPaint.setColor(mAxisTextColor);
        mXAxisPaint.setTextSize(mAxisTextSize);

        mDotTextPaint = new TextPaint();
        mDotTextPaint.setColor(mDotTextColor);
        mDotTextPaint.setTextSize(mDotTextSize);

        mContentPath = new Path();
        //        mMaxVelocity = ViewConfiguration.get(getContext()).getScaledMaximumFlingVelocity();
        mMaxVelocity = 3000;
    }
 
開發者ID:auv1107,項目名稱:CurveView,代碼行數:25,代碼來源:CurveView.java

示例3: init

import android.graphics.CornerPathEffect; //導入依賴的package包/類
private void init() {

        CornerPathEffect cpe = new CornerPathEffect(20);

        mPaint.setColor(Color.RED);
        mPaint.setStrokeWidth(5);
        mPaint.setAntiAlias(false);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setPathEffect(cpe);
//        mPaint.setPathEffect(new DashPathEffect(new float[]{10,10},0));
//        mPaint.setPathEffect(new DiscretePathEffect(3.0f, 5.0f));
//        Path path = new Path();
//        path.addCircle(0, 0, 3, Path.Direction.CCW);
//        PathEffect pathEffect = new PathDashPathEffect(path, 12, 0, PathDashPathEffect.Style.ROTATE);
//        mPaint.setPathEffect(pathEffect);

        mBitmapPaint.setStrokeWidth(3);
        mBitmapPaint.setAntiAlias(true);
        mBitmapPaint.setStyle(Paint.Style.STROKE);
        mBitmapPaint.setPathEffect(cpe);

        makePolygon(new RectF(50, 50, 450, 450), mPath,6);
        makePolygon(new RectF(75, 75, 425, 425), mInnerPath,6);
        mBitmap = Bitmap.createBitmap(500, 500, Bitmap.Config.ARGB_8888);
        mBitmapCanvas = new Canvas(mBitmap);
    }
 
開發者ID:ViewStub,項目名稱:FlowLine,代碼行數:27,代碼來源:FlowLineView.java

示例4: onDraw

import android.graphics.CornerPathEffect; //導入依賴的package包/類
@Override protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  //無效果
  mEffects[0] = null;
  //拐角處變得圓滑
  mEffects[1] = new CornerPathEffect(30);
  //線段上就會產生許多雜點
  mEffects[2] = new DiscretePathEffect(3.0F, 5.0F);
  //繪製虛線
  mEffects[3] = new DashPathEffect(new float[] { 20, 10, 5, 10 }, 0);
  Path path = new Path();
  path.addRect(0, 0, 8, 8, Path.Direction.CCW);
  //設置點的圖形,即方形點的虛線,圓形點的虛線
  mEffects[4] = new PathDashPathEffect(path, 12, 0, PathDashPathEffect.Style.ROTATE);
  //組合PathEffect
  mEffects[5] = new ComposePathEffect(mEffects[3], mEffects[1]);
  for (int i = 0; i < mEffects.length; i++) {
    mPaint.setPathEffect(mEffects[i]);
    canvas.drawPath(mPath, mPaint);
    canvas.translate(0, 200);
  }
}
 
開發者ID:liuguoquan727,項目名稱:android-study,代碼行數:23,代碼來源:PathEffectView.java

示例5: AuthenticationView

import android.graphics.CornerPathEffect; //導入依賴的package包/類
public AuthenticationView(Context context, byte[] key) {
    super(context);
    byte[] digest = new byte[0];
    try {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        messageDigest.update(key);
        digest = messageDigest.digest();
    } catch (NoSuchAlgorithmException e) {
        Log.w(TAG, "MessageDigest algorithm not found.");
    }

    this.digest = digest;
    this.dotPaint.setColor(getContext().getResources().getColor(R.color.colorPrimaryDark));
    this.dotPaint.setAntiAlias(true);
    this.dotPaint.setStyle(Paint.Style.FILL);

    this.patternPaint.setColor(Color.GREEN);
    this.patternPaint.setAntiAlias(true);
    this.patternPaint.setStyle(Paint.Style.FILL);
    this.patternPaint.setStrokeJoin(Paint.Join.ROUND);    // set the join to round you want
    this.patternPaint.setStrokeCap(Paint.Cap.ROUND);      // set the paint cap to round too
    this.patternPaint.setPathEffect(new CornerPathEffect(10));
    this.patternPaint.setDither(true);
}
 
開發者ID:coinblesk,項目名稱:coinblesk-client-gui,代碼行數:25,代碼來源:AuthenticationView.java

示例6: ViewPagerIndicator

import android.graphics.CornerPathEffect; //導入依賴的package包/類
public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    // 初始化畫筆
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

    mLinePaint = new Paint();
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mLinePaint.setStyle(Style.FILL);
    mLinePaint.setStrokeWidth(10);

    mDividerLinePaint = new Paint();
    mDividerLinePaint.setAntiAlias(true);
    mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mDividerLinePaint.setStyle(Style.FILL);
    mDividerLinePaint.setStrokeWidth(5);
}
 
開發者ID:jacklongway,項目名稱:LiteSDK,代碼行數:22,代碼來源:ViewPagerIndicator.java

示例7: onMeasure

import android.graphics.CornerPathEffect; //導入依賴的package包/類
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    viewHeight = getMeasuredHeight();
    viewWidth = getMeasuredWidth();
    if (viewWidth != 0 && viewHeight != 0) {
        center.x = viewWidth / 2f;
        center.y = viewHeight / 2f;
        float spaceRate = 1 / 100f;
        space = viewWidth <= viewHeight ? viewWidth * spaceRate : viewHeight * spaceRate;
        hexagonRadius = (float) ((viewWidth - 2 * space) / (3 * Math.sqrt(3)));
        initHexagonCenters();
        //圓角處理
        paint.setPathEffect(new CornerPathEffect(hexagonRadius * 0.1f));
        baseDataInited = true;
    }
}
 
開發者ID:zhangyuChen1991,項目名稱:OverWatchLoading,代碼行數:18,代碼來源:OWLoadingView.java

示例8: ViewPagerIndicator

import android.graphics.CornerPathEffect; //導入依賴的package包/類
public ViewPagerIndicator(Context context, AttributeSet attrs)
{
	super(context, attrs);

	// 獲得自定義屬性,tab的數量
	TypedArray a = context.obtainStyledAttributes(attrs,
			R.styleable.ViewPagerIndicator);
	mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_item_count,
			COUNT_DEFAULT_TAB);
	if (mTabVisibleCount < 0)
		mTabVisibleCount = COUNT_DEFAULT_TAB;
	a.recycle();

	// 初始化畫筆
	mPaint = new Paint();
	mPaint.setAntiAlias(true);
	mPaint.setColor(Color.parseColor("#ffFD7580"));
	mPaint.setStyle(Style.FILL);
	mPaint.setPathEffect(new CornerPathEffect(3));

}
 
開發者ID:shaw748,項目名稱:ViewPageIndicator-underline,代碼行數:22,代碼來源:ViewPagerIndicator.java

示例9: init

import android.graphics.CornerPathEffect; //導入依賴的package包/類
private void init() {
    mPaint = new Paint();
    // 繪製貝塞爾曲線
    mPaint.setColor(mColor);
    mPaint.setStrokeWidth(8);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setTextSize(60);
    mPaint.setPathEffect(new CornerPathEffect(4));

    for (int i = 0; i < mData.length; i++) {
        mData[i] = new PointF();
    }
    for (int i = 0; i < mCtrl.length; i++) {
        mCtrl[i] = new PointF();
    }

}
 
開發者ID:ssseasonnn,項目名稱:BackgroundView,代碼行數:20,代碼來源:LeafView.java

示例10: init

import android.graphics.CornerPathEffect; //導入依賴的package包/類
private void init() {
    mPaint = new Paint();
    // 繪製貝塞爾曲線
    mPaint.setColor(mColor);
    mPaint.setStrokeWidth(8);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setTextSize(60);
    mPaint.setPathEffect(new CornerPathEffect(4));

    for (int i = 0; i < mData.length; i++) {
        mData[i] = new PointF();
    }
    for (int i = 0; i < mCtrl.length; i++) {
        mCtrl[i] = new PointF();
    }


}
 
開發者ID:ssseasonnn,項目名稱:BackgroundView,代碼行數:21,代碼來源:MountainView.java

示例11: ViewPagerIndicator

import android.graphics.CornerPathEffect; //導入依賴的package包/類
public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);

    // 獲得自定義屬性,tab的數量
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ViewPagerIndicator);
    mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_item_count,
            COUNT_DEFAULT_TAB);
    if (mTabVisibleCount < 0)
        mTabVisibleCount = COUNT_DEFAULT_TAB;
    a.recycle();

    // 初始化畫筆
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.parseColor("#ffffffff"));
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

}
 
開發者ID:beanu,項目名稱:smart-farmer-android,代碼行數:21,代碼來源:ViewPagerIndicator.java

示例12: assignPaint

import android.graphics.CornerPathEffect; //導入依賴的package包/類
protected CiPaint assignPaint() {
    CiPaint paint = new CiPaint(drawingContext.getPaint());
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);
    if (smoothRadius > 0) {
        CornerPathEffect effect = new CornerPathEffect(smoothRadius);
        if (paint.getPathEffect() == null) {
            paint.setPathEffect(effect);
        } else {
            ComposePathEffect composeEffect = new ComposePathEffect(paint.getPathEffect(), effect);
            paint.setPathEffect(composeEffect);
        }
    }
    return paint;
}
 
開發者ID:mocircle,項目名稱:cidrawing,代碼行數:18,代碼來源:SmoothStrokeMode.java

示例13: ViewPagerIndicator

import android.graphics.CornerPathEffect; //導入依賴的package包/類
public ViewPagerIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    screenWidth = getScreenWidth(context);
    DIMENSION_TRIANGEL_WIDTH = (int) (screenWidth / 3 * RADIO_TRIANGEL);
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ViewPagerIndicator);
    mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_item_count,
            COUNT_DEFAULT_TAB);
    if (mTabVisibleCount < 0)
        mTabVisibleCount = COUNT_DEFAULT_TAB;
    a.recycle();

    // 初始化畫筆
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.parseColor("#ffffffff"));
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));
}
 
開發者ID:710224800,項目名稱:stickynavlayout,代碼行數:20,代碼來源:ViewPagerIndicator.java

示例14: ViewPagerIndicator

import android.graphics.CornerPathEffect; //導入依賴的package包/類
public ViewPagerIndicator(Context context, AttributeSet attrs)
{
	super(context, attrs);

	// 獲得自定義屬性,tab的數量
	mTabVisibleCount = 2;
	if (mTabVisibleCount < 0)
		mTabVisibleCount = COUNT_DEFAULT_TAB;

	// 初始化畫筆
	mPaint = new Paint();
	mPaint.setAntiAlias(true);
	mPaint.setColor(Color.parseColor("#ffff9a23"));
	mPaint.setColor(getContext().getResources().getColor(R.color.yellow));
	mPaint.setStyle(Style.FILL);
	mPaint.setPathEffect(new CornerPathEffect(3));

}
 
開發者ID:gizwits,項目名稱:GOpenSource_AppKit_Android_AS,代碼行數:19,代碼來源:ViewPagerIndicator.java

示例15: initPathIfNeeded

import android.graphics.CornerPathEffect; //導入依賴的package包/類
private void initPathIfNeeded() {
    if (this.pathPaint != null) {
        return;
    }

    final Rect frame = super.framingRect;
    final float radius = 25.0f;
    final int strokeWidth = 10;
    final int offset = strokeWidth / 2;

    this.pathPaint = new Paint();
    this.pathPaint.setColor(Color.WHITE);
    this.pathPaint.setStrokeWidth(strokeWidth);
    this.pathPaint.setStyle(Paint.Style.STROKE);

    this.path = new Path();
    this.path.moveTo(frame.left + radius, frame.top - offset);
    this.path.lineTo(frame.left + frame.width() + offset, frame.top - offset);
    this.path.lineTo(frame.left + frame.width() + offset, frame.top + frame.height() + offset);
    this.path.lineTo(frame.left - offset, frame.top + frame.height() + offset);
    this.path.lineTo(frame.left - offset, frame.top - offset);
    this.path.lineTo(frame.left + frame.width() - radius, frame.top - offset);

    final CornerPathEffect cornerPathEffect = new CornerPathEffect(radius);
    this.pathPaint.setPathEffect(cornerPathEffect);
}
 
開發者ID:toshiapp,項目名稱:toshi-android-client,代碼行數:27,代碼來源:FramedViewfinderView.java


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