当前位置: 首页>>代码示例>>Java>>正文


Java Path.addRoundRect方法代码示例

本文整理汇总了Java中android.graphics.Path.addRoundRect方法的典型用法代码示例。如果您正苦于以下问题:Java Path.addRoundRect方法的具体用法?Java Path.addRoundRect怎么用?Java Path.addRoundRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Path的用法示例。


在下文中一共展示了Path.addRoundRect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateClipPath

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * Update the path with which we'll clip this view
 */
private void updateClipPath() {
  mPath = new Path();

  TMP_RECT.set(
      getLeft(),
      getTop(),
      getRight(),
      getBottom());

  // set the path
  mPath.addRoundRect(
      TMP_RECT,
      mClipRadius,
      mClipRadius,
      Path.Direction.CW);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:DrawView.java

示例2: computePath

import android.graphics.Path; //导入方法依赖的package包/类
private void computePath(Rect bounds) {
    final float currentScale = mCurrentScale;
    final Path path = mPath;
    final RectF rect = mRect;
    final Matrix matrix = mMatrix;

    path.reset();
    int totalSize = Math.min(bounds.width(), bounds.height());

    float initial = mClosedStateSize;
    float currentSize = initial + ((float) totalSize - initial) * currentScale;

    float halfSize = currentSize / 2f;
    float inverseScale = 1f - currentScale;
    float cornerSize = halfSize * inverseScale;
    float[] corners = new float[]{halfSize, halfSize, halfSize, halfSize, halfSize, halfSize, cornerSize, cornerSize};
    rect.set(bounds.left, bounds.top, bounds.left + currentSize, bounds.top + currentSize);
    path.addRoundRect(rect, corners, Path.Direction.CCW);
    matrix.reset();
    matrix.postRotate(-45, bounds.left + halfSize, bounds.top + halfSize);
    matrix.postTranslate((bounds.width() - currentSize) / 2, 0);
    float hDiff = (bounds.bottom - currentSize - mExternalOffset) * inverseScale;
    matrix.postTranslate(0, hDiff);
    path.transform(matrix);
}
 
开发者ID:tranleduy2000,项目名称:screenfilter,代码行数:26,代码来源:MarkerDrawable.java

示例3: computePath

import android.graphics.Path; //导入方法依赖的package包/类
private void computePath(Rect bounds) {
    final float currentScale = mCurrentScale;
    final Path path = mPath;
    final RectF rect = mRect;
    final Matrix matrix = mMatrix;

    path.reset();
    int totalSize = Math.min(bounds.width(), bounds.height());

    float initial = mClosedStateSize;
    float destination = totalSize;
    float currentSize = initial + (destination - initial) * currentScale;

    float halfSize = currentSize / 2f;
    float inverseScale = 1f - currentScale;
    float cornerSize = halfSize * inverseScale;
    float[] corners = new float[]{halfSize, halfSize, halfSize, halfSize, halfSize, halfSize, cornerSize, cornerSize};
    rect.set(bounds.left, bounds.top, bounds.left + currentSize, bounds.top + currentSize);
    path.addRoundRect(rect, corners, Path.Direction.CCW);
    matrix.reset();
    matrix.postRotate(-45, bounds.left + halfSize, bounds.top + halfSize);
    matrix.postTranslate((bounds.width() - currentSize) / 2, 0);
    float hDiff = (bounds.bottom - currentSize - mExternalOffset) * inverseScale;
    matrix.postTranslate(0, hDiff);
    path.transform(matrix);
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:27,代码来源:MarkerDrawable.java

示例4: getOutlineProvider

import android.graphics.Path; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public ViewOutlineProvider getOutlineProvider() {
    shadowpath = new Path();
    if (config.getRadius() == 0) {
        shadowpath = path;
    } else {
        rect = new Rect(0, 0, (int) width, (int) height);
        RectF r = new RectF(rect);
        shadowpath.addRoundRect(r, config.getRadius(), config.getRadius(), Path.Direction.CCW);
        shadowpath.op(path, shadowpath, Path.Op.INTERSECT);
    }
    return new ViewOutlineProvider() {
        @Override
        public void getOutline(View view, Outline outline) {
            if (path.isConvex()) {
                outline.setConvexPath(shadowpath);
            }
        }
    };
}
 
开发者ID:akshay2211,项目名称:Oblique,代码行数:22,代码来源:ObliqueView.java

示例5: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    Log.e("TAG", "onDraw");
    if (getDrawable() == null) {
        return;
    }
    setUpShader();

    if (type == TYPE_ROUND) {
        canvas.drawRoundRect(mRoundRect, mBorderRadius, mBorderRadius,
                mBitmapPaint);
    } else if (type == TYPE_LEFT_ROUND) {
        float[] radii = {mBorderRadius, mBorderRadius, 0f, 0f, 0f, 0f, mBorderRadius, mBorderRadius};
        Path path = new Path();
        path.addRoundRect(mRoundRect, radii, Path.Direction.CW);
        canvas.drawPath(path, mBitmapPaint);
    } else {
        canvas.drawCircle(mRadius, mRadius, mRadius, mBitmapPaint);
        // drawSomeThing(canvas);
    }
}
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:22,代码来源:RoundImageView.java

示例6: draw

import android.graphics.Path; //导入方法依赖的package包/类
public void draw(Canvas canvas) {
    boolean positionChanged = adapterPositionChanged();
    if (this.rippleOverlay) {
        if (!positionChanged) {
            this.rippleBackground.draw(canvas);
        }
        super.draw(canvas);
        if (!positionChanged) {
            if (this.rippleRoundedCorners != 0.0f) {
                Path clipPath = new Path();
                clipPath.addRoundRect(new RectF(0.0f, 0.0f, (float) canvas.getWidth(), (float) canvas.getHeight()), this.rippleRoundedCorners, this.rippleRoundedCorners, Direction.CW);
                canvas.clipPath(clipPath);
            }
            canvas.drawCircle((float) this.currentCoords.x, (float) this.currentCoords.y, this.radius, this.paint);
            return;
        }
        return;
    }
    if (!positionChanged) {
        this.rippleBackground.draw(canvas);
        canvas.drawCircle((float) this.currentCoords.x, (float) this.currentCoords.y, this.radius, this.paint);
    }
    super.draw(canvas);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:MaterialRippleLayout.java

示例7: drawContent

import android.graphics.Path; //导入方法依赖的package包/类
private Bitmap drawContent(int width, int height) {
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);

    int borderWidth = mLayer.mBorder.mBorderWidth;
    int topLeft = mLayer.mCornor.mTopLeftCornor;
    int topRight = mLayer.mCornor.mTopRightCornor;
    int bottomLeft = mLayer.mCornor.mBottomLeftCornor;
    int bottomRight = mLayer.mCornor.mBottomRightCornor;
    Path path = new Path();
    path.addRoundRect(new RectF(borderWidth, borderWidth, width - borderWidth, height - borderWidth),
            new float[]{topLeft, topLeft, topRight, topRight, bottomRight, bottomRight, bottomLeft, bottomLeft},
            Path.Direction.CW);
    canvas.drawPath(path, p);
    return bitmap;
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:18,代码来源:UIView.java

示例8: createCannulaBottomPath

import android.graphics.Path; //导入方法依赖的package包/类
private Path createCannulaBottomPath(RectF cannulaRect) {
    RectF cannulaHeadRect = new RectF(cannulaRect.left, cannulaRect.bottom - 0.833f * cannulaRect.width(),
            cannulaRect.right, cannulaRect.bottom);

    Path path = new Path();
    path.addRoundRect(cannulaHeadRect, mRectCornerRadius, mRectCornerRadius, Path.Direction.CCW);
    return path;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:BalloonLoadingRenderer.java

示例9: drawEffectWithBorder

import android.graphics.Path; //导入方法依赖的package包/类
private void drawEffectWithBorder(Canvas canvas, Paint mTransparentPaint) {
  RectF clipBounds = new RectF(canvas.getClipBounds());
  Path mPath= new Path();
  mPath.addRoundRect(clipBounds, mCornerRadius, Path.Direction.CW);
  Bitmap result = Bitmap.createBitmap(getWidth(),getHeight(), Bitmap.Config.ARGB_8888);
  Canvas tempCanvas = new Canvas(result);
  Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
  canvas.drawCircle(0,getHeight()/2,mCircleRadius,mTransparentPaint);
  canvas.drawPath(mPath, paint);
  paint.setXfermode(null);
  //Draw result after performing masking
  canvas.drawBitmap(result, 0, 0, new Paint());
}
 
开发者ID:omidheshmatinia,项目名称:RippleValidatorEditText,代码行数:15,代码来源:RippleValidatorEditText.java

示例10: getContentPath

import android.graphics.Path; //导入方法依赖的package包/类
public
@NonNull
Path getContentPath(int viewTopPadding,
                    int viewRightPadding,
                    int viewBottomPadding,
                    int viewLeftPadding,
                    @NonNull RectF contentBox) {
  RectF rectForBorderOutline = new RectF();
  Path contentClip = new Path();
  rectForBorderOutline.set(contentBox);
  if (mBorderRadius != null) {
    prepareBorderRadius();
    float topLeftRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS);
    float topRightRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS);
    float bottomRightRadius = getBorderRadius(mOverlappingBorderRadius,
                                              BORDER_BOTTOM_RIGHT_RADIUS);
    float bottomLeftRadius = getBorderRadius(mOverlappingBorderRadius,
                                             BORDER_BOTTOM_LEFT_RADIUS);
    contentClip.addRoundRect(rectForBorderOutline,
                             new float[]{
                                 topLeftRadius - viewLeftPadding,
                                 topLeftRadius - viewTopPadding,
                                 topRightRadius - viewRightPadding,
                                 topRightRadius - viewTopPadding,
                                 bottomRightRadius - viewRightPadding,
                                 bottomRightRadius - viewBottomPadding,
                                 bottomLeftRadius - viewLeftPadding,
                                 bottomLeftRadius - viewBottomPadding
                             },
                             Path.Direction.CW);
  } else {
    contentClip.addRect(rectForBorderOutline, Path.Direction.CW);
  }
  return contentClip;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:36,代码来源:BorderDrawable.java

示例11: prepareBorderPath

import android.graphics.Path; //导入方法依赖的package包/类
private void prepareBorderPath(int topPadding,
                               int rightPadding,
                               int bottomPadding,
                               int leftPadding,
                               @NonNull RectF rectF,
                               @NonNull Path path) {
  if (mBorderRadius != null) {
    prepareBorderRadius(rectF);
    float topLeftRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_LEFT_RADIUS);
    float topRightRadius = getBorderRadius(mOverlappingBorderRadius, BORDER_TOP_RIGHT_RADIUS);
    float bottomRightRadius = getBorderRadius(mOverlappingBorderRadius,
                                              BORDER_BOTTOM_RIGHT_RADIUS);
    float bottomLeftRadius = getBorderRadius(mOverlappingBorderRadius,
                                             BORDER_BOTTOM_LEFT_RADIUS);
    path.addRoundRect(
        rectF,
        new float[]{
            topLeftRadius - leftPadding,
            topLeftRadius - topPadding,
            topRightRadius - rightPadding,
            topRightRadius - topPadding,
            bottomRightRadius - rightPadding,
            bottomRightRadius - bottomPadding,
            bottomLeftRadius - leftPadding,
            bottomLeftRadius - bottomPadding
        },
        Path.Direction.CW);
  } else {
    path.addRect(rectF, Path.Direction.CW);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:32,代码来源:BorderDrawable.java

示例12: buildBoundPath

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void buildBoundPath(Path boundPath){
	boundPath.reset();
	
	final int width = getWidth();
	final int height = getHeight();
	radius = Math.min(radius, Math.min(width, height) * 0.5f);
	
	RectF rect = new RectF(0, 0, width, height);
	boundPath.addRoundRect(rect , radius, radius, Direction.CW);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:12,代码来源:RoundImageView.java

示例13: buildBorderPath

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void buildBorderPath(Path borderPath) {
	borderPath.reset();
	
	final float halfBorderWidth = getBorderWidth() * 0.5f;
	
	final int width = getWidth();
	final int height = getHeight();
	radius = Math.min(radius, Math.min(width, height) * 0.5f);
	
	RectF rect = new RectF(halfBorderWidth, halfBorderWidth,
			width - halfBorderWidth, height - halfBorderWidth);
	borderPath.addRoundRect(rect , radius, radius, Direction.CW);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:15,代码来源:RoundImageView.java

示例14: updatePath

import android.graphics.Path; //导入方法依赖的package包/类
protected final void updatePath(Path path, float correction) {
  path.reset();

  TMP_RECT.set(
      getLeft() + correction,
      getTop() + correction,
      getRight() - correction,
      getBottom() - correction);

  path.addRoundRect(
      TMP_RECT,
      mBorderRadius,
      mBorderRadius,
      Path.Direction.CW);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:AbstractDrawBorder.java

示例15: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    // 需要剪切应显示视图的其余部分
    Path path = new Path();
    path.addRoundRect(
            new RectF(0, 0, canvas.getWidth(), canvas.getHeight()),
            _PST.dpToPx(cornerRadius),
            _PST.dpToPx(cornerRadius),
            Path.Direction.CW
    );
    canvas.clipPath(path, Region.Op.REPLACE);
}
 
开发者ID:LemonAppCN,项目名称:LemonHello4Android,代码行数:14,代码来源:LemonHelloPanel.java


注:本文中的android.graphics.Path.addRoundRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。