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

version» Context lines:

Roxen.git/server/modules/graphics/gbutton.pike:18:   // icon_src -- icon reference   // icon_data -- inline icon data   // align -- left|center|right text alignment   // align_icon -- left|center_before|center_after|right icon 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.42 2000/03/24 17:34:53 per Exp $"; + constant cvs_version = "$Id: gbutton.pike,v 1.43 2000/04/04 20:21:55 marcus Exp $";   constant thread_safe = 1;      #include <module.h>   inherit "module";   inherit "roxenlib";         roxen.ImageCache button_cache;      constant module_type = MODULE_PARSER;
Roxen.git/server/modules/graphics/gbutton.pike:105:    m = layer_slice( o, x1+1, x2-1 );    r = layer_slice( o, x2, o->xsize() );       m->set_image( m->image()->scale( leftovers, l->ysize() ),    m->alpha()->scale( leftovers, l->ysize() ));       l->set_offset( 0,0 );    m->set_offset( x1,0 );    r->set_offset( w-r->xsize(),0 );    o = Image.lay( ({ l, m, r }) ); +  o->set_mode( oo->mode() ); +  o->set_alpha_value( oo->alpha_value() );    return o;   }      array(Image.Layer) draw_button(mapping args, string text, object id)   {    Image.Image text_img;    mapping icon;    object button_font = resolve_font( args->font );       Image.Layer background;
Roxen.git/server/modules/graphics/gbutton.pike:321:    background = 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 );    +  array(Image.Layer) button_layers = ({ +  Image.Layer( Image.Image(req_width, frame->ysize(), args->bg), +  mask->alpha()), +  }); +     if( background )    {    if( !background->alpha() )    background->set_image( background->image(),    Image.Image( background->xsize(),    background->ysize(),    ({255,255,255}) ) );    if( args->dim )    background->set_alpha_value( 0.3 );    background = stretch_layer( background, left, right, req_width ); -  +  button_layers += ({ background });    } -  +  button_layers += ({ frame });    -  -  array(Image.Layer) button_layers = ({ -  Image.Layer( Image.Image(req_width, frame->ysize(), args->bg), -  mask->alpha()), - // Image.Layer( ([ "fill":args->bg, - // "alpha":mask->alpha()->threshold(200), - // ]) ), -  frame, -  }); -  +     frame->set_mode( "value" );       if( args->dim )    {    // Adjust dimmed border intensity to the background    int bg_value = Image.Color(@args->bg)->hsv()[2];    int dim_high, dim_low;    if (bg_value < 128) {    dim_low = max(bg_value - 64, 0);    dim_high = dim_low + 128;
Roxen.git/server/modules/graphics/gbutton.pike:364:    dim_high = min(bg_value + 64, 255);    dim_low = dim_high - 128;    }    frame->set_image(frame->image()->    modify_by_intensity( 1, 1, 1,    ({ dim_low, dim_low, dim_low }),    ({ dim_high, dim_high, dim_high })),    frame->alpha());    }    -  // if there is a background, draw it. -  if( background ) -  button_layers += ({ background }); -  +     // Draw icon.    if (icon)    button_layers += ({    Image.Layer( ([    "alpha_value":(args->dim ? 0.3 : 1.0),    "image":icon->img,    "alpha":icon->alpha,    "xoffset":icn_x,    "yoffset":(frame->ysize()-icon->img->ysize())/2,    ]) )});
Roxen.git/server/modules/graphics/gbutton.pike:396:    "xoffset":txt_x,    "yoffset":top,    ]))    });       // '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}); -  if( sizeof( q ) ) +  if( sizeof( q ) > 1)    button_layers += ({stretch_layer(Image.lay(q),left,right,req_width)}); -  +  else if( sizeof( q ) ) +  button_layers += ({ stretch_layer( q[0], left, right, req_width ) });    }          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 = ({ });