Manoj wrote:
> Hi,
>
> If i want to draw something on top of an image then it never apper.
>
> Suppose i have drawn some lines in a part of window say(0,0,200,200)
>
> Now i want to draw a partial rectangle using fl_rectf on (0,0,50,50). I want
> partial rectangle so that lines under the rectangle should also appear.
>
> I have tried it by using fl_rectf or fl_rect. But no rectangle appear on top
> of this area(0,0,50,50).
fl_rect() would be the right thing to use for a line drawing
of a rectangle, and fl_rectf() if you want a filled rectangle.
Using fl_rect() and fl_line() should be as simple as the techniques
shown here:
http://seriss.com/people/erco/fltk/#FltkX
Modifying that example to do what you're literally describing would be:
#include <FL/Fl.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Double_Window.H>
class MyDraw : public Fl_Widget {
public:
MyDraw(int X, int Y, int W, int H, const char*L=0) : Fl_Widget(X,Y,W,H,L) {
}
void draw() {
// DRAW A BLACK DIAGONAL LINE, AND SMALL BLACK RECTANGLE
fl_color(FL_BLACK);
fl_line(0, 0, 200, 200);
fl_rect(0, 0, 50, 50);
}
};
int main() {
Fl_Double_Window win(200,200);
MyDraw mydraw(0, 0, win.w(), win.h());
win.resizable(mydraw);
win.show();
return(Fl::run());
}
..which is a complete program that you can compile and run.
Be sure all your line drawing calls are /only/ in the draw() method
of your derived class, which is called by FLTK automatically. Don't
call drawing functions from anywhere else.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk