pike.git / lib / modules / _Image_PSD.pmod

version» Context lines:

pike.git/lib/modules/_Image_PSD.pmod:1:   #pike __REAL_VERSION__    - /* Note: I'm following the convention from Image.XCF here to not -  document all optional arguments. Makes the functions look easier to -  use to the casual Pike programmer, so it might be a good idea, but -  I'm not sure. /Zino */ +       //! @appears Image.PSD   //! PhotoShop Document image format.    - //! @ignore +    inherit Image._PSD; - //! @endignore +     -  + //!   class Layer   { -  +     string mode, name; -  +  //! +     int opacity; -  +  //! +     object image; -  +  //! +     object alpha; -  +  //!       int flags; -  +  //! +     int xoffset, yoffset; -  +  //! +     int width, height; -  +  //!       int mask_flags; -  +  //! +     int mask_xoffset, mask_yoffset; -  +  //! +     int mask_width, mask_height; -  +  //! +     int mask_default_color; -  +  //!   }    -  +    Layer decode_layer(mapping layer, mapping i)   {   // int stt = gethrtime();    Layer l = Layer();    int use_cmap;    l->opacity = layer->opacity;    l->width = layer->right-layer->left;    l->height = layer->bottom-layer->top;    l->xoffset = layer->left;    l->yoffset = layer->top;
pike.git/lib/modules/_Image_PSD.pmod:219:   //! Duotone   //! @value 9   //! Lab   //! @endint   //! @member string "color_data"   //! Raw color data.   //! @member string "image_data"   //! Ram image data.   //! @member mapping(string|int:mixed) "resources"   //! Additional image data. See mappping below. - //! @member array(mapping) "layers" + //! @member array(Layer) "layers"   //! An array with the layers of the image. See mapping below.   //! @endmapping   //!   //! The resources mapping. Unknown resources will be identified   //! by their ID number (as an int).   //! @mapping   //! @member string "caption"   //! Image caption.   //! @member string "url"   //! Image associated URL.
pike.git/lib/modules/_Image_PSD.pmod:253:   //! @member int "hres"   //! @member int "hres_unit"   //! @member int "width_unit"   //! @member int "vres"   //! @member int "vres_unit"   //! @member int "height_unit"   //! FIXME: Document these.   //! @endmapping   //! @endmapping   //! - //! The layer mapping: + //! The layer members:   //! @mapping   //! @member int "top"   //! @member int "left"   //! @member int "right"   //! @member int "bottom"   //! The rectangle containing the contents of the layer.   //! @member int "mask_top"   //! @member int "mask_left"   //! @member int "mask_right"   //! @member int "mask_bottom"
pike.git/lib/modules/_Image_PSD.pmod:331:   //! Red   //! @value 1   //! Green   //! @value 2   //! Blue   //! @endint   //! @member string "data"   //! The image data   //! @endmapping   //! @endmapping -  +    mapping __decode( mapping|string what, mapping|void options )   {    mapping data;    if(mappingp(what))    data = what;    else    data = ___decode( what );    what=0;    array rl = ({});    foreach( data->layers, mapping l )    rl += ({ decode_layer( l, data ) });       data->layers = rl;    return data;   }    -  +    array(object) decode_background( mapping data )   {    object img;       if( data->image_data )    img = ___decode_image_data(data->width, data->height,    data->channels, data->mode,    data->compression, data->image_data,       data->color_data);    return ({ img, 0 });   }    -  + //! Convert a photoshop mode name to pike @[Image.lay] mode names   string translate_mode( string mode )   {    switch( mode )    {    case "norm": return "normal";    case "mul ": return "multiply";    case "add ": return "add";    case "diff": return "difference";    case "sub ": return "subtract";    case "diss": return "dissolve";
pike.git/lib/modules/_Image_PSD.pmod:407:    default:    werror("WARNING: PSD: Unsupported mode: "+mode+". Skipping layer\n");    return 0;    }   }      //! @decl array(Image.Layer) decode_layers( string data, mapping|void options )   //!   //! Decodes a PSD image to an array of Image.Layer objects   //! - //! Takes the same aptions mapping as @[_decode], note especially - //! "draw_all_layers":1, but implements "crop_to_bounds" which preserves - //! the bounding box for the whole image (i.e. discards data that extend - //! outside of the global bounds). - //! +    //! The layer object have the following extra variables (to be queried   //! using @[Image.Layer()->get_misc_value]):   //!   //! @string   //! @value "image_guides"   //! Returns array containing guide definitions.   //! @value "name"   //! Returns string containing the name of the layer.   //! @value "visible"   //! Is 1 of the layer is visible and 0 if it is hidden.   //! @endstring -  + //! + //! Accepts these options: + //! @mapping + //! @member bool "draw_all_layers" + //! If included, all layers will be decoded, even the non-visible ones. + //! @member bool "crop_to_bounds" + //! Remove areas that are outside the image boundaries in all layers + //! @member Image.Color "background" + //! If included, include a solid background layer with the given color + //! @endmapping   array decode_layers( string|mapping what, mapping|void opts )   {    if(!opts) opts = ([]);       if(!mappingp( what ) )    what = __decode( what );       mapping lopts = ([ "tiled":1, ]);       if( opts->background )
pike.git/lib/modules/_Image_PSD.pmod:530:   //! Decodes a PSD image to a mapping, with at least an   //! 'image' and possibly an 'alpha' object. Data is either a PSD image, or   //! a mapping (as received from @[__decode])   //!   //! @param options   //! @mapping   //! @member array(int)|Image.Color "background"   //! Sets the background to the given color. Arrays should be in   //! the format ({r,g,b}).   //! - //! @member int(0..1) "draw_all_layers" + //! @member bool "draw_all_layers"   //! Draw invisible layers as well.   //! - //! @member int(0..1) "draw_guides" + //! @member bool "draw_guides"   //! Draw the guides.   //! - //! @member int(0..1) "draw_selection" + //! @member bool "draw_selection"   //! Mark the selection using an overlay.   //! - //! @member int(0..1) "ignore_unknown_layer_modes" + //! @member bool "ignore_unknown_layer_modes"   //! Do not asume 'Normal' for unknown layer modes.   //! - //! @member int(0..1) "mark_layers" + //! @member bool "mark_layers"   //! Draw an outline around all (drawn) layers.   //!   //! @member Image.Font "mark_layer_names"   //! Write the name of all layers using the font object,   //! - //! @member int(0..1) "mark_active_layer" + //! @member bool "mark_active_layer"   //! Draw an outline around the active layer   //! @endmapping   //!   //! @returns   //! @mapping   //! @member Image.Image "image"   //! The image object.   //! @member Image.Image "alpha"   //! The alpha channel image object.   //! @endmapping