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

PhotoViewAttacher.java 文件源码 项目:GCSApp 阅读 39 收藏 0 点赞 0 评论 0
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);
            }
        }
    }
}
PacmanIndicator.java 文件源码 项目:Discover 阅读 37 收藏 0 点赞 0 评论 0
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();
}
PacmanIndicator.java 文件源码 项目:ImitateZHRB 阅读 36 收藏 0 点赞 0 评论 0
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();
}
Bubble.java 文件源码 项目:Hitalk 阅读 31 收藏 0 点赞 0 评论 0
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();
    }
Camera2VideoFragment.java 文件源码 项目:Camara2-Video-Demo-fixed 阅读 40 收藏 0 点赞 0 评论 0
/**
 * 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);
}
ALetter.java 文件源码 项目:ReadMark 阅读 37 收藏 0 点赞 0 评论 0
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);
}
VerticalSlideColorPicker.java 文件源码 项目:PeSanKita-android 阅读 43 收藏 0 点赞 0 评论 0
@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();
}
MaterialRippleLayout.java 文件源码 项目:YCUtils 阅读 37 收藏 0 点赞 0 评论 0
@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);
    }
}
MLImageView.java 文件源码 项目:LeCatApp 阅读 40 收藏 0 点赞 0 评论 0
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);
        }
    }
}
ListHashtagAdapter.java 文件源码 项目:app_secompufscar 阅读 39 收藏 0 点赞 0 评论 0
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;
}
GlideRoundTransform.java 文件源码 项目:baselibrary-master 阅读 32 收藏 0 点赞 0 评论 0
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;
}
WallpaperPickerActivity.java 文件源码 项目:SimpleUILauncher 阅读 37 收藏 0 点赞 0 评论 0
@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);
            }
        }
    });
}
ImageHelper.java 文件源码 项目:Phoenix-for-VK 阅读 33 收藏 0 点赞 0 评论 0
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;
}
HorizontalBarChart.java 文件源码 项目:GitHub 阅读 34 收藏 0 点赞 0 评论 0
@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);

}
GhostsEyeLoadingRenderer.java 文件源码 项目:JueDiQiuSheng 阅读 28 收藏 0 点赞 0 评论 0
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;
}
DLetter.java 文件源码 项目:ReadMark 阅读 48 收藏 0 点赞 0 评论 0
@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);
}
TextDrawable.java 文件源码 项目:Excuser 阅读 32 收藏 0 点赞 0 评论 0
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);
    }
}
RoundRectDrawableWithShadow.java 文件源码 项目:boohee_v5.6 阅读 47 收藏 0 点赞 0 评论 0
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);
}
CropWindowMoveHandler.java 文件源码 项目:android-titanium-imagecropper 阅读 43 收藏 0 点赞 0 评论 0
/**
 * 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;
  }
}
InkPageIndicator.java 文件源码 项目:AndelaTrackChallenge 阅读 38 收藏 0 点赞 0 评论 0
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);
}
ReactImageView.java 文件源码 项目:RNLearn_Project1 阅读 41 收藏 0 点赞 0 评论 0
@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);
}
LineScalePartyIndicator.java 文件源码 项目:UiLib 阅读 40 收藏 0 点赞 0 评论 0
@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();
    }
}
LineMoveIndicator.java 文件源码 项目:Dachshund-Tab-Layout 阅读 31 收藏 0 点赞 0 评论 0
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;
}
GlideManager.java 文件源码 项目:FastLib 阅读 34 收藏 0 点赞 0 评论 0
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;
}
Attacher.java 文件源码 项目:PicKing 阅读 38 收藏 0 点赞 0 评论 0
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;
}
ObjectTracker.java 文件源码 项目:SortingHatAndroid 阅读 38 收藏 0 点赞 0 评论 0
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);
}
Classifier.java 文件源码 项目:TensorFlowAndroidDynamic 阅读 39 收藏 0 点赞 0 评论 0
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;
}
CropImageView.java 文件源码 项目:SuperSelector 阅读 39 收藏 0 点赞 0 评论 0
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();
}
XulMassiveRender.java 文件源码 项目:starcor.xul 阅读 37 收藏 0 点赞 0 评论 0
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;
}
PinchImageView.java 文件源码 项目:godlibrary 阅读 38 收藏 0 点赞 0 评论 0
/**
 * 获取当前设置的mask
 *
 * @return 返回当前的mask对象副本,如果当前没有设置mask则返回null
 */
public RectF getMask() {
    if (mMask != null) {
        return new RectF(mMask);
    } else {
        return null;
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号