Jump to content
Sign in to follow this  
=sinister=

Double Buffer

Recommended Posts

=sinister=

Is there any way to double buffer this?

Func drawpix($dc,$x,$y,$color)
$dll = DllOpen("user32.dll")
$dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "")
DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color)
DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0,  "int", $dc[0])

Share this post


Link to post
Share on other sites
SmOke_N

What are you talking about?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
martin

Sorry I should explain more. The script above sets a cerain pixel a certain color.

Double buffering helps reduce flicker

http://en.wikipedia.org/wiki/Double_buffering

Double buffering the change of a single pixel is not going to do anything more than waste some time. Is the problem that you are changing a lot of pixels and you get some flickering? For double buffering you need to change the pixels in a memory DC, then when all the pixels have been drawn copy the memory DC to the Gui DC. Or, stop Windows updating the gui, change all the pixels then allow the window to be redrawn.

SendMessage( $Gui, $WM_SETREDRAW,0,0);stop redrawing

;change the pixels

SendMessage( $Gui, $WM_SETREDRAW,1,0);allow redrawing
DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $GUI "int", 0, "int", 1);force a redraw

If the pixels are changed on a control in the gui then instead of $gui you can use the handle for the control.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.