8 i_mmarray_cr(i_mmarray *ar,int l) {
12 ar->data=mymalloc(sizeof(minmax)*l);
13 for(i=0;i<l;i++) { ar->data[i].max=-1; ar->data[i].min=MAXINT; }
17 i_mmarray_dst(i_mmarray *ar) {
19 if (ar->data != NULL) { myfree(ar->data); ar->data=NULL; }
23 i_mmarray_add(i_mmarray *ar,int x,int y) {
24 if (y>-1 && y<ar->lines)
26 if (x<ar->data[y].min) ar->data[y].min=x;
27 if (x>ar->data[y].max) ar->data[y].max=x;
32 i_mmarray_gmin(i_mmarray *ar,int y) {
33 if (y>-1 && y<ar->lines) return ar->data[y].min;
38 i_mmarray_getm(i_mmarray *ar,int y) {
39 if (y>-1 && y<ar->lines) return ar->data[y].max;
44 i_mmarray_render(i_img *im,i_mmarray *ar,i_color *val) {
46 for(i=0;i<ar->lines;i++) if (ar->data[i].max!=-1) for(x=ar->data[i].min;x<ar->data[i].max;x++) i_ppix(im,x,i,val);
50 i_mmarray_render_fill(i_img *im,i_mmarray *ar,i_fill_t *fill) {
52 if (im->bits == i_8_bits && fill->fill_with_color) {
53 i_color *line = mymalloc(sizeof(i_color) * im->xsize);
56 work = mymalloc(sizeof(i_color) * im->xsize);
57 for(y=0;y<ar->lines;y++) {
58 if (ar->data[y].max!=-1) {
60 w = ar->data[y].max-ar->data[y].min;
63 i_glin(im, x, x+w, y, line);
65 (fill->fill_with_color)(fill, x, y, w, im->channels, line, work);
66 i_plin(im, x, x+w, y, line);
75 i_fcolor *line = mymalloc(sizeof(i_fcolor) * im->xsize);
76 i_fcolor *work = NULL;
78 work = mymalloc(sizeof(i_fcolor) * im->xsize);
79 for(y=0;y<ar->lines;y++) {
80 if (ar->data[y].max!=-1) {
82 w = ar->data[y].max-ar->data[y].min;
85 i_glinf(im, x, x+w, y, line);
87 (fill->fill_with_fcolor)(fill, x, y, w, im->channels, line, work);
88 i_plinf(im, x, x+w, y, line);
101 i_arcdraw(int x1, int y1, int x2, int y2, i_mmarray *ar) {
105 alpha=(double)(y2-y1)/(double)(x2-x1);
108 if (x2<x1) { temp=x1; x1=x2; x2=temp; temp=y1; y1=y2; y2=temp; }
113 i_mmarray_add(ar,x1,(int)(dsec+0.5));
120 if (y2<y1) { temp=x1; x1=x2; x2=temp; temp=y1; y1=y2; y2=temp; }
125 i_mmarray_add(ar,(int)(dsec+0.5),y1);
132 i_mmarray_info(i_mmarray *ar) {
134 for(i=0;i<ar->lines;i++)
135 if (ar->data[i].max!=-1) printf("line %d: min=%d, max=%d.\n",i,ar->data[i].min,ar->data[i].max);
140 i_arc(i_img *im,int x,int y,float rad,float d1,float d2,i_color *val) {
145 mm_log((1,"i_arc(im* 0x%x,x %d,y %d,rad %.2f,d1 %.2f,d2 %.2f,val 0x%x)\n",im,x,y,rad,d1,d2,val));
147 i_mmarray_cr(&dot,im->ysize);
149 x1=(int)(x+0.5+rad*cos(d1*PI/180.0));
150 y1=(int)(y+0.5+rad*sin(d1*PI/180.0));
151 fx=(float)x1; fy=(float)y1;
153 /* printf("x1: %d.\ny1: %d.\n",x1,y1); */
154 i_arcdraw(x, y, x1, y1, &dot);
156 x1=(int)(x+0.5+rad*cos(d2*PI/180.0));
157 y1=(int)(y+0.5+rad*sin(d2*PI/180.0));
159 for(f=d1;f<=d2;f+=0.01) i_mmarray_add(&dot,(int)(x+0.5+rad*cos(f*PI/180.0)),(int)(y+0.5+rad*sin(f*PI/180.0)));
161 /* printf("x1: %d.\ny1: %d.\n",x1,y1); */
162 i_arcdraw(x, y, x1, y1, &dot);
165 i_mmarray_render(im,&dot,val);
170 i_arc_cfill(i_img *im,int x,int y,float rad,float d1,float d2,i_fill_t *fill) {
175 mm_log((1,"i_arc_cfill(im* 0x%x,x %d,y %d,rad %.2f,d1 %.2f,d2 %.2f,fill 0x%x)\n",im,x,y,rad,d1,d2,fill));
177 i_mmarray_cr(&dot,im->ysize);
179 x1=(int)(x+0.5+rad*cos(d1*PI/180.0));
180 y1=(int)(y+0.5+rad*sin(d1*PI/180.0));
181 fx=(float)x1; fy=(float)y1;
183 /* printf("x1: %d.\ny1: %d.\n",x1,y1); */
184 i_arcdraw(x, y, x1, y1, &dot);
186 x1=(int)(x+0.5+rad*cos(d2*PI/180.0));
187 y1=(int)(y+0.5+rad*sin(d2*PI/180.0));
189 for(f=d1;f<=d2;f+=0.01) i_mmarray_add(&dot,(int)(x+0.5+rad*cos(f*PI/180.0)),(int)(y+0.5+rad*sin(f*PI/180.0)));
191 /* printf("x1: %d.\ny1: %d.\n",x1,y1); */
192 i_arcdraw(x, y, x1, y1, &dot);
195 i_mmarray_render_fill(im,&dot,fill);
201 /* Temporary AA HACK */
205 static frac float_to_frac(float x) { return (frac)(0.5+x*16.0); }
206 static int frac_sub (frac x) { return (x%16); }
207 static int frac_int (frac x) { return (x/16); }
208 static float frac_to_float(float x) { return (float)x/16.0; }
212 polar_to_plane(float cx, float cy, float angle, float radius, frac *x, frac *y) {
213 *x = float_to_frac(cx+radius*cos(angle));
214 *y = float_to_frac(cy+radius*sin(angle));
219 order_pair(frac *x, frac *y) {
232 make_minmax_list(i_mmarray *dot, float x, float y, float radius) {
234 float astep = radius>0.1 ? .5/radius : 10;
235 frac cx, cy, lx, ly, sx, sy;
237 mm_log((1, "make_minmax_list(dot %p, x %.2f, y %.2f, radius %.2f)\n", dot, x, y, radius));
239 polar_to_plane(x, y, angle, radius, &sx, &sy);
241 for(angle = 0.0; angle<361; angle +=astep) {
244 polar_to_plane(x, y, angle, radius, &cx, &cy);
247 if (fabs(cx-lx) > fabs(cy-ly)) {
250 ccx = lx; lx = cx; cx = ccx;
251 ccy = ly; ly = cy; cy = ccy;
254 for(ccx=lx; ccx<=cx; ccx++) {
255 ccy = ly + ((cy-ly)*(ccx-lx))/(cx-lx);
256 i_mmarray_add(dot, ccx, ccy);
262 ccy = ly; ly = cy; cy = ccy;
263 ccx = lx; lx = cx; cx = ccx;
266 for(ccy=ly; ccy<=cy; ccy++) {
267 if (cy-ly) ccx = lx + ((cx-lx)*(ccy-ly))/(cy-ly); else ccx = lx;
268 i_mmarray_add(dot, ccx, ccy);
274 /* Get the number of subpixels covered */
278 i_pixel_coverage(i_mmarray *dot, int x, int y) {
284 for(cy=y*16; cy<(y+1)*16; cy++) {
285 frac tmin = dot->data[cy].min;
286 frac tmax = dot->data[cy].max;
288 if (tmax == -1 || tmin > maxx || tmax < minx) continue;
290 if (tmin < minx) tmin = minx;
291 if (tmax > maxx) tmax = maxx;
299 i_circle_aa(i_img *im, float x, float y, float rad, i_color *val) {
304 mm_log((1, "i_circle_aa(im %p, x %d, y %d, rad %.2f, val %p)\n", im, x, y, rad, val));
306 i_mmarray_cr(&dot,16*im->ysize);
307 make_minmax_list(&dot, x, y, rad);
309 for(ly = 0; ly<im->ysize; ly++) {
310 int ix, cy, cnt = 0, minx = INT_MAX, maxx = INT_MIN;
312 /* Find the left/rightmost set subpixels */
313 for(cy = 0; cy<16; cy++) {
314 frac tmin = dot.data[ly*16+cy].min;
315 frac tmax = dot.data[ly*16+cy].max;
316 if (tmax == -1) continue;
318 if (minx > tmin) minx = tmin;
319 if (maxx < tmax) maxx = tmax;
322 if (maxx == INT_MIN) continue; /* no work to be done for this row of pixels */
326 for(ix=minx; ix<=maxx; ix++) {
327 int cnt = i_pixel_coverage(&dot, ix, ly);
328 if (cnt>255) cnt = 255;
329 if (cnt) { /* should never be true */
331 float ratio = (float)cnt/255.0;
332 i_gpix(im, ix, ly, &temp);
333 for(ch=0;ch<im->channels; ch++) temp.channel[ch] = (unsigned char)((float)val->channel[ch]*ratio + (float)temp.channel[ch]*(1.0-ratio));
334 i_ppix(im, ix, ly, &temp);
347 i_box(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
349 mm_log((1,"i_box(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,val 0x%x)\n",im,x1,y1,x2,y2,val));
350 for(x=x1;x<x2+1;x++) {
354 for(y=y1;y<y2+1;y++) {
361 i_box_filled(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
363 mm_log((1,"i_box_filled(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,val 0x%x)\n",im,x1,y1,x2,y2,val));
364 for(x=x1;x<x2+1;x++) for (y=y1;y<y2+1;y++) i_ppix(im,x,y,val);
368 i_box_cfill(i_img *im,int x1,int y1,int x2,int y2,i_fill_t *fill) {
369 mm_log((1,"i_box_cfill(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,fill 0x%x)\n",im,x1,y1,x2,y2,fill));
372 if (im->bits == i_8_bits && fill->fill_with_color) {
373 i_color *line = mymalloc(sizeof(i_color) * (x2 - x1));
374 i_color *work = NULL;
376 work = mymalloc(sizeof(i_color) * (x2-x1));
379 i_glin(im, x1, x2, y1, line);
381 (fill->fill_with_color)(fill, x1, y1, x2-x1, im->channels, line, work);
382 i_plin(im, x1, x2, y1, line);
390 i_fcolor *line = mymalloc(sizeof(i_fcolor) * (x2 - x1));
392 work = mymalloc(sizeof(i_fcolor) * (x2 - x1));
396 i_glinf(im, x1, x2, y1, line);
398 (fill->fill_with_fcolor)(fill, x1, y1, x2-x1, im->channels, line, work);
399 i_plinf(im, x1, x2, y1, line);
409 i_draw(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
414 mm_log((1,"i_draw(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,val 0x%x)\n",im,x1,y1,x2,y2,val));
416 alpha=(double)(y2-y1)/(double)(x2-x1);
419 if (x2<x1) { temp=x1; x1=x2; x2=temp; temp=y1; y1=y2; y2=temp; }
424 i_ppix(im,x1,(int)(dsec+0.5),val);
431 if (y2<y1) { temp=x1; x1=x2; x2=temp; temp=y1; y1=y2; y2=temp; }
436 i_ppix(im,(int)(dsec+0.5),y1,val);
440 mm_log((1,"i_draw: alpha=%f.\n",alpha));
444 i_line_aa(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
448 int temp,dx,dy,isec,ch;
450 mm_log((1,"i_draw(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,val 0x%x)\n",im,x1,y1,x2,y2,val));
455 if (abs(dx)>abs(dy)) { /* alpha < 1 */
456 if (x2<x1) { temp=x1; x1=x2; x2=temp; temp=y1; y1=y2; y2=temp; }
457 alpha=(float)(y2-y1)/(float)(x2-x1);
463 /* dfrac=1-(1-dfrac)*(1-dfrac); */
464 /* This is something we can play with to try to get better looking lines */
466 i_gpix(im,x1,isec,&tval);
467 for(ch=0;ch<im->channels;ch++) tval.channel[ch]=(unsigned char)(dfrac*(float)tval.channel[ch]+(1-dfrac)*(float)val->channel[ch]);
468 i_ppix(im,x1,isec,&tval);
470 i_gpix(im,x1,isec+1,&tval);
471 for(ch=0;ch<im->channels;ch++) tval.channel[ch]=(unsigned char)((1-dfrac)*(float)tval.channel[ch]+dfrac*(float)val->channel[ch]);
472 i_ppix(im,x1,isec+1,&tval);
478 if (y2<y1) { temp=y1; y1=y2; y2=temp; temp=x1; x1=x2; x2=temp; }
479 alpha=(float)(x2-x1)/(float)(y2-y1);
484 /* dfrac=sqrt(dfrac); */
485 /* This is something we can play with */
486 i_gpix(im,isec,y1,&tval);
487 for(ch=0;ch<im->channels;ch++) tval.channel[ch]=(unsigned char)(dfrac*(float)tval.channel[ch]+(1-dfrac)*(float)val->channel[ch]);
488 i_ppix(im,isec,y1,&tval);
490 i_gpix(im,isec+1,y1,&tval);
491 for(ch=0;ch<im->channels;ch++) tval.channel[ch]=(unsigned char)((1-dfrac)*(float)tval.channel[ch]+dfrac*(float)val->channel[ch]);
492 i_ppix(im,isec+1,y1,&tval);
505 for(i=k+1;i<=n;i++) r*=i;
506 for(i=1;i<=(n-k);i++) r/=i;
511 /* Note in calculating t^k*(1-t)^(n-k)
512 we can start by using t^0=1 so this simplifies to
513 t^0*(1-t)^n - we want to multiply that with t/(1-t) each iteration
514 to get a new level - this may lead to errors who knows lets test it */
517 i_bezier_multi(i_img *im,int l,double *x,double *y,i_color *val) {
526 bzcoef=mymalloc(sizeof(double)*l);
527 for(k=0;k<l;k++) bzcoef[k]=perm(n,k);
531 /* for(k=0;k<l;k++) printf("bzcoef: %d -> %f\n",k,bzcoef[k]); */
533 for(t=0;t<=1;t+=0.005) {
538 /* cx+=bzcoef[k]*x[k]*pow(t,k)*pow(1-t,n-k);
539 cy+=bzcoef[k]*y[k]*pow(t,k)*pow(1-t,n-k);*/
541 cx+=bzcoef[k]*x[k]*ccoef;
542 cy+=bzcoef[k]*y[k]*ccoef;
545 /* printf("%f -> (%d,%d)\n",t,(int)(0.5+cx),(int)(0.5+cy)); */
547 i_line_aa(im,lx,ly,(int)(0.5+cx),(int)(0.5+cy),val);
549 /* i_ppix(im,(int)(0.5+cx),(int)(0.5+cy),val); */
569 REF: Graphics Gems I. page 282+
573 /* This should be moved into a seperate file? */
575 /* This is the truncation used:
577 a double is multiplied by 16 and then truncated.
578 This means that 0 -> 0
579 So a triangle of (0,0) (10,10) (10,0) Will look like it's
580 not filling the (10,10) point nor the (10,0)-(10,10) line segment
585 /* Flood fill algorithm - based on the Ken Fishkins (pixar) gem in
600 struct stack_element {
608 /* create the link data to put push onto the stack */
611 struct stack_element*
612 crdata(int left,int right,int dadl,int dadr,int y, int dir) {
613 struct stack_element *ste;
614 ste = mymalloc(sizeof(struct stack_element));
620 ste->myDirection = dir;
624 /* i_ccomp compares two colors and gives true if they are the same */
627 i_ccomp(i_color *val1,i_color *val2,int ch) {
629 for(i=0;i<ch;i++) if (val1->channel[i] !=val2->channel[i]) return 0;
635 i_lspan(i_img *im,int seedx,int seedy,i_color *val) {
638 if (seedx-1 < 0) break;
639 i_gpix(im,seedx-1,seedy,&cval);
640 if (!i_ccomp(val,&cval,im->channels)) break;
647 i_rspan(i_img *im,int seedx,int seedy,i_color *val) {
650 if (seedx+1 > im->xsize-1) break;
651 i_gpix(im,seedx+1,seedy,&cval);
652 if (!i_ccomp(val,&cval,im->channels)) break;
658 /* Macro to create a link and push on to the list */
660 #define ST_PUSH(left,right,dadl,dadr,y,dir) { struct stack_element *s = crdata(left,right,dadl,dadr,y,dir); llist_push(st,&s); }
662 /* pops the shadow on TOS into local variables lx,rx,y,direction,dadLx and dadRx */
663 /* No overflow check! */
665 #define ST_POP() { struct stack_element *s; llist_pop(st,&s); lx = s->myLx; rx = s->myRx; dadLx = s->dadLx; dadRx = s->dadRx; y = s->myY; direction= s->myDirection; myfree(s); }
667 #define ST_STACK(dir,dadLx,dadRx,lx,rx,y) { int pushrx = rx+1; int pushlx = lx-1; ST_PUSH(lx,rx,pushlx,pushrx,y+dir,dir); if (rx > dadRx) ST_PUSH(dadRx+1,rx,pushlx,pushrx,y-dir,-dir); if (lx < dadLx) ST_PUSH(lx,dadLx-1,pushlx,pushrx,y-dir,-dir); }
669 #define SET(x,y) btm_set(btm,x,y);
671 #define INSIDE(x,y) ((!btm_test(btm,x,y) && ( i_gpix(im,x,y,&cval),i_ccomp(&val,&cval,channels) ) ))
674 i_flood_fill(i_img *im,int seedx,int seedy,i_color *dcol) {
686 int bxmin=seedx,bxmax=seedx,bymin=seedy,bymax=seedy;
689 struct i_bitmap *btm;
691 int channels,xsize,ysize;
694 channels = im->channels;
698 btm = btm_new(xsize,ysize);
699 st = llist_new(100,sizeof(struct stack_element*));
701 /* Get the reference color */
702 i_gpix(im,seedx,seedy,&val);
704 /* Find the starting span and fill it */
705 lx = i_lspan(im,seedx,seedy,&val);
706 rx = i_rspan(im,seedx,seedy,&val);
708 /* printf("span: %d %d \n",lx,rx); */
710 for(x=lx; x<=rx; x++) SET(x,seedy);
712 ST_PUSH(lx, rx, lx, rx, seedy+1, 1);
713 ST_PUSH(lx, rx, lx, rx, seedy-1,-1);
718 if (y<0 || y>ysize-1) continue;
720 if (bymin > y) bymin=y; /* in the worst case an extra line */
721 if (bymax < y) bymax=y;
723 /* printf("start of scan - on stack : %d \n",st->count); */
726 /* printf("lx=%d rx=%d dadLx=%d dadRx=%d y=%d direction=%d\n",lx,rx,dadLx,dadRx,y,direction); */
730 for(tx=0;tx<xsize;tx++) printf("%d",tx%10);
732 for(ty=0;ty<ysize;ty++) {
734 for(tx=0;tx<xsize;tx++) printf("%d",!!btm_test(btm,tx,ty));
743 if ( (wasIn = INSIDE(lx,y)) ) {
746 while(INSIDE(lx,y) && lx > 0) {
752 if (bxmin > lx) bxmin=lx;
754 while(x <= xsize-1) {
755 /* printf("x=%d\n",x); */
759 /* case 1: was inside, am still inside */
762 /* case 2: was inside, am no longer inside: just found the
763 right edge of a span */
764 ST_STACK(direction,dadLx,dadRx,lx,(x-1),y);
766 if (bxmax < x) bxmax=x;
774 /* case 3: Wasn't inside, am now: just found the start of a new run */
778 /* case 4: Wasn't inside, still isn't */
783 EXT: /* out of loop */
785 /* hit an edge of the frame buffer while inside a run */
786 ST_STACK(direction,dadLx,dadRx,lx,(x-1),y);
787 if (bxmax < x) bxmax=x;
791 /* printf("lx=%d rx=%d dadLx=%d dadRx=%d y=%d direction=%d\n",lx,rx,dadLx,dadRx,y,direction);
792 printf("bounding box: [%d,%d] - [%d,%d]\n",bxmin,bymin,bxmax,bymax); */
794 for(y=bymin;y<=bymax;y++) for(x=bxmin;x<=bxmax;x++) if (btm_test(btm,x,y)) i_ppix(im,x,y,dcol);
797 mm_log((1, "DESTROY\n"));
801 static struct i_bitmap *
802 i_flood_fill_low(i_img *im,int seedx,int seedy,
803 int *bxminp, int *bxmaxp, int *byminp, int *bymaxp) {
814 int bxmin=seedx,bxmax=seedx,bymin=seedy,bymax=seedy;
817 struct i_bitmap *btm;
819 int channels,xsize,ysize;
822 channels=im->channels;
826 btm=btm_new(xsize,ysize);
827 st=llist_new(100,sizeof(struct stack_element*));
829 /* Get the reference color */
830 i_gpix(im,seedx,seedy,&val);
832 /* Find the starting span and fill it */
833 lx=i_lspan(im,seedx,seedy,&val);
834 rx=i_rspan(im,seedx,seedy,&val);
836 /* printf("span: %d %d \n",lx,rx); */
838 for(x=lx;x<=rx;x++) SET(x,seedy);
840 ST_PUSH(lx,rx,lx,rx,seedy+1,1);
841 ST_PUSH(lx,rx,lx,rx,seedy-1,-1);
846 if (y<0 || y>ysize-1) continue;
848 if (bymin > y) bymin=y; /* in the worst case an extra line */
849 if (bymax < y) bymax=y;
851 /* printf("start of scan - on stack : %d \n",st->count); */
854 /* printf("lx=%d rx=%d dadLx=%d dadRx=%d y=%d direction=%d\n",lx,rx,dadLx,dadRx,y,direction); */
858 for(tx=0;tx<xsize;tx++) printf("%d",tx%10);
860 for(ty=0;ty<ysize;ty++) {
862 for(tx=0;tx<xsize;tx++) printf("%d",!!btm_test(btm,tx,ty));
871 if ( (wasIn = INSIDE(lx,y)) ) {
874 while(INSIDE(lx,y) && lx > 0) {
880 if (bxmin > lx) bxmin=lx;
882 while(x <= xsize-1) {
883 /* printf("x=%d\n",x); */
887 /* case 1: was inside, am still inside */
890 /* case 2: was inside, am no longer inside: just found the
891 right edge of a span */
892 ST_STACK(direction,dadLx,dadRx,lx,(x-1),y);
894 if (bxmax < x) bxmax=x;
902 /* case 3: Wasn't inside, am now: just found the start of a new run */
906 /* case 4: Wasn't inside, still isn't */
911 EXT: /* out of loop */
913 /* hit an edge of the frame buffer while inside a run */
914 ST_STACK(direction,dadLx,dadRx,lx,(x-1),y);
915 if (bxmax < x) bxmax=x;
919 /* printf("lx=%d rx=%d dadLx=%d dadRx=%d y=%d direction=%d\n",lx,rx,dadLx,dadRx,y,direction);
920 printf("bounding box: [%d,%d] - [%d,%d]\n",bxmin,bymin,bxmax,bymax); */
933 i_flood_cfill(i_img *im, int seedx, int seedy, i_fill_t *fill) {
934 int bxmin, bxmax, bymin, bymax;
935 struct i_bitmap *btm;
939 btm = i_flood_fill_low(im, seedx, seedy, &bxmin, &bxmax, &bymin, &bymax);
941 if (im->bits == i_8_bits && fill->fill_with_color) {
942 i_color *line = mymalloc(sizeof(i_color) * (bxmax - bxmin));
943 i_color *work = NULL;
945 work = mymalloc(sizeof(i_color) * (bxmax - bxmin));
947 for(y=bymin;y<=bymax;y++) {
950 while (x < bxmax && !btm_test(btm, x, y)) {
953 if (btm_test(btm, x, y)) {
955 while (x < bxmax && btm_test(btm, x, y)) {
959 i_glin(im, start, x, y, line);
960 (fill->fill_with_color)(fill, start, y, x-start, im->channels,
962 i_plin(im, start, x, y, line);
971 i_fcolor *line = mymalloc(sizeof(i_fcolor) * (bxmax - bxmin));
972 i_fcolor *work = NULL;
974 work = mymalloc(sizeof(i_fcolor) * (bxmax - bxmin));
976 for(y=bymin;y<=bymax;y++) {
979 while (x < bxmax && !btm_test(btm, x, y)) {
982 if (btm_test(btm, x, y)) {
984 while (x < bxmax && btm_test(btm, x, y)) {
988 i_glinf(im, start, x, y, line);
989 (fill->fill_with_fcolor)(fill, start, y, x-start, im->channels,
991 i_plinf(im, start, x, y, line);