On Jul 8, 2007, at 3:14 PM, Hans George wrote: > Hello FLTK-experts! > > I?ve got a "simple" question: Is there a way to brighten a specific > area of a images with fltk2? > > For example: > I`ve got a window with a background image. When the mouse enters a > specific area of this image, than this area should be brighten. > > I couldn`t find a helpfull methode in the draw.h ...
Fl_RGB_Image (or the correspoding FLTK2 interfaces) has a method "darken". You could copy that and write a "lighten" function. Then write a custom "draw()" function. When you need to highlight the rectangle, draw the whole original image first, then us fl_draw_image again to draw the subarea of the brighter image over the old image. To draw a subrectangle, you have to juggle with pointers and coordinates a little. fl_draw_image takes a pointer to the start of you image data. You calculate that like this: newStart = oldStart + xPos*bytesPerPixel + yPos*width*bytesPerPixel x and y are the destination coordinates. Don't forget the widget->x() and y(). w and h are the size of your sub-rectangle d should be 1 or 3 for gray or color, or 2 or 4 for gray with alpha or RGB with alpha ld should be the image width times d (not the sub-rect width!) Tadaa. ---- http://robowerk.com/ _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

