GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Jun-2007, 02:05
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road
Post

Problem with PNG background


Hi there,

I'm developing applications based on v.1.1.3. The app draws some image buttons on a wallpaper. All graphic elements are provided in PNG format. But some images go disappeared when some button was pushed.

Here goes the example. Use bg1(PNG) as background. Button b1,b2,b3 are lined from left to right. If b3 was pushed, b2 will disappear. It seems to be covered by redraw of background. So I create another background bg2 in JPG format to replace the PNG one, the buttons act normal now. Is it some bug in button or PNG classes?

CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>

int main() {
        Fl_Window     win(320,240);
        win.begin();
        Fl_PNG_Image  p1("/var/1.png");
        Fl_PNG_Image  p2("/var/2.png");
        Fl_PNG_Image  p3("/var/3.png");
        Fl_PNG_Image  bg1("/var/screenbg.png");
        Fl_JPEG_Image bg2("/var/screenbg.jpg");
        Fl_Box            box1(FL_NO_BOX,0,0,320,240,0);
        box1.image(bg2);
        Fl_Button       b1(1,1,35,35,0);
        b1.image(p1);
        b1.box(FL_OVAL_FRAME);
        Fl_Button       b2(42,1,35,35,0);
        b2.image(p2);
        b2.box(FL_OVAL_FRAME);
        Fl_Button       b3(82,1,35,35,0);
        b3.image(p3);
        b3.box(FL_OVAL_FRAME);
        win.end();
        win.show();
        return(Fl::run());
}
  #2  
Old 07-Jun-2007, 05:37
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough

Re: Problem with PNG background


Quote:
Originally Posted by ykhuang
Hi there,
Hello and Welcome to GIDForums™!

Quote:
Originally Posted by ykhuang
I'm developing applications based on v.1.1.3.
Is there some reason you are using such an old version? If it is possible, I would suggest getting updated a bit. The latest snapshots are quite stable and could be called 1.1.8 if you like. It can be found at fltk.org on the download page.

Look at that, code tags on your first post. Rockin' !

If you want, you can zip up the images and attach them to your post. I will give your code a run on 1.1.8 then.

BTW, what platform are you using? I can give it a run on WIN. No 'nix box with me here though...

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #3  
Old 07-Jun-2007, 09:07
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road

Re: Problem with PNG background


Thanks for the reply,

My target platform is a ARM9 SoC. The graphics engine below FLTK is NXLib+microwindows. It is said that NXLib has been test a lot with FLTK 1.1.3, that's why I start from this version.

I also build a emulation platform on Linux and get the same result. I'll try a updated FLTK with NXLib+microwindows to see if it could correct the problem.

The test PNG/JPG files are attached. You may give it a try, and thank you.
Attached Files
File Type: zip fltktest.zip (47.0 KB, 14 views)
  #4  
Old 07-Jun-2007, 19:01
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough

Re: Problem with PNG background


XP using CygWin and FLTK 1.1.current-svn (essentially 1.1.8)

Minor code changes.
CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>

int main() {
        Fl_Window     win(320,240);
        win.begin();
        Fl_PNG_Image  p1("1.png");
        Fl_PNG_Image  p2("2.png");
        Fl_PNG_Image  p3("3.png");
        Fl_PNG_Image  bg1("screenbg.png");
//         Fl_JPEG_Image bg2("screenbg.jpg");
        Fl_Box            box1(FL_NO_BOX,0,0,320,240,0);
        box1.image(bg1);
        Fl_Button       b1(1,1,35,35,0);
        b1.image(p1);
        b1.box(FL_OVAL_FRAME);
        Fl_Button       b2(42,1,35,35,0);
        b2.image(p2);
        b2.box(FL_OVAL_FRAME);
        Fl_Button       b3(82,1,35,35,0);
        b3.image(p3);
        b3.box(FL_OVAL_FRAME);
        win.end();
        win.show();
        return(Fl::run());
}


I can click away and everything stays visible. See attached image.

Hopefully the version change will help. If its platform, I can't help there.

Mark
Attached Images
File Type: png screenshot.png (37.1 KB, 51 views)
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #5  
Old 07-Jun-2007, 21:18
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road

Re: Problem with PNG background


Thank you guy,

I'll keep trying with latest version.
  #6  
Old 10-Jun-2007, 03:16
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road

Re: Problem with PNG background


The problem is solved when I use latest FLTK 1.1.x. I think the 1.1.3 is not so compatible with libpng. So I use the local png library in 1.1.x instead.

I will put it to my ARM target platform to do more test. Hope it fine with it.
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
display problem in firefox and opera batrsau Web Design Forum 4 09-Dec-2005 04:18
Graphic problem in Unreal Tournament 2004 zerox Computer Software Forum - Games 10 09-Oct-2005 13:31
Runtime Problem involving "printf" in C Program supamakia C Programming Language 2 09-Oct-2005 11:09
a significant problem after installing Xp mohammad Computer Software Forum - Windows 10 09-Aug-2005 08:03

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:37.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.