pike.git / src / modules / Image / layers.c

version» Context lines:

pike.git/src/modules/Image/layers.c:1:   /*   **! module Image   **! note - **! $Id: layers.c,v 1.61 2001/01/19 22:18:42 grubba Exp $ + **! $Id: layers.c,v 1.62 2001/03/04 15:27:55 mirar Exp $   **! class Layer   **! see also: layers   **!      **!   **!   **! <add_appendix name="layers" title="Image.Layer modes">   **! <dl compact>   **! <dt><i>The variables in the expression:</i>   **! <dt>L<dd><i>The active layer</i>
pike.git/src/modules/Image/layers.c:208:   **! }   **!   **! </execute>   **! </add_appendix>   */      #include "global.h"      #include <math.h> /* floor */    - RCSID("$Id: layers.c,v 1.61 2001/01/19 22:18:42 grubba Exp $"); + RCSID("$Id: layers.c,v 1.62 2001/03/04 15:27:55 mirar Exp $");      #include "image_machine.h"      #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "array.h"
pike.git/src/modules/Image/layers.c:261:    rgb_group *la, /* may be NULL */    rgb_group *da,    int len,    double alpha);         #define SNUMPIXS 64 /* pixels in short-stroke buffer */      struct layer   { -  INT_TYPE xsize; /* underlaying image size */ -  INT_TYPE ysize; +  INT32 xsize; /* underlaying image size */ +  INT32 ysize;    -  INT_TYPE xoffs,yoffs; /* clip offset */ +  INT32 xoffs,yoffs; /* clip offset */       struct object *image; /* image object */    struct object *alpha; /* alpha object or null */       struct image *img; /* image object storage */    struct image *alp; /* alpha object storage */       FLOAT_TYPE alpha_value; /* overall alpha value (1.0=opaque) */       rgb_group fill; /* fill color ("outside" the layer) */    rgb_group fill_alpha; /* fill alpha */       rgb_group sfill[SNUMPIXS]; /* pre-calculated rows */    rgb_group sfill_alpha[SNUMPIXS];    -  INT_TYPE tiled; /* true if tiled */ +  int tiled; /* true if tiled */       lm_row_func *row_func;/* layer mode */ -  INT_TYPE optimize_alpha; -  INT_TYPE really_optimize_alpha; +  int optimize_alpha; +  int really_optimize_alpha;       struct mapping *misc; /* Misc associated data. Added by per,    rather useful for some things... */   };      #undef THIS   #define THIS ((struct layer *)(Pike_fp->current_storage))   #define THISOBJ (Pike_fp->current_object)      #define LMFUNC(X) \
pike.git/src/modules/Image/layers.c:2764:    push_int(THIS->fill.r);    push_int(THIS->fill.g);    push_int(THIS->fill.b);    f_call_function(8);    if (Pike_sp[-1].type!=T_OBJECT ||    !(img=(struct image*)get_storage(Pike_sp[-1].u.object,image_program)))    Pike_error("No image returned from image->copy\n");    if (img->xsize!=xz || img->ysize!=yz)    Pike_error("Image returned from image->copy had "    "unexpected size (%d,%d, expected %d,%d)\n", -  img->xsize,img->ysize,xz,yz); +  img->xsize,img->ysize,(INT32)xz,(INT32)yz);       free_object(l->image);    l->image=Pike_sp[-1].u.object;    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    l->img=img;    }       if (zot && l->alpha)    {
pike.git/src/modules/Image/layers.c:2792:    push_int(THIS->fill_alpha.r);    push_int(THIS->fill_alpha.g);    push_int(THIS->fill_alpha.b);    f_call_function(8);    if (Pike_sp[-1].type!=T_OBJECT ||    !(img=(struct image*)get_storage(Pike_sp[-1].u.object,image_program)))    Pike_error("No image returned from alpha->copy\n");    if (img->xsize!=xz || img->ysize!=yz)    Pike_error("Image returned from alpha->copy had "    "unexpected size (%d,%d, expected %d,%d)\n", -  img->xsize,img->ysize,xz,yz); +  img->xsize,img->ysize,(INT32)xz,(INT32)yz);    free_object(l->alpha);    l->alpha=Pike_sp[-1].u.object;    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    l->alp=img;    }       l->xoffs=x;    l->yoffs=y;    l->xsize=xz;
pike.git/src/modules/Image/layers.c:2834:   **! A tiled image will not be cropped at all.   **!   **! <tt>left</tt>...<tt>bottom</tt> arguments can be used   **! to tell what sides cropping are ok on.   **!   **! see also: crop, Image.Image->autocrop   */      static void image_layer_find_autocrop(INT32 args)   { -  INT_TYPE x1=0,y1=0,x2=THIS->xsize-1,y2=THIS->ysize-1; +  INT32 x1=0,y1=0,x2=THIS->xsize-1,y2=THIS->ysize-1;    INT_TYPE l=1,r=1,t=1,b=1;       if (args>3)    get_all_args("find_autocrop",args,"%d%d%d%d",&l,&r,&t,&b);       if (!THIS->tiled) {    if (THIS->alpha)    {    img_find_autocrop(THIS->alp, &x1,&y1,&x2,&y2,    0,l,r,t,b,1,THIS->fill_alpha);    if (THIS->image &&    (THIS->fill_alpha.r!=0 ||    THIS->fill_alpha.g!=0 || /* non-transparent fill */    THIS->fill_alpha.b!=0)) /* check image too */    { -  int ix1,iy1,ix2,iy2; +  INT32 ix1,iy1,ix2,iy2;    img_find_autocrop(THIS->img, &ix1,&iy1,&ix2,&iy2, -  0,l,r,t,b,1,THIS->fill); +  0,(int)l,(int)r,(int)t,(int)b,1,THIS->fill);    if (ix1<x1) x1=ix1;    if (ix2>x2) x2=ix2;    if (iy1<y1) y1=iy1;    if (iy2>y2) y2=iy2;    }    }    else if (THIS->image && /* image alpha is 'white'... */    (THIS->fill_alpha.r==255 ||    THIS->fill_alpha.g==255 || /* opaque fill */    THIS->fill_alpha.b==255)) /* we may be able to crop */    {    img_find_autocrop(THIS->img, &x1,&y1,&x2,&y2, -  0,l,r,t,b,1,THIS->fill); +  0,(int)l,(int)r,(int)t,(int)b,1,THIS->fill);    }    }    push_int(x1+THIS->xoffs);    push_int(y1+THIS->yoffs);    push_int(x2-x1+1);    push_int(y2-y1+1);    f_aggregate(4);   }      void image_layer_autocrop(INT32 args)