Re: [lazarus] Reducing Flickeron a TImage component

2007-05-31 Thread A.J. Venter


The disabled TBitBtn flickers, because the grayed image is created
during paint. TSpeedButton does not gray the image, but paints delayed
(gtk1 intf). So it might flicker less for small buttons.


Aaaah, okay, that explains it - but also means it won't work for me.
The 'grayed' effect is fairly fundamental to the usability of the app.
Also - these are not small buttons :) the glyphs are about 128x128 each.

A.J.
--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-31 Thread Mattias Gaertner
On Thu, 31 May 2007 09:14:52 +0200
A.J. Venter [EMAIL PROTECTED] wrote:

 
  The disabled TBitBtn flickers, because the grayed image is created
  during paint. TSpeedButton does not gray the image, but paints
  delayed (gtk1 intf). So it might flicker less for small buttons.
 
 Aaaah, okay, that explains it - but also means it won't work for me.
 The 'grayed' effect is fairly fundamental to the usability of the app.

You can 'gray' it yourself.


 Also - these are not small buttons :) the glyphs are about 128x128
 each.

That's not very big. It should flicker less.


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-30 Thread A.J. Venter


It seems, gtk_pixmap is creating the disabled image on-the-fly on first
paint. So, the flickering is built-in. Because you change the image
often, you see it often.
Conclusion:
gtk1+TBitBtn+disabled = flicker

So the short version is - that GTK1 couldn't do what I needed (a
dynamically updated but often disabled set of buttons with pictures on
them) without creating a new component. It turned out to be far less
work to just port this part of the program to GTK2, the rest remains
GTK1 for now (there are three apps that make up the suite here) simply
because fixing all the layouts etc. for GTK2 would take a LONG time
(and worst of all GTK2 is still horrible with Z-order handling) but
this part works just fine under GTK2 - and as per your predictions,
the GTK2 version is completely flicker free.

For the next OutKafe release (which I will start on after I return
from this project on Friday) I will port it to GTK2 in it's entirety
(it can be done now that SetWindowFulScreen works for GTK2) however.
A.J.
--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-30 Thread Mattias Gaertner
On Wed, 30 May 2007 10:34:45 +0200
A.J. Venter [EMAIL PROTECTED] wrote:

 
  It seems, gtk_pixmap is creating the disabled image on-the-fly on
  first paint. So, the flickering is built-in. Because you change the
  image often, you see it often.
  Conclusion:
  gtk1+TBitBtn+disabled = flicker
 So the short version is - that GTK1 couldn't do what I needed (a
 dynamically updated but often disabled set of buttons with pictures on
 them) without creating a new component. 

Maybe you can try TSpeedButton instead of TBitBtn.

 It turned out to be far less
 work to just port this part of the program to GTK2, the rest remains
 GTK1 for now (there are three apps that make up the suite here) simply
 because fixing all the layouts etc. for GTK2 would take a LONG time
 (and worst of all GTK2 is still horrible with Z-order handling) but
 this part works just fine under GTK2 - and as per your predictions,
 the GTK2 version is completely flicker free.
 
 For the next OutKafe release (which I will start on after I return
 from this project on Friday) I will port it to GTK2 in it's entirety
 (it can be done now that SetWindowFulScreen works for GTK2) however.
 A.J.

The gtk2 intf is currently under heavy development. This can be good or
bad for your project.


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-30 Thread A.J. Venter

  gtk1+TBitBtn+disabled = flicker
 So the short version is - that GTK1 couldn't do what I needed (a
 dynamically updated but often disabled set of buttons with pictures on
 them) without creating a new component.

Maybe you can try TSpeedButton instead of TBitBtn.

That would only work if I painted the Caption myself would it not ? In
which case... it gets even MORE custom painting... not sure it's worth
it.

 For the next OutKafe release (which I will start on after I return
 from this project on Friday) I will port it to GTK2 in it's entirety
 (it can be done now that SetWindowFulScreen works for GTK2) however.
 A.J.

The gtk2 intf is currently under heavy development. This can be good or
bad for your project.

For OutKafe it's probably a good thing, for CAN it's less good as
stability is more important and this is just phase1 of a large
multiphase project that will take many more months if not years to
finish. That is the major reason I ONLY migrated the admin console
despite the fact that the client could work too, it reduces the impact
of unexpected changes in the gtk2 interface. Appart from the dynamic
bitbuttons, it's really a pretty simple interface so it works fine.

Ciao
A.J.
--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-30 Thread Mattias Gaertner
On Wed, 30 May 2007 13:56:55 +0200
A.J. Venter [EMAIL PROTECTED] wrote:

gtk1+TBitBtn+disabled = flicker
   So the short version is - that GTK1 couldn't do what I needed (a
   dynamically updated but often disabled set of buttons with
   pictures on them) without creating a new component.
 
  Maybe you can try TSpeedButton instead of TBitBtn.
 That would only work if I painted the Caption myself would it not ? 

TSpeedButton has a Caption. Default is ''.


 In
 which case... it gets even MORE custom painting... not sure it's worth
 it.

Did you try?


   For the next OutKafe release (which I will start on after I return
   from this project on Friday) I will port it to GTK2 in it's
   entirety (it can be done now that SetWindowFulScreen works for
   GTK2) however. A.J.
 
  The gtk2 intf is currently under heavy development. This can be
  good or bad for your project.
 For OutKafe it's probably a good thing, for CAN it's less good as
 stability is more important and this is just phase1 of a large
 multiphase project that will take many more months if not years to
 finish. That is the major reason I ONLY migrated the admin console
 despite the fact that the client could work too, it reduces the impact
 of unexpected changes in the gtk2 interface. Appart from the dynamic
 bitbuttons, it's really a pretty simple interface so it works fine.


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-30 Thread A.J. Venter

  Maybe you can try TSpeedButton instead of TBitBtn.
 That would only work if I painted the Caption myself would it not ?

TSpeedButton has a Caption. Default is ''.


 In
 which case... it gets even MORE custom painting... not sure it's worth
 it.

Did you try?

Heh, point made :)
Question then: so what IS the difference between TBitBtn and
TSpeedButton ? In general, but also specifially before it's worth
trying, it's worth knowing if their disabled paint code are in fact
different.

A.J.
--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-30 Thread Mattias Gaertner
On Wed, 30 May 2007 22:17:57 +0200
A.J. Venter [EMAIL PROTECTED] wrote:

Maybe you can try TSpeedButton instead of TBitBtn.
   That would only work if I painted the Caption myself would it
   not ?
 
  TSpeedButton has a Caption. Default is ''.
 
 
   In
   which case... it gets even MORE custom painting... not sure it's
   worth it.
 
  Did you try?
 Heh, point made :)
 Question then: so what IS the difference between TBitBtn and
 TSpeedButton ? In general, but also specifially before it's worth
 trying, it's worth knowing if their disabled paint code are in fact
 different.

The disabled TBitBtn flickers, because the grayed image is created
during paint. TSpeedButton does not gray the image, but paints delayed
(gtk1 intf). So it might flicker less for small buttons.


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread A.J. Venter

An updated (related) question would be whether there is any way to
remove the flicker in THIS case:

I have a couple of TBitBtn components. Appart from their captions and
glyphs, I actually write some information to the canvasses which are
meant to show up ON TOP of each glyph. A button may or may not contain
info/may or may not currently be enabled ( these buttons represent
actual computer terminals in the real world, and are updated based on
what those terminals store in a database - when somebody logs into a
terminal, the corresponding button should display his info and be
enabled).

The procedures I have for either updating or disabling buttons are
below. A TTimer checks the database every second and then runs either
UpdateBtn or ButtonOff depending on the particular button's current
state.
It all works quite well... (although before adding invalidates to each
procedure it had a tendency to lose the caption) ... except it
flickers something awful.

Since I have no desire to cause massive epilepsy among my users, I
would appreciate some advice here (this is a trickier one.. after all
how do you double buffer a BUTTON ?)

A.J.

Procedure UpdateBtn(Button:TBitBtn;UserName,Time,Status:String);
Begin
 Button.Glyph.Canvas.Clear;
 Button.Glyph.Assign(NewMainForm.Image1.Picture);
 Button.Glyph.Canvas.Font.Size := 18;
 Button.Glyph.Canvas.Font.Name := 'times';
 Button.Glyph.Canvas.Font.Color := ClBlue;
 Button.Glyph.Canvas.TextOut(20,20,'User: '+Username);
 Button.Hint := UserName;
 Button.Glyph.Canvas.TextOut(20,50,'Time: '+Time);
 Button.Glyph.Canvas.TextOut(20,80,'Status: '+Status);
 Button.Invalidate;
End;

Procedure ButtonOff(Button:TbitBtn);
Begin
Button.Glyph.Canvas.Clear;
Button.Glyph.Assign(NewMainForm.Image1.Picture);
Button.Enabled := False;
Button.Invalidate;;
end;

On 5/28/07, Dave Coventry [EMAIL PROTECTED] wrote:

Gustavo,

My problem was caused by the fact that the background for my TImage was
black. When I placed it on a black-coloured panel (I used a TScrollBox
as I want to capture mousewheel events), I found the flicker was more or
less unoticeable.

Gustavo Enrique Jimenez wrote:


 2007/5/28, Dave Coventry [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

 Gustavo Enrique Jimenez wrote:
 
 
  There are good tutorials/examples on
  http://wiki.lazarus.freepascal.org/Developing_with_Graphics
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics
  http://wiki.lazarus.freepascal.org/Developing_with_Graphics
 Gustavo,

 Thank you for your reply.

 But they don't really help.

 Do you draw a line to the Image1.Canvas? or do you draw to
 Image1.Picture.Bitmap.Canvas as suggested by the wiki? Which seems to
 make the flickering worse?

 Or do you need to suspend onPaint until you've finished drawing?

 In which case, how do you suspend onPaint?



 I have used the Create a custom control which draws itself method,
 and it worked very well !! Try this method.

 Gustavo

 ps: for the record, Felipe Monteiro help me A LOT in private mails.
 Thanks Felipe, and excuse me for bother you in private.







--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives




--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread A.J. Venter

On 5/29/07, Felipe Monteiro de Carvalho
[EMAIL PROTECTED] wrote:

On 5/29/07, A.J. Venter [EMAIL PROTECTED] wrote:
 I have a couple of TBitBtn components. Appart from their captions and
 glyphs, I actually write some information to the canvasses which are
 meant to show up ON TOP of each glyph.

I would write my own fully custom-drawn button to do this.

I was afraid you'd say that :)
Now imagine my deadline is a few hours only and I have other
outstanding functionality to code...

A.J.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread Dave Coventry

AJ,

In my case, when the image is redrawn, the TImage was cleared which 
showed the underlying colour (clBtnFace), which caused the flicker when 
the black background was painted in.


I'm not sure of how relevant it would be in your case, but I changed the 
colour of the underlying panel to black, which eliminated the flicker.


It would depend, I guess, on the colour of your graphic and the colour 
of the background displayed when it clears. (I'm not really auf fe with 
the TBitBtn components, having never used them).


A.J. Venter wrote:

On 5/29/07, Felipe Monteiro de Carvalho
[EMAIL PROTECTED] wrote:

On 5/29/07, A.J. Venter [EMAIL PROTECTED] wrote:
 I have a couple of TBitBtn components. Appart from their captions and
 glyphs, I actually write some information to the canvasses which are
 meant to show up ON TOP of each glyph.

I would write my own fully custom-drawn button to do this.

I was afraid you'd say that :)
Now imagine my deadline is a few hours only and I have other
outstanding functionality to code...

A.J.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives





--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread A.J. Venter

Well I've reduced the flicker a little by doing a few small things
(mostly not reloading images unless they have changed).
I also set the DoubleBuffered property of the components to true,
though I see no effect from doing so nor do I know what effect it's
supposed to have.
My understanding of doublebuffering (as I learned it doing things like
SDL) is that it means that any changes to the component/canvas is
drawn in memory NOT on screen, and only when they are all done do you
update the component with one single action (drawing the memory buffer
to the screen buffer - known commonly as a 'flip') - my TDoubleBuffer
component is based on doing exactly that.
What it means when you set the doublebuffered property of a button to
true I don't know - though I would love to find out.

A.J.

On 5/29/07, Dave Coventry [EMAIL PROTECTED] wrote:

AJ,

In my case, when the image is redrawn, the TImage was cleared which
showed the underlying colour (clBtnFace), which caused the flicker when
the black background was painted in.

I'm not sure of how relevant it would be in your case, but I changed the
colour of the underlying panel to black, which eliminated the flicker.

It would depend, I guess, on the colour of your graphic and the colour
of the background displayed when it clears. (I'm not really auf fe with
the TBitBtn components, having never used them).

A.J. Venter wrote:
 On 5/29/07, Felipe Monteiro de Carvalho
 [EMAIL PROTECTED] wrote:
 On 5/29/07, A.J. Venter [EMAIL PROTECTED] wrote:
  I have a couple of TBitBtn components. Appart from their captions and
  glyphs, I actually write some information to the canvasses which are
  meant to show up ON TOP of each glyph.

 I would write my own fully custom-drawn button to do this.
 I was afraid you'd say that :)
 Now imagine my deadline is a few hours only and I have other
 outstanding functionality to code...

 A.J.

 _
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives




--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives




--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread Mattias Gaertner
On Tue, 29 May 2007 11:26:02 +0200
A.J. Venter [EMAIL PROTECTED] wrote:

 Well I've reduced the flicker a little by doing a few small things
 (mostly not reloading images unless they have changed).
 I also set the DoubleBuffered property of the components to true,
 though I see no effect from doing so nor do I know what effect it's
 supposed to have.
 My understanding of doublebuffering (as I learned it doing things like
 SDL) is that it means that any changes to the component/canvas is
 drawn in memory NOT on screen, and only when they are all done do you
 update the component with one single action (drawing the memory buffer
 to the screen buffer - known commonly as a 'flip') - my TDoubleBuffer
 component is based on doing exactly that.
 What it means when you set the doublebuffered property of a button to
 true I don't know - though I would love to find out.

DoubleBuffered is a hint for the interface.
The gtk2 intf always paints double buffered for each gdkwindow.
That means paint events are double buffered, other painting not. The
gtk1 intf has almost no doublebuffering. I'm not sure about
the other interfaces.

I only did a small test: The gtk intf only paints once per Invalidate
and there I see no flicker at all. That's because the bitbtn glyph
handle is a memory handle and not an image on the screen. Maybe the
win32 intf is creating a screen handle? That would explain the
flickering.


Mattias


 
 A.J.
 
 On 5/29/07, Dave Coventry [EMAIL PROTECTED] wrote:
  AJ,
 
  In my case, when the image is redrawn, the TImage was cleared which
  showed the underlying colour (clBtnFace), which caused the flicker
  when the black background was painted in.
 
  I'm not sure of how relevant it would be in your case, but I
  changed the colour of the underlying panel to black, which
  eliminated the flicker.
 
  It would depend, I guess, on the colour of your graphic and the
  colour of the background displayed when it clears. (I'm not really
  auf fe with the TBitBtn components, having never used them).
 
  A.J. Venter wrote:
   On 5/29/07, Felipe Monteiro de Carvalho
   [EMAIL PROTECTED] wrote:
   On 5/29/07, A.J. Venter [EMAIL PROTECTED] wrote:
I have a couple of TBitBtn components. Appart from their
captions and glyphs, I actually write some information to the
canvasses which are meant to show up ON TOP of each glyph.
  
   I would write my own fully custom-drawn button to do this.
   I was afraid you'd say that :)
   Now imagine my deadline is a few hours only and I have other
   outstanding functionality to code...
  
   A.J.
  
   _
   To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
 archives at http://www.lazarus.freepascal.org/mailarchives
  
  
 
 
  --
  Dave Coventry
  Tel   (home):  +27(0)31 3092301
  Tel (office):  +27(0)31 2058448
 
  Cell: +27(0)82 9000179
 
  _
   To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
 archives at http://www.lazarus.freepascal.org/mailarchives
 
 
 

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread A.J. Venter

DoubleBuffered is a hint for the interface.
The gtk2 intf always paints double buffered for each gdkwindow.
That means paint events are double buffered, other painting not. The
gtk1 intf has almost no doublebuffering. I'm not sure about
the other interfaces.

Aaah okay, that makes sense.


I only did a small test: The gtk intf only paints once per Invalidate
and there I see no flicker at all. That's because the bitbtn glyph
handle is a memory handle and not an image on the screen. Maybe the
win32 intf is creating a screen handle? That would explain the
flickering.

This is a GTK1 app.
The catch is that if I don't call invalidate, the buttons go entirely
blank instead of merely being grayed out, this includes the captions.
If I DO call invalidate, I end up with a whole LOT of repaints all the
time - which is... well ugly to say the least.

I am still not sure how best to approach this. Shouldn't the buttons
remain in their last state, repainted when damaged until such time
as they are changed ? I'm not even moving anything here just painting
some info onto SOME of the buttons and updating those periodically
while setting the others disabled until such time as they are in use.

And it's the DISABLED buttons which are giving me grief, the enabled
once have a very slight flicker but it's actually almost nothing
(again I don't know why that would be).
--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread Charl van Jaarsveldt

Hi,

I am just making a wild guess, so  if it sounds absurd, please ignore. :-)

How about creating a dummy invisible button, and use that one as a buffer
for all the other buttons. So, everytime you need to update a button, rather
make the dummy what you want, then somehow copy the canvas of the dummy into
the canvas of the actual button. I think if this would work it will
eliminate flicker and shouldn't be too much overhead.

Charl

On 5/29/07, A.J. Venter [EMAIL PROTECTED] wrote:


 DoubleBuffered is a hint for the interface.
 The gtk2 intf always paints double buffered for each gdkwindow.
 That means paint events are double buffered, other painting not. The
 gtk1 intf has almost no doublebuffering. I'm not sure about
 the other interfaces.
Aaah okay, that makes sense.

 I only did a small test: The gtk intf only paints once per Invalidate
 and there I see no flicker at all. That's because the bitbtn glyph
 handle is a memory handle and not an image on the screen. Maybe the
 win32 intf is creating a screen handle? That would explain the
 flickering.
This is a GTK1 app.
The catch is that if I don't call invalidate, the buttons go entirely
blank instead of merely being grayed out, this includes the captions.
If I DO call invalidate, I end up with a whole LOT of repaints all the
time - which is... well ugly to say the least.

I am still not sure how best to approach this. Shouldn't the buttons
remain in their last state, repainted when damaged until such time
as they are changed ? I'm not even moving anything here just painting
some info onto SOME of the buttons and updating those periodically
while setting the others disabled until such time as they are in use.

And it's the DISABLED buttons which are giving me grief, the enabled
once have a very slight flicker but it's actually almost nothing
(again I don't know why that would be).
--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives





--
I love deadlines. I especially love the whooshing sound they make as they
fly by. - Douglas Adams


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread Mattias Gärtner
Zitat von A.J. Venter [EMAIL PROTECTED]:

  DoubleBuffered is a hint for the interface.
  The gtk2 intf always paints double buffered for each gdkwindow.
  That means paint events are double buffered, other painting not. The
  gtk1 intf has almost no doublebuffering. I'm not sure about
  the other interfaces.
 Aaah okay, that makes sense.
 
  I only did a small test: The gtk intf only paints once per Invalidate
  and there I see no flicker at all. That's because the bitbtn glyph
  handle is a memory handle and not an image on the screen. Maybe the
  win32 intf is creating a screen handle? That would explain the
  flickering.
 This is a GTK1 app.
 The catch is that if I don't call invalidate, the buttons go entirely
 blank instead of merely being grayed out, this includes the captions.
 If I DO call invalidate, I end up with a whole LOT of repaints all the
 time - which is... well ugly to say the least.

 I am still not sure how best to approach this. Shouldn't the buttons
 remain in their last state, repainted when damaged until such time
 as they are changed ? I'm not even moving anything here just painting
 some info onto SOME of the buttons and updating those periodically
 while setting the others disabled until such time as they are in use.

 And it's the DISABLED buttons which are giving me grief, the enabled
 once have a very slight flicker but it's actually almost nothing
 (again I don't know why that would be).

I can reproduce the issue: gtk1 with enabled=false TBitBtn.
I wonder, why only the flickering is only visible with a disabled bitbtn ...

Mattias


 --
 A.J. Venter
 CEO - OutKast Solutions C.C.
 http://www.outkastsolutions.co.za
 Cell: +27 83 455 9978
 Fax: +27 21 413 2800
 Office: +27 21 591 6766

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



--
Powered by NetMail

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread Darmawan Sugiarto
I used TPaintBox... it's work better than Timage when Drawing (OnPaint)
You can try it

Gustavo Enrique Jimenez [EMAIL PROTECTED] wrote: 

2007/5/28, Dave Coventry [EMAIL PROTECTED]: Gustavo Enrique Jimenez wrote:


 There are good tutorials/examples on
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics 
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics
Gustavo,

Thank you for your reply.

But they don't really help. 

Do you draw a line to the Image1.Canvas? or do you draw to
Image1.Picture.Bitmap.Canvas as suggested by the wiki? Which seems to
make the flickering worse?

Or do you need to suspend onPaint until you've finished drawing? 

In which case, how do you suspend onPaint?

I have used the Create a custom control which draws itself method, and it 
worked very well !! Try this method. 

Gustavo

ps: for the record, Felipe Monteiro help me A LOT in private mails. Thanks 
Felipe, and excuse me for bother you in private.



 


 


=INTOSOFT
   ALEXIO CHAOS
   [EMAIL PROTECTED]   
  Yahoo Messager
=
   
-
Need a vacation? Get great deals to amazing places on Yahoo! Travel. 

Re: [lazarus] Reducing Flickeron a TImage component

2007-05-29 Thread Mattias Gaertner
On Tue, 29 May 2007 15:11:48 +0200
Mattias Gärtner [EMAIL PROTECTED] wrote:

 Zitat von A.J. Venter [EMAIL PROTECTED]:
 
   DoubleBuffered is a hint for the interface.
   The gtk2 intf always paints double buffered for each gdkwindow.
   That means paint events are double buffered, other painting not.
   The gtk1 intf has almost no doublebuffering. I'm not sure about
   the other interfaces.
  Aaah okay, that makes sense.
  
   I only did a small test: The gtk intf only paints once per
   Invalidate and there I see no flicker at all. That's because the
   bitbtn glyph handle is a memory handle and not an image on the
   screen. Maybe the win32 intf is creating a screen handle? That
   would explain the flickering.
  This is a GTK1 app.
  The catch is that if I don't call invalidate, the buttons go
  entirely blank instead of merely being grayed out, this includes
  the captions. If I DO call invalidate, I end up with a whole LOT of
  repaints all the time - which is... well ugly to say the least.
 
  I am still not sure how best to approach this. Shouldn't the buttons
  remain in their last state, repainted when damaged until such time
  as they are changed ? I'm not even moving anything here just
  painting some info onto SOME of the buttons and updating those
  periodically while setting the others disabled until such time as
  they are in use.
 
  And it's the DISABLED buttons which are giving me grief, the enabled
  once have a very slight flicker but it's actually almost nothing
  (again I don't know why that would be).
 
 I can reproduce the issue: gtk1 with enabled=false TBitBtn.
 I wonder, why only the flickering is only visible with a disabled
 bitbtn ...

It seems, gtk_pixmap is creating the disabled image on-the-fly on first
paint. So, the flickering is built-in. Because you change the image
often, you see it often.
Conclusion:
gtk1+TBitBtn+disabled = flicker


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Reducing Flickeron a TImage component

2007-05-28 Thread Dave Coventry

I'm getting an awful lot of screen flicker from the following code:
== snip 
 Form1.Image1.Canvas.Pen.Color:=$FF;
 Form1.Image1.Canvas.Pen.Mode:=pmNot;
 Form1.Image1.Canvas.MoveTo(iCornerX,CornerY);
 Form1.Image1.Canvas.LineTo(PrevX,PrevY);
 Form1.Image1.Canvas.MoveTo(iCornerX,CornerY);
 Form1.Image1.Canvas.LineTo(X,Y);   
== snip 

It's actually rubberbanding showing where a line will be drawn.

Is there a way of reducing this? The background colour of the TImage is 
black which tends to accentuate it somewhat.


--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-28 Thread Gustavo Enrique Jimenez

Hi

I'm getting an awful lot of screen flicker from the following code:

== snip 
  Form1.Image1.Canvas.Pen.Color:=$FF;
  Form1.Image1.Canvas.Pen.Mode:=pmNot;
  Form1.Image1.Canvas.MoveTo(iCornerX,CornerY);
  Form1.Image1.Canvas.LineTo(PrevX,PrevY);
  Form1.Image1.Canvas.MoveTo(iCornerX,CornerY);
  Form1.Image1.Canvas.LineTo(X,Y);
== snip 
It's actually rubberbanding showing where a line will be drawn.

Is there a way of reducing this? The background colour of the TImage is
black which tends to accentuate it somewhat.

--



There are good tutorials/examples on
http://wiki.lazarus.freepascal.org/Developing_with_Graphics

Gustavo


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-28 Thread Dave Coventry

Gustavo Enrique Jimenez wrote:



There are good tutorials/examples on 
http://wiki.lazarus.freepascal.org/Developing_with_Graphics 
http://wiki.lazarus.freepascal.org/Developing_with_Graphics

Gustavo,

Thank you for your reply.

But they don't really help.

Do you draw a line to the Image1.Canvas? or do you draw to 
Image1.Picture.Bitmap.Canvas as suggested by the wiki? Which seems to 
make the flickering worse?


Or do you need to suspend onPaint until you've finished drawing?

In which case, how do you suspend onPaint?

--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-28 Thread Gustavo Enrique Jimenez

2007/5/28, Dave Coventry [EMAIL PROTECTED]:


Gustavo Enrique Jimenez wrote:


 There are good tutorials/examples on
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics
Gustavo,

Thank you for your reply.

But they don't really help.

Do you draw a line to the Image1.Canvas? or do you draw to
Image1.Picture.Bitmap.Canvas as suggested by the wiki? Which seems to
make the flickering worse?

Or do you need to suspend onPaint until you've finished drawing?

In which case, how do you suspend onPaint?




I have used the Create a custom control which draws itself method, and it
worked very well !! Try this method.

Gustavo

ps: for the record, Felipe Monteiro help me A LOT in private mails. Thanks
Felipe, and excuse me for bother you in private.


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-28 Thread Felipe Monteiro de Carvalho

On 5/28/07, Gustavo Enrique Jimenez [EMAIL PROTECTED] wrote:

ps: for the record, Felipe Monteiro help me A LOT in private mails. Thanks
Felipe, and excuse me for bother you in private.


No problem =)

--
Felipe Monteiro de Carvalho

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Reducing Flickeron a TImage component

2007-05-28 Thread Dave Coventry

Gustavo,

My problem was caused by the fact that the background for my TImage was 
black. When I placed it on a black-coloured panel (I used a TScrollBox 
as I want to capture mousewheel events), I found the flicker was more or 
less unoticeable.


Gustavo Enrique Jimenez wrote:



2007/5/28, Dave Coventry [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

Gustavo Enrique Jimenez wrote:


 There are good tutorials/examples on
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics
http://wiki.lazarus.freepascal.org/Developing_with_Graphics
 http://wiki.lazarus.freepascal.org/Developing_with_Graphics
Gustavo,

Thank you for your reply.

But they don't really help.

Do you draw a line to the Image1.Canvas? or do you draw to
Image1.Picture.Bitmap.Canvas as suggested by the wiki? Which seems to
make the flickering worse?

Or do you need to suspend onPaint until you've finished drawing?

In which case, how do you suspend onPaint?



I have used the Create a custom control which draws itself method, 
and it worked very well !! Try this method.


Gustavo

ps: for the record, Felipe Monteiro help me A LOT in private mails. 
Thanks Felipe, and excuse me for bother you in private.




 




--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives