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 20-Dec-2007, 01:49
Invincible Invincible is offline
New Member
 
Join Date: Jul 2007
Posts: 23
Invincible is on a distinguished road

Not redrawing image


Hi all,

Coming straight to the problem
I am drawing a rectangle using API fl_rect( x,y,w,h )
after that I am filling certain area inside that rectangle using fl_rectf(x,y,w/2,h/2)
So far everything goes fine

but when I try to toggle the state of drawing using FUNCTION KEY F9 that area is not redrawing

CPP / C++ / C Code:
mywindow::draw()
{
    fl_rect( x,y,w,h );
  if(background){
    fl_rectf(x,y,w/2,h/2)
 }
  redraw();
}

CPP / C++ / C Code:
int mywindow::handle(int event)
{
	Fl_Window::handle(event);
	
	switch( event ) {
		case FL_KEYUP:
			if ( (FL_F+9)	==	Fl::event_key() ){	

                       //bool background  
                       // default value of background= false 

			background = (! background );
			flush();
			}
			break;
	}
}

What might be the reason I tried Fl::flush also but doesn't work?
__________________
Everything you see is a Dream...
Last edited by admin : 20-Dec-2007 at 04:41. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #2  
Old 20-Dec-2007, 10:18
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road

Re: Not redrawing image


You should call draw() in handle(), not flush().
  #3  
Old 20-Dec-2007, 20:00
Invincible Invincible is offline
New Member
 
Join Date: Jul 2007
Posts: 23
Invincible is on a distinguished road

Re: Not redrawing image


Thanks for your precious reply
Initially i tired with redraw() but it was not refreshing the screen

With redraw() or flush() it faces the same problem of not refreshing the screen ,
but when screen is minimized and maximized it refreshes the screen
for now I have replaced redraw() or flush() with (hide() ,show()) it works fine but this is not the required solution because if I do this ,noticeable flickering is there .

Can anyone tell me the better solution ?
__________________
Everything you see is a Dream...
  #4  
Old 20-Dec-2007, 20:20
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road

Re: Not redrawing image


Quote:
Originally Posted by Invincible
Thanks for your precious reply
Initially i tired with redraw() but it was not refreshing the screen

I think redraw() method should work.

I also implement some widget, here's its handle section.

CPP / C++ / C Code:
int myButton::handle(int event)
{
        switch(event) {
                case FL_PUSH:
                        bgbox.box(FL_DOWN_BOX);
                        redraw();
                        do_callback();
                        return 1;
                case FL_DRAG:
                        return 1;
                case FL_RELEASE:
                        bgbox.box(FL_UP_BOX);
                        redraw();
                        return 1;
                default:
                        return 0;
        };
}
  #5  
Old 20-Dec-2007, 20:46
Invincible Invincible is offline
New Member
 
Join Date: Jul 2007
Posts: 23
Invincible is on a distinguished road

Re: Not redrawing image


Yes it does but in the case I have mentioned I is not doing that ...
When it's a question of painting in void window it is doing that beautifully but when you want to erase what you have painted it is creating problem
__________________
Everything you see is a Dream...
  #6  
Old 20-Dec-2007, 20:57
ykhuang ykhuang is offline
New Member
 
Join Date: Jun 2007
Posts: 9
ykhuang is on a distinguished road

Re: Not redrawing image


Quote:
Originally Posted by Invincible
Yes it does but in the case I have mentioned I is not doing that ...
When it's a question of painting in void window it is doing that beautifully but when you want to erase what you have painted it is creating problem

If you are talking about flickering, to my experience it is probably unavoidable, especially on some platform.

I implement the same code both on ARM SoC and x86 version testing on VMWare. It looks flawless on PC but flickers on ARM platform.
  #7  
Old 20-Dec-2007, 21:38
Invincible Invincible is offline
New Member
 
Join Date: Jul 2007
Posts: 23
Invincible is on a distinguished road

Re: Not redrawing image


You got me right
I am using ARM processor only ,though I am bit concern about flickering but my major concern is about refreshing screen .

My requirement is I want dynamically to paint half rectangle and erase that half portion
so that it appears half filled when FUNCTION KEY say F9 is pressed once and full empty when it is again pressed without minimizing and maximizing of window
__________________
Everything you see is a Dream...
 
 

Recent GIDBlogProblems with the Navy (Enlisted) 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
Image onto JFrame tedds Java Forum 8 25-Oct-2007 20:04
Importing images arety33 Java Forum 1 12-Jul-2007 13:28
How to create or display an image Unit1 C Programming Language 1 27-Sep-2006 02:18
GIM gidedit - a fltk fluid resize project cable_guy_67 FLTK Forum 2 01-Jun-2005 15:00
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 21:47

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

All times are GMT -6. The time now is 01:21.


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