Overview
Comment: | Add drawing ellipses into picture editor |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
38ac4dd10f9534e42b5958b9834a124c |
User & Date: | user on 2021-01-18 23:27:52 |
Other Links: | manifest | tags |
Context
2021-01-19
| ||
02:43 | Implement import/export in the picture editor. check-in: a5ef9613c5 user: user tags: trunk | |
2021-01-18
| ||
23:27 | Add drawing ellipses into picture editor check-in: 38ac4dd10f user: user tags: trunk | |
06:04 | Add rotation and add/delete pictures commands into the picture editor. Also correct the maximum number of picture variants. check-in: bf1d25458b user: user tags: trunk | |
Changes
Modified picedit.c from [665be25639] to [14fb1e6db2].
︙ | |||
291 292 293 294 295 296 297 298 299 300 301 302 303 304 | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | static void fill_circle(Uint8*p,Uint8 s,Uint8 x0,Uint8 y0,Uint32 r,Uint8 c) { int x,y; for(y=0;y<s;y++) for(x=0;x<s;x++) { if((x-x0)*(x-x0)+(y-y0)*(y-y0)<=r) p[y*s+x]=c; } } static void draw_ellipse(Uint8*p,Uint8 s,Uint8 x0,Uint8 y0,Uint8 x1,Uint8 y1,Uint8 c) { double cx,cy,rx,ry,v; int x,y; if(x1<x0) x=x1,x1=x0,x0=x; if(y1<y0) y=y1,y1=y0,y0=y; cx=0.5*(x1+x0); cy=0.5*(y1+y0); rx=0.5*(x1-x0); ry=0.5*(y1-y0); for(y=y0;y<=y1;y++) { v=(y-cy)/ry; v*=v; if(v>1.0) continue; v=rx*sqrt(1.0-v); x=round(cx-v); if(x>=0 && x<s) p[y*s+x]=c; x=round(cx+v); if(x>=0 && x<s) p[y*s+x]=c; } for(x=x0;x<=x1;x++) { v=(x-cx)/rx; v*=v; if(v>1.0) continue; v=ry*sqrt(1.0-v); y=round(cy-v); if(y>=0 && y<s) p[y*s+x]=c; y=round(cy+v); if(y>=0 && y<s) p[y*s+x]=c; } } static void fill_ellipse(Uint8*p,Uint8 s,Uint8 x0,Uint8 y0,Uint8 x1,Uint8 y1,Uint8 c) { double cx,cy,rx,ry; int x,y; if(x1<x0) x=x1,x1=x0,x0=x; if(y1<y0) y=y1,y1=y0,y0=y; cx=0.5*(x1+x0); cy=0.5*(y1+y0); rx=0.5*(x1-x0); ry=0.5*(y1-y0); for(y=y0;y<=y1;y++) for(x=x0;x<=x1;x++) { if(pow((x-cx)/rx,2.0)+pow((y-cy)/ry,2.0)<=1.0) p[y*s+x]=c; } } static inline void edit_picture_1(Picture**pict,const char*name) { static const Uint8 shade[64]= "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" |
︙ | |||
487 488 489 490 491 492 493 | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | - + - + - + + + + + + + + + + + + + + + + | case 2: // Pick i=pict[sel]->data[(y+1)*pict[sel]->size+x]; goto pick; case 3: // Line if((i&2) && xx!=-1) draw_line(pict[sel]->data+pict[sel]->size,pict[sel]->size,x,y,xx,yy,cc); if(i&1) xx=x,yy=y; break; |
︙ |
Modified picedit.doc from [47704e2e89] to [a51d4def0a].
︙ | |||
142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | - + + - + + | Filled circle (I) Click the left button at the centre of the circle and the right button at the radius, or you can click the left button at the radius and the middle button at the centre. Hollow ellipse (E) |