Branch: Tag:

1999-07-16

1999-07-16 19:23:24 by Per Hedbor <ph@opera.com>

Optimizations and fixes. PSD is still somewhat broken

Rev: lib/modules/_Image_PSD.pmod:1.5
Rev: lib/modules/_Image_XCF.pmod:1.6

430:    }   }    - 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)    {
484:    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;
586:    }       Array.map( data->layers, destruct ); -  +     destruct( data ); -  +     return    ([    "image":img,    "alpha":alpha,    ]); - #ifdef DEBUG -  }; -  werror(describe_backtrace( e ) ); -  throw(e); - #endif +    }