Michael Schmid wrote:
> Hello!
>
> I'm using FLTK 1.1.9
>
> It sounds stupid but I don't find a appropriate method to show text on
> an image. It should be possible to position the text wehereever I want.
> I also want to determine the size, the color and the font of the text. I
> show the image in a box.
fl_draw() [1] is your friend. There's no way to do it with an image/label
combination. You need to derive your own widget and write a simple
draw() method, something like:
MyBox::draw() {
Fl_Box::draw(); // if Fl_Box is your parent class
// this will also draw the image()
// and maybe the label() text
fl_color(FL_RED);
fl_font(FL_HELVETICA,22);
fl_draw("this is red text\nwith a 22 px. font",x()+10,y()+20);
}
You can find more info in the introduction chapter about drawing [2], including
measurement of strings [3].
Albrecht
[1] http://www.fltk.org/doc-1.1/drawing.html#fl_draw
[2] http://www.fltk.org/doc-1.1/drawing.html
[3] http://www.fltk.org/doc-1.1/drawing.html#fl_measure
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk