|
|
In scaled mode lines are drawn with different widths to adapt for empty gaps when drawing adjacent lines.
This may look ugly when drawing grids. Is there a way to get lines of fixed widths?
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/fl_draw.H>
class LineBox : public Fl_Box
{
typedef Fl_Box Inherited;
public:
LineBox(int x_, int y_, int w_, int h_, const char *l_ = 0) :
Inherited( x_, y_, w_, h_, l_ ) {}
void draw()
{
Inherited::draw();
fl_color( FL_BLACK );
fl_line_style( FL_SOLID, 1 );
for ( int x = 0; x < this->w(); x += this->w() / 10 )
fl_yxline( this->x() + x, this->y(), this->y() + this->h() );
for ( int y = 0; y < this->h(); y += this->h() / 10 )
fl_xyline( this->x(), this->y() + y, this->x() + this->w() );
fl_line_style( 0 );
}
};
int main( int argc_, char *argv_[] )
{
static const int W = 200;
static const int H = 200;
Fl_Double_Window win( 0, 0, W, H );
LineBox b( 0, 0, W, H );
win.end();
win.resizable(win);
win.show();
return Fl::run();
}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
[ Direct Link to Message ] | |
|
| |