質問

I am using FLTK to create a GUI and I have to draw onto the screen some polygons (shapes).

From their documentation of fl_complex_polygon:

Start and end drawing a convex filled polygon.

The problem? The polygon is not filled, but only the stroke is displayed. How can I make the polygon a filled shape?

My code looks like this:

fl_color(FL_RED);
fl_begin_complex_polygon();
fl_line(mX,mY, x, y);
....
fl_line(mX,mY, x, y);
fl_end_complex_polygon();

Other related question: How can I redraw a FL_BOX? Do I have to draw a blank (background-colored) rectangle over it, or is there some FL_BOX::clear() function?

役に立ちましたか?

解決

Re: the filled polygon. The polygon is made up of vertices: not of lines. It doesn't know about lines. Use fl_vertex instead of fl_line.

Re: fl_box There are two fl_boxes, depending on case.

fl_box sets the box type Fl_Box from Fl_Box.H draws a box. The redraw code will automatically redraw it if it is damaged. Say the widget is called box. Call box->damage(FL_USER1) to force a redraw.

For more tricks, have a look at http://seriss.com/people/erco/fltk/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top