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


Java RectF类代码示例

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


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

示例1: setImageViewMatrix

import android.graphics.RectF; //导入依赖的package包/类
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);
            }
        }
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:17,代码来源:PhotoViewAttacher.java

示例2: drawPacman

import android.graphics.RectF; //导入依赖的package包/类
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();
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:23,代码来源:PacmanIndicator.java

示例3: initBottomRoundedPath

import android.graphics.RectF; //导入依赖的package包/类
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();
    }
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:24,代码来源:Bubble.java

示例4: configureTransform

import android.graphics.RectF; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mywitness,项目名称:Camara2-Video-Demo-fixed,代码行数:31,代码来源:Camera2VideoFragment.java

示例5: initConfig

import android.graphics.RectF; //导入依赖的package包/类
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);
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:17,代码来源:ALetter.java

示例6: onSizeChanged

import android.graphics.RectF; //导入依赖的package包/类
@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();
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:25,代码来源:VerticalSlideColorPicker.java

示例7: draw

import android.graphics.RectF; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:yangchong211,项目名称:YCUtils,代码行数:26,代码来源:MaterialRippleLayout.java

示例8: drawBorder

import android.graphics.RectF; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:17,代码来源:MLImageView.java

示例9: getTweetImage

import android.graphics.RectF; //导入依赖的package包/类
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;
}
 
开发者ID:secompufscar,项目名称:app_secompufscar,代码行数:20,代码来源:ListHashtagAdapter.java

示例10: roundCrop

import android.graphics.RectF; //导入依赖的package包/类
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;
}
 
开发者ID:codeccc,项目名称:baselibrary-master,代码行数:19,代码来源:GlideRoundTransform.java

示例11: onClick

import android.graphics.RectF; //导入依赖的package包/类
@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);
            }
        }
    });
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:27,代码来源:WallpaperPickerActivity.java

示例12: getRoundedBitmap

import android.graphics.RectF; //导入依赖的package包/类
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;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:25,代码来源:ImageHelper.java

示例13: getBarBounds

import android.graphics.RectF; //导入依赖的package包/类
@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);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:HorizontalBarChart.java

示例14: createLeftEyeCircle

import android.graphics.RectF; //导入依赖的package包/类
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;
}
 
开发者ID:ZhuoKeTeam,项目名称:JueDiQiuSheng,代码行数:17,代码来源:GhostsEyeLoadingRenderer.java

示例15: initConfig

import android.graphics.RectF; //导入依赖的package包/类
@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);
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:17,代码来源:DLetter.java


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