pike.git / lib / modules / _Image_PSD.pmod

version» Context lines:

pike.git/lib/modules/_Image_PSD.pmod:138:    break;    case -1: /* alpha */    if(!l->alpha)    l->alpha = tmp;    else    l->alpha *= tmp;    break;    case -2: /* user mask */    if(!(l->mask_flags & 2 )) /* layer mask disabled */    { -  array pad_color = ({255,255,255}); -  if( (l->mask_flags & 4 ) ) /* invert mask */ +  array pad_color = ({ 0, 0, 0 }); +  if( (l->mask_flags & 4 ) ) { +  /* invert mask */    tmp = tmp->invert(); -  +  pad_color = ({ 255, 255, 255 }); +  }       tmp = tmp->copy( -l->mask_xoffset, -l->mask_yoffset,    l->image->xsize()-1, l->image->ysize()-1,    @pad_color )    ->copy(0,0,l->image->xsize()-1,l->image->ysize()-1,    @pad_color);    if(!l->alpha)    l->alpha = tmp;    else    l->alpha *= tmp;
pike.git/lib/modules/_Image_PSD.pmod:304:    float lo = l->opacity / 255.0;    if( lay->alpha() )    lay->set_image( lay->image(), lay->alpha()*lo );    else    lay->set_image( lay->image(), Image.Image( lay->xsize(),    lay->yszize(),    (int)(255*lo),    (int)(255*lo),    (int)(255*lo)));    } +  +  if (opts->crop_to_bounds) { +  // Crop/expand this layer so it matches the image bounds. +  // This will lose data which extends beyond the image bounds +  // but keeps the image dimensions consistent. +  int x0 = -l->xoffset, y0 = -l->yoffset; +  int x1 = x0 + what->width - 1, y1 = y0 + what->height - 1; +  Image.Image new_img = +  lay->image()->copy(x0, y0, x1, y1); +  Image.Image new_alpha = +  lay->alpha() && +  lay->alpha()->copy(x0, y0, x1, y1); +  lay->set_image(new_img, new_alpha); +  } else    lay->set_offset( l->xoffset, l->yoffset ); -  +     layers += ({ lay });    }    }    }   // werror("%O\n", layers );    return layers;   }      mapping _decode( string|mapping what, mapping|void opts )   {