Java 类android.graphics.RectF 实例源码

项目:GCSApp    文件:PhotoViewAttacher.java   
private void setImageViewMatrix(Matrix matrix) {
    ImageView imageView = getImageView();
    if (null != imageView) {

        checkImageViewScaleType();
        imageView.setImageMatrix(matrix);

        // Call MatrixChangedListener if needed
        if (null != mMatrixChangeListener) {
            RectF displayRect = getDisplayRect(matrix);
            if (null != displayRect) {
                mMatrixChangeListener.onMatrixChanged(displayRect);
            }
        }
    }
}
项目:Discover    文件:PacmanIndicator.java   
private void drawPacman(Canvas canvas,Paint paint){
    float x=getWidth()/2;
    float y=getHeight()/2;

    canvas.save();

    canvas.translate(x, y);
    canvas.rotate(degrees1);
    paint.setAlpha(255);
    RectF rectF1=new RectF(-x/1.7f,-y/1.7f,x/1.7f,y/1.7f);
    canvas.drawArc(rectF1, 0, 270, true, paint);

    canvas.restore();

    canvas.save();
    canvas.translate(x, y);
    canvas.rotate(degrees2);
    paint.setAlpha(255);
    RectF rectF2=new RectF(-x/1.7f,-y/1.7f,x/1.7f,y/1.7f);
    canvas.drawArc(rectF2,90,270,true,paint);
    canvas.restore();
}
项目:ImitateZHRB    文件:PacmanIndicator.java   
private void drawPacman(Canvas canvas,Paint paint){
    float x=getWidth()/2;
    float y=getHeight()/2;

    canvas.save();

    canvas.translate(x, y);
    canvas.rotate(degrees1);
    paint.setAlpha(255);
    RectF rectF1=new RectF(-x/1.7f,-y/1.7f,x/1.7f,y/1.7f);
    canvas.drawArc(rectF1, 0, 270, true, paint);

    canvas.restore();

    canvas.save();
    canvas.translate(x, y);
    canvas.rotate(degrees2);
    paint.setAlpha(255);
    RectF rectF2=new RectF(-x/1.7f,-y/1.7f,x/1.7f,y/1.7f);
    canvas.drawArc(rectF2,90,270,true,paint);
    canvas.restore();
}
项目:Hitalk    文件:Bubble.java   
private void initBottomRoundedPath(RectF rect, Path path, float strokeWidth) {

        path.moveTo(rect.left + mCornersRadius + strokeWidth, rect.top + strokeWidth);
        path.lineTo(rect.width() - mCornersRadius - strokeWidth, rect.top + strokeWidth);
        path.arcTo(new RectF(rect.right - mCornersRadius,
                rect.top + strokeWidth, rect.right - strokeWidth, mCornersRadius + rect.top), 270, 90);

        path.lineTo(rect.right - strokeWidth, rect.bottom - mArrowHeight - mCornersRadius - strokeWidth);
        path.arcTo(new RectF(rect.right - mCornersRadius, rect.bottom - mCornersRadius - mArrowHeight,
                rect.right - strokeWidth, rect.bottom - mArrowHeight - strokeWidth), 0, 90);

        path.lineTo(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2), rect.bottom - mArrowHeight - strokeWidth);
        path.lineTo(rect.left + mArrowPosition + mArrowWidth / 2, rect.bottom - strokeWidth - strokeWidth);
        path.lineTo(rect.left + mArrowPosition + (strokeWidth / 2), rect.bottom - mArrowHeight - strokeWidth);
        path.lineTo(rect.left + Math.min(mCornersRadius, mArrowPosition) + strokeWidth, rect.bottom - mArrowHeight - strokeWidth);

        path.arcTo(new RectF(rect.left + strokeWidth, rect.bottom - mCornersRadius - mArrowHeight,
                mCornersRadius + rect.left, rect.bottom - mArrowHeight - strokeWidth), 90, 90);
        path.lineTo(rect.left + strokeWidth, rect.top + mCornersRadius + strokeWidth);
        path.arcTo(new RectF(rect.left + strokeWidth, rect.top + strokeWidth, mCornersRadius
                + rect.left, mCornersRadius + rect.top), 180, 90);
        path.close();
    }
项目:Camara2-Video-Demo-fixed    文件:Camera2VideoFragment.java   
/**
 * Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
 * This method should not to be called until the camera preview size is determined in
 * openCamera, or until the size of `mTextureView` is fixed.
 *
 * @param viewWidth  The width of `mTextureView`
 * @param viewHeight The height of `mTextureView`
 */
private void configureTransform(int viewWidth, int viewHeight) {
    Activity activity = getActivity();
    if (null == mTextureView || null == mPreviewSize || null == activity) {
        return;
    }
    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    Matrix matrix = new Matrix();
    RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
    RectF bufferRect = new RectF(0, 0, mPreviewSize.getHeight(), mPreviewSize.getWidth());
    float centerX = viewRect.centerX();
    float centerY = viewRect.centerY();
    if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
        bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
        matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
        float scale = Math.max(
                (float) viewHeight / mPreviewSize.getHeight(),
                (float) viewWidth / mPreviewSize.getWidth());
        matrix.postScale(scale, scale, centerX, centerY);
        matrix.postRotate(90 * (rotation - 2), centerX, centerY);
    }
    mTextureView.setTransform(matrix);
}
项目:ReadMark    文件:ALetter.java   
protected void initConfig(int x, int y){
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mRectF = new RectF(x - MAX_RADIUS_CIRCLE
            , y - MAX_RADIUS_CIRCLE
            , x + MAX_RADIUS_CIRCLE
            , y + MAX_RADIUS_CIRCLE);

    mFirPoint = new Point(x + MAX_RADIUS_CIRCLE, y - MAX_RADIUS_CIRCLE);
    mSecPoint = new Point(mFirPoint);
}
项目:PeSanKita-android    文件:VerticalSlideColorPicker.java   
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
  super.onSizeChanged(w, h, oldw, oldh);

  viewWidth = w;
  viewHeight = h;

  centerX           = viewWidth / 2;
  colorPickerRadius = (viewWidth / 2) - borderWidth;

  colorPickerBody = new RectF(centerX - colorPickerRadius, borderWidth + colorPickerRadius, centerX + colorPickerRadius, viewHeight - (borderWidth + colorPickerRadius));

  LinearGradient gradient = new LinearGradient(0, colorPickerBody.top, 0, colorPickerBody.bottom, colors, null, Shader.TileMode.CLAMP);
  paint.setShader(gradient);

  if (bitmap != null) {
    bitmap.recycle();
  }

  bitmap       = Bitmap.createBitmap(viewWidth, viewHeight, Bitmap.Config.ARGB_8888);
  bitmapCanvas = new Canvas(bitmap);

  resetToDefault();
}
项目:YCUtils    文件:MaterialRippleLayout.java   
@Override
public void draw(Canvas canvas) {
    final boolean positionChanged = adapterPositionChanged();
    if (rippleOverlay) {
        if (!positionChanged) {
            rippleBackground.draw(canvas);
        }
        super.draw(canvas);
        if (!positionChanged) {
            if (rippleRoundedCorners != 0) {
                Path clipPath = new Path();
                RectF rect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
                clipPath.addRoundRect(rect, rippleRoundedCorners, rippleRoundedCorners, Path.Direction.CW);
                canvas.clipPath(clipPath);
            }
            canvas.drawCircle(currentCoords.x, currentCoords.y, radius, paint);
        }
    } else {
        if (!positionChanged) {
            rippleBackground.draw(canvas);
            canvas.drawCircle(currentCoords.x, currentCoords.y, radius, paint);
        }
        super.draw(canvas);
    }
}
项目:LeCatApp    文件:MLImageView.java   
private void drawBorder(Canvas canvas){
    if(mBorderWidth > 0){
        Paint paint = new Paint();
        paint.setStrokeWidth(mBorderWidth);
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(mBorderColor);
        paint.setAntiAlias(true);
        if (mShapeType == 0) {
            canvas.drawCircle(mWidth / 2, mHeight / 2, mWidth / 2, paint);
        } else {
            // 当ShapeType = 1 时 图片为圆角矩形
            RectF rectf = new RectF(0, 0, getWidth(), getHeight());
            canvas.drawRoundRect(rectf, mRadius, mRadius, paint);
        }
    }
}
项目:app_secompufscar    文件:ListHashtagAdapter.java   
private Bitmap getTweetImage(String url) {
    byte[] image_b = getImageByte(url);

    Bitmap image;

    if (image_b != null) {
        image = BitmapFactory.decodeByteArray(image_b, 0, image_b.length);
    } else {
        image = BitmapFactory.decodeResource(context.getResources(), R.drawable.pessoa_foto_default);
    }

    Bitmap imageRounded = Bitmap.createBitmap(image.getWidth(), image.getHeight(), image.getConfig());
    Canvas canvas = new Canvas(imageRounded);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setShader(new BitmapShader(image, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
    canvas.drawRoundRect((new RectF(0, 0, image.getWidth(), image.getHeight())), 12, 12, paint);
    return imageRounded;
}
项目:baselibrary-master    文件:GlideRoundTransform.java   
private static Bitmap roundCrop(BitmapPool pool, Bitmap source)
{
    if (source == null) return null;

    Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
    if (result == null)
    {
        result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
    canvas.drawRoundRect(rectF, radius, radius, paint);
    return result;
}
项目:SimpleUILauncher    文件:WallpaperPickerActivity.java   
@Override
public void onClick(final WallpaperPickerActivity a) {
    a.setWallpaperButtonEnabled(false);
    final BitmapRegionTileSource.ResourceBitmapSource bitmapSource =
            new BitmapRegionTileSource.ResourceBitmapSource(mResources, mResId);
    a.setCropViewTileSource(bitmapSource, false, false, new CropViewScaleAndOffsetProvider() {

        @Override
        public float getScale(Point wallpaperSize, RectF crop) {
            return wallpaperSize.x /crop.width();
        }

        @Override
        public float getParallaxOffset() {
            return a.getWallpaperParallaxOffset();
        }
    }, new Runnable() {

        @Override
        public void run() {
            if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) {
                a.setWallpaperButtonEnabled(true);
            }
        }
    });
}
项目:Phoenix-for-VK    文件:ImageHelper.java   
public static Bitmap getRoundedBitmap(Bitmap bitmap) {
    if(bitmap == null){
        return null;
    }

    final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(output);

    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    final RectF rectF = new RectF(rect);

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(0xff424242);
    canvas.drawOval(rectF, paint);

    paint.setXfermode(PORTER_DUFF_XFERMODE);
    canvas.drawBitmap(bitmap, rect, rect, paint);

    bitmap.recycle();

    return output;
}
项目:GitHub    文件:HorizontalBarChart.java   
@Override
public void getBarBounds(BarEntry e, RectF outputRect) {

    RectF bounds = outputRect;
    IBarDataSet set = mData.getDataSetForEntry(e);

    if (set == null) {
        outputRect.set(Float.MIN_VALUE, Float.MIN_VALUE, Float.MIN_VALUE, Float.MIN_VALUE);
        return;
    }

    float y = e.getY();
    float x = e.getX();

    float barWidth = mData.getBarWidth();

    float top = x - barWidth / 2f;
    float bottom = x + barWidth / 2f;
    float left = y >= 0 ? y : 0;
    float right = y <= 0 ? y : 0;

    bounds.set(left, top, right, bottom);

    getTransformer(set.getAxisDependency()).rectValueToPixel(bounds);

}
项目:JueDiQiuSheng    文件:GhostsEyeLoadingRenderer.java   
private Path createLeftEyeCircle(RectF arcBounds, float offsetY) {
    Path path = new Path();

    //the center of the left eye
    float leftEyeCenterX = arcBounds.centerX() - mEyeInterval / 2.0f - mEyeCircleRadius;
    float leftEyeCenterY = arcBounds.centerY() + offsetY;
    //the bounds of left eye
    RectF leftEyeBounds = new RectF(leftEyeCenterX - mEyeCircleRadius, leftEyeCenterY - mEyeCircleRadius,
            leftEyeCenterX + mEyeCircleRadius, leftEyeCenterY + mEyeCircleRadius);
    path.addArc(leftEyeBounds, 0, DEGREE_180 + 15);
    //the above radian of of the eye
    path.quadTo(leftEyeBounds.left + mAboveRadianEyeOffsetX, leftEyeBounds.top + mEyeCircleRadius * 0.2f,
            leftEyeBounds.left + mAboveRadianEyeOffsetX / 4.0f, leftEyeBounds.top - mEyeCircleRadius * 0.15f);

    return path;
}
项目:ReadMark    文件:DLetter.java   
@Override
protected void initConfig(int x, int y) {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mRectF = new RectF(x - MAX_RADIUS_CIRCLE
            , y - MAX_RADIUS_CIRCLE
            , x + MAX_RADIUS_CIRCLE
            , y + MAX_RADIUS_CIRCLE);
    mFirPoint = new Point(x + MAX_RADIUS_CIRCLE, y - 2 * MAX_RADIUS_CIRCLE);
    mSecPoint = new Point(mFirPoint);
}
项目:Excuser    文件:TextDrawable.java   
private void drawBorder(Canvas canvas) {
    RectF rect = new RectF(getBounds());
    rect.inset(borderThickness/2, borderThickness/2);

    if (shape instanceof OvalShape) {
        canvas.drawOval(rect, borderPaint);
    }
    else if (shape instanceof RoundRectShape) {
        canvas.drawRoundRect(rect, radius, radius, borderPaint);
    }
    else {
        canvas.drawRect(rect, borderPaint);
    }
}
项目:boohee_v5.6    文件:RoundRectDrawableWithShadow.java   
RoundRectDrawableWithShadow(Resources resources, int backgroundColor, float radius, float shadowSize, float maxShadowSize) {
    this.mShadowStartColor = resources.getColor(R.color.cardview_shadow_start_color);
    this.mShadowEndColor = resources.getColor(R.color.cardview_shadow_end_color);
    this.mInsetShadow = resources.getDimensionPixelSize(R.dimen.cardview_compat_inset_shadow);
    this.mPaint = new Paint(5);
    this.mPaint.setColor(backgroundColor);
    this.mCornerShadowPaint = new Paint(5);
    this.mCornerShadowPaint.setStyle(Style.FILL);
    this.mCornerRadius = (float) ((int) (0.5f + radius));
    this.mCardBounds = new RectF();
    this.mEdgeShadowPaint = new Paint(this.mCornerShadowPaint);
    this.mEdgeShadowPaint.setAntiAlias(false);
    setShadowSize(shadowSize, maxShadowSize);
}
项目:android-titanium-imagecropper    文件:CropWindowMoveHandler.java   
/**
 * Change the size of the crop window on the required edge (or edges for corner size move) without
 * affecting "secondary" edges.<br>
 * Only the primary edge(s) are fixed to stay within limits.
 */
private void moveSizeWithFreeAspectRatio(
    RectF rect, float x, float y, RectF bounds, int viewWidth, int viewHeight, float snapMargin) {
  switch (mType) {
    case TOP_LEFT:
      adjustTop(rect, y, bounds, snapMargin, 0, false, false);
      adjustLeft(rect, x, bounds, snapMargin, 0, false, false);
      break;
    case TOP_RIGHT:
      adjustTop(rect, y, bounds, snapMargin, 0, false, false);
      adjustRight(rect, x, bounds, viewWidth, snapMargin, 0, false, false);
      break;
    case BOTTOM_LEFT:
      adjustBottom(rect, y, bounds, viewHeight, snapMargin, 0, false, false);
      adjustLeft(rect, x, bounds, snapMargin, 0, false, false);
      break;
    case BOTTOM_RIGHT:
      adjustBottom(rect, y, bounds, viewHeight, snapMargin, 0, false, false);
      adjustRight(rect, x, bounds, viewWidth, snapMargin, 0, false, false);
      break;
    case LEFT:
      adjustLeft(rect, x, bounds, snapMargin, 0, false, false);
      break;
    case TOP:
      adjustTop(rect, y, bounds, snapMargin, 0, false, false);
      break;
    case RIGHT:
      adjustRight(rect, x, bounds, viewWidth, snapMargin, 0, false, false);
      break;
    case BOTTOM:
      adjustBottom(rect, y, bounds, viewHeight, snapMargin, 0, false, false);
      break;
    default:
      break;
  }
}
项目:AndelaTrackChallenge    文件:InkPageIndicator.java   
public InkPageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.InkPageIndicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter,
            DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap,
            DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration,
            DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor,
            DEFAULT_UNSELECTED_COLOUR);
    selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,
            DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = new FastOutSlowInInterpolator();

    // create paths & rect now – reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}
项目:RNLearn_Project1    文件:ReactImageView.java   
@Override
public void process(Bitmap output, Bitmap source) {
  cornerRadii(sComputedCornerRadii);

  output.setHasAlpha(true);
  if (FloatUtil.floatsEqual(sComputedCornerRadii[0], 0f) &&
      FloatUtil.floatsEqual(sComputedCornerRadii[1], 0f) &&
      FloatUtil.floatsEqual(sComputedCornerRadii[2], 0f) &&
      FloatUtil.floatsEqual(sComputedCornerRadii[3], 0f)) {
    super.process(output, source);
    return;
  }
  Paint paint = new Paint();
  paint.setAntiAlias(true);
  paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
  Canvas canvas = new Canvas(output);

  float[] radii = new float[8];

  getRadii(source, sComputedCornerRadii, radii);

  Path pathForBorderRadius = new Path();

  pathForBorderRadius.addRoundRect(
      new RectF(0, 0, source.getWidth(), source.getHeight()),
      radii,
      Path.Direction.CW);

  canvas.drawPath(pathForBorderRadius, paint);
}
项目:UiLib    文件:LineScalePartyIndicator.java   
@Override
public void draw(Canvas canvas, Paint paint) {
    float translateX=getWidth()/9;
    float translateY=getHeight()/2;
    for (int i = 0; i < 4; i++) {
        canvas.save();
        canvas.translate((2 + i * 2) * translateX - translateX / 2, translateY);
        canvas.scale(scaleFloats[i], scaleFloats[i]);
        RectF rectF=new RectF(-translateX/2,-getHeight()/2.5f,translateX/2,getHeight()/2.5f);
        canvas.drawRoundRect(rectF,5,5,paint);
        canvas.restore();
    }
}
项目:Dachshund-Tab-Layout    文件:LineMoveIndicator.java   
public LineMoveIndicator(DachshundTabLayout dachshundTabLayout){
    this.dachshundTabLayout = dachshundTabLayout;

    linearInterpolator = new LinearInterpolator();

    valueAnimatorLeft = new ValueAnimator();
    valueAnimatorLeft.setDuration(DEFAULT_DURATION);
    valueAnimatorLeft.addUpdateListener(this);
    valueAnimatorLeft.setInterpolator(linearInterpolator);

    valueAnimatorRight = new ValueAnimator();
    valueAnimatorRight.setDuration(DEFAULT_DURATION);
    valueAnimatorRight.addUpdateListener(this);
    valueAnimatorRight.setInterpolator(linearInterpolator);

    rectF = new RectF();
    rect = new Rect();

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);

    leftX = (int) dachshundTabLayout.getChildXLeft(dachshundTabLayout.getCurrentPosition());
    rightX = (int) dachshundTabLayout.getChildXRight(dachshundTabLayout.getCurrentPosition());

    edgeRadius = -1;
}
项目:FastLib    文件:GlideManager.java   
private Bitmap roundCrop(BitmapPool pool, Bitmap source) {
    Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
    canvas.drawRoundRect(rectF, radius, radius, paint);
    return result;
}
项目:PicKing    文件:Attacher.java   
private RectF getDisplayRect(Matrix matrix) {
    DraweeView<GenericDraweeHierarchy> draweeView = getDraweeView();
    if (draweeView == null || (mImageInfoWidth == -1 && mImageInfoHeight == -1)) {
        return null;
    }
    mDisplayRect.set(0.0F, 0.0F, mImageInfoWidth, mImageInfoHeight);
    draweeView.getHierarchy().getActualImageBounds(mDisplayRect);
    matrix.mapRect(mDisplayRect);
    return mDisplayRect;
}
项目:SortingHatAndroid    文件:ObjectTracker.java   
private RectF upscaleRect(final RectF downsampledFrameRect) {
  return new RectF(
      downsampledFrameRect.left * DOWNSAMPLE_FACTOR,
      downsampledFrameRect.top * DOWNSAMPLE_FACTOR,
      downsampledFrameRect.right * DOWNSAMPLE_FACTOR,
      downsampledFrameRect.bottom * DOWNSAMPLE_FACTOR);
}
项目:TensorFlowAndroidDynamic    文件:Classifier.java   
public Recognition(
        final String id, final String title, final Float confidence, final RectF location) {
    this.id = id;
    this.title = title;
    this.confidence = confidence;
    this.location = location;
}
项目:SuperSelector    文件:CropImageView.java   
private void adjustRatio() {
    if (mImageRect == null) return;
    float imgW = mImageRect.right - mImageRect.left;
    float imgH = mImageRect.bottom - mImageRect.top;
    float frameW = getRatioX(imgW);
    float frameH = getRatioY(imgH);
    float imgRatio = imgW / imgH;
    float frameRatio = frameW / frameH;
    float l = mImageRect.left, t = mImageRect.top, r = mImageRect.right, b = mImageRect.bottom;
    if (frameRatio >= imgRatio) {
        l = mImageRect.left;
        r = mImageRect.right;
        float hy = (mImageRect.top + mImageRect.bottom) * 0.5f;
        float hh = (imgW / frameRatio) * 0.5f;
        t = hy - hh;
        b = hy + hh;
    } else if (frameRatio < imgRatio) {
        t = mImageRect.top;
        b = mImageRect.bottom;
        float hx = (mImageRect.left + mImageRect.right) * 0.5f;
        float hw = imgH * frameRatio * 0.5f;
        l = hx - hw;
        r = hx + hw;
    }
    float w = r - l;
    float h = b - t;
    float cx = l + w / 2;
    float cy = t + h / 2;
    float sw = w * mInitialFrameScale;
    float sh = h * mInitialFrameScale;
    mFrameRect = new RectF(cx - sw / 2, cy - sh / 2, cx + sw / 2, cy + sh / 2);
    invalidate();
}
项目:starcor.xul    文件:XulMassiveRender.java   
public RectF getItemRect(int idx, RectF rect) {
    if (idx < 0 || idx >= _data.size()) {
        return null;
    }

    _ItemData itemData = _data.get(idx);
    if (!itemData.isInitialized()) {
        return null;
    }
    rect.set(itemData.relativeLeft, itemData.relativeTop,
        itemData.relativeLeft + itemData.width, itemData.relativeTop + itemData.height
    );
    XulUtils.offsetRect(rect, _screenX, _screenY);
    return rect;
}
项目:godlibrary    文件:PinchImageView.java   
/**
 * 获取当前设置的mask
 *
 * @return 返回当前的mask对象副本,如果当前没有设置mask则返回null
 */
public RectF getMask() {
    if (mMask != null) {
        return new RectF(mMask);
    } else {
        return null;
    }
}
项目:MontageCam    文件:RotateImageView.java   
private void init(Context context) {
    srcRect = new Rect();
    dstRect = new RectF();
    maxRect = new Rect();
    bottomPaint = PaintUtil.newRotateBottomImagePaint();
    originImageRect = new RectF();
}
项目:CanvasScript    文件:OvalParamsTest.java   
@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));
}
项目:SimpleUILauncher    文件:FolderIcon.java   
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();

}
项目:Amazing    文件:FadingTextView.java   
@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);
}
项目:JueDiQiuSheng    文件:BalloonLoadingRenderer.java   
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;
}
项目:android_camera_experiment    文件:CircleProgressView.java   
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;
}
项目:TPlayer    文件:BorderShape.java   
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();
        }
    }
}
项目:JsoupSample    文件:TouchImageView.java   
/**
 * 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);
}
项目:KTalk    文件:PhotoViewAttacher.java   
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;
}
项目:Renrentou    文件:CircleImageView.java   
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);
}