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


Java RectF.set方法代码示例

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


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

示例1: draw

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Draw the progress spinner
 */
public void draw(Canvas c, Rect bounds) {
  final RectF arcBounds = mTempBounds;
  arcBounds.set(bounds);
  arcBounds.inset(mStrokeInset, mStrokeInset);

  final float startAngle = (mStartTrim + mRotation) * 360;
  final float endAngle = (mEndTrim + mRotation) * 360;
  float sweepAngle = endAngle - startAngle;

  mPaint.setColor(mCurrentColor);
  c.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);

  drawTriangle(c, startAngle, sweepAngle, bounds);

  if (mAlpha < 255) {
    mCirclePaint.setColor(mBackgroundColor);
    mCirclePaint.setAlpha(255 - mAlpha);
    c.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), bounds.width() / 2,
                 mCirclePaint);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:25,代码来源:MaterialProgressDrawable.java

示例2: drawLabel

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * 绘制单元标签
 *
 * @param canvas 画板对象
 */
private void drawLabel(Canvas canvas) {

    mPaint.setXfermode(null);
    int colorSize = beans.size();
    for (int i = 0; i < colorSize; i++) {

        ChartValueBean valueBean = beans.get(i);

        RectF rectF = new RectF();
        int perNowY = (i + 1) * 50;
        rectF.set(200, perNowY, 500, perNowY + 30);
        mPaint.setColor(valueBean.getColor());
        canvas.drawRect(rectF, mPaint);

        canvas.drawText(valueBean.getName(), 600, perNowY + 25, mPaintLine);
    }

}
 
开发者ID:zmobs,项目名称:DoChart,代码行数:24,代码来源:PieChartView.java

示例3: draw

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Draw the progress spinner
 */
public void draw(Canvas c, Rect bounds) {
    final RectF arcBounds = mTempBounds;
    arcBounds.set(bounds);
    arcBounds.inset(mStrokeInset, mStrokeInset);

    final float startAngle = (mStartTrim + mRotation) * 360;
    final float endAngle = (mEndTrim + mRotation) * 360;
    float sweepAngle = endAngle - startAngle;

    mPaint.setColor(mCurrentColor);
    c.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);

    drawTriangle(c, startAngle, sweepAngle, bounds);

    if (mAlpha < 255) {
        mCirclePaint.setColor(mBackgroundColor);
        mCirclePaint.setAlpha(255 - mAlpha);
        c.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), bounds.width() / 2,
                mCirclePaint);
    }
}
 
开发者ID:yangjiantao,项目名称:AndroidUiKit,代码行数:25,代码来源:MaterialProgressDrawable.java

示例4: draw

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Draw the progress spinner
 */
public void draw(Canvas c, Rect bounds) {
    final RectF arcBounds = mTempBounds;
    arcBounds.set(bounds);
    arcBounds.inset(mStrokeInset, mStrokeInset);

    final float startAngle = (mStartTrim + mRotation) * 360;
    final float endAngle = (mEndTrim + mRotation) * 360;
    float sweepAngle = endAngle - startAngle;

    mPaint.setColor(mColors[mColorIndex]);
    c.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);

    drawTriangle(c, startAngle, sweepAngle, bounds);

    if (mAlpha < 255) {
        mCirclePaint.setColor(mBackgroundColor);
        mCirclePaint.setAlpha(255 - mAlpha);
        c.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), bounds.width() / 2,
                mCirclePaint);
    }
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:25,代码来源:MaterialProgressDrawable.java

示例5: computeRect

import android.graphics.RectF; //导入方法依赖的package包/类
private void computeRect(RectF r, View view) {
    r.set(0.0f, 0.0f, (float) view.getWidth(), (float) view.getHeight());
    Matrix m = this.mTempMatrix;
    m.reset();
    transformMatrix(m, view);
    this.mTempMatrix.mapRect(r);
    r.offset((float) view.getLeft(), (float) view.getTop());
    if (r.right < r.left) {
        float f = r.right;
        r.right = r.left;
        r.left = f;
    }
    if (r.bottom < r.top) {
        f = r.top;
        r.top = r.bottom;
        r.bottom = f;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:AnimatorProxy.java

示例6: draw

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Draw the progress spinner
 */
void draw(Canvas c, Rect bounds) {
    final RectF arcBounds = mTempBounds;
    arcBounds.set(bounds);
    arcBounds.inset(mStrokeInset, mStrokeInset);

    final float startAngle = (mStartTrim + mRotation) * 360;
    final float endAngle = (mEndTrim + mRotation) * 360;
    float sweepAngle = endAngle - startAngle;

    mPaint.setColor(mCurrentColor);
    c.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);

    drawTriangle(c, startAngle, sweepAngle, bounds);

    if (mAlpha < 255) {
        mCirclePaint.setColor(mBackgroundColor);
        mCirclePaint.setAlpha(255 - mAlpha);
        c.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), bounds.width() / 2,
                mCirclePaint);
    }
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:25,代码来源:MaterialProgressDrawable.java

示例7: draw

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Draw the progress spinner
 */
void draw(Canvas c, Rect bounds) {
    final RectF arcBounds = mTempBounds;
    arcBounds.set(bounds);
    arcBounds.inset(mStrokeInset, mStrokeInset);
    final float startAngle = (mStartTrim + mRotation) * 360;
    final float endAngle = (mEndTrim + mRotation) * 360;
    float sweepAngle = endAngle - startAngle;

    mCirclePaint.setColor(mBackgroundColor);
    mCirclePaint.setAlpha(mAlpha);
    c.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), arcBounds.width() / 2,
            mCirclePaint);

    mPaint.setColor(mCurrentColor);
    c.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);
}
 
开发者ID:mReady,项目名称:progress-layouts,代码行数:20,代码来源:MaterialProgressDrawable.java

示例8: draw

import android.graphics.RectF; //导入方法依赖的package包/类
public void draw(Canvas canvas) {
    if (this.mInvalidateShader) {
        this.mPaint.setShader(createGradientShader());
        this.mInvalidateShader = false;
    }
    float halfBorderWidth = this.mPaint.getStrokeWidth() / 2.0f;
    RectF rectF = this.mRectF;
    copyBounds(this.mRect);
    rectF.set(this.mRect);
    rectF.left += halfBorderWidth;
    rectF.top += halfBorderWidth;
    rectF.right -= halfBorderWidth;
    rectF.bottom -= halfBorderWidth;
    canvas.save();
    canvas.rotate(this.mRotation, rectF.centerX(), rectF.centerY());
    canvas.drawOval(rectF, this.mPaint);
    canvas.restore();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:CircularBorderDrawable.java

示例9: draw

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
protected void draw(Canvas canvas, Rect bounds) {
    RectF arcBounds = mTempBounds;
    arcBounds.set(bounds);
    arcBounds.inset(mStrokeInset, mStrokeInset);
    mCurrentBounds.set(arcBounds);

    int saveCount = canvas.save();

    //draw circle trim
    float startAngle = (mStartTrim + mRotation) * 360;
    float endAngle = (mEndTrim + mRotation) * 360;
    float sweepAngle = endAngle - startAngle;
    if (sweepAngle != 0) {
        mPaint.setColor(mColor);
        mPaint.setStyle(Paint.Style.STROKE);
        canvas.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);
    }

    //draw water wave
    if (mWaveProgress < 1.0f) {
        mPaint.setColor(Color.argb((int) (Color.alpha(mColor) * (1.0f - mWaveProgress)),
                Color.red(mColor), Color.green(mColor), Color.blue(mColor)));
        mPaint.setStyle(Paint.Style.STROKE);
        float radius = Math.min(arcBounds.width(), arcBounds.height()) / 2.0f;
        canvas.drawCircle(arcBounds.centerX(), arcBounds.centerY(), radius * (1.0f + mWaveProgress), mPaint);
    }
    //draw ball bounce
    if (mPathMeasure != null) {
        mPaint.setColor(mBallColor);
        mPaint.setStyle(Paint.Style.FILL);
        canvas.drawCircle(mCurrentPosition[0], mCurrentPosition[1], mSkipBallSize * mScale, mPaint);
    }

    canvas.restoreToCount(saveCount);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:GuardLoadingRenderer.java

示例10: drawOval

import android.graphics.RectF; //导入方法依赖的package包/类
/**
     * 画椭圆
     *
     * @param canvas
     */
    private void drawOval(Canvas canvas) {
        Paint paint = new Paint();
        paint.setColor(Color.parseColor("#FF7F24"));
        paint.setStyle(Paint.Style.FILL); //设置描边的画法

//        canvas.drawOval(50, 50, 300, 200, paint);

        RectF rectF = new RectF();
        rectF.set(50, 50, 300, 200);
        canvas.drawOval(rectF, paint);
    }
 
开发者ID:songjiabin,项目名称:MySelfDemo,代码行数:17,代码来源:MyView2.java

示例11: drawTile

import android.graphics.RectF; //导入方法依赖的package包/类
private void drawTile(GLCanvas canvas,
                      int tx, int ty, int level, float x, float y, float length) {
    RectF source = mSourceRect;
    RectF target = mTargetRect;
    target.set(x, y, x + length, y + length);
    source.set(0, 0, mTileSize, mTileSize);

    Tile tile = getTile(tx, ty, level);
    if (tile != null) {
        if (!tile.isContentValid()) {
            if (tile.mTileState == STATE_DECODED) {
                if (mUploadQuota > 0) {
                    --mUploadQuota;
                    tile.updateContent(canvas);
                } else {
                    mRenderComplete = false;
                }
            } else if (tile.mTileState != STATE_DECODE_FAIL) {
                mRenderComplete = false;
                queueForDecode(tile);
            }
        }
        if (drawTile(tile, canvas, source, target)) {
            return;
        }
    }
    if (mPreview != null) {
        int size = mTileSize << level;
        float scaleX = (float) mPreview.getWidth() / mImageWidth;
        float scaleY = (float) mPreview.getHeight() / mImageHeight;
        source.set(tx * scaleX, ty * scaleY, (tx + size) * scaleX,
                (ty + size) * scaleY);
        canvas.drawTexture(mPreview, source, target);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:36,代码来源:TiledImageRenderer.java

示例12: getRootBounds

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public void getRootBounds(RectF bounds) {
  if (mTransformCallback != null) {
    mTransformCallback.getRootBounds(bounds);
  } else {
    bounds.set(getBounds());
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:ArrayDrawable.java

示例13: getMatrixRectF

import android.graphics.RectF; //导入方法依赖的package包/类
private RectF getMatrixRectF() {
    Matrix matrix = mImageMatrix;
    RectF rectF = new RectF();
    Drawable d = getDrawable();
    if (d != null) {
        rectF.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
        matrix.mapRect(rectF);
    }
    return rectF;
}
 
开发者ID:Sora-Shiro,项目名称:ChinaMapInfoView,代码行数:11,代码来源:ChinaMapInfoView.java

示例14: demo

import android.graphics.RectF; //导入方法依赖的package包/类
private void demo(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.BLACK);
    paint.setAntiAlias(true);


    RectF rectF = new RectF();
    rectF.set(30, 30, getWidth() - 30, getHeight() - 30);

    canvas.drawArc(rectF, -110, 100, true, paint);


    canvas.drawArc(rectF, 10, 140, false, paint);


    Paint paint1 = new Paint();
    paint1.setColor(Color.BLACK);
    paint1.setStyle(Paint.Style.STROKE);


    canvas.drawArc(rectF, 180, 60, false, paint1);
}
 
开发者ID:songjiabin,项目名称:MySelfDemo,代码行数:23,代码来源:Practice8DrawArcView.java

示例15: getLimitBounds

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Gets the bounds used to limit the translation, in view-absolute coordinates.
 * <p>
 * <p> These bounds are passed to the zoomable controller in order to limit the translation. The
 * image is attempted to be centered within the limit bounds if the transformed image is smaller.
 * There will be no empty spaces within the limit bounds if the transformed image is bigger.
 * This applies to each dimension (horizontal and vertical) independently.
 * <p> Unless overridden by a subclass, these bounds are same as the view bounds.
 */
protected void getLimitBounds(RectF outBounds) {
    outBounds.set(0, 0, getWidth(), getHeight());
}
 
开发者ID:idisfkj,项目名称:Zoomable,代码行数:13,代码来源:ZoomableDraweeView.java


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