Advertisement
Najeebsk

SCREENSHOT.ahk

Dec 31st, 2021
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2. ;            HOTKEYS: Windows 10
  3. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  4.  
  5. ;~ Hotkey , *^ESC , GuiClose  ; Ctrl + Esc to exit    
  6.  
  7. ;<------------------------------   Activate to use.
  8.  
  9.  
  10. Hotkey, Numpad1 , Take_ScreenShot   ;<---------------------  Take screenshot
  11.  
  12. of pre-selected area.
  13.  
  14. ;***************************************************************************
  15.  
  16. **********************************************
  17.  
  18. ;Auto-Execute Section
  19.  
  20. ;The following code executes as soon as the script is run.
  21. ;Setup of script settings and options.
  22. ;Declaration of global and other variables used throughout the script.
  23. ;Creation of the main gui.
  24. ;Creation of the folder to store saved screenshots.
  25.  
  26. ;***************************************************************************
  27.  
  28. **********************************************
  29.  
  30.     ;Set the script to exit the previous instance if it is run again
  31.  
  32. while it is already running
  33. #SingleInstance, Force
  34.  
  35.     ;Set the script to use no environment variables
  36. #NoEnv
  37.  
  38.     ;Set the script to run at top speed
  39. SetBatchLines, -1
  40.  
  41.     ;Set the coordmode used when selecting pixel positions to be related
  42.  
  43. to the screen
  44. CoordMode, Pixel , Screen
  45.  
  46.     ;Set the coordmode used when selecting cursor positions to be
  47.  
  48. related to the screen
  49. CoordMode, Mouse , Screen
  50.  
  51.     ;Start using Gdip.
  52. Gdip_Startup()
  53.  
  54. IfNotExist, %A_ScriptDir%\Screen Shots
  55.     ;If the folder to hold the saved screenshots doen't already exist.
  56.  
  57.         ;Create a folder to hold the saved screenshots.
  58.     FileCreateDir, %A_ScriptDir%\Screen Shots
  59.    
  60.     ;Set the working dir to be the folder that will hold any screenshots
  61.  
  62. taken.
  63. SetWorkingDir, %A_ScriptDir%\Screen Shots
  64.  
  65. ;Declaration of global variables used throughout the execution of the
  66.  
  67. script.
  68. ;***************************************************************************
  69.  
  70. *************************
  71. global CapActive := 0 , SP , XCAP , YCAP , WCAP , HCAP , OB := 0
  72.  
  73. global CapWin := {} , Monitors := New MonitorClass()
  74.  
  75. ;~ global TXC , TYC , BB := New_Brush( "000000" , "88" ) , GB := New_Brush(
  76.  
  77. "00ff00" , "55" ) , RB := New_Brush( "ff0000" , "55" )
  78. global TXC , TYC , BB := New_Brush( "000000" , "ff" ) , GB := New_Brush(
  79.  
  80. "00ff00" , "55" ) , RB := New_Brush( "ff0000" , "55" )
  81.  
  82. global ShowWin := {} , ImageList1 := [] , ZoomWindow := {}
  83.  
  84. global Index := 1 , Frame1 , Detached , Message
  85.  
  86. global OutColor := "3399FF"
  87. ;***************************************************************************
  88.  
  89. *************************
  90.  
  91. ;###########################################################################
  92.  
  93. ########################
  94. ;Added Jan 7th, 2020
  95. ;Check if there are any saved colors and dump them into a variable.
  96. IfNotExist, %A_ScriptDir%\Saved Colors.txt
  97.     FileAppend,3399FF`,3399FF`,3399FF`,3399FF,%A_ScriptDir%\Saved
  98.  
  99. Colors.txt
  100. FileRead, SavedColors, %A_ScriptDir%\Saved Colors.txt
  101. global SavedColors:=StrSplit(SavedColors,",")
  102. ;~ ToolTip,% SavedColors[1] "`n" SavedColors[2] "`n" SavedColors[3] "`n"
  103.  
  104. SavedColors[4]
  105. ;###########################################################################
  106.  
  107. ########################
  108.  
  109.     ;Create a instance of a layered window for the main gui
  110. global CDisplay := Layered_Window_SetUp( 4 , A_ScreenWidth - 250 , 50 , 200
  111.  
  112. , 200 , 1 , "-Caption -DPIScale +ToolWindow +AlwaysOnTop" )
  113.  
  114.     ;Add a text control to act as a trigger for moving the window
  115. Gui, 1: Add , Text , x0 y0 w200 h40 gMove_Window hwndForumTestHwnd
  116.  
  117.     ;Add a text control to act as a trigger for getting a color from the
  118.  
  119. screen
  120. Gui, 1: Add , Text , x45 y75 w110 h30 gGetColor
  121.  
  122.     ;Add a text control to act as a trigger for running the setting
  123.  
  124. menu.
  125. Gui, 1: Add , Text , x45 y103 w110 h30 gGetColor
  126.  
  127.     ;Add a text control to act as a trigger for taking a screenshot.
  128. Gui, 1: Add , Text , x45 y135 w20 h20 gCreate_Capture_Size_Window
  129.  
  130.     ;Add a text control to act as a trigger for displaying the
  131.  
  132. screenshots saved in the scripts folder.
  133. Gui, 1: Add , Text , x75 y135 w20 h20 gShowPics
  134.  
  135.  
  136.     ;Add a text control to act as a trigger for launching the 3rd
  137.  
  138. function.
  139. Gui, 1: Add , Text , x105 y135 w20 h20 gTemp1
  140.  
  141.     ;Add a text control to act as a trigger for launching the 4th
  142.  
  143. function.
  144. Gui, 1: Add , Text , x135 y135 w20 h20 gTemp2
  145.  
  146.     ;Draw the main windows background to the graphics.
  147. Gdip_DrawImage( CDisplay.G , HB_BITMAP_MAKER() , 0 , 0 , CDisplay.w ,
  148.  
  149. CDisplay.h )
  150.  
  151.     ;Draw the Get Color button to the graphics.
  152. Gdip_DrawImage( CDisplay.G , _Create_Default_Bitmap( 110 , 30 , "0xFF2D2F33"
  153.  
  154. , "0xFF000000" , "0xFF3399FF" , "Get Color" , "12 Bold" , "0" , "Segoe UI" )
  155.  
  156. , 45 , 75 , 110 , 30 )
  157.  
  158.     ;Draw the Settings button to the graphics.
  159. Gdip_DrawImage( CDisplay.G , _Create_Default_Bitmap( 110 , 30 , "0xFF2D2F33"
  160.  
  161. , "0xFF000000" , "0xFF3399FF" , "Settings" , "12 Bold" , "0" , "Segoe UI" )
  162.  
  163. , 45 , 103 , 110 , 30 )
  164.  
  165.     ;Draw the graphics to the main window and set its default size and
  166.  
  167. positioning.
  168. UpdateLayeredWindow( CDisplay.hwnd , CDisplay.hdc , CDisplay.x , CDisplay.y
  169.  
  170. , CDisplay.w , CDisplay.h )
  171.  
  172.     ;Create a new brush
  173. Brush := Gdip_BrushCreateSolid( "0xFF2D2F33" )
  174.  
  175.     ;Use the brush to cover the section of the graphics that will
  176.  
  177. contain the text displaying the color.
  178. Gdip_FillRectangle( CDisplay.G , Brush , 45 , 55 , 110 , 20 )
  179.  
  180.     ;Delete the brush.
  181. Gdip_DeleteBrush( Brush )
  182.  
  183.     ;Add text to the graphics containing the color.
  184. Gdip_TextToGraphics( CDisplay.G , OutColor := "0x3399ff" , "s12 Bold Center
  185.  
  186. vCenter cFF3399FF  x45 y50" , "Segoe UI" , 110 , 30 )
  187.  
  188.     ;Show the window hidden to set its default width and height.
  189. Gui, 1: Show , hide w200 h200 , Gadget
  190.  
  191.     ;Show the window with its tabbed size.
  192. Gui, 1: Show , % "h" 45
  193.  
  194.     ;Draw the graphics to the main window.
  195. UpdateLayeredWindow( CDisplay.hwnd , CDisplay.hdc )
  196.  
  197. ;###########################################################################
  198.  
  199. ########################
  200. ;Added Jan 7th, 2020
  201. ;Update the main window with the saved colors
  202.  
  203. Loop, 4 {
  204.     OutColor := SavedColors[A_Index]
  205.     ChangeColor(A_Index)
  206. }
  207.  
  208. ;###########################################################################
  209.  
  210. ########################
  211.  
  212.  
  213.     ;Set a timer that will keep the main window on top of all other
  214.  
  215. windows
  216. SetTimer, Always , 2000
  217.  
  218.     ;End of the Auto-Execute Section.
  219. return
  220.  
  221. ;***************************************************************************
  222.  
  223. **********************************************
  224.  
  225. ;Subroutine: GuiClose
  226.  
  227. ;Triggered by press the close button on a gui or by pressing the Hotkey
  228.  
  229. Escape
  230. ;Once called the script will exit.
  231.  
  232. ;***************************************************************************
  233.  
  234. **********************************************
  235.  
  236. GuiClose:
  237. ;~ *Esc::
  238.     ExitApp
  239.  
  240.  
  241. ;***************************************************************************
  242.  
  243. **********************************************
  244.  
  245. ;Function: Move_Window
  246.  
  247. ;Called whenever the trigger text control at the top of the main gui or the
  248.  
  249. sides of the Display Window are clicked.
  250. ;Allows the window to be moved around. Thinking about having the Display
  251.  
  252. window follow the main window if it hasn't been moved yet.
  253.  
  254. ;***************************************************************************
  255.  
  256. **********************************************
  257.  
  258. Move_Window(){
  259.    
  260.         ;Post WM_NCLBUTTONDOWN message to allow the active window to
  261.  
  262. be dragged to a new location
  263.     PostMessage, 0xA1 , 2
  264.        
  265.         ;Redraw the graphics
  266.     UpdateLayeredWindow( CDisplay.hwnd , CDisplay.hdc )
  267.    
  268. }
  269.  
  270. ;***************************************************************************
  271.  
  272. **********************************************
  273.  
  274. ;Function: Temp1
  275.  
  276. ;A placeholder function for button 3
  277.  
  278. ;***************************************************************************
  279.  
  280. **********************************************
  281.  
  282. Temp1(){
  283.    
  284.     if(GetKeyState("Shift")){
  285.         ;If Shift is being held
  286.        
  287.             ;Change the color of this button on the main gui to
  288.  
  289. the one currently in the main color display.
  290.         ChangeColor(3)
  291.            
  292.             ;Write the new list of saved colors to file.
  293.         WriteColors(3)
  294.        
  295.             ;exit this thread
  296.         return
  297.        
  298.     }
  299. }
  300.  
  301. ;***************************************************************************
  302.  
  303. **********************************************
  304.  
  305. ;Function: Temp2
  306.  
  307. ;A placeholder function for button 4
  308.  
  309. ;***************************************************************************
  310.  
  311. **********************************************
  312.  
  313. Temp2(){
  314.    
  315.     if(GetKeyState("Shift")){
  316.         ;If Shift is being held
  317.        
  318.             ;Change the color of this button on the main gui to
  319.  
  320. the one currently in the main color display.
  321.         ChangeColor(4)
  322.        
  323.             ;Write the new list of saved colors to file.
  324.         WriteColors(4)
  325.        
  326.             ;exit this thread
  327.         return
  328.        
  329.     }
  330.    
  331. }
  332.  
  333.  
  334. ;***************************************************************************
  335.  
  336. **********************************************
  337.  
  338. ;Function: Always
  339.  
  340. ;A timed function that puts the main gui on top of any other window ( even
  341.  
  342. ones that are using the AlwaysOnTop setting )
  343.  
  344. ;***************************************************************************
  345.  
  346. **********************************************
  347.  
  348. Always(){
  349.    
  350.         ;Draw the window on top of all other windows
  351.     Gui,1:Show,NA
  352.    
  353. }
  354.  
  355.  
  356. ;***************************************************************************
  357.  
  358. **********************************************
  359.  
  360. ;Function: WriteColors
  361.  
  362. ;This function is called every time one of the four saved colors is changed.
  363. ;Deletes the old file and then writes a new one with the updated saved
  364.  
  365. colors.
  366.  
  367. ;***************************************************************************
  368.  
  369. **********************************************
  370.  
  371. WriteColors(Position){
  372.     SavedColors[Position] := OutColor
  373.     FileDelete,%A_ScriptDir%\Saved Colors.txt
  374.     Loop, 4 {
  375.         FileAppend,% SavedColors[A_Index]",",%A_ScriptDir%\Saved
  376.  
  377. Colors.txt
  378.     }
  379. }
  380.  
  381.  
  382.  
  383. ;***************************************************************************
  384.  
  385. **********************************************
  386.  
  387. ;Function: GuiContextMenu
  388.  
  389. ;Triggered by right clicking the main gui.
  390. ;Toggles between showing the main window at full size or tab sized.
  391.  
  392. ;***************************************************************************
  393.  
  394. **********************************************
  395.  
  396. GuiContextMenu(){
  397.    
  398.         ;Create a static variable to maintain the value of the
  399.  
  400. toggle state
  401.     static Tog := 1
  402.    
  403.     if( Tog := !Tog )
  404.         ;test if the inverted value is true while also setting it as
  405.  
  406. the value
  407.    
  408.             ;Show the main window with the tab sized height
  409.         Gui , 1: Show , % "h" 45
  410.        
  411.        
  412.     else    {
  413.         ;if the value of the toggle is false
  414.    
  415.             ;Show the full sized main window
  416.         Gui, 1: Show , % "h" 200
  417.        
  418.     }
  419.    
  420.         ;Redraw the graphics
  421.     UpdateLayeredWindow( CDisplay.hwnd , CDisplay.hdc )
  422.    
  423. }
  424.  
  425. ;***************************************************************************
  426.  
  427. **********************************************
  428.  
  429. ;Function: ShowPics
  430.  
  431. ;Triggered by pressing the Second Square on the main gui.
  432. ;This function is a hub for a number of actions that can happen depending on
  433.  
  434. the keys that are being pressed when the button is pressed.
  435. ;Shows a timed tooltip displaying the main function of this button.
  436.  
  437. ;***************************************************************************
  438.  
  439. **********************************************
  440.  
  441. ShowPics(){
  442.    
  443.         ;Set the value for the message that contains the name of the
  444.  
  445. main operation for this button
  446.     Message := "View ScreenShots"
  447.    
  448.         ;Set a timer to show the tooltip containing the message
  449.  
  450. quickly following the mouse until the other timer turns it off.
  451.     SetTimer, TooltipFollow , 30
  452.    
  453.         ;Set a one time timer to turn off the tooltip timers
  454.     SetTimer, TooltipOff , -900
  455.    
  456.     if( GetKeyState( "Shift" ) )
  457.         ;if the key shift is being held down when the button is
  458.  
  459. pressed
  460.    
  461.             ;Call the function to change the color on the button
  462.  
  463. for this function ( Button 2 ), return and then write the new colors
  464.         return ChangeColor( 2 ) , WriteColors( 2 ) 
  465.        
  466.     else if( GetKeyState( "ctrl" ) )
  467.         ;If Control is being held when the button is pressed.
  468.    
  469.             ;No action currently assigned for this key... yet.
  470.         return
  471.        
  472.         ;Get the x and y positions of the main gui to be used for
  473.  
  474. the positioning of the Display Window.
  475.     WingetPos, tx , ty ,,, % "ahk_ID " CDisplay.Hwnd
  476.    
  477.         ;Call the function to create the Display Window, passing it
  478.  
  479. the x and y coords.
  480.     Create_Display_Window( tx , ty + 190 )
  481.    
  482. }
  483.  
  484. ;***************************************************************************
  485.  
  486. **********************************************
  487.  
  488. ;Function: TooltipFollow
  489.  
  490. ;A timed function that displays a tooltip at the current cursor location
  491.  
  492. rapidly.
  493. ;This timer is terminated by another timer.
  494.  
  495. ;***************************************************************************
  496.  
  497. **********************************************
  498.  
  499. TooltipFollow(){
  500.    
  501.         ;Set the owner of the tooltip to the main gui so that the
  502.  
  503. tooltip will always show above all windows.
  504.     Gui, 1: +OwnDialogs
  505.    
  506.         ;Display the tooltip containing the message.
  507.     Tooltip, % Message
  508.    
  509. }
  510.  
  511. ;***************************************************************************
  512.  
  513. **********************************************
  514.  
  515. ;Function: TooltipOff
  516.  
  517. ;A timed function that displays a tooltip at the current cursor location
  518.  
  519. rapidly.
  520. ;This timer is terminated by another timer.
  521.  
  522. ;***************************************************************************
  523.  
  524. **********************************************
  525.  
  526. TooltipOff(){
  527.    
  528.         ;Turn off the timer for the message tooltip.
  529.     SetTimer, TooltipFollow , Off
  530.    
  531.         ;Turn off any active tooltips
  532.     ToolTip,
  533.    
  534. }
  535.  
  536. ;***************************************************************************
  537.  
  538. **********************************************
  539.  
  540. ;Function: Create_Display_Window
  541.  
  542. ;Create a small window that displays the screenshots taken with this device.
  543.  
  544. ;***************************************************************************
  545.  
  546. **********************************************
  547.  
  548. Create_Display_Window( tx := "" , ty := "" ){
  549.    
  550.         ;Select the object
  551.     SelectObject( ShowWin.hdc , ShowWin.obm )
  552.    
  553.         ;Delete the object
  554.     DeleteObject( ShowWin.hbm )
  555.    
  556.         ;Delete the device context
  557.     DeleteDC( ShowWin.hdc )
  558.    
  559.         ;Delete the graphics
  560.     Gdip_deleteGraphics( ShowWin.G )
  561.    
  562.         ;Destroy the Display Window if it already exists. I could
  563.  
  564. just use the "New" option, but destroying the window is more fun.
  565.     Gui,5:Destroy
  566.    
  567.         ;Create a new layered window.
  568.     ShowWin := Layered_Window_SetUp( 3 , 0 , 0 , 970 , 220 , "5" ,
  569.  
  570. "+AlwaysOnTop -DPIScale -Caption +Owner1" )
  571.    
  572.         ;Draw the graphics to the Display Window and set its default
  573.  
  574. size and positioning.
  575.     UpdateLayeredWindow( ShowWin.hwnd , ShowWin.hdc , ShowWin.x ,
  576.  
  577. ShowWin.y , ShowWin.w , ShowWin.h )
  578.    
  579.         ;Draw the background onto the graphics.
  580.     Gdip_DrawImage(ShowWin.G, DW := DisplayWindow(), 0, 0, ShowWin.w,
  581.  
  582. ShowWin.h)
  583.    
  584.         ;Delete the Background bitmap.
  585.     Gdip_DisposeImage(DW)
  586.    
  587.         ;Add a text control to act as a trigger for moving this
  588.  
  589. window.
  590.     Gui,5:Add,Text,x0 y0 w43 h220 gMove_Window
  591.    
  592.         ;Add a text control to act as a trigger for moving this
  593.  
  594. window.
  595.     Gui,5:Add,Text,x927 y0 w43 h220 gMove_Window
  596.    
  597.         ;Add a text control to act as a trigger for closing this
  598.  
  599. window.
  600.     Gui,5:Add,Text,x904 y40 w20 h110 g5GuiClose
  601.    
  602.         ;Add a text control to act as a trigger for moving forward
  603.  
  604. in the image list.
  605.     Gui,5:Add,Text,x691 y176 w112 h19 gMoveForward
  606.    
  607.         ;Add a text control to act as a trigger for moving Backward
  608.  
  609. in the image list.
  610.     Gui,5:Add,Text,x181 y176 w112 h19 gMoveBackward
  611.    
  612.         ;Add a text control to act as a trigger for refreshing the
  613.  
  614. image list and updating the Dispaly Window.
  615.     Gui,5:Add,Text,x47 y42 w16 h106 gRefresh
  616.    
  617.         ;Add a text control to act as a trigger for the center frame
  618.  
  619. of the Display Window.
  620.     Gui,5:Add,Text,x411 y21 w150 h150 hwndFrame1 gGetInfo1
  621.    
  622.         ;Add a text control to act as a trigger for moving Backward
  623.  
  624. in the image list. (this may change, currently attached to one of the
  625.  
  626. frames)
  627.     Gui,5:Add,Text,x241 y21 w150 h150 hwndFrame2 gMoveBackward
  628.    
  629.         ;Add a text control to act as a trigger for moving Backward
  630.  
  631. in the image list. (this may change, currently attached to one of the
  632.  
  633. frames)
  634.     Gui,5:Add,Text,x71 y21 w150 h150 hwndFrame3 gMoveBackward
  635.    
  636.         ;Add a text control to act as a trigger for moving Forward
  637.  
  638. in the image list. (this may change, currently attached to one of the
  639.  
  640. frames)
  641.     Gui,5:Add,Text,x581 y21 w150 h150 hwndFrame4 gMoveforward
  642.    
  643.         ;Add a text control to act as a trigger for moving Forward
  644.  
  645. in the image list. (this may change, currently attached to one of the
  646.  
  647. frames)
  648.     Gui,5:Add,Text,x751 y21 w150 h150 hwndFrame5 gMoveforward
  649.    
  650.         ;Get the size of the monitor that the cursor is currently
  651.  
  652. in.
  653.         ;This is used in position the Display Window when it is
  654.  
  655. first created.
  656.         ;Purpose is to have the Dispaly Window line up with the left
  657.  
  658. edge of the main gui when possible or line up with the right side of the
  659.  
  660. monitor when not.
  661.     temp:=Monitors.Get_New_Window_Position(Monitors.Get_Current_Monitor
  662.  
  663. (),0,0,2,2)
  664.    
  665.         ;Get the current position of the main gui
  666.     WinGetPos , tX, tY,,, % "ahk_ID " CDisplay.hwnd
  667.    
  668.         ;Calculate if the Dispaly Window can be popped up at the
  669.  
  670. same x position as the main gui, or if it needs to line up along the right
  671.  
  672. side of the monitor
  673.     (tx+970>temp.x)?(ntx := temp.x - 970 ):(ntx := tx)
  674.    
  675.         ;Calculate if the Display Window can sit below the main gui,
  676.  
  677. or if it needs to be placed above it.
  678.     (ty+200+220+10 > temp.y)?(nty := (ty - 220) -10 ):(nty := ty + 200 +
  679.  
  680. 10)
  681.    
  682.         ;Show the Dispaly Window at the calculated position
  683.     Gui, 5: Show , % "x" ntx " y" nty " w970 h220 NA"
  684.    
  685.         ;Draw the graphics onto the Dispaly Window
  686.     UpdateLayeredWindow( ShowWin.hwnd , ShowWin.hdc )
  687.    
  688.         ;Create a new List of all the images in the target folder
  689.     ImageList1 := "" , ImageList1 := Get_File_List()
  690.    
  691.         ;Draw a group of the images from the list to the Display
  692.  
  693. Window Frames. (Based around the current value of "Index")
  694.     UpdateWheel( Index , ImageList1 )
  695.    
  696.         ;Start a timer to watch for the cursor moving over the
  697.  
  698. center frame. This will cause a small window to pop up above the Display
  699.  
  700. Window containing the Indexed Image
  701.     SetTimer, ImageZoom , 300
  702.    
  703. }
  704.  
  705. ;***************************************************************************
  706.  
  707. **********************************************
  708.  
  709. ;Function: UpdateWheel
  710.  
  711. ;Update the Display Window with the images found in the screenshot folder
  712.  
  713. ;***************************************************************************
  714.  
  715. **********************************************
  716.  
  717. UpdateWheel( Index , ImageList1 ){
  718.    
  719.     if( !ImageList1 )
  720.         ;If there are no images in the folder
  721.        
  722.             ;exit the function
  723.         Return
  724.    
  725.         ;Set an array with the positions for images to be placed.
  726.     Positions := [ { x : 411 , y: 21 } , { x : 241 , y: 21 } , { x : 71
  727.  
  728. , y: 21 } , { x : 581 , y: 21 } , { x : 751 , y: 21 } ]
  729.    
  730.         ;Create some variable / arrays to help in determining which
  731.  
  732. image needs to get placed and what size it should be.
  733.     Images := [] , PB := [] , caseit := [ 0 , -1 , -2 , +1 , +2 ] , Set
  734.  
  735. := [ 150 , 70 , 70 , 70 , 70 ]
  736.    
  737.     Loop, 5     {
  738.         ;Loop once for every frame in the Display Window.
  739.    
  740.             ;Create a new brush, use it to redraw over each
  741.  
  742. frame to remove any previous images, then delete the brush.
  743.         Brush := Gdip_BrushCreateSolid( "0xFF000000" ) ,
  744.  
  745. Gdip_FillRectangle( ShowWin.G , Brush , Positions[A_Index].X , Positions
  746.  
  747. [A_Index].Y , 150 , 150 ) , Gdip_DeleteBrush( Brush )
  748.        
  749.             ;Create bitmaps of the images that need to be
  750.  
  751. dispalyed.
  752.         PB[ A_Index ] := Gdip_CreateBitmapFromFile( ImageList1[Index
  753.  
  754. + caseit[ A_Index ] ] )
  755.            
  756.             ;Resize each of the bitmaps to fit within the
  757.  
  758. allotted space while maintaining the same aspect ratio
  759.         Centering := ResizeIt( PB[ A_Index ] , Width , Height , Set[
  760.  
  761. A_Index ] )
  762.        
  763.             ;Check if there is a bitmap for the current index,
  764.  
  765. and if there is, Draw it to the graphics
  766.         ( PB[ A_Index ] ) ? ( Gdip_DrawImage( ShowWin.G , PB[
  767.  
  768. A_Index ] , Positions[ A_Index ].X  , Positions[ A_Index ].Y  , Width ,
  769.  
  770. Height ) )
  771.        
  772.             ;Delete the bitmaps to free up the memory
  773.         Gdip_DisposeImage( PB[ A_Index ] )
  774.        
  775.     }
  776.        
  777.         ;Create a new brush, paint over the area that contains the
  778.  
  779. "Index" text, then delete the brush.
  780.     Brush := Gdip_BrushCreateSolid( "0xff333333" ),Gdip_FillRectangle(
  781.  
  782. ShowWin.G , Brush , 810 , 174 , 80 , 20 ),Gdip_DeleteBrush( Brush )
  783.    
  784.         ;Create a new brush, paint the "Index" number, then delete
  785.  
  786. the brush (Bottom layer of the text).
  787.     Brush := Gdip_BrushCreateSolid( "0xff000000" ),Gdip_TextToGraphics(
  788.  
  789. ShowWin.G , Index , "s18 Center vCenter Bold c" Brush " x800 y175" , "Segoe
  790.  
  791. UI" , 100 , 20 ),Gdip_DeleteBrush( Brush ) 
  792.        
  793.         ;Create a new brush, paint the "Index" number, then delete
  794.  
  795. the brush (Top layer of the text).
  796.         Brush := Gdip_BrushCreateSolid( "0xff3399FF"
  797.  
  798. ),Gdip_TextToGraphics( ShowWin.G , Index , "s18 Center vCenter Bold c" Brush
  799.  
  800. " x801 y176" , "Segoe UI" , 100 , 20 ),Gdip_DeleteBrush( Brush )   
  801.    
  802.         ;Draw the graphics to the Display Window.
  803.     UpdateLayeredWindow( ShowWin.hwnd , ShowWin.hdc )
  804.    
  805. }
  806.  
  807.  
  808. ;***************************************************************************
  809.  
  810. **********************************************
  811.  
  812. ;Function: ImageZoom
  813.  
  814. ;A timed routine that checks if the cursor is over the center image display
  815.  
  816. frame in the Display Window ("ShowWin")
  817. ;If it is, create a small window with a larger example of the center image
  818.  
  819. ("Index")
  820.  
  821. ;***************************************************************************
  822.  
  823. **********************************************
  824.  
  825. ImageZoom(){
  826.    
  827.         ;create a static control variable to help with flow of
  828.  
  829. control
  830.     static ActiveFrame
  831.    
  832.         ;get the hwnd of the control under the cursor
  833.     MouseGetPos,,,, ctrl, 2
  834.    
  835.     if( !ActiveFrame && ctrl = Frame1 ) {
  836.         ;if the image display is not already active and if the
  837.  
  838. control under the cursor is the center frame panel
  839.         ;create a display window containing the image from the
  840.  
  841. center frame ("Index")
  842.    
  843.             ;create a bitmap of the image (.png) saved in the
  844.  
  845. folder
  846.         pBit := Gdip_CreateBitmapFromFile( ImageList1[ Index ] )
  847.    
  848.             ;resize and scale the image to its new size
  849.         ResizeIt( pBit, Width, Height, 400 )
  850.        
  851.             ;Create a new floating window directly above the
  852.  
  853. center frame containing the selected image
  854.         CreateZoomWindow( pBit, Width, Height )
  855.        
  856.             ;Once drawn to the graphics, the bitmap can get
  857.  
  858. deleted.
  859.         Gdip_DisposeImage(pBit)
  860.        
  861.             ;Set control variable to 1 so this part gets skipped
  862.  
  863. until the control under the cursor is no longer the correct one.
  864.         ActiveFrame := 1
  865.        
  866.     }else if( ActiveFrame && ctrl != Frame1 ){
  867.         ;if the image display is already active and if the control
  868.  
  869. under the cursor is not the center frame panel
  870.         ;Destroy the zoom window and swap the value of the control
  871.  
  872. variable
  873.        
  874.             ;Destroy the Zoom Window
  875.         Gui,6:Destroy
  876.        
  877.             ;Set the control variable back to 0 so that the
  878.  
  879. routine can begin waiting for the cursor can be back over the center frame
  880.  
  881. again
  882.         ActiveFrame := 0
  883.     }
  884. }
  885.  
  886. ;***************************************************************************
  887.  
  888. **********************************************
  889. ;Function: CreateZoomWindow
  890.  
  891. ; Create a window containing the selected image and display it directly
  892.  
  893. above the certer frame of the Display Window ("ShowWin")
  894. ; Takes: pointer to the selected Bitmap, and the resized Width and Height.
  895. ;***************************************************************************
  896.  
  897. **********************************************
  898.  
  899. CreateZoomWindow( pBit, Width, Height ){
  900.        
  901.         ;if this window already exists, destory it ( destroying
  902.  
  903. things is fun! ).
  904.     Gui, 6: Destroy
  905.    
  906.         ;Select the object
  907.     SelectObject( ZoomWindow.hdc,ZoomWindow.obm)
  908.    
  909.         ;Delete the object
  910.     DeleteObject(ZoomWindow.hbm)
  911.    
  912.         ;Delete the device context
  913.     DeleteDC(ZoomWindow.hdc)
  914.    
  915.         ;Delete the graphics
  916.     Gdip_deleteGraphics(ZoomWindow.G)
  917.    
  918.         ;Create a new Layered window to display the image on
  919.     ZoomWindow := Layered_Window_SetUp( 2 , 0 , 0 , Width , Height , "6"
  920.  
  921. , "+AlwaysOnTop -DPIScale -Caption +Owner5" )
  922.    
  923.         ;Create a brush for the background of the Layered Window
  924.     Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , Width , Height ,
  925.  
  926. "0xFF777777" , "0xFF000000" , 1 , 1 )
  927.    
  928.         ;Paint the background of the window
  929.     Gdip_FillRectangle( ZoomWindow.G , Brush , 0 , 0 , Width , Height )
  930.    
  931.         ;Delete the brush to free up the memory
  932.     Gdip_DeleteBrush( Brush )  
  933.    
  934.         ;Draw the bitmap of the selected image to onto the Graphics
  935.  
  936. for the Layered Window
  937.     Gdip_DrawImage(ZoomWindow.G, pBit, 1, 1, ZoomWindow.w-2,
  938.  
  939. ZoomWindow.h-2)
  940.     ;~ Gdip_DisposeImage(pBit)
  941.    
  942.         ;Update (Redraw) the Layered Window with the newly changed
  943.  
  944. Graphics
  945.     UpdateLayeredWindow(ZoomWindow.hwnd, ZoomWindow.hdc, ZoomWindow.x,
  946.  
  947. ZoomWindow.y, ZoomWindow.w, ZoomWindow.h)
  948.    
  949.         ;Get the position of the Dispaly Window
  950.     WinGetPos,tx,ty,,,% "ahk_ID " ShowWin.Hwnd
  951.    
  952.         ;Display the ZoomWindow offset from the Display Window
  953.     Gui,6:Show,% "x" ( tx + 411 + 75 - Width // 2 ) " y" ( ty + 21 -
  954.  
  955. height - 20 ) " w" Width " h" Height " NA"
  956.    
  957. }
  958.  
  959. ;***************************************************************************
  960.  
  961. **********************************************
  962. ;Function: ResizeIt
  963.  
  964. ; Get the dimensions from a bitmap and then resize it so that the scale is
  965.  
  966. maintained but the size is adjusted to fit in a defined space
  967. ; Takes: Pointer to a bitmap, defined Width and Height variable, The size of
  968.  
  969. the defined area.
  970. ;***************************************************************************
  971.  
  972. **********************************************
  973.  
  974. ResizeIt( PB , ByRef tWidth , ByRef tHeight , InputValue ){
  975.    
  976.         ;Get the Width and Height of the bitmap.
  977.     Gdip_GetDimensions( PB , tWidth , tHeight )
  978.    
  979.     if( tWidth > InputValue && tWidth >= tHeight )
  980.         ;If the width is greater than the defined area and the width
  981.  
  982. is greater than or equal to the height
  983.        
  984.             ;Set the scale ratio to be the height divided by the
  985.  
  986. width, set the width to be the max size, set the height to be the scaled
  987.  
  988. value.
  989.         Ratio := tHeight / tWidth , tWidth := InputValue , tHeight
  990.  
  991. := InputValue * Ratio
  992.        
  993.        
  994.     else if( tHeight > InputValue && tHeight >= tWidth )
  995.         ;If the height is greater than the defined area and the
  996.  
  997. height is greater than or equal to the width
  998.    
  999.             ;Set the scale ratio to be the width divided by the
  1000.  
  1001. height, set the height to be the max size, set the width to be the scaled
  1002.  
  1003. value.
  1004.         Ratio := tWidth / tHeight , tHeight := InputValue , tWidth
  1005.  
  1006. := InputValue * Ratio
  1007.        
  1008.        
  1009.     else if( tWidth > InputValue && tWidth <= tHeight )
  1010.         ;If the width is greater than the defined area and the
  1011.  
  1012. Height is greater than or equal to the Width
  1013.    
  1014.             ;Set the scale ratio to be the width divided by the
  1015.  
  1016. height, set the height to be the max size, set the width to be the scaled
  1017.  
  1018. value.
  1019.         Ratio := tWidth / tHeight , tHeight := InputValue , tWidth
  1020.  
  1021. := InputValue * Ratio
  1022.        
  1023. }
  1024.  
  1025. ;***************************************************************************
  1026.  
  1027. **********************************************
  1028. ;Function: Refresh
  1029.  
  1030. ; Creates a new list of the images in the target folder and then displays
  1031.  
  1032. the newly updated list in the display window.
  1033. ;***************************************************************************
  1034.  
  1035. **********************************************
  1036.  
  1037. Refresh(){
  1038.    
  1039.         ;Create a list of all the full paths of images in a folder
  1040.     ImageList1 := "" , ImageList1 := Get_File_List()
  1041.        
  1042.         ;Draw the images on to the display window with the selected
  1043.  
  1044. image in the center frame
  1045.     UpdateWheel( Index , ImageList1 )
  1046.    
  1047. }
  1048.  
  1049. ;***************************************************************************
  1050.  
  1051. **********************************************
  1052. ;Function: GetInfo1
  1053.  
  1054. ; This is a hub for a number of actions that are connected to the center
  1055.  
  1056. frame of the Display Window.
  1057. ; Depending on the keys being pressed, different actions will occur.
  1058.  
  1059. ;***************************************************************************
  1060.  
  1061. **********************************************
  1062.  
  1063. GetInfo1(){
  1064.    
  1065.     if( GetKeyState( "ctrl" ) && GetKeyState( "Shift" ) )
  1066.         ;If both the shift and control keys are being pressed when
  1067.  
  1068. the frame is clicked
  1069.    
  1070.             ;Remove the image from the Display Window and delete
  1071.  
  1072. the image file in the target folder.
  1073.         RemoveImage( Index )
  1074.        
  1075.     else if( GetKeyState( "Shift" ) )
  1076.         ;If only the shift key is being pressed when the center
  1077.  
  1078. frame is click
  1079.    
  1080.         Try
  1081.             ;Try to do a action, if it fails, do so silently
  1082.        
  1083.                 ;Run the center image in windows image
  1084.  
  1085. viewer
  1086.             Run, % ImageList1[ Index ]
  1087.            
  1088.     else
  1089.         ;If no keys are being pressed.
  1090.    
  1091.             ;Put the full path of the image into the clipboard.
  1092.         Clipboard := ImageList1[ Index ]
  1093.        
  1094. }
  1095.  
  1096. ;***************************************************************************
  1097.  
  1098. **********************************************
  1099. ;Function: RemoveImage
  1100.  
  1101. ;Delete the selected image file from the screenshot folder and then refresh
  1102.  
  1103. the Dispaly Window and update the image list.
  1104. ;Takes: The current index for the image in the center frame of the Display
  1105.  
  1106. Window
  1107.  
  1108. ;***************************************************************************
  1109.  
  1110. **********************************************
  1111.  
  1112. RemoveImage( inVal ){
  1113.    
  1114.         ;Delete the selected file
  1115.     FileDelete, % ImageList1[ inVal ]
  1116.    
  1117.         ;Refresh the Display Window
  1118.     Refresh()
  1119.    
  1120. }
  1121.  
  1122. ;***************************************************************************
  1123.  
  1124. **********************************************
  1125.  
  1126. ;Subroutine: MoveForward
  1127.  
  1128. ;Triggered by pressing either the forward arrow button or by clicking on one
  1129.  
  1130. of the frames to the right of the center frame in the Display Window
  1131.  
  1132. ;***************************************************************************
  1133.  
  1134. **********************************************
  1135.  
  1136. MoveForward:
  1137.  
  1138.     if( GetKeyState( "Shift" ) ){
  1139.         ;If shift is being held when the button/buttons are pressed.
  1140.        
  1141.             ;Check to see if the length of the image list is
  1142.  
  1143. greater than the current index + 10, if it is, move forward 10, else set the
  1144.  
  1145. index to the last position.
  1146.         ( Index + 10 > ImageList1.Length() ) ? ( Index :=
  1147.  
  1148. ImageList1.Length() ) : ( Index += 10 )
  1149.        
  1150.             ;Draw the newly selected batch of 5 images to the
  1151.  
  1152. Display Window.
  1153.         UpdateWheel( Index , ImageList1 )
  1154.        
  1155.             ;Exit thread
  1156.         return
  1157.        
  1158.     }
  1159.    
  1160.     if( Index >= ImageList1.Length() )
  1161.         ;If the current value of "Index" is already at the end of
  1162.  
  1163. the list.
  1164.    
  1165.             ;Exit thread
  1166.         return
  1167.        
  1168.         ;Add one to the value of "Index" and then draw the newly
  1169.  
  1170. selected batch of 5 images to the Display Window.
  1171.     UpdateWheel( Index += 1 , ImageList1 )
  1172.    
  1173.    
  1174.     return
  1175.    
  1176. ;***************************************************************************
  1177.  
  1178. **********************************************
  1179.  
  1180. ;Subroutine: MoveBackward
  1181.  
  1182. ;Triggered by pressing either the back arrow button or by clicking on one of
  1183.  
  1184. the frames to the left of the center frame in the Display Window
  1185.  
  1186. ;***************************************************************************
  1187.  
  1188. **********************************************
  1189.    
  1190. MoveBackward:
  1191.     if( GetKeyState( "Shift" ) ){
  1192.         ;If shift is being held when the button/buttons are pressed.
  1193.        
  1194.             ;Check to see if subtracting 10 from the current
  1195.  
  1196. value of "Index" will be less than 1, if it is, set "Index" to 1, else set
  1197.  
  1198. it to the current value - 10.
  1199.         ( Index - 10 < 1 ) ? ( Index := 1 ) : ( Index -= 10 )
  1200.        
  1201.             ;Draw the newly selected batch of 5 images to the
  1202.  
  1203. Display Window.
  1204.         UpdateWheel( Index , ImageList1 )
  1205.        
  1206.             ;Exit thread
  1207.         return
  1208.        
  1209.     }
  1210.    
  1211.     if( Index - 1 <= 0 )
  1212.         ;If the value of "Index" is already at 1 or less
  1213.    
  1214.             ;Exit thread
  1215.         return
  1216.        
  1217.         ;Subtract one from the value of "Index" and then draw the
  1218.  
  1219. newly selected batch of 5 images to the Display Window.
  1220.     UpdateWheel( Index -= 1 , ImageList1 )
  1221.    
  1222.     return
  1223.    
  1224. ;***************************************************************************
  1225.  
  1226. **********************************************
  1227. ;Function: Get_File_List
  1228.  
  1229. ;Creates a list containing the full path to all .pngs in the screenshot
  1230.  
  1231. folder
  1232.  
  1233. ;***************************************************************************
  1234.  
  1235. ********************************************** 
  1236.  
  1237. Get_File_List(){
  1238.        
  1239.         ;Create a array to hold the file paths, set the loop index
  1240.  
  1241. to 0
  1242.     Full_Path := [] , Index2 := 0
  1243.        
  1244.     Loop, %A_ScriptDir%\Screen Shots\*.png
  1245.         ;Loop through the contents of the screenshot folder and sort
  1246.  
  1247. for the ones with a .png extention.
  1248.    
  1249.             ;Add the full path for each found file with the .png
  1250.  
  1251. extention to the array.
  1252.         Full_Path[ ++Index2 ] := A_LoopFileFullPath
  1253.        
  1254.         ;return the array to the caller.
  1255.     return Full_Path
  1256.    
  1257. }
  1258.  
  1259. ;***************************************************************************
  1260.  
  1261. **********************************************
  1262.  
  1263. ;Subroutine/s: 5GuiClose - 5GuiContextMenu
  1264.  
  1265. ;Triggered by press the close button on the Display Window or by right
  1266.  
  1267. clicking the window
  1268. ;Once called the Display Window will be closed and related timers are turned
  1269.  
  1270. off.
  1271.  
  1272. ;***************************************************************************
  1273.  
  1274. **********************************************
  1275.  
  1276. 5GuiClose:
  1277. 5GuiContextMenu:
  1278.  
  1279.         ;Select the object
  1280.     SelectObject( ShowWin.hdc,ShowWin.obm)
  1281.    
  1282.         ;Delete the object
  1283.     DeleteObject(ShowWin.hbm)
  1284.    
  1285.         ;Delete the device context
  1286.     DeleteDC(ShowWin.hdc)
  1287.    
  1288.         ;Delete the graphics
  1289.     Gdip_deleteGraphics(ShowWin.G)
  1290.    
  1291.         ;Destroy the Display Window
  1292.     Gui, 5: Destroy
  1293.    
  1294.     return
  1295.  
  1296. ;***************************************************************************
  1297.  
  1298. **********************************************
  1299. ;Function: Create_Capture_Size_Window
  1300.  
  1301. ;Create a layered window that will be used to draw the cross lines for
  1302.  
  1303. setting the capture area for the screenshot.  
  1304.  
  1305. ;***************************************************************************
  1306.  
  1307. ********************************************** 
  1308.  
  1309. Create_Capture_Size_Window(){
  1310.    
  1311.         ;Create a static variable that is used to check if this is
  1312.  
  1313. the first time this function is being called. Default = null / 0 / ""
  1314.     static ft
  1315.    
  1316.         ;Set the main gui as the owner of the any tooltips so that
  1317.  
  1318. they stay on top of all other windows
  1319.     Gui, 1: +OwnDialogs
  1320.    
  1321.         ;Display a tooltip containing a message about what this
  1322.  
  1323. button does ( its main function ).
  1324.     Tooltip, % Message := "Take ScreenShot"
  1325.    
  1326.         ;Start a timer that once expired will turn off the other
  1327.  
  1328. timer
  1329.     SetTimer, TooltipOff , -1800
  1330.    
  1331.         ;Start a timer that will repeatedly display the message
  1332.  
  1333. under the cursor
  1334.     SetTimer, TooltipFollow , 30
  1335.    
  1336.     if( GetKeyState( "Shift" ) ){
  1337.         ;if the Shift key is being held when the button is pressed.
  1338.        
  1339.             ;Change the color of this button on the main gui to
  1340.  
  1341. the one currently in the main color display.
  1342.         ChangeColor( 1 )
  1343.        
  1344.             ;Write the new list of saved colors to file.
  1345.         WriteColors( 1 )   
  1346.        
  1347.             ;Exit thread
  1348.         return
  1349.        
  1350.     }
  1351.    
  1352.         ;If this window already exists, destroy it.
  1353.     Gui, 2: Destroy
  1354.    
  1355.         ;Create a new Layered window to display the capture area
  1356.  
  1357. lines
  1358.     CapWin := Layered_Window_SetUp( 3 , 0 , 0 , A_ScreenWidth ,
  1359.  
  1360. A_ScreenHeight , "2" , "+AlwaysOnTop -DPIScale -Caption +Owner1" )
  1361.    
  1362.     if( !ft )
  1363.         ;If this is the first time running this function
  1364.        
  1365.             ;Set the static variable to 1 so that this only
  1366.  
  1367. happens the first time this function is called.
  1368.             ;Create a timer that moves the drawing area to cover
  1369.  
  1370. the current monitor.
  1371.         Monitors.Set_Window_Move_Timer( GUINAME := 2 , GUIHWND :=
  1372.  
  1373. CapWin.hwnd , TCount := 300 , xpOff := 0 , ypOff := 0 , xr := 1 , yr := 1 ,
  1374.  
  1375. Fill_Screen := 1 ) , ft := 1
  1376.    
  1377.     else
  1378.         ;If this isn't the first time.
  1379.            
  1380.             ;Turn on the timer for moving the drawing area to
  1381.  
  1382. cover the current monitor
  1383.         Monitors.Window_Move_Obj.GUIHWND := CapWin.hwnd ,
  1384.  
  1385. Monitors.Turn_On_Window_Move_Timer()
  1386.    
  1387.         ;Show the window
  1388.     Gui, 2: Show
  1389.    
  1390.         ;Set the control variables used in the flow of the drawing
  1391.  
  1392. function.
  1393.     CapActive := 1 , SP := 0 , OB := 0
  1394.    
  1395.         ;Set a timer to be used for drawing the lines of the capture
  1396.  
  1397. area.
  1398.     SetTimer, Set_Positions , 10
  1399.    
  1400. }
  1401.  
  1402. ;***************************************************************************
  1403.  
  1404. **********************************************
  1405. ;Function: ChangeColor
  1406.  
  1407. ;Changes the color of one of the 4 colored buttons on the main gui  
  1408. ;Takes: The position of the button being changed
  1409.  
  1410. ;***************************************************************************
  1411.  
  1412. ********************************************** 
  1413.  
  1414. ChangeColor( Value ){
  1415.    
  1416.         ;Create a local array with the x position of the colored
  1417.  
  1418. buttons.
  1419.     local tempArr := [ 48 , 78 , 108 , 138 ]
  1420.    
  1421.         ;Create a brush, and then paint the button with the color in
  1422.  
  1423. the main color display, then delete the brush.
  1424.     Brush := Gdip_BrushCreateSolid( "0xFF" SubStr( OutColor , 3 ) ) ,
  1425.  
  1426. Gdip_FillRectangle( CDisplay.G , Brush , tempArr[ Value ] , 139 , 14 , 12 )
  1427.  
  1428. , Gdip_DeleteBrush( Brush )
  1429.    
  1430.         ;Create a line brush ( gradient brush ).
  1431.     Brush := Gdip_CreateLineBrushFromRect( tempArr[ Value ] , 139 , 14 ,
  1432.  
  1433. 12 , "0xFF000000" , "0xFF777777" , 1 , 1 )
  1434.    
  1435.         ;Create a pen from the brush.
  1436.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1437.    
  1438.         ;Delete the brush.
  1439.     Gdip_DeleteBrush( Brush )
  1440.    
  1441.         ;Use the pen to draw a border around the new color.
  1442.     Gdip_DrawRectangle( CDisplay.G , Pen , tempArr[ Value ] , 139 , 14 ,
  1443.  
  1444. 12 )
  1445.    
  1446.         ;Delete the pen.
  1447.     Gdip_DeletePen( Pen )
  1448.    
  1449.         ;Draw the graphics to the window.
  1450.     UpdateLayeredWindow( CDisplay.hwnd , CDisplay.hdc )
  1451.    
  1452. }
  1453.  
  1454. ;***************************************************************************
  1455.  
  1456. **********************************************
  1457. ;Function: Set_Positions
  1458.  
  1459. ;A timed function that draws lines onto the screen.
  1460. ;Used for setting the capture area of a screenshot.
  1461.  
  1462. ;***************************************************************************
  1463.  
  1464. ********************************************** 
  1465.  
  1466. Set_Positions(){
  1467.    
  1468.         ;Set the coordmode used for tarcking the mouse position to
  1469.  
  1470. be relative to the active window.
  1471.     Coordmode, Mouse , Window
  1472.    
  1473.         ;Activate the capture window.
  1474.     WinActivate,% "ahk_ID " CapWin.Hwnd
  1475.    
  1476.         ;Clear the graphics so that they can be redrawn in their new
  1477.  
  1478. positions.
  1479.     Gdip_GraphicsClear(CapWin.g)
  1480.    
  1481.         ;Get the current cursor position.
  1482.     MouseGetPos, tx , ty
  1483.    
  1484.     if(SP=0){
  1485.         ;If setting the first position of the capture area.
  1486.        
  1487.             ;Draw a line from the top of the current monitor to
  1488.  
  1489. the bottom of the current monitor.
  1490.         Fill_Box(CapWin.G,BB,tx,0,1,Monitors.Monitor
  1491.  
  1492. [Monitors.Window_Move_Obj.Current_Monitor].Bottom-Monitors.Monitor
  1493.  
  1494. [Monitors.Window_Move_Obj.Current_Monitor].Top)
  1495.        
  1496.             ;Draw a line from the Left side of the current
  1497.  
  1498. monitor to the Right side of the current monitor.
  1499.         Fill_Box(CapWin.G,BB,0,ty,Monitors.Monitor
  1500.  
  1501. [Monitors.Window_Move_Obj.Current_Monitor].Right-Monitors.Monitor
  1502.  
  1503. [Monitors.Window_Move_Obj.Current_Monitor].Left,1)
  1504.        
  1505.             ;Store the x and y positions into new variables
  1506.         TXC:=tx,TYC:=ty
  1507.        
  1508.     }else if(SP=1){
  1509.         ;If the first position has already been set.
  1510.    
  1511.             ;Draw the first line (starting position) for the x
  1512.  
  1513. axis
  1514.         Fill_Box(CapWin.G,BB,TXC,0,1,Monitors.Monitor
  1515.  
  1516. [Monitors.Window_Move_Obj.Current_Monitor].Bottom-Monitors.Monitor
  1517.  
  1518. [Monitors.Window_Move_Obj.Current_Monitor].Top)
  1519.        
  1520.             ;Draw the first line (starting position) for the y
  1521.  
  1522. axis
  1523.         Fill_Box(CapWin.G,BB,0,TYC,Monitors.Monitor
  1524.  
  1525. [Monitors.Window_Move_Obj.Current_Monitor].Right-Monitors.Monitor
  1526.  
  1527. [Monitors.Window_Move_Obj.Current_Monitor].Left,1)
  1528.        
  1529.             ;Draw a line at the current y position for the end
  1530.  
  1531. point of the x axis
  1532.         Fill_Box(CapWin.G,BB,tx,0,1,Monitors.Monitor
  1533.  
  1534. [Monitors.Window_Move_Obj.Current_Monitor].Bottom-Monitors.Monitor
  1535.  
  1536. [Monitors.Window_Move_Obj.Current_Monitor].Top)
  1537.        
  1538.             ;Draw a line at the current x position for the end
  1539.  
  1540. point of the y axis
  1541.         Fill_Box(CapWin.G,BB,0,ty,Monitors.Monitor
  1542.  
  1543. [Monitors.Window_Move_Obj.Current_Monitor].Right-Monitors.Monitor
  1544.  
  1545. [Monitors.Window_Move_Obj.Current_Monitor].Left,1)
  1546.        
  1547.         if(TXC<tx&&TYC<ty){
  1548.             ;if the second set of lines are below and to the
  1549.  
  1550. right of the first set of lines.
  1551.            
  1552.                 ;Fill the area between the two sets of lines
  1553.  
  1554. with a semi transparent green rectangle.
  1555.             Fill_Box(CapWin.G,GB,TXC,TYC,tx-TXC,ty-TYC)
  1556.            
  1557.                 ;Update some variables.
  1558.             WCAP:=tx-TXC,HCAP:=ty-TYC,OB:=0
  1559.            
  1560.                 ;Get the position of the top and left side
  1561.  
  1562. of the current monitor. This is used to calculate the capture area.
  1563.             XCAP := TXC + Monitors.Monitor[
  1564.  
  1565. Monitors.Window_Move_Obj.Current_Monitor ].Left
  1566.            
  1567.             YCAP := TYC + Monitors.Monitor[
  1568.  
  1569. Monitors.Window_Move_Obj.Current_Monitor ].Top
  1570.        
  1571.         }else if(TXC>tx&&TYC<ty){
  1572.             ;If the second set of lines is above and to the left
  1573.  
  1574. of the first set of lines.
  1575.            
  1576.                 ;Fill the area between the two sets of lines
  1577.  
  1578. with a semi transparent red rectangle. (will be changing this to a valid
  1579.  
  1580. action)
  1581.             Fill_Box( CapWin.G , GB , tx , TYC , TXC - tx , ty -
  1582.  
  1583. TYC )
  1584.                
  1585.                 ;Set a variable to determin if a valid
  1586.  
  1587. capture area has been set.
  1588.             ;~ OB := 1
  1589.            
  1590.             WCAP := tx - TXC
  1591.             HCAP := ty - TYC
  1592.             OB := 1
  1593.            
  1594.             XCAP := TXC + Monitors.Monitor[
  1595.  
  1596. Monitors.Window_Move_Obj.Current_Monitor ].Left
  1597.            
  1598.             YCAP := TYC + Monitors.Monitor[
  1599.  
  1600. Monitors.Window_Move_Obj.Current_Monitor ].Top
  1601.        
  1602.         }else if( TXC > tx && TYC > ty ){
  1603.             ;if the second set of lines are below and to the
  1604.  
  1605. left of the first set of lines.
  1606.            
  1607.                 ;Fill the area between the two sets of lines
  1608.  
  1609. with a semi transparent red rectangle. (will be changing this to a valid
  1610.  
  1611. action)
  1612.             Fill_Box( CapWin.G , RB , tx , ty , TXC - tx , TYC -
  1613.  
  1614. ty )
  1615.            
  1616.                 ;Set a variable to determin if a valid
  1617.  
  1618. capture area has been set.
  1619.             OB:=1
  1620.        
  1621.         }else if(TXC<tx&&TYC>ty){
  1622.             ;if the second set of lines are above and to the
  1623.  
  1624. right of the first set of lines.
  1625.            
  1626.                 ;Fill the area between the two sets of lines
  1627.  
  1628. with a semi transparent red rectangle. (will be changing this to a valid
  1629.  
  1630. action)
  1631.             Fill_Box(CapWin.G,RB,TXC,ty,tx-TXC,TYC-ty)
  1632.            
  1633.                 ;Set a variable to determin if a valid
  1634.  
  1635. capture area has been set.
  1636.             OB:=1
  1637.        
  1638.         }
  1639.    
  1640.     }
  1641.    
  1642.         ;Draw the graphics to the window.
  1643.     UpdateLayeredWindow(CapWin.hwnd, CapWin.hdc,Monitors.Monitor
  1644.  
  1645. [Monitors.Window_Move_Obj.Current_Monitor].Left,Monitors.Monitor
  1646.  
  1647. [Monitors.Window_Move_Obj.Current_Monitor].Top,Monitors.Monitor
  1648.  
  1649. [Monitors.Window_Move_Obj.Current_Monitor].Right-Monitors.Monitor
  1650.  
  1651. [Monitors.Window_Move_Obj.Current_Monitor].Left, Monitors.Monitor
  1652.  
  1653. [Monitors.Window_Move_Obj.Current_Monitor].Bottom-Monitors.Monitor
  1654.  
  1655. [Monitors.Window_Move_Obj.Current_Monitor].Top)
  1656.  
  1657. }
  1658.  
  1659. #IF (CapActive=1)
  1660.  
  1661.     LButton::
  1662.         if(SP=0)
  1663.             SP:=1
  1664.         else if(SP=1&&OB=0){
  1665.            
  1666.        
  1667.             CaptureShutDown()
  1668.            
  1669.             gosub,Take_ScreenShot
  1670.        
  1671.         }
  1672.        
  1673.         return
  1674.        
  1675. RButton::
  1676. CaptureShutDown(){
  1677.    
  1678.    
  1679.     Monitors.Turn_Off_Window_Move_Timer()
  1680.    
  1681.    
  1682.     CapActive := 0
  1683.    
  1684.     ;~ SelectObject( CapWin.hdc , CapWin.obm ) , DeleteObject(
  1685.  
  1686. CapWin.hbm ) , DeleteDC( CapWin.hdc ) , gdip_deleteGraphics( CapWin.g )
  1687.        
  1688.         ;Select the object
  1689.     SelectObject( CapWin.hdc,CapWin.obm)
  1690.    
  1691.         ;Delete the object
  1692.     DeleteObject(CapWin.hbm)
  1693.    
  1694.         ;Delete the device context
  1695.     DeleteDC(CapWin.hdc)
  1696.    
  1697.         ;Delete the graphics
  1698.     Gdip_deleteGraphics(CapWin.G)
  1699.    
  1700.     CapWin := "" , SP := 0
  1701.    
  1702.    
  1703.     Gui,2:Destroy
  1704.    
  1705.    
  1706.     SetTimer,Set_Positions,Off
  1707.    
  1708.    
  1709.     Sleep, 300
  1710.    
  1711. }  
  1712.  
  1713.     return
  1714.        
  1715. #IF
  1716.  
  1717.  
  1718.  
  1719. Take_ScreenShot:
  1720.     TempBitmap:=Gdip_BitmapFromScreen(XCAP "|" YCAP "|" WCAP "|" HCAP)
  1721.     ShotName:=A_Now
  1722.     Gdip_SaveBitmapToFile(TempBitmap,A_WorkingDir "\" ShotName ".png",
  1723.  
  1724. 100)
  1725.     Gdip_DisposeImage(TempBitmap)
  1726.     Traytip,,Shot Saved
  1727.     return 
  1728.  
  1729.  
  1730.  
  1731. GetColor(){
  1732.     While(!GetKeyState("ctrl")){
  1733.         ToolTip,Hover over a color and press "ctrl"
  1734.         MouseGetPos,tx,ty
  1735.         PixelGetColor,OutColor,tx,ty, RGB
  1736.         Brush := Gdip_BrushCreateSolid( "0xFF2D2F33" )
  1737.         Gdip_FillRectangle( CDisplay.G , Brush , 45 , 55 , 110 , 20
  1738.  
  1739. )
  1740.         Gdip_DeleteBrush( Brush )
  1741.         Gdip_TextToGraphics( CDisplay.G , OutColor , "s12 Bold
  1742.  
  1743. Center vCenter cFF3399FF  x45 y50" , "Segoe UI" , 110 , 30 )
  1744.         Brush := Gdip_BrushCreateSolid( "0xFF" SubStr(OutColor, 3 )
  1745.  
  1746. )
  1747.         Gdip_FillRectangle( CDisplay.G , Brush , 55 , 15 , 90 , 20 )
  1748.         Gdip_DeleteBrush( Brush )
  1749.         UpdateLayeredWindow(CDisplay.hwnd, CDisplay.hdc)
  1750.     }
  1751.     ToolTip,
  1752.     Clipboard := SubStr(OutColor, 3 )
  1753. }
  1754.  
  1755.  
  1756. _Create_Default_Bitmap( W , H , Background_Color , Font_Color_Bottom ,
  1757.  
  1758. Font_Color_Top , Text , Font_Size , Y_Offset , Font ){
  1759.        
  1760.         ;Bitmap Created Using: HB Bitmap Maker
  1761.         pBitmap:=Gdip_CreateBitmap( W , H )
  1762.         G := Gdip_GraphicsFromImage( pBitmap )
  1763.         Gdip_SetSmoothingMode( G , 1 )
  1764.         Brush := Gdip_BrushCreateSolid( Background_Color )
  1765.         Gdip_FillRectangle( G , Brush , -2 , 0 , W+3 , H+3 )
  1766.         Gdip_DeleteBrush( Brush )
  1767.         Brush := Gdip_BrushCreateSolid( "0xFF141416" )
  1768.         Gdip_FillRectangle( G , Brush , 3 , 3 , W-6 , H-6 )
  1769.         Gdip_DeleteBrush( Brush )
  1770.         Brush := Gdip_CreateLineBrushFromRect( 4 , 3 , W-9 , H-7 ,
  1771.  
  1772. "0xFF363C45" , "0xFF2B2C2E" , 1 , 1 )
  1773.         Gdip_FillRectangle( G , Brush , 4 , 4 , W-8 , H-8 )
  1774.         Gdip_DeleteBrush( Brush )
  1775.         Pen := Gdip_CreatePen( "0xFF4D535B" , 1 )
  1776.         Gdip_DrawLine( G , Pen , 4 , 4 , W-5 , 4 )
  1777.         Gdip_DeletePen( Pen )
  1778.         Brush := Gdip_BrushCreateSolid( Font_Color_Bottom )
  1779.         Gdip_TextToGraphics( G , Text , "s" Font_Size " Center
  1780.  
  1781. vCenter c" Brush " x0 y1" , Font , W , H )
  1782.         Gdip_DeleteBrush( Brush )
  1783.         Brush := Gdip_BrushCreateSolid( Font_Color_Top )
  1784.         Gdip_TextToGraphics( G , Text, "s" Font_Size " Center
  1785.  
  1786. vCenter c" Brush " x1 y0"  , Font , W , H )
  1787.         Gdip_DeleteBrush( Brush )
  1788.         Gdip_DeleteGraphics( G )
  1789.         return pBitmap
  1790.     }
  1791.  
  1792.  
  1793.  
  1794. HB_BITMAP_MAKER(){
  1795.     ;Bitmap Created Using: HB Bitmap Maker
  1796.     pBitmap:=Gdip_CreateBitmap( 200 , 200 )
  1797.     G := Gdip_GraphicsFromImage( pBitmap )
  1798.     Gdip_SetSmoothingMode( G , 4 )
  1799.     Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0x88F0F0F0" ,
  1800.  
  1801. "0xaa000000" , 1 )
  1802.     Gdip_FillRoundedRectangle( G , Brush , 10 , 50 , 180 , 140 , 25 )
  1803.     Gdip_DeleteBrush( Brush )
  1804.     Brush := Gdip_CreateLineBrush( 7 , 184 , 100 , 100 , "0x44F0F0F0" ,
  1805.  
  1806. "0x88000000" , 1 )
  1807.     Gdip_FillRoundedRectangle( G , Brush , 10 , 50 , 180 , 140 , 25 )
  1808.     Gdip_DeleteBrush( Brush )
  1809.     Brush := Gdip_BrushCreateSolid( "0xFF2D2F33" )
  1810.     Gdip_FillRectangle( G , Brush , 40 , 50 , 120 , 110 )
  1811.     Gdip_DeleteBrush( Brush )
  1812.     Brush := Gdip_CreateLineBrushFromRect( 17 , 13 , 165 , 177 ,
  1813.  
  1814. "0xFFF0F0F0" , "0xFF000000" , 1 , 1 )
  1815.     Pen := Gdip_CreatePenFromBrush( Brush , 3 )
  1816.     Gdip_DeleteBrush( Brush )
  1817.     Gdip_DrawRoundedRectangle( G , Pen , 10 , 50 , 180 , 140 , 25 )
  1818.     Gdip_DeletePen( Pen )
  1819.     Brush := Gdip_CreateLineBrushFromRect( 53 , 10 , 116 , 56 ,
  1820.  
  1821. "0xFF444444" , "0xFF030E0E" , 1 , 1 )
  1822.     Gdip_FillRoundedRectangle( G , Brush , 50 , 10 , 100 , 30 , 5 )
  1823.     Gdip_DeleteBrush( Brush )
  1824.     Brush := Gdip_CreateLineBrush( 110 , 46 , 113 , -3 , "0xFF102A2A" ,
  1825.  
  1826. "0xFFF0F0F0" , 1 )
  1827.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1828.     Gdip_DeleteBrush( Brush )
  1829.     Gdip_DrawRoundedRectangle( G , Pen , 50 , 10 , 100 , 30 , 5 )
  1830.     Gdip_DeletePen( Pen )
  1831.     Brush := Gdip_CreateLineBrush( 110 , 46 , 113 , -3 , "0xFF004444" ,
  1832.  
  1833. "0xFFF0F0F0" , 1 )
  1834.     Pen := Gdip_CreatePenFromBrush( Brush , 2 )
  1835.     Gdip_DeleteBrush( Brush )
  1836.     Gdip_DrawRoundedRectangle( G , Pen , 50 , 10 , 100 , 30 , 5 )
  1837.     Gdip_DeletePen( Pen )
  1838.     Brush := Gdip_BrushCreateSolid( "0xFF3399FF" )
  1839.     Gdip_FillRoundedRectangle( G , Brush , 55 , 15 , 90 , 20 , 5 )
  1840.     Gdip_DeleteBrush( Brush )
  1841.     Brush := Gdip_CreateLineBrushFromRect( 43 , 131 , 56 , 57 ,
  1842.  
  1843. "0xFF444444" , "0xFF000000" , 1 , 1 )
  1844.     Gdip_FillRectangle( G , Brush , 45 , 135 , 20 , 20 )
  1845.     Gdip_DeleteBrush( Brush )
  1846.     Brush := Gdip_CreateLineBrushFromRect( 133 , 132 , 27 , 31 ,
  1847.  
  1848. "0xFF777777" , "0xFF000000" , 1 , 1 )
  1849.     Gdip_FillRectangle( G , Brush , 135 , 135 , 20 , 20 )  ;<----------
  1850.     Gdip_DeleteBrush( Brush )
  1851.     Brush := Gdip_CreateLineBrushFromRect( 133 , 132 , 27 , 31 ,
  1852.  
  1853. "0xFF777777" , "0xFF000000" , 1 , 1 )
  1854.     Gdip_FillRectangle( G , Brush , 45 , 135 , 20 , 20 )  
  1855.  
  1856. ;<---------------------
  1857.     Gdip_DeleteBrush( Brush )
  1858.     Brush := Gdip_BrushCreateSolid( "0xFF444444" )
  1859.     Gdip_FillRectangle( G , Brush , 105 , 135 , 20 , 20 )
  1860.     Gdip_DeleteBrush( Brush )
  1861.     Brush := Gdip_BrushCreateSolid( "0xFF444444" )
  1862.     Gdip_FillRectangle( G , Brush , 75 , 135 , 20 , 20 )
  1863.     Gdip_DeleteBrush( Brush )
  1864.     Brush := Gdip_CreateLineBrushFromRect( 133 , 132 , 27 , 31 ,
  1865.  
  1866. "0xFF777777" , "0xFF000000" , 1 , 1 )
  1867.     Gdip_FillRectangle( G , Brush , 75 , 135 , 20 , 20 )
  1868.  
  1869. ;<---------------------
  1870.     Gdip_DeleteBrush( Brush )
  1871.     Brush := Gdip_BrushCreateSolid( "0xFF3399FF" )
  1872.     Gdip_FillRectangle( G , Brush , 48 , 139 , 14 , 12 )
  1873.     Gdip_DeleteBrush( Brush )
  1874.     Brush := Gdip_BrushCreateSolid( "0xFF3399FF" )
  1875.     Gdip_FillRectangle( G , Brush , 78 , 139 , 14 , 12 )
  1876.     Gdip_DeleteBrush( Brush )
  1877.     Brush := Gdip_CreateLineBrushFromRect( 133 , 132 , 27 , 31 ,
  1878.  
  1879. "0xFF777777" , "0xFF000000" , 1 , 1 )
  1880.     Gdip_FillRectangle( G , Brush , 105 , 135 , 20 , 20 )
  1881.  
  1882. ;<---------------------
  1883.     Gdip_DeleteBrush( Brush )
  1884.     Brush := Gdip_BrushCreateSolid( "0xFF3399FF" )
  1885.     Gdip_FillRectangle( G , Brush , 108 , 139 , 14 , 12 )
  1886.     Gdip_DeleteBrush( Brush )
  1887.     Brush := Gdip_BrushCreateSolid( "0xFF3399FF" )
  1888.     Gdip_FillRectangle( G , Brush , 138 , 139 , 14 , 12 )
  1889.     Gdip_DeleteBrush( Brush )
  1890.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1891.  
  1892. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1893.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1894.     Gdip_DeleteBrush( Brush )
  1895.     Gdip_DrawRectangle( G , Pen , 45 , 135 , 20 , 20 )
  1896.     Gdip_DeletePen( Pen )
  1897.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1898.  
  1899. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1900.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1901.     Gdip_DeleteBrush( Brush )
  1902.     Gdip_DrawRectangle( G , Pen , 75 , 135 , 20 , 20 )
  1903.     Gdip_DeletePen( Pen )
  1904.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1905.  
  1906. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1907.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1908.     Gdip_DeleteBrush( Brush )
  1909.     Gdip_DrawRectangle( G , Pen , 105 , 135 , 20 , 20 )
  1910.     Gdip_DeletePen( Pen )
  1911.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1912.  
  1913. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1914.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1915.     Gdip_DeleteBrush( Brush )
  1916.     Gdip_DrawRectangle( G , Pen , 48 , 139 , 14 , 12 )
  1917.     Gdip_DeletePen( Pen )
  1918.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1919.  
  1920. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1921.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1922.     Gdip_DeleteBrush( Brush )
  1923.     Gdip_DrawRectangle( G , Pen , 78 , 139 , 14 , 12 )
  1924.     Gdip_DeletePen( Pen )
  1925.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1926.  
  1927. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1928.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1929.     Gdip_DeleteBrush( Brush )
  1930.     Gdip_DrawRectangle( G , Pen , 108 , 139 , 14 , 12 )
  1931.     Gdip_DeletePen( Pen )
  1932.     Brush := Gdip_CreateLineBrushFromRect( 66 , 157 , 26 , 25 ,
  1933.  
  1934. "0xFF000000" , "0xFF777777" , 1 , 1 )
  1935.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1936.     Gdip_DeleteBrush( Brush )
  1937.     Gdip_DrawRectangle( G , Pen , 138 , 139 , 14 , 12 )
  1938.     Gdip_DeletePen( Pen )
  1939.     Brush := Gdip_CreateLineBrushFromRect( 133 , 133 , 23 , 22 ,
  1940.  
  1941. "0xFF777777" , "0xFF000000" , 1 , 1 )
  1942.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  1943.     Gdip_DeleteBrush( Brush )
  1944.     Gdip_DrawRectangle( G , Pen , 135 , 135 , 20 , 20 )
  1945.     Gdip_DeletePen( Pen )
  1946.     Pen := Gdip_CreatePen( "0xFF121315" , 3)
  1947.     Gdip_DrawLine( G , Pen , 40 , 160 , 40 , 53 )
  1948.     Gdip_DeletePen( Pen )
  1949.     Pen := Gdip_CreatePen( "0xFF121315" , 2)
  1950.     Gdip_DrawLine( G , Pen , 40 , 160 , 159 , 160 )
  1951.     Gdip_DeletePen( Pen )
  1952.     Pen := Gdip_CreatePen( "0xFF121315" , 3)
  1953.     Gdip_DrawLine( G , Pen , 160 , 53 , 160 , 160 )
  1954.     Gdip_DeletePen( Pen )
  1955.     Gdip_DeleteGraphics( G )
  1956.     return pBitmap
  1957. }
  1958.  
  1959. DisplayWindow(){
  1960.     ;Bitmap Created Using: HB Bitmap Maker
  1961.     pBitmap:=Gdip_CreateBitmap( 970 , 220 )
  1962.     G := Gdip_GraphicsFromImage( pBitmap )
  1963.     Gdip_SetSmoothingMode( G , 2 )
  1964.     ;~
  1965.     Brush := Gdip_CreateLineBrushFromRect( 14 , 9 , 947 , 178 ,
  1966.  
  1967. "0x44F0F0F0" , "0x88000000" , 1 , 1 )
  1968.     Gdip_FillRoundedRectangle( G , Brush , 10 , 10 , 950 , 200 , 25 )
  1969.     Gdip_DeleteBrush( Brush )
  1970.     Brush := Gdip_BrushCreateSolid( "0xFF333333" )
  1971.     Gdip_FillRectangle( G , Brush , 40 , 10 , 890 , 190 )
  1972.     Gdip_DeleteBrush( Brush )
  1973.     ;Slot 1
  1974.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  1975.     Gdip_FillRectangle( G , Brush , 70 , 20 , 150 , 150 )
  1976.     Gdip_DeleteBrush( Brush )
  1977.     ;Slot  2
  1978.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  1979.     Gdip_FillRectangle( G , Brush , 240 , 20 , 150 , 150 )
  1980.     Gdip_DeleteBrush( Brush )
  1981.     ;Slot  3
  1982.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  1983.     Gdip_FillRectangle( G , Brush , 410 , 20 , 150 , 150 )
  1984.     Gdip_DeleteBrush( Brush )
  1985.     ;Slot  4
  1986.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  1987.     Gdip_FillRectangle( G , Brush , 580 , 20 , 150 , 150 )
  1988.     Gdip_DeleteBrush( Brush )
  1989.     ;Slot  5
  1990.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  1991.     Gdip_FillRectangle( G , Brush , 750 , 20 , 150 , 150 )
  1992.     Gdip_DeleteBrush( Brush )
  1993.     Brush := Gdip_CreateLineBrushFromRect( 17 , 13 , 165 , 177 ,
  1994.  
  1995. "0xFFF0F0F0" , "0xFF000000" , 1 , 1 )
  1996.     Pen := Gdip_CreatePenFromBrush( Brush , 3 )
  1997.     Gdip_DeleteBrush( Brush )
  1998.     Gdip_DrawRoundedRectangle( G , Pen , 10 , 10 , 950 , 200 , 25 )
  1999.     Gdip_DeletePen( Pen )
  2000.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  2001.     Gdip_FillRectangle( G , Brush , 320 , 184 , 350 , 5 )
  2002.     Gdip_DeleteBrush( Brush )
  2003.     Brush := Gdip_CreateLineBrushFromRect( 180 , 0 , 210 , 376 ,
  2004.  
  2005. "0xFF333333" , "0xFF000000" , 1 , 1 )
  2006.     Gdip_FillRectangle( G , Brush , 181 , 176 , 112 , 19 )
  2007.  
  2008. ;<--------------------------------------------------------------
  2009.     Gdip_DeleteBrush( Brush )
  2010.     Brush := Gdip_BrushCreateSolid( "0xFF444444" )
  2011.     Gdip_FillPolygon( G , Brush , "260,180|215,185|260,190|" )
  2012.     Gdip_DeleteBrush( Brush )
  2013.     ;close button
  2014.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  2015.     Gdip_FillRectangle( G , Brush , 904 , 40 , 20 , 110 )
  2016.     Gdip_DeleteBrush( Brush )
  2017.     ;part of close
  2018.     Brush := Gdip_CreateLineBrushFromRect( 905 , 42 , 34 , 191 ,
  2019.  
  2020. "0xFF333333" , "0xFF000000" , 1 , 1 )
  2021.     Gdip_FillRectangle( G , Brush , 906 , 42 , 16 , 106 )
  2022.     Gdip_DeleteBrush( Brush )
  2023.     ;part of close
  2024.     Brush := Gdip_BrushCreateSolid( "0x99000000" )
  2025.     ;part of close
  2026.     Gdip_TextToGraphics( G , "Close" , "s10 Center vCenter Bold c" Brush
  2027.  
  2028. " x907 y32" , "Segoe UI" , 10 , 130 )
  2029.     Gdip_DeleteBrush( Brush )
  2030.     ;part of close
  2031.     Brush := Gdip_BrushCreateSolid( "0x99F0F0F0" )
  2032.     ;part of close
  2033.     Gdip_TextToGraphics( G , "CLOSE" , "s10 Center vCenter Bold c" Brush
  2034.  
  2035. " x909 y33" , "Segoe UI" , 10 , 130 )
  2036.     Gdip_DeleteBrush( Brush )
  2037.     ;part of close
  2038.     Brush := Gdip_BrushCreateSolid( "0x993399FF" )
  2039.     ;part of close
  2040.     Gdip_TextToGraphics( G , "CLOSE" , "s10 Center vCenter Bold c" Brush
  2041.  
  2042. " x909 y33" , "Segoe UI" , 10 , 130 )
  2043.     Gdip_DeleteBrush( Brush )
  2044.     Brush := Gdip_CreateLineBrushFromRect( 180 , 0 , 210 , 376 ,
  2045.  
  2046. "0xFF333333" , "0xFF000000" , 1 , 1 )
  2047.     Gdip_FillRectangle( G , Brush , 691 , 176 , 112 , 19 )
  2048.     Gdip_DeleteBrush( Brush )
  2049.     Brush := Gdip_BrushCreateSolid( "0xFF444444" )
  2050.     Gdip_FillPolygon( G , Brush , "725,180|770,185|725,190|" )
  2051.     Gdip_DeleteBrush( Brush )
  2052.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2053.     Gdip_DrawRectangle( G , Pen , 905 , 41 , 18 , 108 )
  2054.     Gdip_DeletePen( Pen )
  2055.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2056.     Gdip_DrawRectangle( G , Pen , 40 , 12 , 889 , 188 )
  2057.     Gdip_DeletePen( Pen )
  2058.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2059.     Gdip_DrawRectangle( G , Pen , 69 , 19 , 152 , 152 )
  2060.     Gdip_DeletePen( Pen )
  2061.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2062.     Gdip_DrawRectangle( G , Pen , 239 , 19 , 152 , 152 )
  2063.     Gdip_DeletePen( Pen )
  2064.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2065.     Gdip_DrawRectangle( G , Pen , 409 , 19 , 152 , 152 )
  2066.     Gdip_DeletePen( Pen )
  2067.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2068.     Gdip_DrawRectangle( G , Pen , 579 , 19 , 152 , 152 )
  2069.     Gdip_DeletePen( Pen )
  2070.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2071.     Gdip_DrawRectangle( G , Pen , 749 , 19 , 152 , 152 )
  2072.     Gdip_DeletePen( Pen )
  2073.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2074.     Gdip_DrawRectangle( G , Pen , 180 , 175 , 114 , 21 )
  2075.     Gdip_DeletePen( Pen )
  2076.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2077.     Gdip_DrawRectangle( G , Pen , 319 , 183 , 352 , 6 )
  2078.     Gdip_DeletePen( Pen )
  2079.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2080.     Gdip_DrawRectangle( G , Pen , 690 , 175 , 114 , 21 )
  2081.     Gdip_DeletePen( Pen )
  2082.     ;close button
  2083.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  2084.     Gdip_FillRectangle( G , Brush , 45 , 40 , 20 , 110 )
  2085.     Gdip_DeleteBrush( Brush )
  2086.     ;part of close
  2087.     Brush := Gdip_CreateLineBrushFromRect( 905 , 42 , 34 , 191 ,
  2088.  
  2089. "0xFF333333" , "0xFF000000" , 1 , 1 )
  2090.     Gdip_FillRectangle( G , Brush , 47 , 42 , 16 , 106 )
  2091.     Gdip_DeleteBrush( Brush )
  2092.     ;part of close
  2093.     Brush := Gdip_BrushCreateSolid( "0x99000000" )
  2094.     ;part of close
  2095.     Gdip_TextToGraphics( G , "REFRESH" , "s10 Center vCenter Bold c"
  2096.  
  2097. Brush " x49 y32" , "Segoe UI" , 10 , 130 )
  2098.     Gdip_DeleteBrush( Brush )
  2099.     ;part of close
  2100.     Brush := Gdip_BrushCreateSolid( "0x99F0F0F0" )
  2101.     ;part of close
  2102.     Gdip_TextToGraphics( G , "REFRESH" , "s10 Center vCenter Bold c"
  2103.  
  2104. Brush " x50 y33" , "Segoe UI" , 10 , 130 )
  2105.     Gdip_DeleteBrush( Brush )
  2106.     ;part of close
  2107.     Brush := Gdip_BrushCreateSolid( "0x993399FF" )
  2108.     ;part of close
  2109.     Gdip_TextToGraphics( G , "REFRESH" , "s10 Center vCenter Bold c"
  2110.  
  2111. Brush " x50 y33" , "Segoe UI" , 10 , 130 )
  2112.     Gdip_DeleteBrush( Brush )
  2113.     Pen := Gdip_CreatePen( "0x443399FF" , 1 )
  2114.     Gdip_DrawRectangle( G , Pen , 46 , 41 , 18 , 108 )
  2115.     Gdip_DeletePen( Pen )
  2116.     Gdip_DeleteGraphics( G )
  2117.     return pBitmap
  2118. }
  2119.  
  2120. ;---------------------------------------------------------------------------
  2121.  
  2122. ----------------------
  2123. ;---------------------------------------------------------------------------
  2124.  
  2125. ----------------------
  2126. ;---------------------------------------------------------------------------
  2127.  
  2128. ----------------------
  2129.  
  2130. class MonitorClass  {
  2131.     __New(){
  2132.         This._SetMonCount()
  2133.         This._SetPrimeMonitor()
  2134.         This._Set_Bounds()
  2135.     }
  2136.     _SetMonCount(){
  2137.         local MC
  2138.         SysGet, MC, MonitorCount
  2139.         This.MonitorCount := MC
  2140.     }
  2141.     _SetPrimeMonitor(){
  2142.         local PM
  2143.         SysGet, PM, MonitorPrimary
  2144.         This.PrimeMonitor := PM
  2145.     }
  2146.     _Set_Bounds(){
  2147.         local bmon,bmonLeft,bmonRight,bmonTop,bmonBottom
  2148.         This.Monitors:=[]
  2149.         Loop,% This.MonitorCount    {
  2150.             SysGet, bmon, Monitor, % A_Index
  2151.             This.Monitor[A_Index]:= { Left      :  
  2152.  
  2153. bmonLeft
  2154.                                     ,
  2155.  
  2156. Top     :   bmonTop
  2157.                                     ,
  2158.  
  2159. Right       :   bmonRight
  2160.                                     ,
  2161.  
  2162. Bottom  :   bmonBottom  }
  2163.         }
  2164.     }
  2165.     Get_Current_Monitor(){
  2166.         local x,y
  2167.         CoordMode,Mouse,Screen
  2168.         MouseGetPos,x,y
  2169.         Loop,% This.MonitorCount    {
  2170.             if(x>=This.Monitor[A_Index].Left&&x<=This.Monitor
  2171.  
  2172. [A_Index].Right&&y>=This.Monitor[A_Index].Top&&y<=This.Monitor
  2173.  
  2174. [A_Index].Bottom){
  2175.                 return A_Index
  2176.             }
  2177.         }
  2178.     }
  2179.     Get_New_Window_Position(curMon,xpOff,ypOff,xr,yr){
  2180.         local tposa:="",tposa:={}
  2181.         if(xr=1) ; 1 xr = relative to the left side ; 2 xr =
  2182.  
  2183. relative to the right side
  2184.             tposa.x:=This.Monitor[curMon].Left+xpOff
  2185.         else
  2186.             tposa.x:=This.Monitor[curMon].Right-xpOff
  2187.         if(yr=1) ; 1 yr = relative to the top  ; 2 yr = relative to
  2188.  
  2189. the bottom
  2190.             tposa.y:=This.Monitor[curMon].Top+ypOff
  2191.         else
  2192.             tposa.y:=This.Monitor[curMon].Bottom-ypOff
  2193.         return tposa
  2194.     }
  2195.     Set_Window_Move_Timer
  2196.  
  2197. (GUINAME:=1,GUIHWND:="",TCount:=500,xpOff:=0,ypOff:=0,xr:=1,yr:=1,Fill_Scree
  2198.  
  2199. n:=0){
  2200.        
  2201.         local Window_Timer
  2202.        
  2203.         This.Window_Move_Obj:=  {   Interval        :  
  2204.  
  2205. TCount
  2206.                                 ,  
  2207.  
  2208. GUINAME         :   GUINAME
  2209.                                 ,  
  2210.  
  2211. FILLSCREEN      :   Fill_Screen
  2212.                                 ,  
  2213.  
  2214. GUIHWND         :   GUIHWND
  2215.                                 ,  
  2216.  
  2217. XPOFF           :   xpOff
  2218.                                 ,  
  2219.  
  2220. YPOFF           :   ypOff
  2221.                                 ,  
  2222.  
  2223. XRelative       :   xr
  2224.                                 ,  
  2225.  
  2226. YRelative       :   yr 
  2227.                                 ,  
  2228.  
  2229. Current_Monitor :   This.Get_Current_Monitor()
  2230.                                 ,  
  2231.  
  2232. Old_Monitor     :   This.Get_Current_Monitor() 
  2233.                                 ,  
  2234.  
  2235. NEW_GUI_POS     :   This.Get_New_Window_Position
  2236.  
  2237. (This.Get_Current_Monitor(),xpOff,ypOff,xr,yr)  }
  2238.                                
  2239.         This.Window_Timer := Window_Timer :=  ObjBindMethod(This,
  2240.  
  2241. "_Window_Move_Timer")
  2242.        
  2243.         This._Set_TFTime()
  2244.        
  2245.         SetTimer,%Window_Timer%,%TCount%
  2246.        
  2247.     }
  2248.     _Window_Move_Timer(){
  2249.         This.Window_Move_Obj.Current_Monitor :=
  2250.  
  2251. This.Get_Current_Monitor()
  2252.         if(This.Window_Move_Obj.Current_Monitor!
  2253.  
  2254. =This.Window_Move_Obj.Old_Monitor&&!DllCall("IsIconic", "Ptr",
  2255.  
  2256. This.Window_Move_Obj.GUIHWND, "UInt")){
  2257.            
  2258.  
  2259. This.Window_Move_Obj.NEW_GUI_POS:=This.Get_New_Window_Position
  2260.  
  2261. (This.Window_Move_Obj.Current_Monitor,This.Window_Move_Obj.XPOFF,This.Window
  2262.  
  2263. _Move_Obj.YPOFF,This.Window_Move_Obj.XRelative,This.Window_Move_Obj.YRelativ
  2264.  
  2265. e)
  2266.             This._Move_Window()
  2267.             This.Window_Move_Obj.Old_Monitor :=
  2268.  
  2269. This.Window_Move_Obj.Current_Monitor
  2270.         }
  2271.     }
  2272.     _Set_TFTime(){
  2273.         This.Window_Move_Obj.Current_Monitor :=
  2274.  
  2275. This.Get_Current_Monitor()
  2276.        
  2277.  
  2278. This.Window_Move_Obj.NEW_GUI_POS:=This.Get_New_Window_Position
  2279.  
  2280. (This.Window_Move_Obj.Current_Monitor,This.Window_Move_Obj.XPOFF,This.Window
  2281.  
  2282. _Move_Obj.YPOFF,This.Window_Move_Obj.XRelative,This.Window_Move_Obj.YRelativ
  2283.  
  2284. e)
  2285.         This.Window_Move_Obj.Old_Monitor :=
  2286.  
  2287. This.Window_Move_Obj.Current_Monitor
  2288.         This._Move_Window()
  2289.     }
  2290.     _Move_Window(){
  2291.         if(!This.Window_Move_Obj.FILLSCREEN)
  2292.             Gui,% This.Window_Move_Obj.GUINAME ":Show",% "x"
  2293.  
  2294. This.Window_Move_Obj.NEW_GUI_POS.X " y" This.Window_Move_Obj.NEW_GUI_POS.Y "
  2295.  
  2296. NA"
  2297.         else
  2298.             Gui,% This.Window_Move_Obj.GUINAME ":Show",% "x"
  2299.  
  2300. This.Window_Move_Obj.NEW_GUI_POS.X " y" This.Window_Move_Obj.NEW_GUI_POS.Y "
  2301.  
  2302. w" This.Monitor[This.Window_Move_Obj.Current_Monitor].Right " h"
  2303.  
  2304. This.Monitor[This.Window_Move_Obj.Current_Monitor].Bottom " NA"
  2305.     }
  2306.     Turn_Off_Window_Move_Timer(){
  2307.         local Window_Timer
  2308.         Window_Timer := This.Window_Timer
  2309.         SetTimer,%Window_Timer%,Off
  2310.     }
  2311.     Turn_On_Window_Move_Timer(){
  2312.         local Window_Timer
  2313.         Window_Timer := This.Window_Timer
  2314.         This._Set_TFTime()
  2315.         SetTimer,%Window_Timer%,On
  2316.     }
  2317.     GetGuiPos(){
  2318.         local x,y
  2319.         WinGetPos,x,y,,,% "ahk_id " This.Window_Move_Obj.GUIHWND
  2320.         return x
  2321.     }
  2322. }
  2323.  
  2324.  
  2325.  
  2326.  
  2327. ;Shit that I (Hellbent) added
  2328. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2329.  
  2330. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2331. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2332.  
  2333. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2334. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2335.  
  2336. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  2337.  
  2338. Layered_Window_SetUp
  2339.  
  2340. (Smoothing,Window_X,Window_Y,Window_W,Window_H,Window_Name:=1,Window_Options
  2341.  
  2342. :=""){
  2343.     Layered:={}
  2344.     Layered.W:=Window_W
  2345.     Layered.H:=Window_H
  2346.     Layered.X:=Window_X
  2347.     Layered.Y:=Window_Y
  2348.     Layered.Name:=Window_Name
  2349.     Layered.Options:=Window_Options
  2350.     ;~ Layered.Token:=Gdip_Startup()
  2351.     Create_Layered_GUI(Layered)
  2352.     Layered.hwnd:=winExist()
  2353.     Layered.hbm := CreateDIBSection(Window_W,Window_H)
  2354.     Layered.hdc := CreateCompatibleDC()
  2355.     Layered.obm := SelectObject(Layered.hdc,Layered.hbm)
  2356.     Layered.G := Gdip_GraphicsFromHDC(Layered.hdc)
  2357.     Gdip_SetSmoothingMode(Layered.G,Smoothing)
  2358.     return Layered
  2359. }
  2360.  
  2361. Create_Layered_GUI(Layered){
  2362.     Gui,% Layered.Name ": +E0x80000 +LastFound " Layered.Options
  2363.     ;~ Gui,% Layered.Name ":Show",% "x" Layered.X " y" Layered.Y " w"
  2364.  
  2365. Layered.W " h" Layered.H " NA"
  2366. }
  2367.    
  2368. Layered_Window_ShutDown(This){
  2369.     SelectObject(This.hdc,This.obm)
  2370.     DeleteObject(This.hbm)
  2371.     DeleteDC(This.hdc)
  2372.     gdip_deleteGraphics(This.g)
  2373.     Gdip_Shutdown(This.Token)
  2374. }
  2375.  
  2376. New_Brush(colour:="000000",Alpha:="FF"){
  2377.     new_colour := "0x" Alpha colour
  2378.     return Gdip_BrushCreateSolid(new_colour)
  2379. }
  2380.  
  2381. New_Pen(colour:="000000",Alpha:="FF",Width:= 5){
  2382.     new_colour := "0x" Alpha colour
  2383.     return Gdip_CreatePen(New_Colour,Width)
  2384. }  
  2385.  
  2386. Fill_Box(pGraphics,pBrush,x,y,w,h)  {
  2387.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2388.     return DllCall("gdiplus\GdipFillRectangle", Ptr, pGraphics, Ptr,
  2389.  
  2390. pBrush, "float", x, "float", y, "float", w, "float", h)
  2391. }
  2392. ;###########################################################################
  2393.  
  2394. ###########################################################
  2395. ;#####################################################             
  2396.  
  2397.             #######################################################
  2398. ;#####################################################        Gdip LITE
  2399.  
  2400.         #######################################################
  2401. ;#####################################################             
  2402.  
  2403.             #######################################################
  2404. ;###########################################################################
  2405.  
  2406. ###########################################################
  2407. ; Gdip standard library v1.45 by tic (Tariq Porter) 07/09/11
  2408. ; Modifed by Rseding91 using fincs 64 bit compatible Gdip library 5/1/2013
  2409. ;###########################################################################
  2410.  
  2411. ##########
  2412. ;~ Gdip_DeleteRegion(Region)
  2413. ;~ {
  2414.     ;~ return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" :
  2415.  
  2416. "UInt", Region)
  2417. ;~ }
  2418. DestroyIcon(hIcon)
  2419. {
  2420.     return DllCall("DestroyIcon", A_PtrSize ? "UPtr" : "UInt", hIcon)
  2421. }
  2422. Gdip_CreateBitmapFromFile(sFile, IconNumber=1, IconSize="")
  2423. {
  2424.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2425.     , PtrA := A_PtrSize ? "UPtr*" : "UInt*"
  2426.    
  2427.     SplitPath, sFile,,, ext
  2428.     if ext in exe,dll
  2429.     {
  2430.         Sizes := IconSize ? IconSize : 256 "|" 128 "|" 64 "|" 48 "|"
  2431.  
  2432. 32 "|" 16
  2433.         BufSize := 16 + (2*(A_PtrSize ? A_PtrSize : 4))
  2434.        
  2435.         VarSetCapacity(buf, BufSize, 0)
  2436.         Loop, Parse, Sizes, |
  2437.         {
  2438.             DllCall("PrivateExtractIcons", "str", sFile, "int",
  2439.  
  2440. IconNumber-1, "int", A_LoopField, "int", A_LoopField, PtrA, hIcon, PtrA, 0,
  2441.  
  2442. "uint", 1, "uint", 0)
  2443.            
  2444.             if !hIcon
  2445.                 continue
  2446.  
  2447.             if !DllCall("GetIconInfo", Ptr, hIcon, Ptr, &buf)
  2448.             {
  2449.                 DestroyIcon(hIcon)
  2450.                 continue
  2451.             }
  2452.            
  2453.             hbmMask  := NumGet(buf, 12 + ((A_PtrSize ? A_PtrSize
  2454.  
  2455. : 4) - 4))
  2456.             hbmColor := NumGet(buf, 12 + ((A_PtrSize ? A_PtrSize
  2457.  
  2458. : 4) - 4) + (A_PtrSize ? A_PtrSize : 4))
  2459.             if !(hbmColor && DllCall("GetObject", Ptr, hbmColor,
  2460.  
  2461. "int", BufSize, Ptr, &buf))
  2462.             {
  2463.                 DestroyIcon(hIcon)
  2464.                 continue
  2465.             }
  2466.             break
  2467.         }
  2468.         if !hIcon
  2469.             return -1
  2470.  
  2471.         Width := NumGet(buf, 4, "int"), Height := NumGet(buf, 8,
  2472.  
  2473. "int")
  2474.         hbm := CreateDIBSection(Width, -Height), hdc :=
  2475.  
  2476. CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
  2477.         if !DllCall("DrawIconEx", Ptr, hdc, "int", 0, "int", 0, Ptr,
  2478.  
  2479. hIcon, "uint", Width, "uint", Height, "uint", 0, Ptr, 0, "uint", 3)
  2480.         {
  2481.             DestroyIcon(hIcon)
  2482.             return -2
  2483.         }
  2484.        
  2485.         VarSetCapacity(dib, 104)
  2486.         DllCall("GetObject", Ptr, hbm, "int", A_PtrSize = 8 ? 104 :
  2487.  
  2488. 84, Ptr, &dib) ; sizeof(DIBSECTION) = 76+2*(A_PtrSize=8?4:0)+2*A_PtrSize
  2489.         Stride := NumGet(dib, 12, "Int"), Bits := NumGet(dib, 20 +
  2490.  
  2491. (A_PtrSize = 8 ? 4 : 0)) ; padding
  2492.         DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width,
  2493.  
  2494. "int", Height, "int", Stride, "int", 0x26200A, Ptr, Bits, PtrA, pBitmapOld)
  2495.         pBitmap := Gdip_CreateBitmap(Width, Height)
  2496.         G := Gdip_GraphicsFromImage(pBitmap)
  2497.         , Gdip_DrawImage(G, pBitmapOld, 0, 0, Width, Height, 0, 0,
  2498.  
  2499. Width, Height)
  2500.         SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
  2501.         Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmapOld)
  2502.         DestroyIcon(hIcon)
  2503.     }
  2504.     else
  2505.     {
  2506.         if (!A_IsUnicode)
  2507.         {
  2508.             VarSetCapacity(wFile, 1024)
  2509.             DllCall("kernel32\MultiByteToWideChar", "uint", 0,
  2510.  
  2511. "uint", 0, Ptr, &sFile, "int", -1, Ptr, &wFile, "int", 512)
  2512.             DllCall("gdiplus\GdipCreateBitmapFromFile", Ptr,
  2513.  
  2514. &wFile, PtrA, pBitmap)
  2515.         }
  2516.         else
  2517.             DllCall("gdiplus\GdipCreateBitmapFromFile", Ptr,
  2518.  
  2519. &sFile, PtrA, pBitmap)
  2520.     }
  2521.    
  2522.     return pBitmap
  2523. }
  2524.  
  2525. Gdip_GetDimensions(pBitmap, ByRef Width, ByRef Height){
  2526.     Gdip_GetImageDimensions(pBitmap, Width, Height)
  2527. }
  2528.  
  2529. Gdip_GraphicsClear(pGraphics, ARGB=0x00ffffff)
  2530. {
  2531.     return DllCall("gdiplus\GdipGraphicsClear", A_PtrSize ? "UPtr" : "UInt",
  2532.  
  2533. pGraphics, "int", ARGB)
  2534. }
  2535.  
  2536. BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster=""){
  2537.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2538.     return DllCall("gdi32\BitBlt", Ptr, dDC, "int", dx, "int", dy,
  2539.  
  2540. "int", dw, "int", dh, Ptr, sDC, "int", sx, "int", sy, "uint", Raster ?
  2541.  
  2542. Raster : 0x00CC0020)
  2543. }
  2544.  
  2545. Gdip_CreateBitmapFromHBITMAP(hBitmap, Palette=0)
  2546. {
  2547.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2548.    
  2549.     DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", Ptr, hBitmap, Ptr,
  2550.  
  2551. Palette, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
  2552.     return pBitmap
  2553. }
  2554.  
  2555. UpdateLayeredWindow(hwnd, hdc, x="", y="", w="", h="", Alpha=255)
  2556. {
  2557.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2558.    
  2559.     if ((x != "") && (y != ""))
  2560.         VarSetCapacity(pt, 8), NumPut(x, pt, 0, "UInt"), NumPut(y,
  2561.  
  2562. pt, 4, "UInt")
  2563.  
  2564.     if (w = "") ||(h = "")
  2565.         WinGetPos,,, w, h, ahk_id %hwnd%
  2566.    
  2567.     return DllCall("UpdateLayeredWindow"
  2568.                     , Ptr, hwnd
  2569.                     , Ptr, 0
  2570.                     , Ptr, ((x = "") && (y = "")) ? 0 :
  2571.  
  2572. &pt
  2573.                     , "int64*", w|h<<32
  2574.                     , Ptr, hdc
  2575.                     , "int64*", 0
  2576.                     , "uint", 0
  2577.                     , "UInt*", Alpha<<16|1<<24
  2578.                     , "uint", 2)
  2579. }
  2580.  
  2581. Gdip_BitmapFromScreen(Screen=0, Raster="")
  2582. {
  2583.     if (Screen = 0)
  2584.     {
  2585.         Sysget, x, 76
  2586.         Sysget, y, 77  
  2587.         Sysget, w, 78
  2588.         Sysget, h, 79
  2589.     }
  2590.     else if (SubStr(Screen, 1, 5) = "hwnd:")
  2591.     {
  2592.         Screen := SubStr(Screen, 6)
  2593.         if !WinExist( "ahk_id " Screen)
  2594.             return -2
  2595.         WinGetPos,,, w, h, ahk_id %Screen%
  2596.         x := y := 0
  2597.         hhdc := GetDCEx(Screen, 3)
  2598.     }
  2599.     else if (Screen&1 != "")
  2600.     {
  2601.         Sysget, M, Monitor, %Screen%
  2602.         x := MLeft, y := MTop, w := MRight-MLeft, h := MBottom-MTop
  2603.     }
  2604.     else
  2605.     {
  2606.         StringSplit, S, Screen, |
  2607.         x := S1, y := S2, w := S3, h := S4
  2608.     }
  2609.  
  2610.     if (x = "") || (y = "") || (w = "") || (h = "")
  2611.         return -1
  2612.  
  2613.     chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc),
  2614.  
  2615. obm := SelectObject(chdc, hbm), hhdc := hhdc ? hhdc : GetDC()
  2616.     BitBlt(chdc, 0, 0, w, h, hhdc, x, y, Raster)
  2617.     ReleaseDC(hhdc)
  2618.    
  2619.     pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
  2620.     SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc),
  2621.  
  2622. DeleteDC(chdc)
  2623.     return pBitmap
  2624. }
  2625.  
  2626. Gdip_SaveBitmapToFile(pBitmap, sOutput, Quality=75)
  2627. {
  2628.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2629.    
  2630.     SplitPath, sOutput,,, Extension
  2631.     if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
  2632.         return -1
  2633.     Extension := "." Extension
  2634.  
  2635.     DllCall("gdiplus\GdipGetImageEncodersSize", "uint*", nCount,
  2636.  
  2637. "uint*", nSize)
  2638.     VarSetCapacity(ci, nSize)
  2639.     DllCall("gdiplus\GdipGetImageEncoders", "uint", nCount, "uint",
  2640.  
  2641. nSize, Ptr, &ci)
  2642.     if !(nCount && nSize)
  2643.         return -2
  2644.    
  2645.     If (A_IsUnicode){
  2646.         StrGet_Name := "StrGet"
  2647.         Loop, %nCount%
  2648.         {
  2649.             sString := %StrGet_Name%(NumGet(ci, (idx :=
  2650.  
  2651. (48+7*A_PtrSize)*(A_Index-1))+32+3*A_PtrSize), "UTF-16")
  2652.             if !InStr(sString, "*" Extension)
  2653.                 continue
  2654.            
  2655.             pCodec := &ci+idx
  2656.             break
  2657.         }
  2658.     } else {
  2659.         Loop, %nCount%
  2660.         {
  2661.             Location := NumGet(ci, 76*(A_Index-1)+44)
  2662.             nSize := DllCall("WideCharToMultiByte", "uint", 0,
  2663.  
  2664. "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0,
  2665.  
  2666. "uint", 0)
  2667.             VarSetCapacity(sString, nSize)
  2668.             DllCall("WideCharToMultiByte", "uint", 0, "uint", 0,
  2669.  
  2670. "uint", Location, "int", -1, "str", sString, "int", nSize, "uint", 0,
  2671.  
  2672. "uint", 0)
  2673.             if !InStr(sString, "*" Extension)
  2674.                 continue
  2675.            
  2676.             pCodec := &ci+76*(A_Index-1)
  2677.             break
  2678.         }
  2679.     }
  2680.    
  2681.     if !pCodec
  2682.         return -3
  2683.  
  2684.     if (Quality != 75)
  2685.     {
  2686.         Quality := (Quality < 0) ? 0 : (Quality > 100) ? 100 :
  2687.  
  2688. Quality
  2689.         if Extension in .JPG,.JPEG,.JPE,.JFIF
  2690.         {
  2691.             DllCall("gdiplus\GdipGetEncoderParameterListSize",
  2692.  
  2693. Ptr, pBitmap, Ptr, pCodec, "uint*", nSize)
  2694.             VarSetCapacity(EncoderParameters, nSize, 0)
  2695.             DllCall("gdiplus\GdipGetEncoderParameterList", Ptr,
  2696.  
  2697. pBitmap, Ptr, pCodec, "uint", nSize, Ptr, &EncoderParameters)
  2698.             Loop, % NumGet(EncoderParameters, "UInt")      ;%
  2699.             {
  2700.                 elem := (24+(A_PtrSize ? A_PtrSize : 4))*
  2701.  
  2702. (A_Index-1) + 4 + (pad := A_PtrSize = 8 ? 4 : 0)
  2703.                 if (NumGet(EncoderParameters, elem+16,
  2704.  
  2705. "UInt") = 1) && (NumGet(EncoderParameters, elem+20, "UInt") = 6)
  2706.                 {
  2707.                     p := elem+&EncoderParameters-pad-4
  2708.                     NumPut(Quality, NumGet(NumPut(4,
  2709.  
  2710. NumPut(1, p+0)+20, "UInt")), "UInt")
  2711.                     break
  2712.                 }
  2713.             }      
  2714.         }
  2715.     }
  2716.  
  2717.     if (!A_IsUnicode)
  2718.     {
  2719.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint",
  2720.  
  2721. 0, Ptr, &sOutput, "int", -1, Ptr, 0, "int", 0)
  2722.         VarSetCapacity(wOutput, nSize*2)
  2723.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr,
  2724.  
  2725. &sOutput, "int", -1, Ptr, &wOutput, "int", nSize)
  2726.         VarSetCapacity(wOutput, -1)
  2727.         if !VarSetCapacity(wOutput)
  2728.             return -4
  2729.         E := DllCall("gdiplus\GdipSaveImageToFile", Ptr, pBitmap,
  2730.  
  2731. Ptr, &wOutput, Ptr, pCodec, "uint", p ? p : 0)
  2732.     }
  2733.     else
  2734.         E := DllCall("gdiplus\GdipSaveImageToFile", Ptr, pBitmap,
  2735.  
  2736. Ptr, &sOutput, Ptr, pCodec, "uint", p ? p : 0)
  2737.     return E ? -5 : 0
  2738. }
  2739.  
  2740. Gdip_Shutdown(pToken)
  2741. {
  2742.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2743.    
  2744.     DllCall("gdiplus\GdiplusShutdown", Ptr, pToken)
  2745.     if hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
  2746.         DllCall("FreeLibrary", Ptr, hModule)
  2747.     return 0
  2748. }
  2749.  
  2750. Gdip_GetImageDimensions(pBitmap, ByRef Width, ByRef Height)
  2751. {
  2752.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2753.     DllCall("gdiplus\GdipGetImageWidth", Ptr, pBitmap, "uint*", Width)
  2754.     DllCall("gdiplus\GdipGetImageHeight", Ptr, pBitmap, "uint*", Height)
  2755. }
  2756.  
  2757. Gdip_GetRotatedDimensions(Width, Height, Angle, ByRef RWidth, ByRef RHeight)
  2758. {
  2759.     pi := 3.14159, TAngle := Angle*(pi/180)
  2760.     if !(Width && Height)
  2761.         return -1
  2762.     RWidth := Ceil(Abs(Width*Cos(TAngle))+Abs(Height*Sin(TAngle)))
  2763.     RHeight := Ceil(Abs(Width*Sin(TAngle))+Abs(Height*Cos(Tangle)))
  2764. }
  2765.  
  2766. ;###########################################################################
  2767.  
  2768. ##########
  2769. Gdip_GetRotatedTranslation(Width, Height, Angle, ByRef xTranslation, ByRef
  2770.  
  2771. yTranslation)
  2772. {
  2773.     pi := 3.14159, TAngle := Angle*(pi/180)
  2774.  
  2775.     Bound := (Angle >= 0) ? Mod(Angle, 360) : 360-Mod(-Angle, -360)
  2776.     if ((Bound >= 0) && (Bound <= 90))
  2777.         xTranslation := Height*Sin(TAngle), yTranslation := 0
  2778.     else if ((Bound > 90) && (Bound <= 180))
  2779.         xTranslation := (Height*Sin(TAngle))-(Width*Cos(TAngle)),
  2780.  
  2781. yTranslation := -Height*Cos(TAngle)
  2782.     else if ((Bound > 180) && (Bound <= 270))
  2783.         xTranslation := -(Width*Cos(TAngle)), yTranslation := -
  2784.  
  2785. (Height*Cos(TAngle))-(Width*Sin(TAngle))
  2786.     else if ((Bound > 270) && (Bound <= 360))
  2787.         xTranslation := 0, yTranslation := -Width*Sin(TAngle)
  2788. }
  2789.  
  2790. Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="",
  2791.  
  2792. sw="", sh="", Matrix=1){
  2793.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2794.     if (Matrix&1 = "")
  2795.         ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
  2796.     else if (Matrix != 1)
  2797.         ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|
  2798.  
  2799. 0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
  2800.     if(sx = "" && sy = "" && sw = "" && sh = ""){
  2801.         if(dx = "" && dy = "" && dw = "" && dh = ""){
  2802.             sx := dx := 0, sy := dy := 0
  2803.             sw := dw := Gdip_GetImageWidth(pBitmap)
  2804.             sh := dh := Gdip_GetImageHeight(pBitmap)
  2805.         }else   {
  2806.             sx := sy := 0,sw := Gdip_GetImageWidth(pBitmap),sh
  2807.  
  2808. := Gdip_GetImageHeight(pBitmap)
  2809.         }
  2810.     }
  2811.     E := DllCall("gdiplus\GdipDrawImageRectRect", Ptr, pGraphics, Ptr,
  2812.  
  2813. pBitmap, "float", dx, "float", dy, "float", dw, "float", dh, "float", sx,
  2814.  
  2815. "float", sy, "float", sw, "float", sh, "int", 2, Ptr, ImageAttr, Ptr, 0,
  2816.  
  2817. Ptr, 0)
  2818.     if ImageAttr
  2819.         Gdip_DisposeImageAttributes(ImageAttr)
  2820.     return E
  2821. }
  2822. Gdip_SetImageAttributesColorMatrix(Matrix){
  2823.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2824.     VarSetCapacity(ColourMatrix, 100, 0)
  2825.     Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])",
  2826.  
  2827. "$1", "", 1), "[^\d-\.]+", "|")
  2828.     StringSplit, Matrix, Matrix, |
  2829.     Loop, 25
  2830.     {
  2831.         Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod
  2832.  
  2833. (A_Index-1, 6) ? 0 : 1
  2834.         NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
  2835.     }
  2836.     DllCall("gdiplus\GdipCreateImageAttributes", A_PtrSize ? "UPtr*" :
  2837.  
  2838. "uint*", ImageAttr)
  2839.     DllCall("gdiplus\GdipSetImageAttributesColorMatrix", Ptr, ImageAttr,
  2840.  
  2841. "int", 1, "int", 1, Ptr, &ColourMatrix, Ptr, 0, "int", 0)
  2842.     return ImageAttr
  2843. }
  2844. Gdip_GetImageWidth(pBitmap){
  2845.    DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt",
  2846.  
  2847. pBitmap, "uint*", Width)
  2848.    return Width
  2849. }
  2850. Gdip_GetImageHeight(pBitmap){
  2851.    DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt",
  2852.  
  2853. pBitmap, "uint*", Height)
  2854.    return Height
  2855. }
  2856. Gdip_DeletePen(pPen){
  2857.    return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt",
  2858.  
  2859. pPen)
  2860. }
  2861. Gdip_DeleteBrush(pBrush){
  2862.    return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt",
  2863.  
  2864. pBrush)
  2865. }
  2866. Gdip_DisposeImage(pBitmap){
  2867.    return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt",
  2868.  
  2869. pBitmap)
  2870. }
  2871. Gdip_DeleteGraphics(pGraphics){
  2872.    return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt",
  2873.  
  2874. pGraphics)
  2875. }
  2876. Gdip_DisposeImageAttributes(ImageAttr){
  2877.     return DllCall("gdiplus\GdipDisposeImageAttributes", A_PtrSize ?
  2878.  
  2879. "UPtr" : "UInt", ImageAttr)
  2880. }
  2881. Gdip_DeleteFont(hFont){
  2882.    return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt",
  2883.  
  2884. hFont)
  2885. }
  2886. Gdip_DeleteStringFormat(hFormat){
  2887.    return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" :
  2888.  
  2889. "UInt", hFormat)
  2890. }
  2891. Gdip_DeleteFontFamily(hFamily){
  2892.    return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" :
  2893.  
  2894. "UInt", hFamily)
  2895. }
  2896. CreateCompatibleDC(hdc=0){
  2897.    return DllCall("CreateCompatibleDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  2898. }
  2899. SelectObject(hdc, hgdiobj){
  2900.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2901.     return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
  2902. }
  2903. DeleteObject(hObject){
  2904.    return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
  2905. }
  2906. GetDC(hwnd=0){
  2907.     return DllCall("GetDC", A_PtrSize ? "UPtr" : "UInt", hwnd)
  2908. }
  2909. GetDCEx(hwnd, flags=0, hrgnClip=0){
  2910.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2911.     return DllCall("GetDCEx", Ptr, hwnd, Ptr, hrgnClip, "int", flags)
  2912. }
  2913. ReleaseDC(hdc, hwnd=0){
  2914.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2915.     return DllCall("ReleaseDC", Ptr, hwnd, Ptr, hdc)
  2916. }
  2917. DeleteDC(hdc){
  2918.    return DllCall("DeleteDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  2919. }
  2920. Gdip_SetClipRegion(pGraphics, Region, CombineMode=0){
  2921.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2922.     return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr,
  2923.  
  2924. Region, "int", CombineMode)
  2925. }
  2926. CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0){
  2927.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2928.     hdc2 := hdc ? hdc : GetDC()
  2929.     VarSetCapacity(bi, 40, 0)
  2930.     NumPut(w, bi, 4, "uint"), NumPut(h, bi, 8, "uint"), NumPut(40, bi,
  2931.  
  2932. 0, "uint"), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16, "uInt"), NumPut
  2933.  
  2934. (bpp, bi, 14, "ushort")
  2935.     hbm := DllCall("CreateDIBSection", Ptr, hdc2, Ptr, &bi, "uint", 0,
  2936.  
  2937. A_PtrSize ? "UPtr*" : "uint*", ppvBits, Ptr, 0, "uint", 0, Ptr)
  2938.     if !hdc
  2939.         ReleaseDC(hdc2)
  2940.     return hbm
  2941. }
  2942. Gdip_GraphicsFromImage(pBitmap){
  2943.     DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" :
  2944.  
  2945. "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  2946.     return pGraphics
  2947. }
  2948. Gdip_GraphicsFromHDC(hdc){
  2949.     DllCall("gdiplus\GdipCreateFromHDC", A_PtrSize ? "UPtr" : "UInt", hdc,
  2950.  
  2951. A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  2952.     return pGraphics
  2953. }
  2954. Gdip_GetDC(pGraphics){
  2955.     DllCall("gdiplus\GdipGetDC", A_PtrSize ? "UPtr" : "UInt", pGraphics,
  2956.  
  2957. A_PtrSize ? "UPtr*" : "UInt*", hdc)
  2958.     return hdc
  2959. }
  2960.  
  2961.  
  2962. Gdip_Startup(){
  2963.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  2964.     if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
  2965.         DllCall("LoadLibrary", "str", "gdiplus")
  2966.     VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
  2967.     DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*",
  2968.  
  2969. pToken, Ptr, &si, Ptr, 0)
  2970.     return pToken
  2971. }
  2972. Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="",
  2973.  
  2974. Height="", Measure=0){
  2975.     IWidth := Width, IHeight:= Height
  2976.     RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
  2977.     RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
  2978.     RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
  2979.     RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
  2980.     RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
  2981.     RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
  2982.     RegExMatch(Options, "i)NoWrap", NoWrap)
  2983.     RegExMatch(Options, "i)R(\d)", Rendering)
  2984.     RegExMatch(Options, "i)S(\d+)(p*)", Size)
  2985.     if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
  2986.         PassBrush := 1, pBrush := Colour2
  2987.     if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 ||
  2988.  
  2989. Size2)
  2990.         return -1
  2991.     Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|
  2992.  
  2993. Strikeout"
  2994.     Loop, Parse, Styles, |
  2995.     {
  2996.         if RegExMatch(Options, "\b" A_loopField)
  2997.         Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
  2998.     }
  2999.     Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
  3000.     Loop, Parse, Alignments, |
  3001.     {
  3002.         if RegExMatch(Options, "\b" A_loopField)
  3003.             Align |= A_Index//2.1      ; 0|0|1|1|2|2
  3004.     }
  3005.     xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
  3006.     ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
  3007.     Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
  3008.     Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 :
  3009.  
  3010. IHeight
  3011.     if !PassBrush
  3012.         Colour := "0x" (Colour2 ? Colour2 : "ff000000")
  3013.     Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 :
  3014.  
  3015. 4
  3016.     Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
  3017.     hFamily := Gdip_FontFamilyCreate(Font)
  3018.     hFont := Gdip_FontCreate(hFamily, Size, Style)
  3019.     FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
  3020.     hFormat := Gdip_StringFormatCreate(FormatStyle)
  3021.     pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
  3022.     if !(hFamily && hFont && hFormat && pBrush && pGraphics)
  3023.         return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !
  3024.  
  3025. hFormat ? -5 : !pBrush ? -6 : 0
  3026.     CreateRectF(RC, xpos, ypos, Width, Height)
  3027.     Gdip_SetStringFormatAlign(hFormat, Align)
  3028.     Gdip_SetTextRenderingHint(pGraphics, Rendering)
  3029.     ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  3030.     if vPos
  3031.     {
  3032.         StringSplit, ReturnRC, ReturnRC, |
  3033.         if (vPos = "vCentre") || (vPos = "vCenter")
  3034.             ypos += (Height-ReturnRC4)//2
  3035.         else if (vPos = "Top") || (vPos = "Up")
  3036.             ypos := 0
  3037.         else if (vPos = "Bottom") || (vPos = "Down")
  3038.             ypos := Height-ReturnRC4
  3039.         CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
  3040.         ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont,
  3041.  
  3042. hFormat, RC)
  3043.     }
  3044.     if !Measure
  3045.         E := Gdip_DrawString(pGraphics, Text, hFont, hFormat,
  3046.  
  3047. pBrush, RC)
  3048.     if !PassBrush
  3049.         Gdip_DeleteBrush(pBrush)
  3050.     Gdip_DeleteStringFormat(hFormat)
  3051.     Gdip_DeleteFont(hFont)
  3052.     Gdip_DeleteFontFamily(hFamily)
  3053.     return E ? E : ReturnRC
  3054. }
  3055. Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF){
  3056.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3057.     if (!A_IsUnicode)
  3058.     {
  3059.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint",
  3060.  
  3061. 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
  3062.         VarSetCapacity(wString, nSize*2)
  3063.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr,
  3064.  
  3065. &sString, "int", -1, Ptr, &wString, "int", nSize)
  3066.     }
  3067.     return DllCall("gdiplus\GdipDrawString", Ptr, pGraphics, Ptr,
  3068.  
  3069. A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr,
  3070.  
  3071. hFormat, Ptr, pBrush)
  3072. }
  3073. Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1){
  3074.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3075.     CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
  3076.     DllCall("gdiplus\GdipCreateLineBrush", Ptr, &PointF1, Ptr, &PointF2,
  3077.  
  3078. "Uint", ARGB1, "Uint", ARGB2, "int", WrapMode, A_PtrSize ? "UPtr*" :
  3079.  
  3080. "UInt*", LGpBrush)
  3081.     return LGpBrush
  3082. }
  3083. Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1,
  3084.  
  3085. WrapMode=1){
  3086.     CreateRectF(RectF, x, y, w, h)
  3087.     DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" :
  3088.  
  3089. "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode,
  3090.  
  3091. "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  3092.     return LGpBrush
  3093. }
  3094. Gdip_CloneBrush(pBrush){
  3095.     DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt",
  3096.  
  3097. pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
  3098.     return pBrushClone
  3099. }
  3100. Gdip_FontFamilyCreate(Font){
  3101.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3102.     if (!A_IsUnicode)
  3103.     {
  3104.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint",
  3105.  
  3106. 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
  3107.         VarSetCapacity(wFont, nSize*2)
  3108.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr,
  3109.  
  3110. &Font, "int", -1, Ptr, &wFont, "int", nSize)
  3111.     }
  3112.     DllCall("gdiplus\GdipCreateFontFamilyFromName", Ptr, A_IsUnicode ?
  3113.  
  3114. &Font : &wFont, "uint", 0, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
  3115.     return hFamily
  3116. }
  3117. Gdip_SetStringFormatAlign(hFormat, Align){
  3118.    return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" :
  3119.  
  3120. "UInt", hFormat, "int", Align)
  3121. }
  3122. Gdip_StringFormatCreate(Format=0, Lang=0){
  3123.    DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang,
  3124.  
  3125. A_PtrSize ? "UPtr*" : "UInt*", hFormat)
  3126.    return hFormat
  3127. }
  3128. Gdip_FontCreate(hFamily, Size, Style=0){
  3129.    DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily,
  3130.  
  3131. "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
  3132.    return hFont
  3133. }
  3134. Gdip_CreatePen(ARGB, w){
  3135.    DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2,
  3136.  
  3137. A_PtrSize ? "UPtr*" : "UInt*", pPen)
  3138.    return pPen
  3139. }
  3140. Gdip_CreatePenFromBrush(pBrush, w){
  3141.     DllCall("gdiplus\GdipCreatePen2", A_PtrSize ? "UPtr" : "UInt",
  3142.  
  3143. pBrush, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  3144.     return pPen
  3145. }
  3146. Gdip_BrushCreateSolid(ARGB=0xff000000){
  3147.     DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ?
  3148.  
  3149. "UPtr*" : "UInt*", pBrush)
  3150.     return pBrush
  3151. }
  3152. Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0){
  3153.     DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "UInt",
  3154.  
  3155. ARGBfront, "UInt", ARGBback, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  3156.     return pBrush
  3157. }
  3158. CreateRectF(ByRef RectF, x, y, w, h){
  3159.    VarSetCapacity(RectF, 16)
  3160.    NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w,
  3161.  
  3162. RectF, 8, "float"), NumPut(h, RectF, 12, "float")
  3163. }
  3164. Gdip_SetTextRenderingHint(pGraphics, RenderingHint){
  3165.     return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ?
  3166.  
  3167. "UPtr" : "UInt", pGraphics, "int", RenderingHint)
  3168. }
  3169. Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF){
  3170.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3171.     VarSetCapacity(RC, 16)
  3172.     if !A_IsUnicode
  3173.     {
  3174.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint",
  3175.  
  3176. 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
  3177.         VarSetCapacity(wString, nSize*2)
  3178.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr,
  3179.  
  3180. &sString, "int", -1, Ptr, &wString, "int", nSize)
  3181.     }
  3182.     DllCall("gdiplus\GdipMeasureString", Ptr, pGraphics, Ptr,
  3183.  
  3184. A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr,
  3185.  
  3186. hFormat, Ptr, &RC, "uint*", Chars, "uint*", Lines)
  3187.     return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|"
  3188.  
  3189. NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
  3190. }
  3191. CreateRect(ByRef Rect, x, y, w, h){
  3192.     VarSetCapacity(Rect, 16)
  3193.     NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w,
  3194.  
  3195. Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
  3196. }
  3197. CreateSizeF(ByRef SizeF, w, h){
  3198.    VarSetCapacity(SizeF, 8)
  3199.    NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")
  3200. }
  3201. CreatePointF(ByRef PointF, x, y){
  3202.    VarSetCapacity(PointF, 8)
  3203.    NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")
  3204. }
  3205. Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  3206.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3207.     return DllCall("gdiplus\GdipDrawArc", Ptr, pGraphics, Ptr, pPen,
  3208.  
  3209. "float", x, "float", y, "float", w, "float", h, "float", StartAngle,
  3210.  
  3211. "float", SweepAngle)
  3212. }
  3213. Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  3214.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3215.     return DllCall("gdiplus\GdipDrawPie", Ptr, pGraphics, Ptr, pPen,
  3216.  
  3217. "float", x, "float", y, "float", w, "float", h, "float", StartAngle,
  3218.  
  3219. "float", SweepAngle)
  3220. }
  3221. Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2){
  3222.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3223.     return DllCall("gdiplus\GdipDrawLine", Ptr, pGraphics, Ptr, pPen,
  3224.  
  3225. "float", x1, "float", y1, "float", x2, "float", y2)
  3226. }
  3227. Gdip_DrawLines(pGraphics, pPen, Points){
  3228.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3229.     StringSplit, Points, Points, |
  3230.     VarSetCapacity(PointF, 8*Points0)
  3231.     Loop, %Points0%
  3232.     {
  3233.         StringSplit, Coord, Points%A_Index%, `,
  3234.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut
  3235.  
  3236. (Coord2, PointF, (8*(A_Index-1))+4, "float")
  3237.     }
  3238.     return DllCall("gdiplus\GdipDrawLines", Ptr, pGraphics, Ptr, pPen,
  3239.  
  3240. Ptr, &PointF, "int", Points0)
  3241. }
  3242. Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h){
  3243.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3244.     return DllCall("gdiplus\GdipFillRectangle", Ptr, pGraphics, Ptr,
  3245.  
  3246. pBrush, "float", x, "float", y, "float", w, "float", h)
  3247. }
  3248. Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r){
  3249.     Region := Gdip_GetClipRegion(pGraphics)
  3250.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  3251.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  3252.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  3253.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  3254.     E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
  3255.     Gdip_SetClipRegion(pGraphics, Region, 0)
  3256.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  3257.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  3258.     Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
  3259.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
  3260.     Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
  3261.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  3262.     Gdip_SetClipRegion(pGraphics, Region, 0)
  3263.     Gdip_DeleteRegion(Region)
  3264.     return E
  3265. }
  3266. Gdip_GetClipRegion(pGraphics){
  3267.     Region := Gdip_CreateRegion()
  3268.     DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt",
  3269.  
  3270. pGraphics, "UInt*", Region)
  3271.     return Region
  3272. }
  3273. Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0){
  3274.    return DllCall("gdiplus\GdipSetClipRect",  A_PtrSize ? "UPtr" : "UInt",
  3275.  
  3276. pGraphics, "float", x, "float", y, "float", w, "float", h, "int",
  3277.  
  3278. CombineMode)
  3279. }
  3280. Gdip_SetClipPath(pGraphics, Path, CombineMode=0){
  3281.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3282.     return DllCall("gdiplus\GdipSetClipPath", Ptr, pGraphics, Ptr, Path,
  3283.  
  3284. "int", CombineMode)
  3285. }
  3286. Gdip_ResetClip(pGraphics){
  3287.    return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt",
  3288.  
  3289. pGraphics)
  3290. }
  3291. Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h){
  3292.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3293.     return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr,
  3294.  
  3295. pBrush, "float", x, "float", y, "float", w, "float", h)
  3296. }
  3297. Gdip_FillRegion(pGraphics, pBrush, Region){
  3298.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3299.     return DllCall("gdiplus\GdipFillRegion", Ptr, pGraphics, Ptr,
  3300.  
  3301. pBrush, Ptr, Region)
  3302. }
  3303. Gdip_FillPath(pGraphics, pBrush, Path){
  3304.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3305.     return DllCall("gdiplus\GdipFillPath", Ptr, pGraphics, Ptr, pBrush,
  3306.  
  3307. Ptr, Path)
  3308. }
  3309. Gdip_CreateRegion(){
  3310.     DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
  3311.     return Region
  3312. }
  3313. Gdip_DeleteRegion(Region){
  3314.     return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" :
  3315.  
  3316. "UInt", Region)
  3317. }
  3318. Gdip_CreateBitmap(Width, Height, Format=0x26200A){
  3319.     DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int",
  3320.  
  3321. Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ?
  3322.  
  3323. "UPtr*" : "uint*", pBitmap)
  3324.     Return pBitmap
  3325. }
  3326. Gdip_SetSmoothingMode(pGraphics, SmoothingMode){
  3327.    return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" :
  3328.  
  3329. "UInt", pGraphics, "int", SmoothingMode)
  3330. }
  3331. Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h){
  3332.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3333.     return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr,
  3334.  
  3335. pPen, "float", x, "float", y, "float", w, "float", h)
  3336. }
  3337. Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r){
  3338.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  3339.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  3340.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  3341.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  3342.     E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
  3343.     Gdip_ResetClip(pGraphics)
  3344.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  3345.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  3346.     Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
  3347.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
  3348.     Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
  3349.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  3350.     Gdip_ResetClip(pGraphics)
  3351.     return E
  3352. }
  3353. Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h){
  3354.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3355.     return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen,
  3356.  
  3357. "float", x, "float", y, "float", w, "float", h)
  3358. }
  3359. Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff){
  3360.     DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", A_PtrSize ? "UPtr" :
  3361.  
  3362. "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hbm, "int", Background)
  3363.     return hbm
  3364. }
  3365. SetImage(hwnd, hBitmap){
  3366.     SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
  3367.     E := ErrorLevel
  3368.     DeleteObject(E)
  3369.     return E
  3370. }
  3371. Gdip_FillPolygon(pGraphics, pBrush, Points, FillMode=0){
  3372.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  3373.     StringSplit, Points, Points, |
  3374.     VarSetCapacity(PointF, 8*Points0)
  3375.     Loop, %Points0%
  3376.     {
  3377.         StringSplit, Coord, Points%A_Index%, `,
  3378.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut
  3379.  
  3380. (Coord2, PointF, (8*(A_Index-1))+4, "float")
  3381.     }
  3382.     return DllCall("gdiplus\GdipFillPolygon", Ptr, pGraphics, Ptr,
  3383.  
  3384. pBrush, Ptr, &PointF, "int", Points0, "int", FillMode)
  3385. }
  3386.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement