MCPcopy Index your code
hub / github.com/benfry/processing4 / rect

Method rect

core/src/processing/core/PGraphics.java:2685–2719  ·  view source on GitHub ↗

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. The way these parameters are interpreted, however, may be c

(float a, float b, float c, float d)

Source from the content-addressed store, hash-verified

2683 * @see PGraphics#quad(float, float, float, float, float, float, float, float)
2684 */
2685 public void rect(float a, float b, float c, float d) {
2686 float hradius, vradius;
2687 switch (rectMode) {
2688 case CORNERS:
2689 break;
2690 case CORNER:
2691 c += a; d += b;
2692 break;
2693 case RADIUS:
2694 hradius = c;
2695 vradius = d;
2696 c = a + hradius;
2697 d = b + vradius;
2698 a -= hradius;
2699 b -= vradius;
2700 break;
2701 case CENTER:
2702 hradius = c / 2.0f;
2703 vradius = d / 2.0f;
2704 c = a + hradius;
2705 d = b + vradius;
2706 a -= hradius;
2707 b -= vradius;
2708 }
2709
2710 if (a > c) {
2711 float temp = a; a = c; c = temp;
2712 }
2713
2714 if (b > d) {
2715 float temp = b; b = d; d = temp;
2716 }
2717
2718 rectImpl(a, b, c, d);
2719 }
2720
2721
2722 protected void rectImpl(float x1, float y1, float x2, float y2) {

Callers 2

squareMethod · 0.95
backgroundImplMethod · 0.95

Calls 2

rectImplMethod · 0.95
minMethod · 0.95

Tested by

no test coverage detected