pike.git / lib / modules / _Image_XCF.pmod

version» Context lines:

pike.git/lib/modules/_Image_XCF.pmod:423:    case VALUE_MODE: return "value";    case SCREEN_MODE: return "screen";    case OVERLAY_MODE: return "overlay";       default:    werror("WARNING: XCF: Unsupported mode: "+mode+"\n");    return "normal";    }   }    - mapping _decode( string|mapping what, mapping|void opts ) + array decode_layers( string|object|mapping what, mapping|void opts )   { - #ifdef DEBUG -  mixed e = catch { - #endif +     if(!opts) opts = ([]);    -  GimpImage data = __decode( what ); -  what = 0; -  array layers = ({}); +  if(!objectp( what ) ) +  what = __decode( what );       mapping lopts = ([ "tiled":1, ]);    if( opts->background )    {    lopts->image = Image.Image( 32, 32, opts->background ); -  lopts->alpha = Image.Image( 32,32, Image.Color.white ); +  lopts->alpha = Image.Image( 32, 32, Image.Color.white );    lopts->alpha_value = 1.0;    } else {    lopts->image = Image.Image( 32, 32, Image.Color.black ); -  lopts->alpha = Image.Image( 32,32, Image.Color.black ); +  lopts->alpha = Image.Image( 32, 32, Image.Color.black );    lopts->alpha_value = 0.0;    } -  layers = ({ Image.Layer( lopts ) }); +  array layers = ({ Image.Layer( lopts ) });    -  foreach(data->layers, object l) +  foreach(what->layers, object l)    {    if(l->flags->visible || opts->draw_all_layers)    {    Hierarchy h = l->image;    Image.Layer lay = Image.Layer( h->img,    h->alpha,    translate_mode( l->mode ) );    h->img = 0; h->alpha = 0;       lay->set_alpha_value( l->opacity / 255.0 );
pike.git/lib/modules/_Image_XCF.pmod:477:    a = l->mask->image;    if( a->xsize() != l->image->img->xsize() ||    a->ysize() != l->image->img->ysize() )    a = a->copy( 0,0, l->image->image->xsize(),    l->image->image->ysize(), 255,255,255 );    lay->set_alpha( a );    }    layers += ({ lay });    }    } +  return layers; + }    -  Image.Layer res = Image.lay( layers ); -  layers = 0; + mapping _decode( string|mapping what, mapping|void opts ) + { +  if(!opts) opts = ([]); +  +  GimpImage data = __decode( what ); +  what = 0; +  +  Image.Layer res = Image.lay(decode_layers( data, opts ), +  0,0,data->width,data->height );    Image.Image img = res->image();    Image.Image alpha = res->alpha();    res = 0;       if(opts->draw_guides)    foreach( data->guides, Guide g )    if(g->vertical)    {    img->line( g->pos, 0, g->pos, img->ysize(), 0,155,0 );    if( alpha )
pike.git/lib/modules/_Image_XCF.pmod:579:    alpha->setcolor(0,0,255,100);    alpha->line( x1,y1,x2,y1 );    alpha->line( x2,y1,x2,y2 );    alpha->line( x2,y2,x1,y2 );    alpha->line( x1,y2,x1,y1 );    }    }    }       Array.map( data->layers, destruct ); -  +     destruct( data ); -  +     return    ([    "image":img,    "alpha":alpha,    ]); - #ifdef DEBUG -  }; -  werror(describe_backtrace( e ) ); -  throw(e); - #endif +    }         object decode( string what,mapping|void opts )   {    return _decode( what,opts )->image;   }