|
1 | | -# |
2 | | -void PApplet::rect(float x,float y,float w,float h,float tl,float tr,float br,float bl){ |
3 | | - if(!doFill && !doStroke) return; |
4 | | - float x2=x+w, y2=y+h; |
5 | | - beginShape(); |
6 | | - vertex(x+tl,y); vertex(x2-tr,y); |
7 | | - if(tr>0){for(int i=0;i<=8;i++){float a=PI+HALF_PI+HALF_PI*i/8.f;vertex(x2-tr+::std::cos(a)*tr,y+tr+::std::sin(a)*tr);}} |
8 | | - vertex(x2,y+tr); vertex(x2,y2-br); |
9 | | - if(br>0){for(int i=0;i<=8;i++){float a=HALF_PI*i/8.f;vertex(x2-br+::std::cos(a)*br,y2-br+::std::sin(a)*br);}} |
10 | | - vertex(x2-br,y2); vertex(x+bl,y2); |
11 | | - if(bl>0){for(int i=0;i<=8;i++){float a=HALF_PI+HALF_PI*i/8.f;vertex(x+bl+::std::cos(a)*bl,y2-bl+::std::sin(a)*bl);}} |
12 | | - vertex(x,y2-bl); vertex(x,y+tl); |
13 | | - if(tl>0){for(int i=0;i<=8;i++){float a=PI+HALF_PI*i/8.f;vertex(x+tl+::std::cos(a)*tl,y+tl+::std::sin(a)*tl);}} |
14 | | - endShape(CLOSE); |
15 | | -} |
16 | | -if __has_include("stb_truetype.h") |
| 1 | +#if __has_include("stb_truetype.h") |
17 | 2 | # define PROCESSING_HAS_STB_TRUETYPE 1 |
18 | 3 | # define STB_TRUETYPE_IMPLEMENTATION |
19 | 4 | # include "stb_truetype.h" |
@@ -1153,6 +1138,21 @@ void PApplet::rect(float x, float y, float w, float h, float r) { |
1153 | 1138 | glEnd(); |
1154 | 1139 | } |
1155 | 1140 | } |
| 1141 | +void PApplet::rect(float x,float y,float w,float h,float tl,float tr,float br,float bl){ |
| 1142 | + if(!doFill && !doStroke) return; |
| 1143 | + float x2=x+w, y2=y+h; |
| 1144 | + beginShape(); |
| 1145 | + vertex(x+tl,y); vertex(x2-tr,y); |
| 1146 | + if(tr>0){for(int i=0;i<=8;i++){float a=PI+HALF_PI+HALF_PI*i/8.f;vertex(x2-tr+::std::cos(a)*tr,y+tr+::std::sin(a)*tr);}} |
| 1147 | + vertex(x2,y+tr); vertex(x2,y2-br); |
| 1148 | + if(br>0){for(int i=0;i<=8;i++){float a=HALF_PI*i/8.f;vertex(x2-br+::std::cos(a)*br,y2-br+::std::sin(a)*br);}} |
| 1149 | + vertex(x2-br,y2); vertex(x+bl,y2); |
| 1150 | + if(bl>0){for(int i=0;i<=8;i++){float a=HALF_PI+HALF_PI*i/8.f;vertex(x+bl+::std::cos(a)*bl,y2-bl+::std::sin(a)*bl);}} |
| 1151 | + vertex(x,y2-bl); vertex(x,y+tl); |
| 1152 | + if(tl>0){for(int i=0;i<=8;i++){float a=PI+HALF_PI*i/8.f;vertex(x+tl+::std::cos(a)*tl,y+tl+::std::sin(a)*tl);}} |
| 1153 | + endShape(CLOSE); |
| 1154 | +} |
| 1155 | + |
1156 | 1156 | void PApplet::square(float x,float y,float s){rect(x,y,s,s);} |
1157 | 1157 | void PApplet::triangle(float x1, float y1, float x2, float y2, float x3, float y3) { |
1158 | 1158 | if (doFill) { |
|
0 commit comments