1 | static void box(Img img, Box p) {
|
2 | int w = img.getWidth(), h = img.getHeight(); |
3 | double x1 = normalize(p.cx-p.w), x2 = normalize(p.cx+p.w); |
4 | double y1 = normalize(p.cy-p.h), y2 = normalize(p.cy+p.h); |
5 | int xx1 = round(x1*(w-1)), xx2 = round(x2*(w-1)); |
6 | int yy1 = round(y1*(h-1)), yy2 = round(y2*(h-1)); |
7 | |
8 | for (int yy = yy1; yy <= yy2; yy++) |
9 | for (int xx = xx1; xx <= xx2; xx++) |
10 | img.setPixel(xx, yy, p.color); |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1000540 |
| Snippet name: | box (paints a box) |
| Eternal ID of this version: | #1000540/1 |
| Text MD5: | a5c67f2027086342e620621240b6d9de |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-08-11 01:38:46 |
| Source code size: | 464 bytes / 11 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 956 / 1097 |
| Referenced in: | [show references] |