user10388528
user10388528

Reputation:

fltk1.3 Fl_Image::draw (bounding box)

The fltk documentation for the Fl_Image class mentions a Fl_Image::draw(int x, int y, int w, int h, int cx, int cy) which, as far as I understand, draws a portion of the Fl_Image. Of course, one can not directly call any draw() method in fltk, so how can I achieve a similar result? How can I use the draw() method to draw a portion of an Fl_Image?

Unfortunately, fltk's "Drawing Images" documentation is unhelpful, and I've checked the example files provided with the fltk installation (I'm using ubuntu), but none of the examples make any mention of how to use this function.

I'm aware that the usual way to draw images goes something like this:

//...
Fl_Box b(x,y,w,h);
Fl_PNG_Image i("ex.png");
b.image(i);
//...

but this is unhelpful, since it just uses (I assume) the regular Fl_Image::draw(int x, int y, int w, int h) function. Interestingly, the documentation explicitly reads "Images can be used as labels for widgets using the image() and deimage() methods or drawn directly.".

Upvotes: 0

Views: 305

Answers (1)

jplc
jplc

Reputation: 362

How can I use the draw() method to draw a portion of an Fl_Image?

You need to subclass Fl_Image or some Fl_Widget and overwrite draw function.

Upvotes: 1

Related Questions