本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
}
示例12: getRootBounds
import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public void getRootBounds(RectF bounds) {
if (mTransformCallback != null) {
mTransformCallback.getRootBounds(bounds);
} else {
bounds.set(getBounds());
}
}
示例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;
}
示例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);
}
示例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());
}