>
> On 8 Jun 2010, at 17:08, Leandro Fanzone wrote:
> >
> > I know those are many, and perhaps silly questions, but I couldn't
> > find a suitable example among the demos, and I know you said "no
> > examples" ;)
>
> OK, here's something that works, but it is hacked together out of a
> few bits I had lying around, lacks any useful comments, and is
> probably *not* the smartest way to achieve the desired affect...
>
> Tested on OSX only, as I can't be bothered moving over to another PC...
>
> OH - And past experience suggests that the mailing process will
> probably wrap all the longer lines and make the code even more of a
> mess. Be aware!
>
Excellent, that was way more than I expected! Thank you very, very much, the
code I needed it's already adapted and working in my project:
void MyWidget::draw()
{
draw_box();
std::string s("Hello, world");
fl_font(FL_COURIER, 12);
fl_color(FL_BLACK);
int width = fl_width(s.c_str());
int height = fl_height();
Fl_Offscreen offscreen_cxt = fl_create_offscreen(width, height);
fl_begin_offscreen(offscreen_cxt);
fl_color(FL_WHITE);
fl_rectf(0, 0, width, height);
fl_color(FL_BLACK);
fl_draw(s.c_str(), 0, height - fl_descent());
uchar *data_p = fl_read_image(NULL, 0, 0, width, height, 0);
fl_end_offscreen();
Fl_RGB_Image rgb(data_p, width, height);
Fl_Image *img_tmp = rgb.copy(width * 2, height);
img_tmp->draw(x(), y(), width * 2, height, 0, 0);
delete img_tmp;
delete[] data_p;
}
I would have never figured it out without your help. Thank you again.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk