C++ fill color in shapes using FLTK doesn't work for circles
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

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

  1. #1
    Join Date
    May 2014
    Posts
    42

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

    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 ( )

  2. #2
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,618

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

    This is old, but maybe still relevant because it says something about "compiler bug".
    http://www.fltk.org/str.php?L1656

    Maybe with a different compiler, or different FLTK version, your problem will be resolved.

    Regards
    Nobody cares how it works as long as it works

  3. #3
    Join Date
    May 2014
    Posts
    42

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

    Thank you for your answer. I tested 1.1.10 and also 1.3.2 both. It works for some people on same IDE and FLTK version but no for me!
    Last edited by abbassi; September 14th, 2014 at 02:48 AM.

  4. #4
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,618

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

    If it is the exact same IDE/compiler (please note that you may have the same IDE but a different compiler version), and the exact same FLTK version, then all I can think of is that your graphics driver has problems. Try upgrading or downgrading it.
    Nobody cares how it works as long as it works

  5. #5
    Join Date
    May 2014
    Posts
    42

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

    In what cases one IDE can differ with another same IDE please? Mine is VS 2012. May you mention the differences between IDE and compiler (for example in vs 2012) please?

  6. #6
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,467

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

    Quote Originally Posted by abbassi View Post
    In what cases one IDE can differ with another same IDE please?
    There may be different editions of VS like Express, Professional and so on.
    There may be some Hotfixes, SP, Updates installed on one PC but not on another one.
    Victor Nijegorodov

  7. #7
    Join Date
    May 2014
    Posts
    42

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

    Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center