[vwnc] paint with double buffering in smalltalk

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] paint with double buffering in smalltalk

Dziedzic, Peter

Hello,

I paint a widget where the user can drag and drop.
This widget is flickering alot. Do I have a chance to avoid this flickering.
In Java I would use sth like double buffering. I would not paint in the widget directly. I would paint in a buffer ( e.g. copy of my widget) and after i finsihed painting i would use the buffer as my new widget.
How can i do in smalltalk?

My Code looks sth like this:

\\ aViewList-method:
aViewList
        "Draw-method of the Angle-List that display the angle graphical"
               
        | wb hy |

        ^aViewList
                ifNil:
                        [aViewList := VisualBlock
                                block:
                                        [:gc :bd |
                                        wb := (self widgetAt: #List) bounds extent.
                                        hy := (wb x half min: wb y half) - 20 max: 0.
                                        gc paint: ColorValue black.

                                        "draw shaft:"
                                        gc lineWidth: 10.
                                        gc
                                                displayPolyline:
                                                        (Array
                                                                with: wb x half @ wb y half
                                                                with:
                                                                        (wb x half + (self angle asRAD cos * hy))
                                                                                @ (wb y half - (self angle asRAD sin * hy))).
                        ]]

\\ postBuildWith: aBuilder-method:
postBuildWith: aBuilder

        "List-widget:"
        (self widgetAt: #List)
                visualBlock: [:view :index | self aViewList];
                selectedVisualBlock: [:view :index | self aViewList];
                lineGrid: 1.

        ^super postBuildWith: aBuilder

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] paint with double buffering in smalltalk

Henrik Sperre Johansen
Try putting something like:
builder window damageRepairPolicy: DoubleBufferingWindowDisplayPolicy new.
in a postOpenWith: method.
(Or browse references to DoubleBufferingWindowDisplayPolicy for more examples)

If your invalidates are well thought out, that should reduce flickering,

Cheers,
Henry

On 23.10.2009 08:45, Dziedzic, Peter wrote:

Hello,

I paint a widget where the user can drag and drop.
This widget is flickering alot. Do I have a chance to avoid this flickering.
In Java I would use sth like double buffering. I would not paint in the widget directly. I would paint in a buffer ( e.g. copy of my widget) and after i finsihed painting i would use the buffer as my new widget.
How can i do in smalltalk?

My Code looks sth like this:

\\ aViewList-method:
aViewList
        "Draw-method of the Angle-List that display the angle graphical"
               
        | wb hy |

        ^aViewList
                ifNil:
                        [aViewList := VisualBlock
                                block:
                                        [:gc :bd |
                                        wb := (self widgetAt: #List) bounds extent.
                                        hy := (wb x half min: wb y half) - 20 max: 0.
                                        gc paint: ColorValue black.

                                        "draw shaft:"
                                        gc lineWidth: 10.
                                        gc
                                                displayPolyline:
                                                        (Array
                                                                with: wb x half @ wb y half
                                                                with:
                                                                        (wb x half + (self angle asRAD cos * hy))
                                                                                @ (wb y half - (self angle asRAD sin * hy))).
                        ]]

\\ postBuildWith: aBuilder-method:
postBuildWith: aBuilder

        "List-widget:"
        (self widgetAt: #List)
                visualBlock: [:view :index | self aViewList];
                selectedVisualBlock: [:view :index | self aViewList];
                lineGrid: 1.

        ^super postBuildWith: aBuilder

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.

_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] Antwort: Re: paint with double buffering in smalltalk

Dziedzic, Peter

Thanks for your answer.
Your solution works very fine.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Henrik Sperre Johansen <[hidden email]>
Gesendet von: [hidden email]

23.10.2009 09:21

An
[hidden email]
Kopie
Thema
Re: [vwnc] paint with double buffering in smalltalk





Try putting something like:
builder window damageRepairPolicy: DoubleBufferingWindowDisplayPolicy new.
in a postOpenWith: method.
(Or browse references to DoubleBufferingWindowDisplayPolicy for more examples)

If your invalidates are well thought out, that should reduce flickering,

Cheers,
Henry

On 23.10.2009 08:45, Dziedzic, Peter wrote:


Hello,


I paint a widget where the user can drag and drop.
This widget is flickering alot. Do I have a chance to avoid this flickering.
In Java I would use sth like double buffering. I would not paint in the widget directly. I would paint in a buffer ( e.g. copy of my widget) and after i finsihed painting i would use the buffer as my new widget.
How can i do in smalltalk?


My Code looks sth like this:


\\ aViewList-method:
aViewList
       "Draw-method of the Angle-List that display the angle graphical"
               
       | wb hy |


       ^aViewList
               ifNil:
                       [aViewList := VisualBlock
                               block:
                                       [:gc :bd |
                                       wb := (self widgetAt: #List) bounds extent.
                                       hy := (wb x half min: wb y half) - 20 max: 0.
                                       gc paint: ColorValue black.


                                       "draw shaft:"
                                       gc lineWidth: 10.
                                       gc
                                               displayPolyline:
                                                       (Array
                                                               with: wb x half @ wb y half
                                                               with:
                                                                       (wb x half + (self angle asRAD cos * hy))
                                                                               @ (wb y half - (self angle asRAD sin * hy))).
                       ]]


\\ postBuildWith: aBuilder-method:
postBuildWith: aBuilder


       "List-widget:"
       (self widgetAt: #List)
               visualBlock: [:view :index | self aViewList];
               selectedVisualBlock: [:view :index | self aViewList];
               lineGrid: 1.


       ^super postBuildWith: aBuilder


best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail:
p.dziedzic@...
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.



_______________________________________________
vwnc mailing list
vwnc@...
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
 

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc