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

version» Context lines:

pike.git/src/modules/Image/blit.c:1: - /* $Id: blit.c,v 1.34 1999/05/24 15:38:26 mirar Exp $ */ + /* $Id: blit.c,v 1.35 1999/05/25 10:50:26 mirar Exp $ */   #include "global.h"      /*   **! module Image   **! note - **! $Id: blit.c,v 1.34 1999/05/24 15:38:26 mirar Exp $ + **! $Id: blit.c,v 1.35 1999/05/25 10:50:26 mirar Exp $   **! class Image   */      #include <math.h>   #include <ctype.h>      #include "stralloc.h"   #include "global.h"   #include "pike_macros.h"   #include "object.h"
pike.git/src/modules/Image/blit.c:74:   #define setpixel(x,y) \    (THIS->alpha? \    set_rgb_group_alpha(THIS->img[(x)+(y)*THIS->xsize],THIS->rgb,THIS->alpha): \    ((pixel(THIS,x,y)=THIS->rgb),0))      #define setpixel_test(x,y) \    (((x)<0||(y)<0||(x)>=THIS->xsize||(y)>=THIS->ysize)? \    0:(setpixel(x,y),0))      static INLINE int getrgb(struct image *img, -  INT32 args_start,INT32 args,char *name) +  INT32 args_start,INT32 args,INT32 max,char *name)   {    INT32 i;    if (args-args_start<1) return 0;       if (image_color_svalue(sp-args+args_start,&(img->rgb)))    return 1;    -  if (args-args_start<3) return 0; +  if (max<3 || args-args_start<3) return 0;       for (i=0; i<3; i++)    if (sp[-args+i+args_start].type!=T_INT)    error("Illegal r,g,b argument to %s\n",name);    img->rgb.r=(unsigned char)sp[-args+args_start].u.integer;    img->rgb.g=(unsigned char)sp[1-args+args_start].u.integer;    img->rgb.b=(unsigned char)sp[2-args+args_start].u.integer;    -  if (args-args_start>=4) +  if (max > 3 && args-args_start>=4)    if (sp[3-args+args_start].type!=T_INT)    error("Illegal alpha argument to %s\n",name);    else    {    img->alpha=sp[3-args+args_start].u.integer;    return 4;    }    else    {    img->alpha=0;
pike.git/src/modules/Image/blit.c:556:    if (args<1)    error("too few arguments to image->paste_alpha_color()\n");    if (sp[-args].type!=T_OBJECT    || !sp[-args].u.object    || !(mask=(struct image*)get_storage(sp[-args].u.object,image_program)))    error("illegal argument 1 to image->paste_alpha_color()\n");    if (!THIS->img) return;    if (!mask->img) return;       if (args==6 || args==4 || args==2 || args==3) /* color at arg 2.. */ -  arg=1+getrgb(THIS,1,MINIMUM(args,4),"image->paste_alpha_color()\n"); +  arg=1+getrgb(THIS,1,args,3,"image->paste_alpha_color()\n"); +  fprintf(stderr,"%02x%02x%02x\n",THIS->rgb.r,THIS->rgb.g,THIS->rgb.b);    if (args>arg+1)    {    if (sp[arg-args].type!=T_INT    || sp[1+arg-args].type!=T_INT)    error("illegal coordinate arguments to image->paste_alpha_color()\n");    x1=sp[arg-args].u.integer;    y1=sp[1+arg-args].u.integer;    }    else x1=y1=0;