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.22 1999/06/28 00:43:06 per Exp $ + **! $Id: layers.c,v 1.23 1999/06/30 11:02:56 mirar Exp $   **! class Layer   **! see also: layers   **!      **!   **!   **! <add_appendix name="layers" title="Image.Layer modes"><execute>   **! import Image;   **!   **! void write_image(string desc,
pike.git/src/modules/Image/layers.c:145:   **! }   **!   **! </execute>   **! </add_appendix>   */      #include "global.h"      #include <math.h> /* floor */    - RCSID("$Id: layers.c,v 1.22 1999/06/28 00:43:06 per Exp $"); + RCSID("$Id: layers.c,v 1.23 1999/06/30 11:02:56 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:1065:       try_parameter("mode",image_layer_set_mode);    try_parameter("alpha_value",image_layer_set_alpha_value);       try_parameter_pair("xoffset","yoffset",image_layer_set_offset);    try_parameter_pair("fill","fill_alpha",image_layer_set_fill);    try_parameter("tiled",image_layer_set_tiled);    pop_stack();    return;    } -  else if (sp[-args].type==T_INT) +  else if (sp[-args].type==T_INT && args>1 +  && sp[1-args].type==T_INT)    {    rgb_group col=black,alpha=white;       get_all_args("Image.Layer",args,"%i%i",&(THIS->xsize),&(THIS->ysize));    if (args>2)    if (!image_color_arg(2-args,&col))    SIMPLE_BAD_ARG_ERROR("Image.Layer",3,"Image.Color");       if (args>3)    if (!image_color_arg(3-args,&alpha))
pike.git/src/modules/Image/layers.c:1096:    push_int(THIS->ysize);    push_int(alpha.r);    push_int(alpha.g);    push_int(alpha.b);    push_object(clone_object(image_program,5));       image_layer_set_image(2);       pop_n_elems(args);    } -  else if (sp[-args].type==T_OBJECT) +  else if (sp[-args].type==T_OBJECT || args>1)    {    if (args>2)    {    image_layer_set_mode(args-2);    pop_stack();    args=2;    }    image_layer_set_image(args);    pop_stack();    }
pike.git/src/modules/Image/layers.c:2096:    resource_error(NULL,0,0,"memory",sizeof(rgb_group)*4*width,    "Out of memory.\n");    }       da=dest->alp->img;    d=dest->img->img;       /* loop over lines */    for (y=0; y<dest->ysize; y++)    { -  if (layers>1 || layer[0]->row_func!=lm_normal) +  if (layers>1 || layer[0]->row_func!=lm_normal || +  layer[0]->tiled)    {    /* add the bottom layer first */ -  if (layer[0]->row_func==lm_normal) /* cheat */ +  if (layer[0]->row_func==lm_normal && +  !layer[0]->tiled) /* cheat */    {    img_lay_first_line(layer[0],xoffs,xsize,    y+dest->yoffs-layer[0]->yoffs,    line1,aline1),z=1;    z=1;    }    else    {    smear_color(line1,black,xsize);    smear_color(aline1,black,xsize);
pike.git/src/modules/Image/layers.c:2218:    SIMPLE_BAD_ARG_ERROR("Image.lay",1,    "array(Image.Layer|mapping)");    }       if (xsize==0) /* figure offset and size */    {    xoffset=l[0]->xoffs;    yoffset=l[0]->yoffs;    xsize=l[0]->xsize;    ysize=l[0]->ysize; +  if (l[0]->tiled) /* set size from the first non-tiled */ +  {    for (i=1; i<layers; i++) -  +  if (!l[i]->tiled)    { -  +  xoffset=l[i]->xoffs; +  yoffset=l[i]->yoffs; +  xsize=l[i]->xsize; +  ysize=l[i]->ysize; +  break; +  } +  } +  else i=1; +  for (; i<layers; i++) +  if (!l[i]->tiled) +  {    int t;    if (l[i]->xoffs<xoffset)    t=xoffset-l[i]->xoffs,xoffset-=t,xsize+=t;    if (l[i]->yoffs<yoffset)    t=yoffset-l[i]->yoffs,yoffset-=t,ysize+=t;    if (l[i]->xsize+l[i]->xoffs-xoffset>xsize)    xsize=l[i]->xsize+l[i]->xoffs-xoffset;    if (l[i]->ysize+l[i]->yoffs-yoffset>ysize)    ysize=l[i]->ysize+l[i]->yoffs-yoffset;    }