本文整理匯總了Java中android.graphics.Path.Direction類的典型用法代碼示例。如果您正苦於以下問題:Java Direction類的具體用法?Java Direction怎麽用?Java Direction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Direction類屬於android.graphics.Path包,在下文中一共展示了Direction類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBoundsChange
import android.graphics.Path.Direction; //導入依賴的package包/類
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
rimRadius = Math.min(bounds.width(), bounds.height()) / 2f - rimPaint.getStrokeWidth();
faceRadius = rimRadius - rimPaint.getStrokeWidth();
screwRadius = rimPaint.getStrokeWidth() * 2;
float hourHandLength = (float) (0.5 * faceRadius);
float minuteHandLength = (float) (0.7 * faceRadius);
float top = bounds.centerY() - screwRadius;
hourHandPath.reset();
hourHandPath.moveTo(bounds.centerX(), bounds.centerY());
hourHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - hourHandLength, Direction.CCW);
hourHandPath.close();
minuteHandPath.reset();
minuteHandPath.moveTo(bounds.centerX(), bounds.centerY());
minuteHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - minuteHandLength, Direction.CCW);
minuteHandPath.close();
}
示例2: setupCropBounds
import android.graphics.Path.Direction; //導入依賴的package包/類
public void setupCropBounds() {
int height = (int) (((float) this.mThisWidth) / this.mTargetAspectRatio);
int halfDiff;
if (height > this.mThisHeight) {
int width = (int) (((float) this.mThisHeight) * this.mTargetAspectRatio);
halfDiff = (this.mThisWidth - width) / 2;
this.mCropViewRect.set((float) (getPaddingLeft() + halfDiff), (float) getPaddingTop()
, (float) ((getPaddingLeft() + width) + halfDiff), (float) (getPaddingTop() +
this.mThisHeight));
} else {
halfDiff = (this.mThisHeight - height) / 2;
this.mCropViewRect.set((float) getPaddingLeft(), (float) (getPaddingTop() + halfDiff)
, (float) (getPaddingLeft() + this.mThisWidth), (float) ((getPaddingTop() +
height) + halfDiff));
}
this.mGridPoints = null;
this.mCircularPath.reset();
this.mCircularPath.addOval(this.mCropViewRect, Direction.CW);
}
示例3: draw
import android.graphics.Path.Direction; //導入依賴的package包/類
public void draw(Canvas canvas) {
boolean positionChanged = adapterPositionChanged();
if (this.rippleOverlay) {
if (!positionChanged) {
this.rippleBackground.draw(canvas);
}
super.draw(canvas);
if (!positionChanged) {
if (this.rippleRoundedCorners != 0.0f) {
Path clipPath = new Path();
clipPath.addRoundRect(new RectF(0.0f, 0.0f, (float) canvas.getWidth(), (float) canvas.getHeight()), this.rippleRoundedCorners, this.rippleRoundedCorners, Direction.CW);
canvas.clipPath(clipPath);
}
canvas.drawCircle((float) this.currentCoords.x, (float) this.currentCoords.y, this.radius, this.paint);
return;
}
return;
}
if (!positionChanged) {
this.rippleBackground.draw(canvas);
canvas.drawCircle((float) this.currentCoords.x, (float) this.currentCoords.y, this.radius, this.paint);
}
super.draw(canvas);
}
示例4: drawOutSideText
import android.graphics.Path.Direction; //導入依賴的package包/類
private void drawOutSideText(Canvas canvas) {
Paint textPaint = new Paint();
textPaint.setColor(this.mNormalGray);
textPaint.setAntiAlias(true);
textPaint.setTextSize(getResources().getDimension(R.dimen.out_indicator_size));
int radius = getViewRadius() - this.mDividerWidth;
Path path = new Path();
path.addCircle((float) getCenterX(), (float) getCenterY(), (float) radius, Direction.CW);
if (this.mDividerIndicator.size() != 0) {
String content = BaseCircle.formatNumber(this.mStartIndicator);
canvas.drawTextOnPath(content, path, ViewUtils.getCirclePathLength((float) radius,
135.0f) - ((float) (ViewUtils.getTextWidth(textPaint, content) / 2)), 0.0f,
textPaint);
float perAngle = 270.0f / (this.mEndIndicator - this.mStartIndicator);
for (IndicatorItem item : this.mDividerIndicator) {
content = BaseCircle.formatNumber(item.end);
canvas.drawTextOnPath(content, path, ViewUtils.getCirclePathLength((float)
radius, ((item.end - this.mStartIndicator) * perAngle) + 135.0f) - (
(float) (ViewUtils.getTextWidth(textPaint, content) / 2)), 0.0f, textPaint);
}
}
}
示例5: updatePath
import android.graphics.Path.Direction; //導入依賴的package包/類
private void updatePath(final int w, final int h) {
final float maxAbsSize = Math.min(w, h) / 2f;
final float absSize = size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1;
path.reset();
if (progress == 0) {
path.close();
} else if (progress < maxProgress) {
final float angle = progress * 360 / maxProgress;
final float x = w / 2f;
final float y = h / 2f;
path.moveTo(x, y);
path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y + absSize), 270, angle);
path.close();
} else {
path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
}
}
示例6: onBoundsChange
import android.graphics.Path.Direction; //導入依賴的package包/類
@Override
protected void onBoundsChange(Rect bounds) {
if(mBackgroundDrawable != null)
mBackgroundDrawable.setBounds(bounds);
mBackgroundBounds.set(bounds.left + mMask.left, bounds.top + mMask.top, bounds.right - mMask.right, bounds.bottom - mMask.bottom);
mBackground.reset();
switch (mMask.type) {
case Mask.TYPE_OVAL:
mBackground.addOval(mBackgroundBounds, Direction.CW);
break;
case Mask.TYPE_RECTANGLE:
mBackground.addRoundRect(mBackgroundBounds, mMask.cornerRadius, Direction.CW);
break;
}
}
示例7: getFunnelPath
import android.graphics.Path.Direction; //導入依賴的package包/類
private static Path getFunnelPath(AutoShape shape, Rect rect)
{
float width = 716f;
float height = 536f;
path.addOval(new RectF(28, 22, 688, 238), Direction.CCW);
path.moveTo(0, 130);
path.arcTo(new RectF(0, 0, 716, 260), 180, 180);
path.arcTo(new RectF(258, 444, 458, 536), 30, 150);
path.close();
sm.reset();
sm.postScale(rect.width() / width, rect.height() / height);
path.transform(sm);
path.offset(rect.left, rect.top);
return path;
}
示例8: getFramePath
import android.graphics.Path.Direction; //導入依賴的package包/類
private static Path getFramePath(AutoShape shape, Rect rect)
{
float x = Math.min(rect.height(), rect.width()) * 0.1f;
Float[] values = shape.getAdjustData();
if (values != null && values.length >= 1)
{
if (values[0] != null)
{
x = Math.min(rect.height(), rect.width()) * values[0];
}
}
rectF.set(rect.left, rect.top, rect.right, rect.bottom);
path.addRect(rectF, Path.Direction.CW);
rectF.set(rect.left + x, rect.top + x, rect.right - x, rect.bottom - x);
path.addRect(rectF, Path.Direction.CCW);
return path;
}
示例9: updatePath
import android.graphics.Path.Direction; //導入依賴的package包/類
private void updatePath(final int w, final int h)
{
final float maxAbsSize = Math.min(w, h) / 2f;
final float absSize = size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1;
path.reset();
if (progress == 0)
{
path.close();
}
else if (progress < maxProgress)
{
final float angle = progress * 360 / maxProgress;
final float x = w / 2f;
final float y = h / 2f;
path.moveTo(x, y);
path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y + absSize), 270, angle);
path.close();
}
else
{
path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
}
}
示例10: setBitmap
import android.graphics.Path.Direction; //導入依賴的package包/類
/**
* Sets the bitmap to be used for the zoomed view.
*/
public void setBitmap(Bitmap bitmap) {
if (mZoomedBitmap != null) {
mZoomedBitmap.recycle();
mZoomedBitmap = null;
}
mZoomedBitmap = bitmap;
// Round the corners of the bitmap so it doesn't stick out around the overlay.
Canvas canvas = new Canvas(mZoomedBitmap);
Path path = new Path();
RectF canvasRect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
float overlayCornerRadius = getOverlayCornerRadius(getContext());
path.addRoundRect(canvasRect, overlayCornerRadius, overlayCornerRadius, Direction.CCW);
canvas.clipPath(path, Op.XOR);
Paint clearPaint = new Paint();
clearPaint.setXfermode(new PorterDuffXfermode(Mode.SRC));
clearPaint.setColor(Color.TRANSPARENT);
canvas.drawPaint(clearPaint);
}
示例11: onBoundsChange
import android.graphics.Path.Direction; //導入依賴的package包/類
@Override
protected void onBoundsChange(Rect bounds) {
if(mBackgroundDrawable != null)
mBackgroundDrawable.setBounds(bounds);
mBackgroundBounds.set(bounds.left + mMask.left, bounds.top + mMask.top, bounds.right - mMask.right, bounds.bottom - mMask.bottom);
mBackground.reset();
switch (mMask.type) {
case Mask.TYPE_OVAL:
mBackground.addOval(mBackgroundBounds, Direction.CW);
break;
case Mask.TYPE_RECTANGLE:
mBackground.addRoundRect(mBackgroundBounds, mMask.cornerRadius, Direction.CW);
break;
}
}
示例12: updatePath
import android.graphics.Path.Direction; //導入依賴的package包/類
private void updatePath(final int w, final int h) {
final float maxAbsSize = Math.min(w, h) / 2f;
final float absSize = size < maxSize ? maxAbsSize * size / maxSize
: maxAbsSize - 1;
path.reset();
if (progress == 0) {
path.close();
} else if (progress < maxProgress) {
final float angle = progress * 360 / maxProgress;
final float x = w / 2f;
final float y = h / 2f;
path.moveTo(x, y);
path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y
+ absSize), 270, angle);
path.close();
} else {
path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
}
}
示例13: onDraw
import android.graphics.Path.Direction; //導入依賴的package包/類
@Override
protected void onDraw(Canvas canvas) {
float borderWidth = this.borderWidth;
float roundWidth = this.roundWidth;
if (borderWidth < 0) {
borderWidth = ( getWidth() + getHeight() ) * .02f;
}
paint.setStrokeWidth( borderWidth );
if (roundWidth < 0) {
roundWidth = borderWidth * 2;
}
drawPath.reset();
// drawRect.set( 0 + roundWidth / 2, 0 + roundWidth / 2, getWidth() - roundWidth / 2, getHeight() - roundWidth / 2 );
drawRect.set( 0 + borderWidth / 2, 0 + borderWidth / 2, getWidth() - borderWidth / 2, getHeight() - borderWidth / 2 );
drawPath.addRoundRect( drawRect, roundWidth, roundWidth, Direction.CCW );
canvas.save();
canvas.clipPath( drawPath );
super.onDraw( canvas );
canvas.restore();
canvas.drawRoundRect( drawRect, roundWidth, roundWidth, paint );
}
示例14: onDraw
import android.graphics.Path.Direction; //導入依賴的package包/類
@Override
public void onDraw(Canvas canvas) {
if (mCenter == null) {
mCenter = new Point(getWidth()/2, getHeight()/2);
}
canvas.drawColor(Color.CYAN);
float left = mCenter.x;
float top = mCenter.y;
float radius = 200;
Path p = new Path();
p.addRect(left, top, left+radius, top+radius, Direction.CW);
p.addCircle(mCenter.x, mCenter.y, radius, Direction.CW);
p.lineTo(mCenter.x + 2*radius, mCenter.y+2*radius);
p.close();
Paint paint = new Paint();
paint.setColor(Color.RED);
paint.setAntiAlias(true);
// paint.setStyle(Style.FILL_AND_STROKE);
canvas.drawPath(p, paint);
}
示例15: updatePath
import android.graphics.Path.Direction; //導入依賴的package包/類
private void updatePath(final int w, final int h)
{
final float maxAbsSize = Math.min(w, h) / 2f;
final float absSize = size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1;
path.reset();
if (progress == 0)
{
path.close();
}
else if (progress < maxProgress)
{
final float angle = progress * 360 / maxProgress;
final float x = w / 2f;
final float y = h / 2f;
path.moveTo(x, y);
path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y + absSize), 270, angle);
path.close();
}
else
{
path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
}
}