( begin auto-generated from rect.xml ) Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. These parameters ma
(float a, float b, float c, float d)
| 2584 | * @see PGraphics#quad(float, float, float, float, float, float, float, float) |
| 2585 | */ |
| 2586 | public void rect(float a, float b, float c, float d) { |
| 2587 | float hradius, vradius; |
| 2588 | switch (rectMode) { |
| 2589 | case CORNERS: |
| 2590 | break; |
| 2591 | case CORNER: |
| 2592 | c += a; d += b; |
| 2593 | break; |
| 2594 | case RADIUS: |
| 2595 | hradius = c; |
| 2596 | vradius = d; |
| 2597 | c = a + hradius; |
| 2598 | d = b + vradius; |
| 2599 | a -= hradius; |
| 2600 | b -= vradius; |
| 2601 | break; |
| 2602 | case CENTER: |
| 2603 | hradius = c / 2.0f; |
| 2604 | vradius = d / 2.0f; |
| 2605 | c = a + hradius; |
| 2606 | d = b + vradius; |
| 2607 | a -= hradius; |
| 2608 | b -= vradius; |
| 2609 | } |
| 2610 | |
| 2611 | if (a > c) { |
| 2612 | float temp = a; a = c; c = temp; |
| 2613 | } |
| 2614 | |
| 2615 | if (b > d) { |
| 2616 | float temp = b; b = d; d = temp; |
| 2617 | } |
| 2618 | |
| 2619 | rectImpl(a, b, c, d); |
| 2620 | } |
| 2621 | |
| 2622 | |
| 2623 | protected void rectImpl(float x1, float y1, float x2, float y2) { |
no test coverage detected