Path addRect - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:addOval, addRect, lineTo, moveTo, setFillType
		super.dispatchDraw(canvas);
	} 
	 
	public static Path createArrow(Point left, Point right, int width, int line_width, int direction)
	{ 
		Path path = new Path();
		if (direction == DIRECTION_LEFT){
			Point tmp = right;
			right = left;
			left = tmp;
		}else{ 
			 
		} 
		float radius = (float) (width * 0.45);
		double angle = Math.atan2(right.y - left.y, right.x - left.x);
		path.setFillType(Path.FillType.WINDING);
		RectF oval = new RectF(left.x-radius, left.y - radius, left.x + radius, left.y + radius);
		path.addOval(oval, Path.Direction.CCW);
		if (direction == DIRECTION_LEFT){
			RectF line = new RectF(left.x, left.y - line_width, right.x+width/2, right.y + line_width);

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addCircle, addRect
    protected void draw(Canvas canvas) {
        if (mHidden) {
            return; 
        } 
        canvas.save();
        Path path = new Path();
        if (!hasFocus()) { 
            mOutlinePaint.setColor(0xFF000000);
            canvas.drawRect(mDrawRect, mOutlinePaint);
        } else { 
            Rect viewDrawingRect = new Rect();
            mContext.getDrawingRect(viewDrawingRect);
            if (mCircle) {
                float width  = mDrawRect.width();
                float height = mDrawRect.height();
                path.addCircle(mDrawRect.left + (width  / 2),
                               mDrawRect.top + (height / 2),
                               width / 2,
                               Path.Direction.CW);
                mOutlinePaint.setColor(0xFFEF04D6);

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addRect, reset
	} 
 
	protected void draw(Canvas canvas) {
		canvas.save();
 
		mOutlinePath.reset();
		mOutlinePath.addRect(mDrawRect.left, mDrawRect.top, mDrawRect.right, mDrawRect.bottom, Path.Direction.CW);
 
		if (!Platform.isCanvasHardwareAccelerated(canvas)) {
			canvas.clipPath(mOutlinePath, Region.Op.DIFFERENCE);
			canvas.drawPaint(mFocusPaint);
		} 
 
		canvas.restore();
 
		canvas.drawPath(mOutlinePath, mOutlinePaint);
 
		/** 
		 * Draw Handle Drawables 
		 */ 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addCircle, addRect
    protected void draw(Canvas canvas) {
        if (mHidden) {
            return; 
        } 
        canvas.save();
        Path path = new Path();
        if (!hasFocus()) { 
            mOutlinePaint.setColor(0xFF000000);
            canvas.drawRect(mDrawRect, mOutlinePaint);
        } else { 
            Rect viewDrawingRect = new Rect();
            mContext.getDrawingRect(viewDrawingRect);
            if (mCircle) {
                float width = mDrawRect.width();
                float height = mDrawRect.height();
                path.addCircle(mDrawRect.left + (width / 2), mDrawRect.top + (height / 2), width / 2, Path.Direction.CW);
                mOutlinePaint.setColor(0xFFEF04D6);
            } else { 
                path.addRect(new RectF(mDrawRect), Path.Direction.CW);
                mOutlinePaint.setColor(0xFFFF8A00);

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addCircle, addRect, reset
    protected void draw(Canvas canvas) {
        if (mHidden)
            return; 
         
        canvas.save();
        mPath.reset();
        if (!hasFocus()) { 
            mOutlinePaint.setColor(0xFF000000);
            canvas.drawRect(mDrawRect, mOutlinePaint);
        } else { 
            mContext.getDrawingRect(mViewDrawingRect);
            if (mCircle) {
                float width  = mDrawRect.width()  - (getPaddingLeft() + getPaddingRight());
                float height = mDrawRect.height() - (getPaddingTop()  + getPaddingBottom());
                mPath.addCircle(
                        mDrawRect.left + getPaddingLeft() + (width  / 2), 
                        mDrawRect.top  + getPaddingTop()  + (height / 2),
                        width / 2, 
                        Path.Direction.CW);
                mOutlinePaint.setColor(0xFFEF04D6);

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addRect
     
    /** 
     * {@inheritDoc}  
     */ 
    public Path getPath() {
        Path path = new Path();
        path.addRect(mRect, Direction.CW);
        return path;
    } 
     
    /** 
     * {@inheritDoc}  
     */ 
    public void clip(Canvas canvas) {
        canvas.clipRect(mRect);
    } 
 
    /** 
     * {@inheritDoc}  
     */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addRect, addRoundRect, setFillType
		innerRect.set(bounds.left + padding, bounds.top + padding, bounds.right - padding, bounds.bottom - padding);
 
		if (radius > 0) {
			float outerRadii[] = new float[8];
			Arrays.fill(outerRadii, radius);
			borderPath = new Path();
			borderPath.addRoundRect(outerRect, outerRadii, Direction.CW);
			borderPath.setFillType(FillType.EVEN_ODD);
			innerPath = new Path();
			innerPath.setFillType(FillType.EVEN_ODD);
			if (radius - padding > 0) {
				float innerRadii[] = new float[8];
				Arrays.fill(innerRadii, radius - padding);
				borderPath.addRoundRect(innerRect, innerRadii, Direction.CW);
				innerPath.addRoundRect(innerRect, innerRadii, Direction.CW);
			} else { 
				borderPath.addRect(innerRect, Direction.CW);
				innerPath.addRect(innerRect, Direction.CW);
			} 
		} else { 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addCircle, addRect
	protected void draw(Canvas canvas) {
		if (mHidden) {
			return; 
		} 
		canvas.save();
		Path path = new Path();
		if (!hasFocus()) { 
			mOutlinePaint.setColor(0xFF000000);
			canvas.drawRect(mDrawRect, mOutlinePaint);
		} else { 
			Rect viewDrawingRect = new Rect();
			mContext.getDrawingRect(viewDrawingRect);
			if (mCircle) {
				float width = mDrawRect.width();
				float height = mDrawRect.height();
				path.addCircle(mDrawRect.left + (width / 2), mDrawRect.top
						+ (height / 2), width / 2, Path.Direction.CW);
				mOutlinePaint.setColor(0xFFEF04D6);
			} else { 
				path.addRect(new RectF(mDrawRect), Path.Direction.CW);

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addPath, addRect, reset, setFillType
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addRect, addRoundRect, reset
	// PRIVATE ==================================================================================== 
	 
	private void updateGeometry() { 
		final Rect b = getBounds();
		 
		mStrokePath.reset();
		mFillPath.reset();
		mIndicatorFillPath.reset();
		mIndicatorStrokePath.reset();
		 
		if (b.isEmpty()) {
			return; 
		} 
		 
		final boolean isHorizontal = mIndicatorDirection == IndicatorDirection.TOP
				|| mIndicatorDirection == IndicatorDirection.BOTTOM;
		final int innerCornerWidth = mCornerRadius - mStrokeWidth;
		final float sW = mStrokeWidth;
		final float iW = mIndicatorWidth;
		final float cR = mCornerRadius;

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

Related Path addRect Questions & Answers:

addRect Method Overview
Add a closed rectangle contour to the path
See Code Examples for other Android Path Methods: