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


Java RectF.inset方法代码示例

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


在下文中一共展示了RectF.inset方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(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:zuoweitan,项目名称:Hitalk,代码行数:24,代码来源:MaterialProgressDrawable.java

示例2: 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:ynztlxdeai,项目名称:TextReader,代码行数:25,代码来源:MaterialProgressDrawable.java

示例3: buildShadowCorners

import android.graphics.RectF; //导入方法依赖的package包/类
private void buildShadowCorners() {
    RectF innerBounds = new RectF(-this.mCornerRadius, -this.mCornerRadius, this.mCornerRadius, this.mCornerRadius);
    RectF outerBounds = new RectF(innerBounds);
    outerBounds.inset(-this.mShadowSize, -this.mShadowSize);
    if (this.mCornerShadowPath == null) {
        this.mCornerShadowPath = new Path();
    } else {
        this.mCornerShadowPath.reset();
    }
    this.mCornerShadowPath.setFillType(FillType.EVEN_ODD);
    this.mCornerShadowPath.moveTo(-this.mCornerRadius, 0.0f);
    this.mCornerShadowPath.rLineTo(-this.mShadowSize, 0.0f);
    this.mCornerShadowPath.arcTo(outerBounds, 180.0f, 90.0f, false);
    this.mCornerShadowPath.arcTo(innerBounds, 270.0f, -90.0f, false);
    this.mCornerShadowPath.close();
    float startRatio = this.mCornerRadius / (this.mCornerRadius + this.mShadowSize);
    this.mCornerShadowPaint.setShader(new RadialGradient(0.0f, 0.0f, this.mCornerRadius + this.mShadowSize, new int[]{this.mShadowStartColor, this.mShadowStartColor, this.mShadowEndColor}, new float[]{0.0f, startRatio, 1.0f}, TileMode.CLAMP));
    this.mEdgeShadowPaint.setShader(new LinearGradient(0.0f, (-this.mCornerRadius) + this.mShadowSize, 0.0f, (-this.mCornerRadius) - this.mShadowSize, new int[]{this.mShadowStartColor, this.mShadowStartColor, this.mShadowEndColor}, new float[]{0.0f, 0.5f, 1.0f}, TileMode.CLAMP));
    this.mEdgeShadowPaint.setAntiAlias(false);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:RoundRectDrawableWithShadow.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:gigabytedevelopers,项目名称:FireFiles,代码行数:25,代码来源:MaterialProgressDrawable.java

示例5: 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

示例6: onBoundsChange

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    int length = getFinalDragOffset();
    mBounds = new RectF(bounds.width() / 2 - length / 2, bounds.top, bounds.width() / 2 + length / 2, bounds.top + length);
    mBounds.inset(dp2px(15), dp2px(15));
}
 
开发者ID:liuwei1993,项目名称:Android-PullRefresh,代码行数:8,代码来源:RingDrawable.java

示例7: drawRing

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * draw the ring
 *
 * @param canvas to draw the Ring
 * @param bounds the ring's rect
 */
private void drawRing(Canvas canvas, Rect bounds) {
    final RectF arcBounds = mTempBounds;
    final Ring ring = mRing;
    arcBounds.set(bounds);
    arcBounds.inset(ring.strokeInset, ring.strokeInset);
    canvas.drawArc(arcBounds, ring.start, ring.sweep, false, mPaint);
}
 
开发者ID:zwmlibs,项目名称:BookReader-master,代码行数:14,代码来源:LoadingView.java

示例8: adjustLeftRightByAspectRatio

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Adjust left and right edges by current crop window height and the given aspect ratio,
 * both right and left edges adjusts equally relative to center to keep aspect ratio to the height.
 */
private void adjustLeftRightByAspectRatio(RectF rect, RectF bounds, float aspectRatio) {
    rect.inset((rect.width() - rect.height() * aspectRatio) / 2, 0);
    if (rect.left < bounds.left) {
        rect.offset(bounds.left - rect.left, 0);
    }
    if (rect.right > bounds.right) {
        rect.offset(bounds.right - rect.right, 0);
    }
}
 
开发者ID:garretyoder,项目名称:Cluttr,代码行数:14,代码来源:CropWindowMoveHandler.java

示例9: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
public void onSingleTapConfirmed(float x, float y) {
    final RectF rect = new RectF(mDrawRect);
    rect.inset(-mPadding, -mPadding);

    final float pts[] = new float[] { x, y };

    final Matrix rotateMatrix = new Matrix();
    rotateMatrix.postTranslate(-rect.centerX(), -rect.centerY());
    rotateMatrix.postRotate(-mRotation);
    rotateMatrix.postTranslate(rect.centerX(), rect.centerY());
    rotateMatrix.mapPoints(pts);

    x = pts[0];
    y = pts[1];

    // mContext.invalidate();

    final boolean verticalCheck = (y >= (rect.top - HIT_TOLERANCE))
                                  && (y < (rect.bottom + HIT_TOLERANCE));
    final boolean horizCheck = (x >= (rect.left - HIT_TOLERANCE))
                               && (x < (rect.right + HIT_TOLERANCE));

    if (mAnchorDelete != null) {
        if ((Math.abs(rect.left - x) < HIT_TOLERANCE)
            && (Math.abs(rect.top - y) < HIT_TOLERANCE) && verticalCheck && horizCheck) {
            if (mDeleteClickListener != null) {
                mDeleteClickListener.onDeleteClick();
            }
        }
    }
}
 
开发者ID:Sherchen,项目名称:AnimationsDemo,代码行数:32,代码来源:MyHighlightView.java

示例10: draw

import android.graphics.RectF; //导入方法依赖的package包/类
public void draw(Canvas c, Rect bounds) {
    RectF arcBounds = this.mTempBounds;
    arcBounds.set(bounds);
    arcBounds.inset(this.mStrokeInset, this.mStrokeInset);
    float startAngle = (this.mStartTrim + this.mRotation) * 360.0f;
    float sweepAngle = ((this.mEndTrim + this.mRotation) * 360.0f) - startAngle;
    this.mPaint.setColor(this.mCurrentColor);
    c.drawArc(arcBounds, startAngle, sweepAngle, false, this.mPaint);
    drawTriangle(c, startAngle, sweepAngle, bounds);
    if (this.mAlpha < 255) {
        this.mCirclePaint.setColor(this.mBackgroundColor);
        this.mCirclePaint.setAlpha(255 - this.mAlpha);
        c.drawCircle(bounds.exactCenterX(), bounds.exactCenterY(), (float) (bounds.width() / 2), this.mCirclePaint);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:MaterialProgressDrawable.java

示例11: adjustTopBottomByAspectRatio

import android.graphics.RectF; //导入方法依赖的package包/类
/**
 * Adjust top and bottom edges by current crop window width and the given aspect ratio, both top
 * and bottom edges adjusts equally relative to center to keep aspect ratio to the width.
 */
private void adjustTopBottomByAspectRatio(RectF rect, RectF bounds, float aspectRatio) {
  rect.inset(0, (rect.height() - rect.width() / aspectRatio) / 2);
  if (rect.top < bounds.top) {
    rect.offset(0, bounds.top - rect.top);
  }
  if (rect.bottom > bounds.bottom) {
    rect.offset(0, bounds.bottom - rect.bottom);
  }
}
 
开发者ID:prashantsaini1,项目名称:android-titanium-imagecropper,代码行数:14,代码来源:CropWindowMoveHandler.java

示例12: onSingleTapConfirmed

import android.graphics.RectF; //导入方法依赖的package包/类
/**
  * 點擊事件確定
  *
  * @param x
  * @param y
  */
 public void onSingleTapConfirmed(float x, float y) {
     // Log.w(LOG_TAG, "MyHighlightView onSingleTapConfirmed");
     // caclelateRect();
     final RectF rect = new RectF(caclelateRect());
     rect.inset(-mPadding, -mPadding);

     final boolean verticalCheck = (y >= (rect.top - HIT_TOLERANCE))
             && (y < (rect.bottom + ((textSrcRect != null || stickerPaint.getType() == ConstantsPath.COMMONTEXTSTICKER) ? 2 * mAnchorTextHeight : 0) + HIT_TOLERANCE));
     final boolean horizCheck = (x >= (rect.left - HIT_TOLERANCE)) && (x < (rect.right + HIT_TOLERANCE));

     // //Logger.d("电击" + x + " " + y + " " + (Math.abs(rect.centerX() - x))
     // + " " + (Math.abs(rect.bottom + mAnchorTextHeight - y)) + " "
     // + verticalCheck + " " + horizCheck);

     if ((Math.abs(rect.left - x) < HIT_TOLERANCE) && (Math.abs(rect.top - y) < HIT_TOLERANCE) && verticalCheck
             && horizCheck) {
         // 左上角
         /*
         if (mDeleteClickListener != null && isLock == false) {
	mDeleteClickListener.onDeleteClick();
}*/
     } else if ((Math.abs(rect.right - x) < HIT_TOLERANCE) && (Math.abs(rect.top - y) < HIT_TOLERANCE)
             && verticalCheck && horizCheck) {
         //右上角
         /*if (mAnchorLock != null && canmovedepth) {
             if (isLock) {
		unlockView();
	} else {
		lockView();
	}
}*/
     } else if ((Math.abs(rect.left - x) < HIT_TOLERANCE) && (Math.abs(rect.bottom - y) < HIT_TOLERANCE)
             && verticalCheck && horizCheck) {
         //左下角
         if (mAnchorReverse != null && stickerPaint.getType() != ConstantsPath.COMMONTEXTSTICKER) {
             if (this.isLock) {
                 return;
             }
             ReverseView();
         }
     } else if ((Math.abs(rect.centerX() - x) < HIT_TOLERANCE)
             && (Math.abs(rect.bottom + mAnchorTextHeight - y) < HIT_TOLERANCE) && verticalCheck && horizCheck) {
         //中下
         if (mTextButton != null
                 && (mTempRect != null || stickerPaint.getType() == ConstantsPath.COMMONTEXTSTICKER)) {
             mDeleteClickListener.addText(this);
         }
     }
 }
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:56,代码来源:MyHighlightView.java

示例13: copyBounds

import android.graphics.RectF; //导入方法依赖的package包/类
public void copyBounds(RectF outRect) {
    outRect.set(mDrawRect);
    outRect.inset(-mPadding, -mPadding);
}
 
开发者ID:Sherchen,项目名称:AnimationsDemo,代码行数:5,代码来源:MyHighlightView.java

示例14: getTouchTarget

import android.graphics.RectF; //导入方法依赖的package包/类
@Override
public void getTouchTarget(RectF outTarget) {
    outTarget.set(mBounds);
    // Get the whole touchable region.
    outTarget.inset((int) -mClickSlop, (int) -mClickSlop);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:7,代码来源:CompositorButton.java


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