当前位置: 首页>>代码示例>>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;未经允许,请勿转载。