java类android.graphics.RectF的实例源码

RotateImageView.java 文件源码 项目:MontageCam 阅读 19 收藏 0 点赞 0 评论 0
private void init(Context context) {
    srcRect = new Rect();
    dstRect = new RectF();
    maxRect = new Rect();
    bottomPaint = PaintUtil.newRotateBottomImagePaint();
    originImageRect = new RectF();
}
OvalParamsTest.java 文件源码 项目:CanvasScript 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void shouldDrawOval() {
    RectF rect = mock(RectF.class);
    rect.left = LEFT;
    rect.top = TOP;
    rect.right = RIGHT;
    rect.bottom = BOTTOM;
    OvalParams params = new OvalParams(rect, paint);

    int result = params.draw(canvas);

    verify(canvas).drawOval(rect, paint);
    assertThat(result, is(CanvasParams.NO_SAVE));
}
FolderIcon.java 文件源码 项目:SimpleUILauncher 阅读 25 收藏 0 点赞 0 评论 0
public void drawBackground(Canvas canvas, Paint paint) {
    canvas.save();
    canvas.translate(getOffsetX(), getOffsetY());
    paint.reset();
    paint.setStyle(Paint.Style.FILL);//充满
    paint.setColor(Color.LTGRAY);
    paint.setAntiAlias(true);
    paint.setAlpha(100);
    RectF oval3 = new RectF(0, 0, mBackground.previewSize, mBackground.previewSize);
    canvas.drawRoundRect(oval3, 40, 40,paint);
    canvas.restore();

}
FadingTextView.java 文件源码 项目:Amazing 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    height = h;
    width = w;
    initPaint();
    rectF = new RectF(0, 0, w, h);
}
BalloonLoadingRenderer.java 文件源码 项目:JueDiQiuSheng 阅读 22 收藏 0 点赞 0 评论 0
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;
}
CircleProgressView.java 文件源码 项目:android_camera_experiment 阅读 29 收藏 0 点赞 0 评论 0
public CircleProgressView(Context context, AttributeSet attrs) {
    super(context, attrs);

    final int strokeWidth = 8;

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(strokeWidth);
    paint.setStrokeCap(Paint.Cap.ROUND);
    //Circle color
    paint.setColor(Color.WHITE);

    basePaint = new Paint();
    basePaint.setAntiAlias(true);
    basePaint.setStyle(Paint.Style.STROKE);
    basePaint.setStrokeWidth(strokeWidth);
    basePaint.setStrokeCap(Paint.Cap.ROUND);
    basePaint.setColor(Color.WHITE);
    basePaint.setAlpha(122);

    //size 200x200 example
    rect = new RectF(strokeWidth, strokeWidth, 240 + strokeWidth, 240 + strokeWidth);

    //Initial Angle (optional, it can be zero)
    angle = 0;
}
BorderShape.java 文件源码 项目:TPlayer 阅读 22 收藏 0 点赞 0 评论 0
public BorderShape(RectF border, float dashWidth, float dashGap) {
    if (border.left != 0 || border.top != 0 || border.right != 0 || border.bottom != 0) {
        mBorder = border;
        if (dashWidth > 0 && dashGap > 0) {
            mPathEffect = new DashPathEffect(new float[]{dashWidth, dashGap}, 0);
            mPath = new Path();
        }
    }
}
TouchImageView.java 文件源码 项目:JsoupSample 阅读 39 收藏 0 点赞 0 评论 0
/**
 * Return a Rect representing the zoomed image.
 *
 * @return rect representing zoomed image
 */
public RectF getZoomedRect() {
    if (mScaleType == ScaleType.FIT_XY) {
        throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
    }
    PointF topLeft = transformCoordTouchToBitmap(0, 0, true);
    PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true);

    float w = getDrawable().getIntrinsicWidth();
    float h = getDrawable().getIntrinsicHeight();
    return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h);
}
PhotoViewAttacher.java 文件源码 项目:KTalk 阅读 24 收藏 0 点赞 0 评论 0
public final boolean onSingleTapConfirmed(MotionEvent e) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (null != mPhotoTapListener) {
            final RectF displayRect = getDisplayRect();

            if (null != displayRect) {
                final float x = e.getX(), y = e.getY();

                // Check to see if the user tapped on the photo
                if (displayRect.contains(x, y)) {

                    float xResult = (x - displayRect.left) / displayRect.width();
                    float yResult = (y - displayRect.top) / displayRect.height();

                    mPhotoTapListener.onPhotoTap(imageView, xResult, yResult);
                    return true;
                }
            }
        }
        if (null != mViewTapListener) {
            mViewTapListener.onViewTap(imageView, e.getX(), e.getY());
        }
    }

    return false;
}
CircleImageView.java 文件源码 项目:Renrentou 阅读 35 收藏 0 点赞 0 评论 0
private RectF calculateBounds() {
    int availableWidth  = getWidth() - getPaddingLeft() - getPaddingRight();
    int availableHeight = getHeight() - getPaddingTop() - getPaddingBottom();

    int sideLength = Math.min(availableWidth, availableHeight);

    float left = getPaddingLeft() + (availableWidth - sideLength) / 2f;
    float top = getPaddingTop() + (availableHeight - sideLength) / 2f;

    return new RectF(left, top, left + sideLength, top + sideLength);
}


问题


面经


文章

微信
公众号

扫码关注公众号