Rect inset - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Rect inset method.

This code example shows how to use the following methods:inset, union
        } 
    } 
 
    // Grows the cropping rectange by (dx, dy) in image space. 
    void moveBy(float dx, float dy) {
        Rect invalRect = new Rect(mDrawRect);
 
        mCropRect.offset(dx, dy);
 
        // Put the cropping rectangle inside image rectangle. 
        mCropRect.offset(
                Math.max(0, mImageRect.left - mCropRect.left),
                Math.max(0, mImageRect.top  - mCropRect.top));
 
        mCropRect.offset(
                Math.min(0, mImageRect.right  - mCropRect.right),
                Math.min(0, mImageRect.bottom - mCropRect.bottom));
 
        mDrawRect = computeLayout();
        invalRect.union(mDrawRect);

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset, offset, set
		super.onBoundsChange( bounds );
 
		mLeft = Math.abs( bounds.width() - srcRect.width() ) / 2;
		mTop = Math.abs( bounds.height() - srcRect.height() ) / 2;
 
		dstRect.set( srcRect );
		dstRect.inset( -mInset / 2, -mInset / 2 );
		dstRect.offset( (int) ( mLeft ), (int) ( mTop ) );
 
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see android.graphics.drawable.Drawable#draw(android.graphics.Canvas) 
	 */ 
	@Override 
	public void draw( Canvas canvas ) {
 
		if ( android.os.Build.VERSION.SDK_INT > 10 ) {
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:height, inset, width
		 
		Bitmap croppedImage = Bitmap.createBitmap(mOutputX, mOutputY,
				Bitmap.Config.RGB_565);
		Canvas canvas = new Canvas(croppedImage);
 
		Rect srcRect = new Rect(0, 0, source.getWidth(), source.getHeight());
		Rect dstRect = new Rect(0, 0, mOutputX, mOutputY);
 
		int dx = (srcRect.width() - dstRect.width()) / 2;
		int dy = (srcRect.height() - dstRect.height()) / 2;
 
		// If the srcRect is too big, use the center part of it. 
		srcRect.inset(Math.max(0, dx), Math.max(0, dy));
 
		// If the dstRect is too big, use the center part of it. 
		dstRect.inset(Math.max(0, -dx), Math.max(0, -dy));
 
		// Draw the cropped bitmap in the center 
		canvas.drawBitmap(source, srcRect, dstRect, null);
		return croppedImage;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset, set, union
	 * @param dy 
	 *           the dy 
	 */ 
	void moveBy( float dx, float dy ) {
 
		tmpRectMotion.set( mDrawRect );
		mCropRect.offset( dx, dy );
		mCropRect.offset( Math.max( 0, mImageRect.left - mCropRect.left ), Math.max( 0, mImageRect.top - mCropRect.top ) );
		mCropRect.offset( Math.min( 0, mImageRect.right - mCropRect.right ), Math.min( 0, mImageRect.bottom - mCropRect.bottom ) );
 
		computeLayout( false, mDrawRect );
 
		tmpRectMotion.union( mDrawRect );
		tmpRectMotion.inset( -dWidth * 2, -dHeight * 2 );
		mContext.invalidate( tmpRectMotion );
	} 
 
	/** 
	 * Gets the scale. 
	 *  
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset, union
        } 
    } 
 
    // Grows the cropping rectange by (dx, dy) in image space. 
    void moveBy(float dx, float dy) {
        Rect invalRect = new Rect(mDrawRect);
 
        mCropRect.offset(dx, dy);
 
        // Put the cropping rectangle inside image rectangle. 
        mCropRect.offset(
                Math.max(0, mImageRect.left - mCropRect.left),
                Math.max(0, mImageRect.top  - mCropRect.top));
 
        mCropRect.offset(
                Math.min(0, mImageRect.right  - mCropRect.right),
                Math.min(0, mImageRect.bottom - mCropRect.bottom));
 
        mDrawRect = computeLayout();
        invalRect.union(mDrawRect);

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset, offset, width
    } 
     
    private void addText(Canvas canvas, String str, int x, int y) {
         
        mGridPaint.getTextBounds(str, 0, str.length(), mTextBounds);
        mTextBounds.offset(x - (mTextBounds.width() >> 1), y);
        mTextBounds.inset(-2, -2);
        canvas.drawRect(mTextBounds, mErasePaint);
        canvas.drawText(str, x, y, mGridPaint);
    } 
 
    public void onAccuracyChanged(int sensor, int accuracy) {
    } 
 
    /** 
     * Called when we get a new value from the compass 
     *  
     * @see android.hardware.SensorListener#onSensorChanged(int, float[]) 
     */ 
    public void onSensorChanged(int sensor, float[] values) {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset, union
        } 
    } 
 
    // Grows the cropping rectange by (dx, dy) in image space. 
    void moveBy(float dx, float dy) {
        Rect invalRect = new Rect(mDrawRect);
 
        mCropRect.offset(dx, dy);
 
        // Put the cropping rectangle inside image rectangle. 
        mCropRect.offset(
                Math.max(0, mImageRect.left - mCropRect.left),
                Math.max(0, mImageRect.top  - mCropRect.top));
 
        mCropRect.offset(
                Math.min(0, mImageRect.right  - mCropRect.right),
                Math.min(0, mImageRect.bottom - mCropRect.bottom));
 
        mDrawRect = computeLayout();
        invalRect.union(mDrawRect);

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset
	protected Rect getInvalidationRect() {
		final RectF r = new RectF( mDrawRect );
		r.inset( -mPadding, -mPadding );
		mRotateMatrix.mapRect( r );
 
		final Rect rect = new Rect( (int) r.left, (int) r.top, (int) r.right, (int) r.bottom );
		rect.inset( -mAnchorWidth * 2, -mAnchorHeight * 2 );
		return rect;
	} 
 
	/** 
	 * Gets the matrix. 
	 *  
	 * @return the matrix 
	 */ 
	public Matrix getMatrix() {
		return mMatrix;
	} 
 
	/** 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:inset, union
        } 
    } 
 
    // Grows the cropping rectange by (dx, dy) in image space. 
    void moveBy(float dx, float dy) {
        Rect invalRect = new Rect(mDrawRect);
 
        mCropRect.offset(dx, dy);
 
        // Put the cropping rectangle inside image rectangle. 
        mCropRect.offset(
                Math.max(0, mImageRect.left - mCropRect.left),
                Math.max(0, mImageRect.top  - mCropRect.top));
 
        mCropRect.offset(
                Math.min(0, mImageRect.right  - mCropRect.right),
                Math.min(0, mImageRect.bottom - mCropRect.bottom));
 
        mDrawRect = computeLayout();
        invalRect.union(mDrawRect);

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Rect inset Questions & Answers:

inset Method Overview
Inset the rectangle by (dx,dy).
See Code Examples for other Android Rect Methods: