Roxen.git / server / modules / graphics / gbutton.pike

version» Context lines:

Roxen.git/server/modules/graphics/gbutton.pike:18:   // icon-data -- inline icon data   // align -- left|center|right text alignment   // align-icon -- left|center-before|center-after|right icon alignment   // valign-icon -- above|middle|below icon vertical alignment   // >Button text</gbutton>   //   // Alignment restriction: when text alignment is either left or right, icons   // must also be aligned left or right.       - constant cvs_version = "$Id: gbutton.pike,v 1.71 2000/12/11 13:25:51 per Exp $"; + constant cvs_version = "$Id: gbutton.pike,v 1.72 2000/12/16 02:16:12 per Exp $";   constant thread_safe = 1;      #include <module.h>   inherit "module";      roxen.ImageCache button_cache;      constant module_type = MODULE_TAG;   constant module_name = "GButton";   constant module_doc =
Roxen.git/server/modules/graphics/gbutton.pike:544:    l-=({ 0 });    if( sizeof( l ) )    {    if( mask )    l = ({ mask })+l;    mask = Image.lay( l );    }    }       right = frame->xsize()-right; -  frame = stretch_layer( frame, left, right, req_width ); +     if (mask != frame) -  mask = stretch_layer( mask, left, right, req_width ); +  { +  Image.Image i = mask->image(); +  Image.Image m = mask->alpha(); +  int x0 = -mask->xoffset(); +  int y0 = -mask->yoffset(); +  int x1 = frame->xsize()-1+x0; +  int y1 = frame->ysize()-1+y0;    -  +  i = i->copy(x0,y0, x1,y1); +  if( m ) +  m = m->copy(x0,y0, x1,y1); +  mask->set_image( i, m ); +  mask = stretch_layer( mask, left, right, req_width ); +  } +  frame = stretch_layer( frame, left, right, req_width );    array(Image.Layer) button_layers = ({    Image.Layer( Image.Image(req_width, frame->ysize(), args->bg), -  mask->alpha()->scale(req_width,frame->ysize())), +  mask->alpha()->copy(0,0,req_width-1,frame->ysize()-1)),    });          if( args->extra_background_layers || background)    {    array l = ({ background });    foreach( (args->extra_background_layers||"")/","-({""}), string q )    l += ({ ll[q] });    l-=({ 0 });    foreach( l, object ll )
Roxen.git/server/modules/graphics/gbutton.pike:624:    // 'plain' extra layers are added on top of everything else    if( args->extra_layers )    {    array q = map(args->extra_layers/",",    lambda(string q) { return ll[q]; } )-({0});    foreach( q, object ll )    {    if( args->dim )    ll->set_alpha_value( 0.3 );    button_layers += ({stretch_layer(ll,left,right,req_width)}); +  button_layers[-1]->set_offset( 0, +  button_layers[0]->ysize()- +  button_layers[-1]->ysize() );    }    }       button_layers -= ({ 0 });    // left layers are added to the left of the image, and the mask is    // extended using their mask. There is no corresponding 'mask' layers    // for these, but that is not a problem most of the time.    if( args->extra_left_layers )    {    array l = ({ });    foreach( args->extra_left_layers/",", string q )    l += ({ ll[q] });    l-=({ 0 }); -  +  l->set_offset( 0, 0 );    if( sizeof( l ) )    {    object q = Image.lay( l );    foreach( button_layers, object b )    {    int x = b->xoffset();    int y = b->yoffset();    b->set_offset( x+q->xsize(), y );    } -  q->set_offset( 0, 0 ); +  q->set_offset( 0, button_layers[0]->ysize()-q->ysize() );    button_layers += ({ q });    }    }       // right layers are added to the right of the image, and the mask is    // extended using their mask. There is no corresponding 'mask' layers    // for these, but that is not a problem most of the time.    if( args->extra_right_layers )    {    array l = ({ });    foreach( args->extra_right_layers/",", string q )    l += ({ ll[q] });    l-=({ 0 }); -  +  l->set_offset( 0, 0 );    if( sizeof( l ) )    {    object q = Image.lay( l );    q->set_offset( button_layers[0]->xsize()+ -  button_layers[0]->xoffset(),0); +  button_layers[0]->xoffset(), +  button_layers[0]->ysize()-q->ysize());    button_layers += ({ q });    }    }      // if( !equal( args->pagebg, args->bg ) )   // {    // FIXME: fix transparency (somewhat)    // this version totally destroys the alpha channel of the image,    // but that's sort of the intention. The reason is that    // the png images are generated without alpha.