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.52 2000/08/07 09:49:45 grubba Exp $ + **! $Id: layers.c,v 1.53 2000/08/10 09:51:54 per 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.52 2000/08/07 09:49:45 grubba Exp $"); + RCSID("$Id: layers.c,v 1.53 2000/08/10 09:51:54 per 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 xsize; /* underlaying image size */ -  int ysize; +  INT_TYPE xsize; /* underlaying image size */ +  INT_TYPE ysize;    -  int xoffs,yoffs; /* clip offset */ +  INT_TYPE 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 */    -  double alpha_value; /* overall alpha value (1.0=opaque) */ +  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 tiled; /* true if tiled */ +  INT_TYPE tiled; /* true if tiled */       lm_row_func *row_func;/* layer mode */ -  int optimize_alpha; -  int really_optimize_alpha; +  INT_TYPE optimize_alpha; +  INT_TYPE 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:849:   /*   **! method object set_alpha_value(float value)   **! method double alpha_value()   **! Set/get the general alpha value of this layer.   **! This is a float value between 0 and 1,   **! and is multiplied with the alpha channel.   */      static void image_layer_set_alpha_value(INT32 args)   { -  float f; +  FLOAT_TYPE f;    get_all_args("Image.Layer->set_alpha_value",args,"%F",&f);    if (f<0.0 || f>1.0)    SIMPLE_BAD_ARG_ERROR("Image.Layer->set_alpha_value",1,"float(0..1)");    THIS->alpha_value=f;    pop_n_elems(args);    ref_push_object(THISOBJ);   }      static void image_layer_alpha_value(INT32 args)   {
pike.git/src/modules/Image/layers.c:2552:   **! see also: Image.Layer   */      void image_lay(INT32 args)   {    int layers,i;    struct layer **l;    struct object *o;    struct layer *dest;    struct array *a; -  int gotoffs; -  int xoffset=0,yoffset=0,xsize=0,ysize=0; +  INT_TYPE xoffset=0,yoffset=0,xsize=0,ysize=0;       if (!args)    SIMPLE_TOO_FEW_ARGS_ERROR("Image.lay",1);       if (Pike_sp[-args].type!=T_ARRAY)    SIMPLE_BAD_ARG_ERROR("Image.lay",1,    "array(Image.Layer|mapping)");       if (args>1)    {
pike.git/src/modules/Image/layers.c:2724:   **! enlarged.   **! returns a new layer object   **! note:   **! The new layer object may have the same image object,   **! if there was no cropping to be done.   */      static void image_layer_crop(INT32 args)   {    struct layer *l; -  int x,y,xz,yz,xi,yi; +  INT_TYPE x,y,xz,yz,xi,yi;    int zot=0;    struct image *img;       get_all_args("Image.Layer->crop",args,"%d%d%d%d",&x,&y,&xz,&yz);       l=clone_this_layer();    if (x<=l->xoffs) x=l->xoffs; else zot++;    if (y<=l->yoffs) y=l->yoffs; else zot++;    if (l->xsize+l->xoffs<=x+xz) xz=l->xsize-(x-l->xoffs); else zot++;    if (l->ysize+l->yoffs<=y+yz) yz=l->ysize-(y-l->yoffs); else zot++;
pike.git/src/modules/Image/layers.c:2830:   **! 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 x1=0,y1=0,x2=THIS->xsize-1,y2=THIS->ysize-1; -  int l=1,r=1,t=1,b=1; +  INT_TYPE 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 &&