Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3029

C++ fill color in shapes using FLTK doesn't work for circles

$
0
0
Hi all,

I installed FLTK 1.3.X from http://www.fltk.org/index.php on my visual studio 2012 compiler and use PPP book for C++ programming (this: http://www.stroustrup.com/Programming/PPP1.html ).
My problem is about filling a Shape in. For example please observe this code:

Code:

#include <Simple_window.h>

using namespace Graph_lib;
int main()
{
        Simple_window win(Point(100,100), 1000, 600, "Binary_tree");
        Graph_lib::Circle c(Point(200,200),50);
        c.set_color(Color::red);
        c.set_fill_color(Color::blue);
        Graph_lib::Ellipse e(Point(100,100),50,30);
        e.set_color(Color::blue);
        e.set_fill_color(Color::red);
        Graph_lib::Rectangle r(Point(250,200),Point(350,300));
        r.set_color(Color::green);
        r.set_fill_color(Color::red);
        win.attach(r);
        win.attach(e);
        win.attach(c);
        win.wait_for_button();
}

When I run the program, All three Shapes are drawn on window but only the Rectangle is filled in! Why? set_color works for the three and apparently the set_fill_color is defined for all Shapes and it too should work but why it doesn't for Circle and Ellipse?

This http://www.stroustrup.com/Programming/Graphics/ is the .CPP and .h files ( )

Viewing all articles
Browse latest Browse all 3029

Latest Images

Trending Articles



Latest Images