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.26 2000/02/10 05:29:54 nilsson Exp $"; + constant cvs_version = "$Id: gbutton.pike,v 1.27 2000/02/10 10:57:50 jonasw 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:337:    ({255,255,255}) ) );    if( args->dim )    background->set_image(background->image(),    background->alpha() * 0.3 );    background = stretch_layer( background, left, right, req_width );    }       Image.Image button = Image.Image(req_width, frame->ysize(), args->bg);       button = button->rgb_to_hsv(); -  if( args->dim ) -  frame->set_image( frame->image()->modify_by_intensity( 1,1,1, -  ({ 64,64,64 }), -  ({ 196,196,196 })), +  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; +  } else { +  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()); -  +  }    object h = button*({255,0,0});    object s = button*({0,255,0});    object v = button*({0,0,255});    v->paste_mask( frame->image(), frame->alpha() );    button = Image.lay( ({    Image.Layer( h )->set_mode( "red" ),    Image.Layer( s )->set_mode( "green" ),    Image.Layer( v )->set_mode( "blue" ),    }) )->image();    button = button->hsv_to_rgb();