corgano Posted March 24, 2011 Share Posted March 24, 2011 I was bored, so I started writing a clock. The problem is as it runs, it keeps using more and more memory. I know i did something wrong, but I do not know what. Can someone explain what I did? expandcollapse popup#include <WINAPI.au3> #include <GDIplus.au3> #include <GUIConstantsEx.au3> $r = 0 $pi = 3.14159265358979 $degToRad = $pi / 180 $Radtodeg = 180 / $pi Global $q = 40, $size=@DesktopHeight $gui = GUICreate("Clock", $size, $size) Global $ctrl = GUICtrlCreatePic("", 0, 0, 600, 600) GUISetState() ;~ GUIRegisterMsg($WM_PAINT, "MY_PAINT") _GDIPlus_Startup() Global $redpen2 = _GDIPlus_PenCreate(0x88FF3333,$q) Global $yellowpen2 = _GDIPlus_PenCreate(0x88FFFF33,$q) Global $Greenpen2 = _GDIPlus_PenCreate(0x8833ff33,$q) Global $bluepen2 = _GDIPlus_PenCreate(0x883333ff,$q) Global $redpen = _GDIPlus_PenCreate(0x99FF3333,$q*2) Global $yellowpen = _GDIPlus_PenCreate(0x99FFFF33,$q*2) Global $Greenpen = _GDIPlus_PenCreate(0x9933ff33,$q*2) Global $bluepen = _GDIPlus_PenCreate(0x993333ff,$q*2) Global $Hpen = _GDIPlus_PenCreate(0x993333ff) Global $hBmp = _WinAPI_CreateBitmap($size, $size, 1, 32) Global $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) Global $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) sleep(1000) AdlibRegister("_tic", 90) ;~ _Tic() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Func _Tic() $msecondAngle = 8.0 * ATan(1) * round(@MSEC / 100,1) /9 * $Radtodeg $secondAngle = 8.0 * ATan(1) * @SEC / 60.0 * $Radtodeg $minuteAngle = 8.0 * ATan(1) * @MIN / 60.0 * $Radtodeg $hourAngle = 8.0 * ATan(1) * @HOUR / 12.0 * $Radtodeg If $hourAngle > 359 Then $hourangle -= 360 _GDIPlus_GraphicsClear($hGraphic, 0x60000000) drawring($hGraphic,$size/2,$size/2,$q*2,-90,$msecondAngle,$yellowpen) drawring($hGraphic,$size/2,$size/2,$q*4,-90,$secondAngle,$redpen) drawring($hGraphic,$size/2,$size/2,$q*6,-90,$minuteAngle,$greenpen) drawring($hGraphic,$size/2,$size/2,$q*8,-90,$hourAngle,$bluepen) ConsoleWrite($secondAngle/2&@CRLF) drawring($hGraphic,$size/2,$size/2,$q*2,0,360,$yellowpen2) drawring($hGraphic,$size/2,$size/2,$q*4,0,360,$redpen2) drawring($hGraphic,$size/2,$size/2,$q*6,0,360,$greenpen2) drawring($hGraphic,$size/2,$size/2,$q*8,0,360,$bluepen2) ;~ ConsoleWrite($i&@CRLF) $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $oldbmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) EndFunc ;==>_Tic Func drawring($g,$x,$y,$l,$a1,$a2,$p) _GDIPlus_GraphicsDrawArc ($g, $x-$l, $y-$l, $l*2, $l*2, $a1, $a2, $p) EndFunc 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
AppTux Posted March 24, 2011 Share Posted March 24, 2011 (edited) I don't know how to fix it, but I found it happens in this part: $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $oldbmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) I think you load a lot of bitmaps into the memory, I think you have to clean the memory of GDIPlus in the function. But I don't know how you have to do that . But I'm sure the problem is in that part. Edit: Add this line on the bottom of the _Tic() function and you don't have the memory problem anymore: _GDIPlus_ImageDispose($hBitmap1) But you don't see anything more... Edited March 24, 2011 by AppTux PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
corgano Posted March 24, 2011 Author Share Posted March 24, 2011 Maybe it was the collection of instances of hbitmap2 that causes memory usage? I tried having GDI+ remove it after it was used but AutoIt crashed when I did. Anyone know how to fix this? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Yashied Posted March 24, 2011 Share Posted March 24, 2011 (edited) Anyone know how to fix this? $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) EndIf $OldBmp = GUICtrlSendMsg($ctrl, 0x0173, 0, 0) If $OldBmp <> $hBitmap2 Then _WinAPI_DeleteObject($hBitmap2) EndIf Edited March 24, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
corgano Posted March 24, 2011 Author Share Posted March 24, 2011 Cool, that worked. Could you explain to me why? It would help if I understood this. 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Yashied Posted March 24, 2011 Share Posted March 24, 2011 Important In version 6 of the Microsoft Win32 controls, a bitmap passed to a static control using the STM_SETIMAGE message was the same bitmap returned by a subsequent STM_SETIMAGE message. The client is responsible to delete any bitmap sent to a static control.With Microsoft Windows XP, if the bitmap passed in the STM_SETIMAGE message contains pixels with non-zero alpha, the static control takes a copy of the bitmap. This copied bitmap is returned by the next STM_SETIMAGE message. The client code may independently track the bitmaps passed to the static control, but if it does not check and release the bitmaps returned from STM_SETIMAGE messages, the bitmaps are leaked.http://msdn.microsoft.com/en-us/library/bb760782(VS.85).aspx My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
UEZ Posted March 24, 2011 Share Posted March 24, 2011 If you replace this line If $OldBmp Then _WinAPI_DeleteObject($OldBmp) with these 2 lines it is also working: _WinAPI_DeleteObject($hBitmap2) _WinAPI_DeleteObject($OldBmp) Btw, why are you GUICtrlCreatePic() and sending the image to the control? Br, 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...
corgano Posted March 24, 2011 Author Share Posted March 24, 2011 That's th eonly way I know how to do it. This is based off a script that's based off of a script that's based off of a script that I originally did In GDI, and you actually converted it to GDI+ for me. I don't really understand what I'm doing 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
UEZ Posted March 24, 2011 Share Posted March 24, 2011 Well, here one possibility: expandcollapse popup#include <GDIplus.au3> #include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) $r = 0 Const $pi = ACos(-1) Const $degToRad = $pi / 180 Const $Radtodeg = 180 / $pi Global $q = 40 Const $8ATan1 = 8.0 * ATan(1) Const $size = 800 Const $s2 = $size/2 $gui = GUICreate("Clock", $size, $size) GUISetState() _GDIPlus_Startup() Global $redpen2 = _GDIPlus_PenCreate(0x88FF3333,$q) Global $yellowpen2 = _GDIPlus_PenCreate(0x88FFFF33,$q) Global $Greenpen2 = _GDIPlus_PenCreate(0x8833ff33,$q) Global $bluepen2 = _GDIPlus_PenCreate(0x883333ff,$q) Global $redpen = _GDIPlus_PenCreate(0x99FF3333,$q*2) Global $yellowpen = _GDIPlus_PenCreate(0x99FFFF33,$q*2) Global $Greenpen = _GDIPlus_PenCreate(0x9933ff33,$q*2) Global $bluepen = _GDIPlus_PenCreate(0x993333ff,$q*2) Global $Hpen = _GDIPlus_PenCreate(0x993333ff) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($size, $size, $hGraphics) Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) _GDIPlus_GraphicsClear($hContext, 0xFF000000) _Tic() AdlibRegister("_tic", 975) GUISetOnEvent(-3, "_Exit") While Sleep(1000000) WEnd Func _Tic() $msecondAngle = $8ATan1 * round(@MSEC / 100,1) /9 * $Radtodeg $secondAngle = $8ATan1 * @SEC / 60.0 * $Radtodeg $minuteAngle = $8ATan1 * @MIN / 60.0 * $Radtodeg $hourAngle = $8ATan1 * @HOUR / 12.0 * $Radtodeg If $hourAngle > 359 Then $hourangle -= 360 _GDIPlus_GraphicsClear($hContext, 0xF0000000) drawring($hContext,$s2,$s2,$q*2,-90,$msecondAngle,$yellowpen) drawring($hContext,$s2,$s2,$q*4,-90,$secondAngle,$redpen) drawring($hContext,$s2,$s2,$q*6,-90,$minuteAngle,$greenpen) drawring($hContext,$s2,$s2,$q*8,-90,$hourAngle,$bluepen) ConsoleWrite($secondAngle/2&@CRLF) drawring($hContext,$s2,$s2,$q*2,0,360,$yellowpen2) drawring($hContext,$s2,$s2,$q*4,0,360,$redpen2) drawring($hContext,$s2,$s2,$q*6,0,360,$greenpen2) drawring($hContext,$s2,$s2,$q*8,0,360,$bluepen2) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) EndFunc ;==>_Tic Func drawring($g,$x,$y,$l,$a1,$a2,$p) _GDIPlus_GraphicsDrawArc ($g, $x-$l, $y-$l, $l*2, $l*2, $a1, $a2, $p) EndFunc Func _Exit() _GDIPlus_PenDispose($redpen2) _GDIPlus_PenDispose($yellowpen2) _GDIPlus_PenDispose($Greenpen2) _GDIPlus_PenDispose($bluepen2) _GDIPlus_PenDispose($yellowpen) _GDIPlus_PenDispose($Greenpen) _GDIPlus_PenDispose($bluepen) _GDIPlus_PenDispose($Hpen) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($gui) Exit EndFunc Have fun, 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...
corgano Posted March 25, 2011 Author Share Posted March 25, 2011 (edited) I was looking through the code, and I have a question. _GDIPlus_GraphicsCreateFromHWND($gui) and _GDIPlus_ImageGetGraphicsContext(_GDIPlus_BitmapCreateFromGraphics($x,$y,_GDIPlus_GraphicsCreateFromHWND($gui))) both return a handle to a graphics object. What is the difference? Does _GDIPlus_BitmapCreateFromGraphics just resize it? Second, You can create 2 $hGraphic instances from one GUI right? I'm going to try making it draw the back circles once instead of every loop My first attempt at this was to draw it this way, with the rings and the "hands" on a different set oF graphics objects expandcollapse popup#include <GDIplus.au3> #include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) $r = 0 Const $pi = ACos(-1) Const $degToRad = $pi / 180 Const $Radtodeg = 180 / $pi Const $8ATan1 = 8.0 * ATan(1) ;~ Global $Height=234, $q = $Height/20, $Width = $Height Global $Height=@DesktopHeight, $q = $Height/18, $Width = @DesktopWidth Const $s2 = $Height/2 $gui = GUICreate("Clock", $Width, $Height) GUISetState() _GDIPlus_Startup() Global $redpen2 = _GDIPlus_PenCreate(0x88FF3333,$q) Global $yellowpen2 = _GDIPlus_PenCreate(0x88FFFF33,$q) Global $Greenpen2 = _GDIPlus_PenCreate(0x8833ff33,$q) Global $bluepen2 = _GDIPlus_PenCreate(0x883333ff,$q) Global $redpen = _GDIPlus_PenCreate(0x99FF3333,$q*2) Global $yellowpen = _GDIPlus_PenCreate(0x99FFFF33,$q*2) Global $Greenpen = _GDIPlus_PenCreate(0x9933ff33,$q*2) Global $bluepen = _GDIPlus_PenCreate(0x993333ff,$q*2) Global $Hpen = _GDIPlus_PenCreate(0x993333ff) ;make graphics object from the window Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui) ;make a bitmap object from the graphic object Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphics) ;gets a handel to a graphics object Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) _GDIPlus_GraphicsClear($hContext, 0x00000000) ;make graphics object from the window Global $hGraphics2 = _GDIPlus_GraphicsCreateFromHWND($gui) ;make a bitmap object from the graphic object Global $hBitmap2 = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphics2) ;gets a handel to a graphics object Global $hContext2 = _GDIPlus_ImageGetGraphicsContext($hBitmap2) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) _GDIPlus_GraphicsClear($hContext2, 0xFF000000) _circles() AdlibRegister("_tic", 95) GUISetOnEvent(-3, "_Exit") While Sleep(1000000) WEnd Func _circles() drawring($hContext2,$Width/2,$Height/2,$q*2,0,360,$yellowpen2) drawring($hContext2,$Width/2,$Height/2,$q*4,0,360,$redpen2) drawring($hContext2,$Width/2,$Height/2,$q*6,0,360,$greenpen2) drawring($hContext2,$Width/2,$Height/2,$q*8,0,360,$bluepen2) _GDIPlus_GraphicsDrawImage($hGraphics2, $hBitmap2, 0, 0) EndFunc Func _Tic() $msecondAngle = 8.0 * ATan(1) * round(@MSEC / 100,1) /9 * $Radtodeg $secondAngle = 8.0 * ATan(1) * @SEC / 60.0 * $Radtodeg $minuteAngle = 8.0 * ATan(1) * @MIN / 60.0 * $Radtodeg $hourAngle = 8.0 * ATan(1) * @HOUR / 12.0 * $Radtodeg If $hourAngle > 359 Then $hourangle -= 360 _GDIPlus_GraphicsClear($hContext, "0x00000000") drawring($hContext,$Width/2,$Height/2,$q*2,-90,$msecondAngle,$yellowpen) drawring($hContext,$Width/2,$Height/2,$q*4,-90,$secondAngle,$redpen) drawring($hContext,$Width/2,$Height/2,$q*6,-90,$minuteAngle,$greenpen) drawring($hContext,$Width/2,$Height/2,$q*8,-90,$hourAngle,$bluepen) ;~ ConsoleWrite($secondAngle/2&@CRLF) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) EndFunc ;==>_Tic Func drawring($g,$x,$y,$l,$a1,$a2,$p) _GDIPlus_GraphicsDrawArc ($g, $x-$l, $y-$l, $l*2, $l*2, $a1, $a2, $p) EndFunc Func _Exit() _GDIPlus_PenDispose($redpen2) _GDIPlus_PenDispose($yellowpen2) _GDIPlus_PenDispose($Greenpen2) _GDIPlus_PenDispose($bluepen2) _GDIPlus_PenDispose($yellowpen) _GDIPlus_PenDispose($Greenpen) _GDIPlus_PenDispose($bluepen) _GDIPlus_PenDispose($Hpen) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_GraphicsDispose($hContext2) _GDIPlus_BitmapDispose($hBitmap2) _GDIPlus_GraphicsDispose($hGraphics2) _GDIPlus_Shutdown() GUIDelete($gui) Exit EndFunc Edited March 25, 2011 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
UEZ Posted March 25, 2011 Share Posted March 25, 2011 I would do it this way: expandcollapse popup#include <GDIplus.au3> #include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) $r = 0 Const $pi = ACos(-1) Const $degToRad = $pi / 180 Const $Radtodeg = 180 / $pi Global $q = 40 Const $8ATan1 = 8.0 * ATan(1) Const $size = 800 Const $s2 = $size/2 $gui = GUICreate("Clock", $size, $size) GUISetState() _GDIPlus_Startup() Global $redpen2 = _GDIPlus_PenCreate(0x88FF3333,$q) Global $yellowpen2 = _GDIPlus_PenCreate(0x88FFFF33,$q) Global $Greenpen2 = _GDIPlus_PenCreate(0x8833ff33,$q) Global $bluepen2 = _GDIPlus_PenCreate(0x883333ff,$q) Global $redpen = _GDIPlus_PenCreate(0x99FF3333,$q*2) Global $yellowpen = _GDIPlus_PenCreate(0x99FFFF33,$q*2) Global $Greenpen = _GDIPlus_PenCreate(0x9933ff33,$q*2) Global $bluepen = _GDIPlus_PenCreate(0x993333ff,$q*2) Global $Hpen = _GDIPlus_PenCreate(0x993333ff) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($size, $size, $hGraphics) Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) #region create background circles Global $hBitmap_Back = _GDIPlus_BitmapCreateFromGraphics($size, $size, $hGraphics) Global $hContext_Back = _GDIPlus_ImageGetGraphicsContext($hBitmap_Back) _GDIPlus_GraphicsSetSmoothingMode($hContext_Back, 2) drawring($hContext_Back,$s2,$s2,$q*2,0,360,$yellowpen2) drawring($hContext_Back,$s2,$s2,$q*4,0,360,$redpen2) drawring($hContext_Back,$s2,$s2,$q*6,0,360,$greenpen2) drawring($hContext_Back,$s2,$s2,$q*8,0,360,$bluepen2) #endregion _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) _GDIPlus_GraphicsClear($hContext, 0xFF000000) _Tic() AdlibRegister("_tic", 975) GUISetOnEvent(-3, "_Exit") While Sleep(1000000) WEnd Func _Tic() $msecondAngle = $8ATan1 * round(@MSEC / 100,1) /9 * $Radtodeg $secondAngle = $8ATan1 * @SEC / 60.0 * $Radtodeg $minuteAngle = $8ATan1 * @MIN / 60.0 * $Radtodeg $hourAngle = $8ATan1 * @HOUR / 12.0 * $Radtodeg If $hourAngle > 359 Then $hourangle -= 360 _GDIPlus_GraphicsClear($hContext, 0xF0000000) _GDIPlus_GraphicsDrawImage($hContext, $hBitmap_Back, 0, 0) ;copy background image to backbuffer drawring($hContext,$s2,$s2,$q*2,-90,$msecondAngle,$yellowpen) drawring($hContext,$s2,$s2,$q*4,-90,$secondAngle,$redpen) drawring($hContext,$s2,$s2,$q*6,-90,$minuteAngle,$greenpen) drawring($hContext,$s2,$s2,$q*8,-90,$hourAngle,$bluepen) ConsoleWrite($secondAngle/2&@CRLF) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) EndFunc ;==>_Tic Func drawring($g,$x,$y,$l,$a1,$a2,$p) _GDIPlus_GraphicsDrawArc ($g, $x-$l, $y-$l, $l*2, $l*2, $a1, $a2, $p) EndFunc Func _Exit() _GDIPlus_PenDispose($redpen2) _GDIPlus_PenDispose($yellowpen2) _GDIPlus_PenDispose($Greenpen2) _GDIPlus_PenDispose($bluepen2) _GDIPlus_PenDispose($yellowpen) _GDIPlus_PenDispose($Greenpen) _GDIPlus_PenDispose($bluepen) _GDIPlus_PenDispose($Hpen) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_GraphicsDispose($hContext_Back) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hBitmap_Back) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($gui) Exit EndFunc There is no need to create 2 graphic handles. When you create a bitmap (_GDIPlus_BitmapCreateFromGraphics) you cannot draw directly to the bitmap! You have to create a context to the bitmap to draw to the bitmap. What is the difference between bitmap and image? I don't know. Br, 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...
corgano Posted March 25, 2011 Author Share Posted March 25, 2011 OH, so instead of drawing them on 2 layered graphics, you draw the back rings as another image and layer 2 images on the same graphic. That makes sense. Thanks UEZ 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e 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