xroot Posted April 29, 2009 Share Posted April 29, 2009 Playing around with "PolylineTo" API to generate some graphics and this is what I came up with. It will randomly change colors and get larger as it runs. It might work for a screensaver.graphics.zip Link to comment Share on other sites More sharing options...
UEZ Posted April 29, 2009 Share Posted April 29, 2009 Looks really nice but it is flickering! You can avoid flickering by using buffering method! Also use buildin GDI+ functions! E.g. $pen = _GDIPlus_PenCreate(0, 2) _GDIPlus_PenSetColor($pen, 0xFFFFFFFF) You don't need to create a pen everytime you call NewColor() function - it will cause a memory hog. I made the same mistake Good work! UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
xroot Posted April 30, 2009 Author Share Posted April 30, 2009 Thanks for the info. Thats strange, I get no flickering on my screen, it is smooth as silk. Link to comment Share on other sites More sharing options...
bienmexicano Posted April 30, 2009 Share Posted April 30, 2009 Looks really nice but it is flickering! You can avoid flickering by using buffering method!UEZ could you please explain about the buffering method, because i want to avoid the flickering too.tnx in advance i love to draw so Go here!!!!!!! Link to comment Share on other sites More sharing options...
oMBRa Posted April 30, 2009 Share Posted April 30, 2009 look here:#617017 Link to comment Share on other sites More sharing options...
UEZ Posted April 30, 2009 Share Posted April 30, 2009 (edited) Here the buffered version expandcollapse popup;mixed together by UEZ ;-) #include <GUIConstants.au3> #include <GDIplus.au3> Global Const $width = @DesktopWidth Global Const $height = @DesktopHeight Global $title = "GDI+" ; Build your GUI here Opt("GUIOnEventMode", 1) $hwnd = GUICreate($title, $width, $height, 0, 0, 0x80000000) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState() ; Load your GDI+ resources here: _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4) $pen = _GDIPlus_PenCreate(0, 2) _GDIPlus_PenSetColor($pen, 0xFF000000 + Random(0x400000, 0xFFFFFF, 1)) $R = 0 $X = 0.1 $pi_div_180 = 4 * ATan(1) / 180 $Pt = DllStructCreate("int[2000]") $pPt = DllStructGetPtr($Pt) $IO = TimerInit() Do _GDIPlus_GraphicsClear($backbuffer, 0xFF000000) If TimerDiff($IO) >= 3000 Then NewColor() $IO = TimerInit() EndIf PolyLine() _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) Sleep(50) Until False Func PolyLine() Local $A, $R, $N, $I, $J = 100 $X += 0.01 $I = 1 For $N = 1 To $j $A = $N * $X $R += $A * 0.033 DllStructSetData($Pt, 1, $width / 2 + Cos($A) * $R, $I) DllStructSetData($Pt, 1, $height / 2 - Sin($A) * $R, $I + 1) $I += 2 Next For $N = 1 To $J - 3 Step 2 ;this simulates the PolylineTo api _GDIPlus_GraphicsDrawLine($backbuffer, DllStructGetData($Pt, 1, $N), DllStructGetData($Pt, 1, $N + 1), _ DllStructGetData($Pt, 1, $N + 2), DllStructGetData($Pt, 1, $N + 3), $pen) Next EndFunc ;==>PolyLine Func NewColor() Local $Color = 0xFF000000 + Random(0x400000, 0xFFFFFF, 1) _GDIPlus_PenSetColor($pen, $Color) EndFunc Func close() $Pt = 0 _GDIPlus_PenDispose($pen) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc ;==>closeI used the buffering method from monoceres and mixed it with the code from xroot UEZ Edited May 1, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
bienmexicano Posted May 1, 2009 Share Posted May 1, 2009 ok i've been checking the examples and there awesome tnx for the help! i love to draw so Go here!!!!!!! Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 1, 2009 Share Posted May 1, 2009 Nice. A bit hypnotic though. I started watching this and the next thing I know I'm waking up with just my underwear on, eating an onion that tastes like an apple ... [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
yehia Posted May 1, 2009 Share Posted May 1, 2009 really good example My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now