Re: [Plib-users] Translucent Widgets
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2002-01-18 03:17:55
|
dave wrote: > I'd like to have various groups of widgets that have differing states of > translucence. It isnt obvious to me how to do this. I don't know much > about openGL/Glut, after all, the motivation to use higher level > libraries is partly so I dont have to learn as much low-level details. > > It seems to me that setting up a blend function just before calling > puDisplay is the wrong approach. Setting the defaultColour would apply > to the entire PUI display list would it not? Also, it seems like one > would always want to save/restore the previous defaultColour as well, > and this would be going on a lot. There are really only two mechanisms - set the default colour - or set the colour of each widget individually. > I suspect it is better to derive new translucent PUI classes and put the > blending within each widget. One could then get a group box where the > box's background is in one state of translucence, and the widgets on top > of it can be slightly less translucent, ie, more solid, depending on how > one programs the widgets as one builds the group. That tends to happen that way anyway because if you (say) set the default alpha to 0.5 then the group box obscures 50% of the light coming from behind it and adds in 50% of it's own colour. Then when you render a button or something on top of that, you get 50% of the light from behind it and 50% of the button colour. In total, you get 25% of the ultimate background and 25% of the group box plus 50% of the button. Presuming you choose reasonably harmonious colours for group box and button, the button will *look* more opaque than the rest of the box simply because less of the background is showing through. > It seems to me that each object should have a setColour() and load > color, ie, that these functions should be within the puObject class > instead of being global to PUI. They are within the puObject class. Every widget is derived from puObject - and puObject has member functions: setColour ( which, r, g, b, a ) ; ...where 'which' can be: PUCOL_FOREGROUND PUCOL_BACKGROUND PUCOL_HIGHLIGHT PUCOL_LABEL PUCOL_LEGEND PUCOL_MISC This gives you minute control over every single stoopid little part of every single silly little widget...if you have the patience to choose them all! ...or you can use: setColourScheme ( r, g, b, a ) ; ...where you pick the overall colour and the package 'tastefully' chooses foregrounds and backgrounds that look good. (Usually!) ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |