Branch: Tag:

1999-04-12

1999-04-12 01:53:42 by Per Hedbor <ph@opera.com>

more documentation

Rev: src/modules/Image/encodings/xcf.c:1.4

1:   #include "global.h" - RCSID("$Id: xcf.c,v 1.3 1999/04/11 07:21:23 per Exp $"); + RCSID("$Id: xcf.c,v 1.4 1999/04/12 01:53:42 per Exp $");      #include "config.h"   
33:   **!   */    + #define TILE_WIDTH 64 + #define TILE_HEIGHT 64 +  + #define MIN(X,Y) ((X)<(Y)?(X):(Y))   #define STRING(X) static struct pike_string *s_##X;   #include "xcf_constant_strings.h"   #undef STRING
382:    ob.len = all_tiles_eq;    else if(offset2)    ob.len = offset2-offset; +  else +  ob.len = MIN((TILE_WIDTH*TILE_HEIGHT*5),ob.len);    tile->data = ob;    tile->next = NULL;   /* fprintf(stderr, "tile, o=%d; o2=%d; l=%d\n", offset, offset2,ob.len); */
726:    l = l->next;    }    f_aggregate( nitems ); -  f_reverse(1); +        ref_push_string( s_channels );    nitems=0;
738:    c = c->next;    }    f_aggregate( nitems ); -  f_reverse(1); +     f_aggregate_mapping( sp-osp );   }   
764:   }       - #define TILE_WIDTH 64 - #define TILE_HEIGHT 64 -  +    unsigned char read_char( struct buffer *from )   {    unsigned char res = 0;
857:         /* - **! method mapping _decode(string|object data) + **! method mapping _decode(string|object data,mapping|void options)   **! Decodes a XCF image to a mapping, with at least an - **! 'image' and an 'alpha' object. Data is either a XCF image, or + **! 'image' and possibly an 'alpha' object. Data is either a XCF image, or   **! a XCF.GimpImage object structure (as received from __decode)   **! -  + **! <pre> Supported options + **! ([ + **! "background":({r,g,b})||Image.color object + **! "draw_all_layers":1, + **! Draw invisible layers as well + **! + **! "draw_guides":1, + **! Draw the guides + **! + **! "draw_selection":1, + **! Mark the selection using an overlay + **! + **! "ignore_unknown_layer_modes":1 + **! Do not asume 'Normal' for unknown layer modes. + **! + **! "mark_layers":1, + **! Draw an outline around all (drawn) layers + **! + **! "mark_layer_names":Image.font object, + **! Write the name of all layers using the font object, + **! + **! "mark_active_layer":1, + **! Draw an outline around the active layer + **! ])</pre> + **!   **! note   **! Throws upon error in data. For more information, see Image.XCF.__decode   */      /* - **! method object __decode(string|mapping data) + **! method object __decode(string|mapping data, mapping|void options)   **! Decodes a XCF image to a Image.XCF.GimpImage object.   **! - **! <pre>Structure reference + **! <pre>Returned structure reference   **!   **! class GimpImage   **! {
940:   **! string data;   **! }   **! - **! +    **! class Guide   **! {   **! int pos;
1056:   **!</pre>   */    - #define MIN(X,Y) ((X)<(Y)?(X):(Y)) +    void image_xcf_f__decode_tiles( INT32 args )   {    extern void check_signals();    struct object *io,*ao, *cmapo;    struct array *tiles; -  struct image *i, *a; +  struct image *i, *a=NULL;    struct neo_colortable *cmap = NULL;    rgb_group *colortable=NULL;    int rle, bpp, span;    unsigned int l, x=0, y=0, cx, cy; -  get_all_args( "_decode_tiles", args, "%o%o%a%i%i%O", +  get_all_args( "_decode_tiles", args, "%o%O%a%i%i%O",    &io, &ao, &tiles, &rle, &bpp, &cmapo);    if( !(i = (struct image *)get_storage( io, image_program )))    error("Wrong type object argument 1 (image)\n"); -  if( !(a = (struct image *)get_storage( ao, image_program ))) +  if(ao && !(a = (struct image *)get_storage( ao, image_program )))    error("Wrong type object argument 2 (image)\n");    if( cmapo &&    !(cmap=(struct neo_colortable *)get_storage(cmapo,
1080:    for(l=0; l<(unsigned int)tiles->size; l++)    if(tiles->item[l].type != T_STRING)    error("Wrong type array argument 3 (tiles)\n"); -  if(i->xsize != a->xsize ||i->ysize != a->ysize) +  if(a && (i->xsize != a->xsize ||i->ysize != a->ysize))    error("Image and alpha objects are not identically sized.\n");       if(cmap)
1090:    }       + /* switch(bpp) */ + /* { */ + /* case 1: */ + /* case 3: */ + /* if(ao) */ + /* { */ + /* destruct( ao ); */ + /* a=0; */ + /* ao=0; */ + /* } */ + /* break; */ + /* } */ +     x=y=0;    for(l=0; l<(unsigned)tiles->size; l++)    {
1129:    for(cx=0; cx<ewidth; cx++)    {    rgb_group pix; -  rgb_group apix = {255,255,255}; +  rgb_group apix;    int ind = (cx+cy*ewidth);       if(rle)
1168:    }    ind = i->xsize*(cy+y)+(cx+x);    i->img[ind] = pix; -  a->img[ind] = apix; +  if(a) a->img[ind] = apix;    }    }    x += TILE_WIDTH;