daily pastebin goal
59%
SHARE
TWEET

AHK_Basic - 3D apple

a guest Jan 15th, 2012 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance, Force
  2. #NoEnv
  3. SetBatchLines, -1
  4.  
  5. ;Set The following variable to either the following: a valid url, a valid path to a file, or "Stored"
  6. WhichSource := "http://pastebin.com/raw.php?i=TMX8br7B"
  7. ;http://pastebin.com/raw.php?i=TMX8br7B - Apple on the internet
  8.  
  9. list := "NothingHere"
  10. If (InStr(WhichSource, "://"))
  11. {
  12.         UrlDownloadToFile, %WhichSource%, %A_Temp%\3ddata.txt
  13.         FileRead, list, %A_Temp%\3ddata.txt
  14.         FileDelete, %A_Temp%\3ddata.txt
  15. }
  16. Else If (FileExist(WhichSource))
  17.         FileRead, list, %WhichSource%
  18. Else If (WhichSource = "Stored")
  19.         LoadFailSafe()
  20.  
  21. If (SubStr(list, 1, 13) != "# ImageMagick")
  22. {
  23.         MsgBox, This doesn't look like a valid ImageMagick txt file - Loading FailSafe.
  24.         LoadFailSafe()
  25. }
  26.  
  27. lines := 1
  28. loop, parse, list, `n, `r
  29. {
  30.         If (a_loopfield != "" && SubStr(a_loopfield,1,1) != "#")
  31.     {
  32.         StringSplit, line, a_loopfield, `:
  33.         StringSplit, cords, line1,`,
  34.             RegExMatch(a_loopfield, "#(.*?)" . a_space, RGBA)
  35.         If (StrLen(RGBA1) = 6)
  36.                 RGBA := "FF" . RGBA1
  37.         If (StrLen(RGBA1) = 8)
  38.                 RGBA := SubStr(RGBA1, 7, 2) . SubStr(RGBA1, 1, 6)
  39.         lOx_%lines%_1 := cords1 - 15
  40.         lOx_%lines%_2 := cords1 - 14
  41.                 lOy_%lines%_1 := cords2 - 15
  42.         lOy_%lines%_2 := cords2 - 14
  43.             lOz_%lines%_1 := 0
  44.                 lOz_%lines%_2 := 0
  45.         lOc_%lines% := RGBA
  46.         lines += 1
  47.         }
  48. }
  49.  
  50. NumLines := lines - 1
  51.  
  52. PI := 3.141592
  53. Width := A_ScreenWidth, Height := A_ScreenHeight
  54.  
  55. Loop, 360
  56. {
  57.         s_%a_index% := Sin(a_index * (PI / 180))
  58.         c_%a_index% := COS(a_index * (PI / 180))
  59.  
  60. }
  61.  
  62. xCenter := Width / 2
  63. yCenter := Height / 2
  64. zCenter := 256
  65. Scale := 4096
  66. theta := 0
  67. phi := 0
  68. thetaRot := 2
  69. phiRot := 2
  70. Clock := 0
  71.  
  72. ; Start gdi+
  73. If !pToken := Gdip_Startup()
  74. {
  75.         MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
  76.         ExitApp
  77. }
  78. OnExit, Exit
  79.  
  80. Gui, 1: -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
  81. Gui, 1: Show, NA
  82. hwnd1 := WinExist()
  83.  
  84. hbm := CreateDIBSection(Width, Height)
  85. hdc := CreateCompatibleDC()
  86. obm := SelectObject(hdc, hbm)
  87. G := Gdip_GraphicsFromHDC(hdc)
  88. Gdip_SetSmoothingMode(G, 4)
  89.  
  90. Loop
  91. {
  92.         TickCount := A_TickCount
  93.         Loop, % NumLines
  94.         {
  95.             theta += 1
  96.             phi += 1
  97.                 lRx_%a_index%_1 := (lOx_%a_index%_1 * -1) * s_%theta% + lOy_%a_index%_1 * c_%theta%
  98.                 lRy_%a_index%_1 := (lOx_%a_index%_1 * -1) * c_%theta% * s_%phi% - lOy_%a_index%_1 * s_%theta% * s_%phi% - lOz_%a_index%_1 * c_%phi% + 1
  99.                 lRz_%a_index%_1 := (lOx_%a_index%_1 * -1) * c_%theta% * c_%phi% - lOy_%a_index%_1 * s_%theta% * c_%phi% + lOz_%a_index%_1 * s_%phi%
  100.        
  101.                 lRx_%a_index%_2 := (lOx_%a_index%_2 * -1) * s_%theta% + lOy_%a_index%_2 * c_%theta%
  102.                 lRy_%a_index%_2 := (lOx_%a_index%_2 * -1) * c_%theta% * s_%phi% - lOy_%a_index%_2 * s_%theta% * s_%phi% - lOz_%a_index%_2 * c_%phi% + 1
  103.                 lRz_%a_index%_2 := (lOx_%a_index%_2 * -1) * c_%theta% * c_%phi% - lOy_%a_index%_2 * s_%theta% * c_%phi% + lOz_%a_index%_2 * s_%phi%
  104.  
  105.                 IF ((lRz_%a_index%_1 + zCenter) != 0)
  106.                 {
  107.                         scrX_%a_index%_1 := Scale * (lRx_%a_index%_1 / (lRz_%a_index%_1 + zCenter)) + xCenter
  108.                         scrY_%a_index%_1 := Scale * -(lRy_%a_index%_1 / (lRz_%a_index%_1 + zCenter)) + yCenter
  109.                 }
  110.  
  111.                 IF ((lRz_%a_index%_2 + zCenter) != 0)
  112.                 {
  113.                         scrX_%a_index%_2 := Scale * (lRx_%a_index%_2 / (lRz_%a_index%_2 + zCenter)) + xCenter
  114.                         scrY_%a_index%_2 := Scale * -(lRy_%a_index%_2 / (lRz_%a_index%_2 + zCenter)) + yCenter
  115.                 }
  116.         theta -= 1
  117.             phi -= 1
  118.         }
  119.         Loop, % NumLines
  120.         {
  121.             Values := "0x" . SubStr(lOc_%a_index%, 1, 8)
  122.             pPen := Gdip_CreatePen(Values, 12)
  123.                 Gdip_DrawLine(G, pPen, scrX_%a_index%_1, scrY_%a_index%_1, scrX_%a_index%_2, scrY_%a_index%_2)
  124.             Gdip_DrawLine(G, pPen, scrX_%a_index%_1, scrY_%a_index%_2, scrX_%a_index%_2, scrY_%a_index%_1)
  125.             Gdip_DeletePen(pPen)
  126.         }
  127.  
  128.         theta := Mod(theta + thetaRot,360)
  129.         phi := Mod(phi + phiRot,360)
  130.         Clock += .1
  131.  
  132.         UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2), Width, Height)
  133.         Gdip_GraphicsClear(G)
  134.         Sleep, % 33 - (A_TickCount - TickCount)
  135. }
  136. Return
  137.  
  138. LoadFailSafe()
  139. {
  140. global list
  141. list := "# ImageMagick pixel "
  142. list .= "enumeration: 32,32,255,rgba`r`n0,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n11,0: (  0,  0,  0,255)  #000000  black`r`n12,0: (  0,  0,  0,255)  #000000  black`r`n13,0: (  0,  0,  0,255)  #000000  black`r`n14,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n15,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n16,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n17,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n18,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n19,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n20,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n21,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n22,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n23,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n24,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,0: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,1: (  0,  0,  0,255)  #000000  black`r`n11,1: (255,255, 66,255)  #FFFF42  rgba(255,255,66,1)`r`n12,1: (255,255, 66,255)  #FFFF42  rgba(255,255,66,1)`r`n13,1: (198,198,  0,255)  #C6C600  rgba(198,198,0,1)`r`n14,1: (  0,  0,  0,255)  #000000  black`r`n15,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n16,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n17,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n18,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n19,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n20,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n21,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n22,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n23,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n24,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,1: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,2: (  0,  0,  0,255)  #000000  black`r`n11,2: (255,255, 66,255)  #FFFF42  rgba(255,255,66,1)`r`n12,2: (198,198,  0,255)  #C6C600  rgba(198,198,0,1)`r`n13,2: (198,198,  0,255)  #C6C600  rgba(198,198,0,1)`r`n14,2: (  0,  0,  0,255)  #000000  black`r`n15,2: (  0,  0,  0,255)  #000000  black`r`n16,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n17,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n18,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n19,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n20,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n21,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n22,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n23,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n24,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,2: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n11,3: (  0,  0,  0,255)  #000000  black`r`n12,3: (198,198,  0,255)  #C6C600  rgba(198,198,0,1)`r`n13,3: (198,198,  0,255)  #C6C600  rgba(198,198,0,1)`r`n14,3: (132,132,  0,255)  #848400  rgba(132,132,0,1)`r`n15,3: (  0,  0,  0,255)  #000000  black`r`n16,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n17,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n18,3: (  0,  0,  0,255)  #000000  black`r`n19,3: (  0,  0,  0,255)  #000000  black`r`n20,3: (  0,  0,  0,255)  #000000  black`r`n21,3: (  0,  0,  0,255)  #000000  black`r`n22,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n23,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n24,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,3: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n11,4: (  0,  0,  0,255)  #000000  black`r`n12,4: (198,198,  0,255)  #C6C600  rgba(198,198,0,1)`r`n13,4: (132,132,  0,255)  #848400  rgba(132,132,0,1)`r`n14,4: (132,132,  0,255)  #848400  rgba(132,132,0,1)`r`n15,4: (  0,  0,  0,255)  #000000  black`r`n16,4: (  0,  0,  0,255)  #000000  black`r`n17,4: (  0,  0,  0,255)  #000000  black`r`n18,4: (  0,255,  0,255)  #00FF00  lime`r`n19,4: (  0,255,  0,255)  #00FF00  lime`r`n20,4: (  0,255,  0,255)  #00FF00  lime`r`n21,4: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n22,4: (  0,  0,  0,255)  #000000  black`r`n23,4: (  0,  0,  0,255)  #000000  black`r`n24,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,4: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n11,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n12,5: (  0,  0,  0,255)  #000000  black`r`n13,5: (132,132,  0,255)  #848400  rgba(132,132,0,1)`r`n14,5: (132,132,  0,255)  #848400  rgba(132,132,0,1)`r`n15,5: (  0,  0,  0,255)  #000000  black`r`n16,5: (  0,  0,  0,255)  #000000  black`r`n17,5: (  0,255,  0,255)  #00FF00  lime`r`n18,5: (  0,255,  0,255)  #00FF00  lime`r`n19,5: (  0,255,  0,255)  #00FF00  lime`r`n20,5: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n21,5: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n22,5: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n23,5: (  0,  0,  0,255)  #000000  black`r`n24,5: (  0,  0,  0,255)  #000000  black`r`n25,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255"
  143. list .= ",255,0)`r`n31,5: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n10,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n11,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n12,6: (  0,  0,  0,255)  #000000  black`r`n13,6: (132,132,  0,255)  #848400  rgba(132,132,0,1)`r`n14,6: ( 66, 66,  0,255)  #424200  rgba(66,66,0,1)`r`n15,6: (  0,  0,  0,255)  #000000  black`r`n16,6: (  0,255,  0,255)  #00FF00  lime`r`n17,6: (  0,255,  0,255)  #00FF00  lime`r`n18,6: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n19,6: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n20,6: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n21,6: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n22,6: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n23,6: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n24,6: (  0,  0,  0,255)  #000000  black`r`n25,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,6: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,7: (  0,  0,  0,255)  #000000  black`r`n10,7: (  0,  0,  0,255)  #000000  black`r`n11,7: (  0,  0,  0,255)  #000000  black`r`n12,7: (  0,  0,  0,255)  #000000  black`r`n13,7: (  0,  0,  0,255)  #000000  black`r`n14,7: ( 66, 66,  0,255)  #424200  rgba(66,66,0,1)`r`n15,7: (  0,  0,  0,255)  #000000  black`r`n16,7: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n17,7: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n18,7: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n19,7: (  0,198,  0,255)  #00C600  rgba(0,198,0,1)`r`n20,7: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n21,7: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n22,7: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n23,7: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n24,7: (  0, 66,  0,255)  #004200  rgba(0,66,0,1)`r`n25,7: (  0,  0,  0,255)  #000000  black`r`n26,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,7: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,8: (  0,  0,  0,255)  #000000  black`r`n8,8: (  0,  0,  0,255)  #000000  black`r`n9,8: (255,  0,  0,255)  #FF0000  red`r`n10,8: (255,  0,  0,255)  #FF0000  red`r`n11,8: (255,  0,  0,255)  #FF0000  red`r`n12,8: (255,  0,  0,255)  #FF0000  red`r`n13,8: (255,  0,  0,255)  #FF0000  red`r`n14,8: (  0,  0,  0,255)  #000000  black`r`n15,8: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n16,8: (  0,  0,  0,255)  #000000  black`r`n17,8: (  0,  0,  0,255)  #000000  black`r`n18,8: (  0,  0,  0,255)  #000000  black`r`n19,8: (  0,  0,  0,255)  #000000  black`r`n20,8: (  0,  0,  0,255)  #000000  black`r`n21,8: (  0,  0,  0,255)  #000000  black`r`n22,8: (  0,132,  0,255)  #008400  rgba(0,132,0,1)`r`n23,8: (  0, 66,  0,255)  #004200  rgba(0,66,0,1)`r`n24,8: (  0, 66,  0,255)  #004200  rgba(0,66,0,1)`r`n25,8: (  0,  0,  0,255)  #000000  black`r`n26,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,8: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,9: (  0,  0,  0,255)  #000000  black`r`n7,9: (255,  0,  0,255)  #FF0000  red`r`n8,9: (255,  0,  0,255)  #FF0000  red`r`n9,9: (255,  0,  0,255)  #FF0000  red`r`n10,9: (255,  0,  0,255)  #FF0000  red`r`n11,9: (255,  0,  0,255)  #FF0000  red`r`n12,9: (255,  0,  0,255)  #FF0000  red`r`n13,9: (255,  0,  0,255)  #FF0000  red`r`n14,9: (255,  0,  0,255)  #FF0000  red`r`n15,9: (  0,  0,  0,255)  #000000  black`r`n16,9: (  0,  0,  0,255)  #000000  black`r`n17,9: (255,  0,  0,255)  #FF0000  red`r`n18,9: (255,  0,  0,255)  #FF0000  red`r`n19,9: (255,  0,  0,255)  #FF0000  red`r`n20,9: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,9: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,9: (  0,  0,  0,255)  #000000  black`r`n23,9: (  0,  0,  0,255)  #000000  black`r`n24,9: (  0,  0,  0,255)  #000000  black`r`n25,9: (  0, 66,  0,255)  #004200  rgba(0,66,0,1)`r`n26,9: (  0,  0,  0,255)  #000000  black`r`n27,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,9: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,10: (  0,  0,  0,255)  #000000  black`r`n6,10: (255,  0,  0,255)  #FF0000  red`r`n7,10: (255,  0,  0,255)  #FF0000  red`r`n8,10: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n9,10: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n10,10: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n11,10: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n12,10: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,10: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,10: (255,  0,  0,255)  #FF0000  red`r`n15,10: (255,  0,  0,255)  #FF0000  red`r`n16,10: (255,  0,  0,255)  #FF0000  red`r`n17,10: (  0,  0,  0,255)  #000000  black`r`n18,10: (255,  0,  0,255)  #FF0000  red`r`n19,10: (255,  0,  0,255)  #FF0000  red`r`n20,10: (255,  0,  0,255)  #FF0000  red`r`n21,10: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,10: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,10: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,10: (  0,  0,  0,255)  #000000  black`r`n25,10: (  0,  0,  0,255)  #000000  black`r`n26,10: (  0,  0,  0,255)  #000000  black`r`n27,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,10: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,11: (  0,  0,  0,255)  #000000  black`r`n5,11: (255,  0,  0,255)  #FF0000  red`r`n6,11: (255,  0,  0,255)  #FF0000  red`r`n7,11: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,11: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n9,11: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n10,11: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n11,11: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n12,11: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,11: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,11: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,11: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n16,11: (255,  0,  0,255)  #FF0000  red`r`n17,11: (255,  0,  0,255)  #FF0000  red`r`n18,11: (255,  0,  0,255)  #FF0000  red`r`n19,11: (255,  0,  0,255)  #FF0000  red`r`n20,11: (255,  0,  0,255)  #FF0000  red`r`n21,11: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,11: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,11: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,11: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,11: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,11: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,11: (  0,  0,  0,255)  #000000  black`r`n28,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,11: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,12: (  0,  0,  0,255)  #000000  black`r`n5,12: (255,  0,  0,255)  #FF0000  red`r`n6,12: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,12: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,12: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n9,12: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n10,12: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n11,12: (255,132,132,255)  #FF8484  rgba(255"
  144. list .= ",132,132,1)`r`n12,12: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n13,12: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,12: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,12: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n16,12: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n17,12: (255,  0,  0,255)  #FF0000  red`r`n18,12: (255,  0,  0,255)  #FF0000  red`r`n19,12: (255,  0,  0,255)  #FF0000  red`r`n20,12: (255,  0,  0,255)  #FF0000  red`r`n21,12: (255,  0,  0,255)  #FF0000  red`r`n22,12: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,12: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,12: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,12: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,12: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,12: (  0,  0,  0,255)  #000000  black`r`n28,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,12: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,13: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,13: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,13: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,13: (  0,  0,  0,255)  #000000  black`r`n4,13: (255,  0,  0,255)  #FF0000  red`r`n5,13: (255,  0,  0,255)  #FF0000  red`r`n6,13: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,13: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n8,13: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n9,13: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n10,13: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n11,13: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n12,13: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n13,13: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,13: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,13: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n16,13: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n17,13: (255,  0,  0,255)  #FF0000  red`r`n18,13: (255,  0,  0,255)  #FF0000  red`r`n19,13: (255,  0,  0,255)  #FF0000  red`r`n20,13: (255,  0,  0,255)  #FF0000  red`r`n21,13: (255,  0,  0,255)  #FF0000  red`r`n22,13: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,13: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,13: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,13: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,13: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,13: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,13: (  0,  0,  0,255)  #000000  black`r`n29,13: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,13: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,13: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,14: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,14: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,14: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,14: (  0,  0,  0,255)  #000000  black`r`n4,14: (255,  0,  0,255)  #FF0000  red`r`n5,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n6,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,14: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n8,14: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n9,14: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n10,14: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n11,14: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n12,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n16,14: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n17,14: (255,  0,  0,255)  #FF0000  red`r`n18,14: (255,  0,  0,255)  #FF0000  red`r`n19,14: (255,  0,  0,255)  #FF0000  red`r`n20,14: (255,  0,  0,255)  #FF0000  red`r`n21,14: (255,  0,  0,255)  #FF0000  red`r`n22,14: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,14: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,14: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,14: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,14: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,14: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,14: (  0,  0,  0,255)  #000000  black`r`n29,14: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,14: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,14: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,15: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,15: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,15: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,15: (  0,  0,  0,255)  #000000  black`r`n4,15: (255,  0,  0,255)  #FF0000  red`r`n5,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n6,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,15: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n9,15: (255,132,132,255)  #FF8484  rgba(255,132,132,1)`r`n10,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n11,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n12,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n16,15: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n17,15: (255,  0,  0,255)  #FF0000  red`r`n18,15: (255,  0,  0,255)  #FF0000  red`r`n19,15: (255,  0,  0,255)  #FF0000  red`r`n20,15: (255,  0,  0,255)  #FF0000  red`r`n21,15: (255,  0,  0,255)  #FF0000  red`r`n22,15: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,15: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,15: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,15: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,15: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,15: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,15: (  0,  0,  0,255)  #000000  black`r`n29,15: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,15: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,15: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,16: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,16: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,16: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,16: (  0,  0,  0,255)  #000000  black`r`n4,16: (255,  0,  0,255)  #FF0000  red`r`n5,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n6,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n9,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n10,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n11,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n12,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,16: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n16,16: (255,  0,  0,255)  #FF0000  red`r`n17,16: (255,  0,  0,255)  #FF0000  red`r`n18,16: (255,  0,  0,255)  #FF0000  red`r`n19,16: (255,  0,  0,255)  #FF0000  red`r`n20,16: (255,  0,  0,255)  #FF0000  red`r`n21,16: (255,  0,  0,255)  #FF0000  red`r`n22,16: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,16: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,16: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,16: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,16: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,16: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,16: (  0,  0,  0,255)  #000000  black`r`n29,16: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,16: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,16: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,17: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,17: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,17: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,17: (  0,  0,  0,255)  #000000  black`r`n4,17: (255,  0,  0,255)  #FF0000  red`r`n5,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n6,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n9,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n10,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n11,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n12,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n14,17: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n15,17: (255,  0,  0,255)  #FF0000  red`r`n16,17: (255,  0,  0,255)  #FF0000  red`r`n17,17: (255,  0,  0,255)  #FF0000  red`r`n18,17: (255,  0,  0,255)  #FF0000  red`r`n19,17: (255,  0,  0,255)  #FF0000  red`r`n20,17: (255,  0,  0,255)  #FF0000  red`r`n21,17: (255,  0,  0,255)  #FF0000  red`r`n22,17: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,17: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,17: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,17: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,17: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,17: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,17: (  0,  0,  0,255)  #000000  black`r`n29,17: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,17: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,17: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,18: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,18: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,18: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,18: (  0,  0,  0,255)  #000000  black`r`n4,18: (255,  0,  0,255)  #FF0000  red`r`n5,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n6,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n9,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n10,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n11,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n12,18: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n13,18: (255,  0,  0,255)  #FF0000  red`r`n14,18: (255,  0,  0,255)  #FF0000  red`r`n15,18: (255,  0,  0,255)  #FF0000  red`r`n16,18: (255,  0,  0,255)  #FF0000  red`r`n17,18: (255,  0,  0,255)  #FF0000  red`r`n18,18: (255,  0,  0,255)  #FF0000  red`r`n19,18: (255,  0,  0,255)  #FF0000  red`r`n20,18: (255,  0,  0,255)  #FF0000  red`r`n21,18: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,18: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,18: (198,  0,  0,255)  #C60000  rgba(198"
  145. list .= ",0,0,1)`r`n24,18: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,18: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,18: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,18: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,18: (  0,  0,  0,255)  #000000  black`r`n29,18: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,18: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,18: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,19: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,19: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,19: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,19: (  0,  0,  0,255)  #000000  black`r`n4,19: (255,  0,  0,255)  #FF0000  red`r`n5,19: (255,  0,  0,255)  #FF0000  red`r`n6,19: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n7,19: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n8,19: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n9,19: (255, 82, 82,255)  #FF5252  rgba(255,82,82,1)`r`n10,19: (255,  0,  0,255)  #FF0000  red`r`n11,19: (255,  0,  0,255)  #FF0000  red`r`n12,19: (255,  0,  0,255)  #FF0000  red`r`n13,19: (255,  0,  0,255)  #FF0000  red`r`n14,19: (255,  0,  0,255)  #FF0000  red`r`n15,19: (255,  0,  0,255)  #FF0000  red`r`n16,19: (255,  0,  0,255)  #FF0000  red`r`n17,19: (255,  0,  0,255)  #FF0000  red`r`n18,19: (255,  0,  0,255)  #FF0000  red`r`n19,19: (255,  0,  0,255)  #FF0000  red`r`n20,19: (255,  0,  0,255)  #FF0000  red`r`n21,19: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,19: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,19: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,19: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,19: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n26,19: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,19: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n28,19: (  0,  0,  0,255)  #000000  black`r`n29,19: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,19: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,19: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,20: (  0,  0,  0,255)  #000000  black`r`n5,20: (255,  0,  0,255)  #FF0000  red`r`n6,20: (255,  0,  0,255)  #FF0000  red`r`n7,20: (255,  0,  0,255)  #FF0000  red`r`n8,20: (255,  0,  0,255)  #FF0000  red`r`n9,20: (255,  0,  0,255)  #FF0000  red`r`n10,20: (255,  0,  0,255)  #FF0000  red`r`n11,20: (255,  0,  0,255)  #FF0000  red`r`n12,20: (255,  0,  0,255)  #FF0000  red`r`n13,20: (255,  0,  0,255)  #FF0000  red`r`n14,20: (255,  0,  0,255)  #FF0000  red`r`n15,20: (255,  0,  0,255)  #FF0000  red`r`n16,20: (255,  0,  0,255)  #FF0000  red`r`n17,20: (255,  0,  0,255)  #FF0000  red`r`n18,20: (255,  0,  0,255)  #FF0000  red`r`n19,20: (255,  0,  0,255)  #FF0000  red`r`n20,20: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,20: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,20: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,20: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,20: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,20: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,20: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,20: (  0,  0,  0,255)  #000000  black`r`n28,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,20: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,21: (  0,  0,  0,255)  #000000  black`r`n5,21: (255,  0,  0,255)  #FF0000  red`r`n6,21: (255,  0,  0,255)  #FF0000  red`r`n7,21: (255,  0,  0,255)  #FF0000  red`r`n8,21: (255,  0,  0,255)  #FF0000  red`r`n9,21: (255,  0,  0,255)  #FF0000  red`r`n10,21: (255,  0,  0,255)  #FF0000  red`r`n11,21: (255,  0,  0,255)  #FF0000  red`r`n12,21: (255,  0,  0,255)  #FF0000  red`r`n13,21: (255,  0,  0,255)  #FF0000  red`r`n14,21: (255,  0,  0,255)  #FF0000  red`r`n15,21: (255,  0,  0,255)  #FF0000  red`r`n16,21: (255,  0,  0,255)  #FF0000  red`r`n17,21: (255,  0,  0,255)  #FF0000  red`r`n18,21: (255,  0,  0,255)  #FF0000  red`r`n19,21: (255,  0,  0,255)  #FF0000  red`r`n20,21: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,21: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,21: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,21: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,21: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n25,21: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,21: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,21: (  0,  0,  0,255)  #000000  black`r`n28,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,21: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,22: (  0,  0,  0,255)  #000000  black`r`n5,22: (255,  0,  0,255)  #FF0000  red`r`n6,22: (255,  0,  0,255)  #FF0000  red`r`n7,22: (255,  0,  0,255)  #FF0000  red`r`n8,22: (255,  0,  0,255)  #FF0000  red`r`n9,22: (255,  0,  0,255)  #FF0000  red`r`n10,22: (255,  0,  0,255)  #FF0000  red`r`n11,22: (255,  0,  0,255)  #FF0000  red`r`n12,22: (255,  0,  0,255)  #FF0000  red`r`n13,22: (255,  0,  0,255)  #FF0000  red`r`n14,22: (255,  0,  0,255)  #FF0000  red`r`n15,22: (255,  0,  0,255)  #FF0000  red`r`n16,22: (255,  0,  0,255)  #FF0000  red`r`n17,22: (255,  0,  0,255)  #FF0000  red`r`n18,22: (255,  0,  0,255)  #FF0000  red`r`n19,22: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n20,22: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,22: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,22: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,22: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,22: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n25,22: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,22: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n27,22: (  0,  0,  0,255)  #000000  black`r`n28,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,22: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,23: (  0,  0,  0,255)  #000000  black`r`n6,23: (255,  0,  0,255)  #FF0000  red`r`n7,23: (255,  0,  0,255)  #FF0000  red`r`n8,23: (255,  0,  0,255)  #FF0000  red`r`n9,23: (255,  0,  0,255)  #FF0000  red`r`n10,23: (255,  0,  0,255)  #FF0000  red`r`n11,23: (255,  0,  0,255)  #FF0000  red`r`n12,23: (255,  0,  0,255)  #FF0000  red`r`n13,23: (255,  0,  0,255)  #FF0000  red`r`n14,23: (255,  0,  0,255)  #FF0000  red`r`n15,23: (255,  0,  0,255)  #FF0000  red`r`n16,23: (255,  0,  0,255)  #FF0000  red`r`n17,23: (255,  0,  0,255)  #FF0000  red`r`n18,23: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n19,23: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n20,23: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,23: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,23: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,23: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n24,23: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n25,23: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,23: (  0,  0,  0,255)  #000000  black`r`n27,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,23: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,24: (  0,  0,  0,255)  #000000  black`r`n6,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n7,24: (255,  0,  0,255)  #FF0000  red`r`n8,24: (255,  0,  0,255)  #FF0000  red`r`n9,24: (255,  0,  0,255)  #FF0000  red`r`n10,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n11,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n12,24: (255,  0,  0,255)  #FF0000  red`r`n13,24: (255,  0,  0,255)  #FF0000  red`r`n14,24: (255,  0,  0,255)  #FF0000  red`r`n15,24: (255,  0,  0,255)  #FF0000  red`r`n16,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n17,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n18,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n19,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n20,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,24: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,24: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n24,24: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n25,24: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n26,24: (  0,  0,  0,255)  #000000  black`r`n27,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,24: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,25: (  0,  0,  0,255)  #000000  black`r`n7,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n8,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n9,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n10,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n11,25: ("
  146. list .= "198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n12,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n13,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n14,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n15,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n16,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n17,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n18,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n19,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n20,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,25: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n23,25: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n24,25: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n25,25: (  0,  0,  0,255)  #000000  black`r`n26,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,25: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,26: (  0,  0,  0,255)  #000000  black`r`n7,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n8,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n9,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n10,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n11,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n12,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n13,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n14,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n15,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n16,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n17,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n18,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n19,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n20,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,26: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n22,26: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n23,26: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n24,26: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n25,26: (  0,  0,  0,255)  #000000  black`r`n26,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,26: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,27: (  0,  0,  0,255)  #000000  black`r`n8,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n9,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n10,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n11,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n12,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n13,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n14,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n15,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n16,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n17,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n18,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n19,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n20,27: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n21,27: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n22,27: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n23,27: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n24,27: (  0,  0,  0,255)  #000000  black`r`n25,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,27: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,28: (  0,  0,  0,255)  #000000  black`r`n8,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n9,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n10,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n11,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n12,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n13,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n14,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n15,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n16,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n17,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n18,28: (198,  0,  0,255)  #C60000  rgba(198,0,0,1)`r`n19,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n20,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n21,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n22,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n23,28: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n24,28: (  0,  0,  0,255)  #000000  black`r`n25,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,28: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,29: (  0,  0,  0,255)  #000000  black`r`n9,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n10,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n11,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n12,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n13,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n14,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n15,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n16,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n17,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n18,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n19,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n20,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n21,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n22,29: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n23,29: (  0,  0,  0,255)  #000000  black`r`n24,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,29: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,30: (  0,  0,  0,255)  #000000  black`r`n10,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n11,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n12,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n13,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n14,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n15,30: (  0,  0,  0,255)  #000000  black`r`n16,30: (  0,  0,  0,255)  #000000  black`r`n17,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n18,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n19,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n20,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n21,30: (132,  0,  0,255)  #840000  rgba(132,0,0,1)`r`n22,30: (  0,  0,  0,255)  #000000  black`r`n23,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n24,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n30,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,30: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n0,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n1,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n2,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n3,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n4,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n5,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n6,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n7,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n8,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n9,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n"
  147. list .= "10,31: (  0,  0,  0,255)  #000000  black`r`n11,31: (  0,  0,  0,255)  #000000  black`r`n12,31: (  0,  0,  0,255)  #000000  black`r`n13,31: (  0,  0,  0,255)  #000000  black`r`n14,31: (  0,  0,  0,255)  #000000  black`r`n15,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n16,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n17,31: (  0,  0,  0,255)  #000000  black`r`n18,31: (  0,  0,  0,255)  #000000  black`r`n19,31: (  0,  0,  0,255)  #000000  black`r`n20,31: (  0,  0,  0,255)  #000000  black`r`n21,31: (  0,  0,  0,255)  #000000  black`r`n22,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n23,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n24,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n25,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n26,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n27,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n28,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n29,31: (255,255,255,  0)  #FFFFFF00  "
  148. list .= "rgba(255,255,255,0)`r`n30,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)`r`n31,31: (255,255,255,  0)  #FFFFFF00  rgba(255,255,255,0)"
  149. }
  150.  
  151. ;#######################################################################
  152.  
  153. Exit:
  154. ; gdi+ may now be shutdown on exiting the program
  155. SelectObject(hdc, obm)
  156. DeleteObject(hbm)
  157. DeleteDC(hdc)
  158. Gdip_DeleteGraphics(G)
  159. Gdip_Shutdown(pToken)
  160. ExitApp
  161. Return
  162.  
  163. Rnd(x,y)
  164. {
  165. Random, Result, x, y
  166. Return Result
  167. }
  168.  
  169. ; Gdip standard library v1.45 by tic (Tariq Porter) 07/09/11
  170. ;
  171. ;#####################################################################################
  172. ;#####################################################################################
  173. ; STATUS ENUMERATION
  174. ; Return values for functions specified to have status enumerated return type
  175. ;#####################################################################################
  176. ;
  177. ; Ok =                                          = 0
  178. ; GenericError                          = 1
  179. ; InvalidParameter                      = 2
  180. ; OutOfMemory                           = 3
  181. ; ObjectBusy                            = 4
  182. ; InsufficientBuffer            = 5
  183. ; NotImplemented                        = 6
  184. ; Win32Error                            = 7
  185. ; WrongState                            = 8
  186. ; Aborted                                       = 9
  187. ; FileNotFound                          = 10
  188. ; ValueOverflow                         = 11
  189. ; AccessDenied                          = 12
  190. ; UnknownImageFormat            = 13
  191. ; FontFamilyNotFound            = 14
  192. ; FontStyleNotFound                     = 15
  193. ; NotTrueTypeFont                       = 16
  194. ; UnsupportedGdiplusVersion     = 17
  195. ; GdiplusNotInitialized         = 18
  196. ; PropertyNotFound                      = 19
  197. ; PropertyNotSupported          = 20
  198. ; ProfileNotFound                       = 21
  199. ;
  200. ;#####################################################################################
  201. ;#####################################################################################
  202. ; FUNCTIONS
  203. ;#####################################################################################
  204. ;
  205. ; UpdateLayeredWindow(hwnd, hdc, x="", y="", w="", h="", Alpha=255)
  206. ; BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster="")
  207. ; StretchBlt(dDC, dx, dy, dw, dh, sDC, sx, sy, sw, sh, Raster="")
  208. ; SetImage(hwnd, hBitmap)
  209. ; Gdip_BitmapFromScreen(Screen=0, Raster="")
  210. ; CreateRectF(ByRef RectF, x, y, w, h)
  211. ; CreateSizeF(ByRef SizeF, w, h)
  212. ; CreateDIBSection
  213. ;
  214. ;#####################################################################################
  215.  
  216. ; Function:                             UpdateLayeredWindow
  217. ; Description:                          Updates a layered window with the handle to the DC of a gdi bitmap
  218. ;
  219. ; hwnd                                  Handle of the layered window to update
  220. ; hdc                                   Handle to the DC of the GDI bitmap to update the window with
  221. ; Layeredx                              x position to place the window
  222. ; Layeredy                              y position to place the window
  223. ; Layeredw                              Width of the window
  224. ; Layeredh                              Height of the window
  225. ; Alpha                                 Default = 255 : The transparency (0-255) to set the window transparency
  226. ;
  227. ; return                                If the function succeeds, the return value is nonzero
  228. ;
  229. ; notes                                         If x or y omitted, then layered window will use its current coordinates
  230. ;                                                       If w or h omitted then current width and height will be used
  231.  
  232. UpdateLayeredWindow(hwnd, hdc, x="", y="", w="", h="", Alpha=255)
  233. {
  234.         if ((x != "") && (y != ""))
  235.                 VarSetCapacity(pt, 8), NumPut(x, pt, 0), NumPut(y, pt, 4)
  236.  
  237.         if (w = "") ||(h = "")
  238.                 WinGetPos,,, w, h, ahk_id %hwnd%
  239.    
  240.         return DllCall("UpdateLayeredWindow", "uint", hwnd, "uint", 0, "uint", ((x = "") && (y = "")) ? 0 : &pt
  241.         , "int64*", w|h<<32, "uint", hdc, "int64*", 0, "uint", 0, "uint*", Alpha<<16|1<<24, "uint", 2)
  242. }
  243.  
  244. ;#####################################################################################
  245.  
  246. ; Function                              BitBlt
  247. ; Description                   The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle
  248. ;                                               of pixels from the specified source device context into a destination device context.
  249. ;
  250. ; dDC                                   handle to destination DC
  251. ; dx                                    x-coord of destination upper-left corner
  252. ; dy                                    y-coord of destination upper-left corner
  253. ; dw                                    width of the area to copy
  254. ; dh                                    height of the area to copy
  255. ; sDC                                   handle to source DC
  256. ; sx                                    x-coordinate of source upper-left corner
  257. ; sy                                    y-coordinate of source upper-left corner
  258. ; Raster                                raster operation code
  259. ;
  260. ; return                                If the function succeeds, the return value is nonzero
  261. ;
  262. ; notes                                 If no raster operation is specified, then SRCCOPY is used, which copies the source directly to the destination rectangle
  263. ;
  264. ; BLACKNESS                             = 0x00000042
  265. ; NOTSRCERASE                   = 0x001100A6
  266. ; NOTSRCCOPY                    = 0x00330008
  267. ; SRCERASE                              = 0x00440328
  268. ; DSTINVERT                             = 0x00550009
  269. ; PATINVERT                             = 0x005A0049
  270. ; SRCINVERT                             = 0x00660046
  271. ; SRCAND                                = 0x008800C6
  272. ; MERGEPAINT                    = 0x00BB0226
  273. ; MERGECOPY                             = 0x00C000CA
  274. ; SRCCOPY                               = 0x00CC0020
  275. ; SRCPAINT                              = 0x00EE0086
  276. ; PATCOPY                               = 0x00F00021
  277. ; PATPAINT                              = 0x00FB0A09
  278. ; WHITENESS                             = 0x00FF0062
  279. ; CAPTUREBLT                    = 0x40000000
  280. ; NOMIRRORBITMAP                = 0x80000000
  281.  
  282. BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster="")
  283. {
  284.         return DllCall("gdi32\BitBlt", "uint", dDC, "int", dx, "int", dy, "int", dw, "int", dh
  285.         , "uint", sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
  286. }
  287.  
  288. ;#####################################################################################
  289.  
  290. ; Function                              StretchBlt
  291. ; Description                   The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle,
  292. ;                                               stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary.
  293. ;                                               The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
  294. ;
  295. ; ddc                                   handle to destination DC
  296. ; dx                                    x-coord of destination upper-left corner
  297. ; dy                                    y-coord of destination upper-left corner
  298. ; dw                                    width of destination rectangle
  299. ; dh                                    height of destination rectangle
  300. ; sdc                                   handle to source DC
  301. ; sx                                    x-coordinate of source upper-left corner
  302. ; sy                                    y-coordinate of source upper-left corner
  303. ; sw                                    width of source rectangle
  304. ; sh                                    height of source rectangle
  305. ; Raster                                raster operation code
  306. ;
  307. ; return                                If the function succeeds, the return value is nonzero
  308. ;
  309. ; notes                                 If no raster operation is specified, then SRCCOPY is used. It uses the same raster operations as BitBlt        
  310.  
  311. StretchBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, sw, sh, Raster="")
  312. {
  313.         return DllCall("gdi32\StretchBlt", "uint", ddc, "int", dx, "int", dy, "int", dw, "int", dh
  314.         , "uint", sdc, "int", sx, "int", sy, "int", sw, "int", sh, "uint", Raster ? Raster : 0x00CC0020)
  315. }
  316.  
  317. ;#####################################################################################
  318.  
  319. ; Function                              SetStretchBltMode
  320. ; Description                   The SetStretchBltMode function sets the bitmap stretching mode in the specified device context
  321. ;
  322. ; hdc                                   handle to the DC
  323. ; iStretchMode                  The stretching mode, describing how the target will be stretched
  324. ;
  325. ; return                                If the function succeeds, the return value is the previous stretching mode. If it fails it will return 0
  326. ;
  327. ; STRETCH_ANDSCANS              = 0x01
  328. ; STRETCH_ORSCANS               = 0x02
  329. ; STRETCH_DELETESCANS   = 0x03
  330. ; STRETCH_HALFTONE              = 0x04
  331.  
  332. SetStretchBltMode(hdc, iStretchMode=4)
  333. {
  334.         return DllCall("gdi32\SetStretchBltMode", "uint", hdc, "int", iStretchMode)
  335. }
  336.  
  337. ;#####################################################################################
  338.  
  339. ; Function                              SetImage
  340. ; Description                   Associates a new image with a static control
  341. ;
  342. ; hwnd                                  handle of the control to update
  343. ; hBitmap                               a gdi bitmap to associate the static control with
  344. ;
  345. ; return                                If the function succeeds, the return value is nonzero
  346.  
  347. SetImage(hwnd, hBitmap)
  348. {
  349.         SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
  350.         E := ErrorLevel
  351.         DeleteObject(E)
  352.         return E
  353. }
  354.  
  355. ;#####################################################################################
  356.  
  357. ; Function                              SetSysColorToControl
  358. ; Description                   Sets a solid colour to a control
  359. ;
  360. ; hwnd                                  handle of the control to update
  361. ; SysColor                              A system colour to set to the control
  362. ;
  363. ; return                                If the function succeeds, the return value is zero
  364. ;
  365. ; notes                                 A control must have the 0xE style set to it so it is recognised as a bitmap
  366. ;                                               By default SysColor=15 is used which is COLOR_3DFACE. This is the standard background for a control
  367. ;
  368. ; COLOR_3DDKSHADOW                              = 21
  369. ; COLOR_3DFACE                                  = 15
  370. ; COLOR_3DHIGHLIGHT                             = 20
  371. ; COLOR_3DHILIGHT                               = 20
  372. ; COLOR_3DLIGHT                                 = 22
  373. ; COLOR_3DSHADOW                                = 16
  374. ; COLOR_ACTIVEBORDER                    = 10
  375. ; COLOR_ACTIVECAPTION                   = 2
  376. ; COLOR_APPWORKSPACE                    = 12
  377. ; COLOR_BACKGROUND                              = 1
  378. ; COLOR_BTNFACE                                 = 15
  379. ; COLOR_BTNHIGHLIGHT                    = 20
  380. ; COLOR_BTNHILIGHT                              = 20
  381. ; COLOR_BTNSHADOW                               = 16
  382. ; COLOR_BTNTEXT                                 = 18
  383. ; COLOR_CAPTIONTEXT                             = 9
  384. ; COLOR_DESKTOP                                 = 1
  385. ; COLOR_GRADIENTACTIVECAPTION   = 27
  386. ; COLOR_GRADIENTINACTIVECAPTION = 28
  387. ; COLOR_GRAYTEXT                                = 17
  388. ; COLOR_HIGHLIGHT                               = 13
  389. ; COLOR_HIGHLIGHTTEXT                   = 14
  390. ; COLOR_HOTLIGHT                                = 26
  391. ; COLOR_INACTIVEBORDER                  = 11
  392. ; COLOR_INACTIVECAPTION                 = 3
  393. ; COLOR_INACTIVECAPTIONTEXT             = 19
  394. ; COLOR_INFOBK                                  = 24
  395. ; COLOR_INFOTEXT                                = 23
  396. ; COLOR_MENU                                    = 4
  397. ; COLOR_MENUHILIGHT                             = 29
  398. ; COLOR_MENUBAR                                 = 30
  399. ; COLOR_MENUTEXT                                = 7
  400. ; COLOR_SCROLLBAR                               = 0
  401. ; COLOR_WINDOW                                  = 5
  402. ; COLOR_WINDOWFRAME                             = 6
  403. ; COLOR_WINDOWTEXT                              = 8
  404.  
  405. SetSysColorToControl(hwnd, SysColor=15)
  406. {
  407.    WinGetPos,,, w, h, ahk_id %hwnd%
  408.    bc := DllCall("GetSysColor", "Int", SysColor)
  409.    pBrushClear := Gdip_BrushCreateSolid(0xff000000 | (bc >> 16 | bc & 0xff00 | (bc & 0xff) << 16))
  410.    pBitmap := Gdip_CreateBitmap(w, h), G := Gdip_GraphicsFromImage(pBitmap)
  411.    Gdip_FillRectangle(G, pBrushClear, 0, 0, w, h)
  412.    hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  413.    SetImage(hwnd, hBitmap)
  414.    Gdip_DeleteBrush(pBrushClear)
  415.    Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmap), DeleteObject(hBitmap)
  416.    return 0
  417. }
  418.  
  419. ;#####################################################################################
  420.  
  421. ; Function                              Gdip_BitmapFromScreen
  422. ; Description                   Gets a gdi+ bitmap from the screen
  423. ;
  424. ; Screen                                0 = All screens
  425. ;                                               Any numerical value = Just that screen
  426. ;                                               x|y|w|h = Take specific coordinates with a width and height
  427. ; Raster                                raster operation code
  428. ;
  429. ; return                        If the function succeeds, the return value is a pointer to a gdi+ bitmap
  430. ;                                               -1:             one or more of x,y,w,h not passed properly
  431. ;
  432. ; notes                                 If no raster operation is specified, then SRCCOPY is used to the returned bitmap
  433.  
  434. Gdip_BitmapFromScreen(Screen=0, Raster="")
  435. {
  436.         if (Screen = 0)
  437.         {
  438.                 Sysget, x, 76
  439.                 Sysget, y, 77  
  440.                 Sysget, w, 78
  441.                 Sysget, h, 79
  442.         }
  443.         else if (SubStr(Screen, 1, 5) = "hwnd:")
  444.         {
  445.                 Screen := SubStr(Screen, 6)
  446.                 if !WinExist( "ahk_id " Screen)
  447.                         return -2
  448.                 WinGetPos,,, w, h, ahk_id %Screen%
  449.                 x := y := 0
  450.                 hhdc := GetDCEx(Screen, 3)
  451.         }
  452.         else if (Screen&1 != "")
  453.         {
  454.                 Sysget, M, Monitor, %Screen%
  455.                 x := MLeft, y := MTop, w := MRight-MLeft, h := MBottom-MTop
  456.         }
  457.         else
  458.         {
  459.                 StringSplit, S, Screen, |
  460.                 x := S1, y := S2, w := S3, h := S4
  461.         }
  462.  
  463.         if (x = "") || (y = "") || (w = "") || (h = "")
  464.                 return -1
  465.  
  466.         chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc), obm := SelectObject(chdc, hbm), hhdc := hhdc ? hhdc : GetDC()
  467.         BitBlt(chdc, 0, 0, w, h, hhdc, x, y, Raster)
  468.         ReleaseDC(hhdc)
  469.        
  470.         pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
  471.         SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
  472.         return pBitmap
  473. }
  474.  
  475. ;#####################################################################################
  476.  
  477. ; Function                              Gdip_BitmapFromHWND
  478. ; Description                   Uses PrintWindow to get a handle to the specified window and return a bitmap from it
  479. ;
  480. ; hwnd                                  handle to the window to get a bitmap from
  481. ;
  482. ; return                                If the function succeeds, the return value is a pointer to a gdi+ bitmap
  483. ;
  484. ; notes                                 Window must not be not minimised in order to get a handle to it's client area
  485.  
  486. Gdip_BitmapFromHWND(hwnd)
  487. {
  488.         WinGetPos,,, Width, Height, ahk_id %hwnd%
  489.         hbm := CreateDIBSection(Width, Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
  490.         PrintWindow(hwnd, hdc)
  491.         pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
  492.         SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
  493.         return pBitmap
  494. }
  495.  
  496. ;#####################################################################################
  497.  
  498. ; Function                      CreateRectF
  499. ; Description                   Creates a RectF object, containing a the coordinates and dimensions of a rectangle
  500. ;
  501. ; RectF                         Name to call the RectF object
  502. ; x                             x-coordinate of the upper left corner of the rectangle
  503. ; y                             y-coordinate of the upper left corner of the rectangle
  504. ; w                             Width of the rectangle
  505. ; h                             Height of the rectangle
  506. ;
  507. ; return                        No return value
  508.  
  509. CreateRectF(ByRef RectF, x, y, w, h)
  510. {
  511.    VarSetCapacity(RectF, 16)
  512.    NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
  513. }
  514.  
  515. ;#####################################################################################
  516.  
  517. ; Function                      CreateRect
  518. ; Description                   Creates a Rect object, containing a the coordinates and dimensions of a rectangle
  519. ;
  520. ; RectF                         Name to call the RectF object
  521. ; x                             x-coordinate of the upper left corner of the rectangle
  522. ; y                             y-coordinate of the upper left corner of the rectangle
  523. ; w                             Width of the rectangle
  524. ; h                             Height of the rectangle
  525. ;
  526. ; return                        No return value
  527.  
  528. CreateRect(ByRef Rect, x, y, w, h)
  529. {
  530.         VarSetCapacity(Rect, 16)
  531.         NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
  532. }
  533. ;#####################################################################################
  534.  
  535. ; Function                      CreateSizeF
  536. ; Description                   Creates a SizeF object, containing an 2 values
  537. ;
  538. ; SizeF                         Name to call the SizeF object
  539. ; w                             w-value for the SizeF object
  540. ; h                             h-value for the SizeF object
  541. ;
  542. ; return                        No Return value
  543.  
  544. CreateSizeF(ByRef SizeF, w, h)
  545. {
  546.    VarSetCapacity(SizeF, 8)
  547.    NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")    
  548. }
  549. ;#####################################################################################
  550.  
  551. ; Function                      CreatePointF
  552. ; Description                   Creates a SizeF object, containing an 2 values
  553. ;
  554. ; SizeF                         Name to call the SizeF object
  555. ; w                             w-value for the SizeF object
  556. ; h                             h-value for the SizeF object
  557. ;
  558. ; return                        No Return value
  559.  
  560. CreatePointF(ByRef PointF, x, y)
  561. {
  562.    VarSetCapacity(PointF, 8)
  563.    NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")    
  564. }
  565. ;#####################################################################################
  566.  
  567. ; Function                              CreateDIBSection
  568. ; Description                   The CreateDIBSection function creates a DIB (Device Independent Bitmap) that applications can write to directly
  569. ;
  570. ; w                                             width of the bitmap to create
  571. ; h                                             height of the bitmap to create
  572. ; hdc                                   a handle to the device context to use the palette from
  573. ; bpp                                   bits per pixel (32 = ARGB)
  574. ; ppvBits                               A pointer to a variable that receives a pointer to the location of the DIB bit values
  575. ;
  576. ; return                                returns a DIB. A gdi bitmap
  577. ;
  578. ; notes                                 ppvBits will receive the location of the pixels in the DIB
  579.  
  580. CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0)
  581. {
  582.         hdc2 := hdc ? hdc : GetDC()
  583.         VarSetCapacity(bi, 40, 0)
  584.         NumPut(w, bi, 4), NumPut(h, bi, 8), NumPut(40, bi, 0), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16), NumPut(bpp, bi, 14, "ushort")
  585.         hbm := DllCall("CreateDIBSection", "uint" , hdc2, "uint" , &bi, "uint" , 0, "uint*", ppvBits, "uint" , 0, "uint" , 0)
  586.  
  587.         if !hdc
  588.                 ReleaseDC(hdc2)
  589.         return hbm
  590. }
  591.  
  592. ;#####################################################################################
  593.  
  594. ; Function                              PrintWindow
  595. ; Description                   The PrintWindow function copies a visual window into the specified device context (DC), typically a printer DC
  596. ;
  597. ; hwnd                                  A handle to the window that will be copied
  598. ; hdc                                   A handle to the device context
  599. ; Flags                                 Drawing options
  600. ;
  601. ; return                                If the function succeeds, it returns a nonzero value
  602. ;
  603. ; PW_CLIENTONLY                 = 1
  604.  
  605. PrintWindow(hwnd, hdc, Flags=0)
  606. {
  607.         return DllCall("PrintWindow", "uint", hwnd, "uint", hdc, "uint", Flags)
  608. }
  609.  
  610. ;#####################################################################################
  611.  
  612. ; Function                              DestroyIcon
  613. ; Description                   Destroys an icon and frees any memory the icon occupied
  614. ;
  615. ; hIcon                                 Handle to the icon to be destroyed. The icon must not be in use
  616. ;
  617. ; return                                If the function succeeds, the return value is nonzero
  618.  
  619. DestroyIcon(hIcon)
  620. {
  621.    return DllCall("DestroyIcon", "uint", hIcon)
  622. }
  623.  
  624. ;#####################################################################################
  625.  
  626. PaintDesktop(hdc)
  627. {
  628.         return DllCall("PaintDesktop", "uint", hdc)
  629. }
  630.  
  631. ;#####################################################################################
  632.  
  633. CreateCompatibleBitmap(hdc, w, h)
  634. {
  635.         return DllCall("gdi32\CreateCompatibleBitmap", "uint", hdc, "int", w, "int", h)
  636. }
  637.  
  638. ;#####################################################################################
  639.  
  640. ; Function                              CreateCompatibleDC
  641. ; Description                   This function creates a memory device context (DC) compatible with the specified device
  642. ;
  643. ; hdc                                   Handle to an existing device context                                   
  644. ;
  645. ; return                                returns the handle to a device context or 0 on failure
  646. ;
  647. ; notes                                 If this handle is 0 (by default), the function creates a memory device context compatible with the application's current screen
  648.  
  649. CreateCompatibleDC(hdc=0)
  650. {
  651.    return DllCall("CreateCompatibleDC", "uint", hdc)
  652. }
  653.  
  654. ;#####################################################################################
  655.  
  656. ; Function                              SelectObject
  657. ; Description                   The SelectObject function selects an object into the specified device context (DC). The new object replaces the previous object of the same type
  658. ;
  659. ; hdc                                   Handle to a DC
  660. ; hgdiobj                               A handle to the object to be selected into the DC
  661. ;
  662. ; return                                If the selected object is not a region and the function succeeds, the return value is a handle to the object being replaced
  663. ;
  664. ; notes                                 The specified object must have been created by using one of the following functions
  665. ;                                               Bitmap - CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBitmap, CreateDIBSection (A single bitmap cannot be selected into more than one DC at the same time)
  666. ;                                               Brush - CreateBrushIndirect, CreateDIBPatternBrush, CreateDIBPatternBrushPt, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush
  667. ;                                               Font - CreateFont, CreateFontIndirect
  668. ;                                               Pen - CreatePen, CreatePenIndirect
  669. ;                                               Region - CombineRgn, CreateEllipticRgn, CreateEllipticRgnIndirect, CreatePolygonRgn, CreateRectRgn, CreateRectRgnIndirect
  670. ;
  671. ; notes                                 If the selected object is a region and the function succeeds, the return value is one of the following value
  672. ;
  673. ; SIMPLEREGION                  = 2 Region consists of a single rectangle
  674. ; COMPLEXREGION                 = 3 Region consists of more than one rectangle
  675. ; NULLREGION                    = 1 Region is empty
  676.  
  677. SelectObject(hdc, hgdiobj)
  678. {
  679.    return DllCall("SelectObject", "uint", hdc, "uint", hgdiobj)
  680. }
  681.  
  682. ;#####################################################################################
  683.  
  684. ; Function                              DeleteObject
  685. ; Description                   This function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object
  686. ;                                               After the object is deleted, the specified handle is no longer valid
  687. ;
  688. ; hObject                               Handle to a logical pen, brush, font, bitmap, region, or palette to delete
  689. ;
  690. ; return                                Nonzero indicates success. Zero indicates that the specified handle is not valid or that the handle is currently selected into a device context
  691.  
  692. DeleteObject(hObject)
  693. {
  694.    return DllCall("DeleteObject", "uint", hObject)
  695. }
  696.  
  697. ;#####################################################################################
  698.  
  699. ; Function                              GetDC
  700. ; Description                   This function retrieves a handle to a display device context (DC) for the client area of the specified window.
  701. ;                                               The display device context can be used in subsequent graphics display interface (GDI) functions to draw in the client area of the window.
  702. ;
  703. ; hwnd                                  Handle to the window whose device context is to be retrieved. If this value is NULL, GetDC retrieves the device context for the entire screen                                  
  704. ;
  705. ; return                                The handle the device context for the specified window's client area indicates success. NULL indicates failure
  706.  
  707. GetDC(hwnd=0)
  708. {
  709.         return DllCall("GetDC", "uint", hwnd)
  710. }
  711.  
  712. ;#####################################################################################
  713.  
  714. ; DCX_CACHE = 0x2
  715. ; DCX_CLIPCHILDREN = 0x8
  716. ; DCX_CLIPSIBLINGS = 0x10
  717. ; DCX_EXCLUDERGN = 0x40
  718. ; DCX_EXCLUDEUPDATE = 0x100
  719. ; DCX_INTERSECTRGN = 0x80
  720. ; DCX_INTERSECTUPDATE = 0x200
  721. ; DCX_LOCKWINDOWUPDATE = 0x400
  722. ; DCX_NORECOMPUTE = 0x100000
  723. ; DCX_NORESETATTRS = 0x4
  724. ; DCX_PARENTCLIP = 0x20
  725. ; DCX_VALIDATE = 0x200000
  726. ; DCX_WINDOW = 0x1
  727.  
  728. GetDCEx(hwnd, flags=0, hrgnClip=0)
  729. {
  730.     return DllCall("GetDCEx", "uint", hwnd, "uint", hrgnClip, "int", flags)
  731. }
  732.  
  733. ;#####################################################################################
  734.  
  735. ; Function                              ReleaseDC
  736. ; Description                   This function releases a device context (DC), freeing it for use by other applications. The effect of ReleaseDC depends on the type of device context
  737. ;
  738. ; hdc                                   Handle to the device context to be released
  739. ; hwnd                                  Handle to the window whose device context is to be released
  740. ;
  741. ; return                                1 = released
  742. ;                                               0 = not released
  743. ;
  744. ; notes                                 The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common device context
  745. ;                                               An application cannot use the ReleaseDC function to release a device context that was created by calling the CreateDC function; instead, it must use the DeleteDC function.
  746.  
  747. ReleaseDC(hdc, hwnd=0)
  748. {
  749.    return DllCall("ReleaseDC", "uint", hwnd, "uint", hdc)
  750. }
  751.  
  752. ;#####################################################################################
  753.  
  754. ; Function                              DeleteDC
  755. ; Description                   The DeleteDC function deletes the specified device context (DC)
  756. ;
  757. ; hdc                                   A handle to the device context
  758. ;
  759. ; return                                If the function succeeds, the return value is nonzero
  760. ;
  761. ; notes                                 An application must not delete a DC whose handle was obtained by calling the GetDC function. Instead, it must call the ReleaseDC function to free the DC
  762.  
  763. DeleteDC(hdc)
  764. {
  765.    return DllCall("DeleteDC", "uint", hdc)
  766. }
  767. ;#####################################################################################
  768.  
  769. ; Function                              Gdip_LibraryVersion
  770. ; Description                   Get the current library version
  771. ;
  772. ; return                                the library version
  773. ;
  774. ; notes                                 This is useful for non compiled programs to ensure that a person doesn't run an old version when testing your scripts
  775.  
  776. Gdip_LibraryVersion()
  777. {
  778.         return 1.45
  779. }
  780.  
  781. ;#####################################################################################
  782.  
  783. ; Function:                     Gdip_BitmapFromBRA
  784. ; Description:                  Gets a pointer to a gdi+ bitmap from a BRA file
  785. ;
  786. ; BRAFromMemIn                  The variable for a BRA file read to memory
  787. ; File                                  The name of the file, or its number that you would like (This depends on alternate parameter)
  788. ; Alternate                             Changes whether the File parameter is the file name or its number
  789. ;
  790. ; return                        If the function succeeds, the return value is a pointer to a gdi+ bitmap
  791. ;                                               -1 = The BRA variable is empty
  792. ;                                               -2 = The BRA has an incorrect header
  793. ;                                               -3 = The BRA has information missing
  794. ;                                               -4 = Could not find file inside the BRA
  795.  
  796. Gdip_BitmapFromBRA(ByRef BRAFromMemIn, File, Alternate=0)
  797. {
  798.         if !BRAFromMemIn
  799.                 return -1
  800.         Loop, Parse, BRAFromMemIn, `n
  801.         {
  802.                 if (A_Index = 1)
  803.                 {
  804.                         StringSplit, Header, A_LoopField, |
  805.                         if (Header0 != 4 || Header2 != "BRA!")
  806.                                 return -2
  807.                 }
  808.                 else if (A_Index = 2)
  809.                 {
  810.                         StringSplit, Info, A_LoopField, |
  811.                         if (Info0 != 3)
  812.                                 return -3
  813.                 }
  814.                 else
  815.                         break
  816.         }
  817.         if !Alternate
  818.                 StringReplace, File, File, \, \\, All
  819.         RegExMatch(BRAFromMemIn, "mi`n)^" (Alternate ? File "\|.+?\|(\d+)\|(\d+)" : "\d+\|" File "\|(\d+)\|(\d+)") "$", FileInfo)
  820.         if !FileInfo
  821.                 return -4
  822.  
  823.         hData := DllCall("GlobalAlloc", "uint", 2, "uint", FileInfo2)
  824.         pData := DllCall("GlobalLock", "uint", hData)
  825.         DllCall("RtlMoveMemory", "uint", pData, "uint", &BRAFromMemIn+Info2+FileInfo1, "uint", FileInfo2)
  826.         DllCall("GlobalUnlock", "uint", hData)
  827.         DllCall("ole32\CreateStreamOnHGlobal", "uint", hData, "int", 1, "uint*", pStream)
  828.         DllCall("gdiplus\GdipCreateBitmapFromStream", "uint", pStream, "uint*", pBitmap)
  829.         DllCall(NumGet(NumGet(1*pStream)+8), "uint", pStream)
  830.         return pBitmap
  831. }
  832.  
  833. ;#####################################################################################
  834.  
  835. ; Function                              Gdip_DrawRectangle
  836. ; Description                   This function uses a pen to draw the outline of a rectangle into the Graphics of a bitmap
  837. ;
  838. ; pGraphics                             Pointer to the Graphics of a bitmap
  839. ; pPen                                  Pointer to a pen
  840. ; x                                             x-coordinate of the top left of the rectangle
  841. ; y                                             y-coordinate of the top left of the rectangle
  842. ; w                                             width of the rectanlge
  843. ; h                                             height of the rectangle
  844. ;
  845. ; return                                status enumeration. 0 = success
  846. ;
  847. ; notes                                 as all coordinates are taken from the top left of each pixel, then the entire width/height should be specified as subtracting the pen width
  848.  
  849. Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
  850. {
  851.    return DllCall("gdiplus\GdipDrawRectangle", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h)
  852. }
  853.  
  854. ;#####################################################################################
  855.  
  856. ; Function                              Gdip_DrawRoundedRectangle
  857. ; Description                   This function uses a pen to draw the outline of a rounded rectangle into the Graphics of a bitmap
  858. ;
  859. ; pGraphics                             Pointer to the Graphics of a bitmap
  860. ; pPen                                  Pointer to a pen
  861. ; x                                             x-coordinate of the top left of the rounded rectangle
  862. ; y                                             y-coordinate of the top left of the rounded rectangle
  863. ; w                                             width of the rectanlge
  864. ; h                                             height of the rectangle
  865. ; r                                             radius of the rounded corners
  866. ;
  867. ; return                                status enumeration. 0 = success
  868. ;
  869. ; notes                                 as all coordinates are taken from the top left of each pixel, then the entire width/height should be specified as subtracting the pen width
  870.  
  871. Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r)
  872. {
  873.         Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  874.         Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  875.         Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  876.         Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  877.         E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
  878.         Gdip_ResetClip(pGraphics)
  879.         Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  880.         Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  881.         Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
  882.         Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
  883.         Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
  884.         Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  885.         Gdip_ResetClip(pGraphics)
  886.         return E
  887. }
  888.  
  889. ;#####################################################################################
  890.  
  891. ; Function                              Gdip_DrawEllipse
  892. ; Description                   This function uses a pen to draw the outline of an ellipse into the Graphics of a bitmap
  893. ;
  894. ; pGraphics                             Pointer to the Graphics of a bitmap
  895. ; pPen                                  Pointer to a pen
  896. ; x                                             x-coordinate of the top left of the rectangle the ellipse will be drawn into
  897. ; y                                             y-coordinate of the top left of the rectangle the ellipse will be drawn into
  898. ; w                                             width of the ellipse
  899. ; h                                             height of the ellipse
  900. ;
  901. ; return                                status enumeration. 0 = success
  902. ;
  903. ; notes                                 as all coordinates are taken from the top left of each pixel, then the entire width/height should be specified as subtracting the pen width
  904.  
  905. Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h)
  906. {
  907.    return DllCall("gdiplus\GdipDrawEllipse", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h)
  908. }
  909.  
  910. ;#####################################################################################
  911.  
  912. ; Function                              Gdip_DrawBezier
  913. ; Description                   This function uses a pen to draw the outline of a bezier (a weighted curve) into the Graphics of a bitmap
  914. ;
  915. ; pGraphics                             Pointer to the Graphics of a bitmap
  916. ; pPen                                  Pointer to a pen
  917. ; x1                                    x-coordinate of the start of the bezier
  918. ; y1                                    y-coordinate of the start of the bezier
  919. ; x2                                    x-coordinate of the first arc of the bezier
  920. ; y2                                    y-coordinate of the first arc of the bezier
  921. ; x3                                    x-coordinate of the second arc of the bezier
  922. ; y3                                    y-coordinate of the second arc of the bezier
  923. ; x4                                    x-coordinate of the end of the bezier
  924. ; y4                                    y-coordinate of the end of the bezier
  925. ;
  926. ; return                                status enumeration. 0 = success
  927. ;
  928. ; notes                                 as all coordinates are taken from the top left of each pixel, then the entire width/height should be specified as subtracting the pen width
  929.  
  930. Gdip_DrawBezier(pGraphics, pPen, x1, y1, x2, y2, x3, y3, x4, y4)
  931. {
  932.    return DllCall("gdiplus\GdipDrawBezier", "uint", pgraphics, "uint", pPen
  933.    , "float", x1, "float", y1, "float", x2, "float", y2
  934.    , "float", x3, "float", y3, "float", x4, "float", y4)
  935. }
  936.  
  937. ;#####################################################################################
  938.  
  939. ; Function                              Gdip_DrawArc
  940. ; Description                   This function uses a pen to draw the outline of an arc into the Graphics of a bitmap
  941. ;
  942. ; pGraphics                             Pointer to the Graphics of a bitmap
  943. ; pPen                                  Pointer to a pen
  944. ; x                                             x-coordinate of the start of the arc
  945. ; y                                             y-coordinate of the start of the arc
  946. ; w                                             width of the arc
  947. ; h                                             height of the arc
  948. ; StartAngle                    specifies the angle between the x-axis and the starting point of the arc
  949. ; SweepAngle                    specifies the angle between the starting and ending points of the arc
  950. ;
  951. ; return                                status enumeration. 0 = success
  952. ;
  953. ; notes                                 as all coordinates are taken from the top left of each pixel, then the entire width/height should be specified as subtracting the pen width
  954.  
  955. Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle)
  956. {
  957.    return DllCall("gdiplus\GdipDrawArc", "uint", pGraphics, "uint", pPen, "float", x
  958.    , "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  959. }
  960.  
  961. ;#####################################################################################
  962.  
  963. ; Function                              Gdip_DrawPie
  964. ; Description                   This function uses a pen to draw the outline of a pie into the Graphics of a bitmap
  965. ;
  966. ; pGraphics                             Pointer to the Graphics of a bitmap
  967. ; pPen                                  Pointer to a pen
  968. ; x                                             x-coordinate of the start of the pie
  969. ; y                                             y-coordinate of the start of the pie
  970. ; w                                             width of the pie
  971. ; h                                             height of the pie
  972. ; StartAngle                    specifies the angle between the x-axis and the starting point of the pie
  973. ; SweepAngle                    specifies the angle between the starting and ending points of the pie
  974. ;
  975. ; return                                status enumeration. 0 = success
  976. ;
  977. ; notes                                 as all coordinates are taken from the top left of each pixel, then the entire width/height should be specified as subtracting the pen width
  978.  
  979. Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle)
  980. {
  981.    return DllCall("gdiplus\GdipDrawPie", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  982. }
  983.  
  984. ;#####################################################################################
  985.  
  986. ; Function                              Gdip_DrawLine
  987. ; Description                   This function uses a pen to draw a line into the Graphics of a bitmap
  988. ;
  989. ; pGraphics                             Pointer to the Graphics of a bitmap
  990. ; pPen                                  Pointer to a pen
  991. ; x1                                    x-coordinate of the start of the line
  992. ; y1                                    y-coordinate of the start of the line
  993. ; x2                                    x-coordinate of the end of the line
  994. ; y2                                    y-coordinate of the end of the line
  995. ;
  996. ; return                                status enumeration. 0 = success        
  997.  
  998. Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2)
  999. {
  1000.    return DllCall("gdiplus\GdipDrawLine", "uint", pGraphics, "uint", pPen
  1001.    , "float", x1, "float", y1, "float", x2, "float", y2)
  1002. }
  1003.  
  1004. ;#####################################################################################
  1005.  
  1006. ; Function                              Gdip_DrawLines
  1007. ; Description                   This function uses a pen to draw a series of joined lines into the Graphics of a bitmap
  1008. ;
  1009. ; pGraphics                             Pointer to the Graphics of a bitmap
  1010. ; pPen                                  Pointer to a pen
  1011. ; Points                                the coordinates of all the points passed as x1,y1|x2,y2|x3,y3.....
  1012. ;
  1013. ; return                                status enumeration. 0 = success                        
  1014.  
  1015. Gdip_DrawLines(pGraphics, pPen, Points)
  1016. {
  1017.    StringSplit, Points, Points, |
  1018.    VarSetCapacity(PointF, 8*Points0)  
  1019.    Loop, %Points0%
  1020.    {
  1021.       StringSplit, Coord, Points%A_Index%, `,
  1022.       NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  1023.    }
  1024.    return DllCall("gdiplus\GdipDrawLines", "uint", pGraphics, "uint", pPen, "uint", &PointF, "int", Points0)
  1025. }
  1026.  
  1027. ;#####################################################################################
  1028.  
  1029. ; Function                              Gdip_FillRectangle
  1030. ; Description                   This function uses a brush to fill a rectangle in the Graphics of a bitmap
  1031. ;
  1032. ; pGraphics                             Pointer to the Graphics of a bitmap
  1033. ; pBrush                                Pointer to a brush
  1034. ; x                                             x-coordinate of the top left of the rectangle
  1035. ; y                                             y-coordinate of the top left of the rectangle
  1036. ; w                                             width of the rectanlge
  1037. ; h                                             height of the rectangle
  1038. ;
  1039. ; return                                status enumeration. 0 = success
  1040.  
  1041. Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
  1042. {
  1043.    return DllCall("gdiplus\GdipFillRectangle", "uint", pGraphics, "int", pBrush
  1044.    , "float", x, "float", y, "float", w, "float", h)
  1045. }
  1046.  
  1047. ;#####################################################################################
  1048.  
  1049. ; Function                              Gdip_FillRoundedRectangle
  1050. ; Description                   This function uses a brush to fill a rounded rectangle in the Graphics of a bitmap
  1051. ;
  1052. ; pGraphics                             Pointer to the Graphics of a bitmap
  1053. ; pBrush                                Pointer to a brush
  1054. ; x                                             x-coordinate of the top left of the rounded rectangle
  1055. ; y                                             y-coordinate of the top left of the rounded rectangle
  1056. ; w                                             width of the rectanlge
  1057. ; h                                             height of the rectangle
  1058. ; r                                             radius of the rounded corners
  1059. ;
  1060. ; return                                status enumeration. 0 = success
  1061.  
  1062. Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r)
  1063. {
  1064.         Region := Gdip_GetClipRegion(pGraphics)
  1065.         Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  1066.         Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  1067.         Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  1068.         Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  1069.         E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
  1070.         Gdip_SetClipRegion(pGraphics, Region, 0)
  1071.         Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  1072.         Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  1073.         Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
  1074.         Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
  1075.         Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
  1076.         Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  1077.         Gdip_SetClipRegion(pGraphics, Region, 0)
  1078.         Gdip_DeleteRegion(Region)
  1079.         return E
  1080. }
  1081.  
  1082. ;#####################################################################################
  1083.  
  1084. ; Function                              Gdip_FillPolygon
  1085. ; Description                   This function uses a brush to fill a polygon in the Graphics of a bitmap
  1086. ;
  1087. ; pGraphics                             Pointer to the Graphics of a bitmap
  1088. ; pBrush                                Pointer to a brush
  1089. ; Points                                the coordinates of all the points passed as x1,y1|x2,y2|x3,y3.....
  1090. ;
  1091. ; return                                status enumeration. 0 = success
  1092. ;
  1093. ; notes                                 Alternate will fill the polygon as a whole, wheras winding will fill each new "segment"
  1094. ; Alternate                     = 0
  1095. ; Winding                               = 1
  1096.  
  1097. Gdip_FillPolygon(pGraphics, pBrush, Points, FillMode=0)
  1098. {
  1099.    StringSplit, Points, Points, |
  1100.    VarSetCapacity(PointF, 8*Points0)  
  1101.    Loop, %Points0%
  1102.    {
  1103.       StringSplit, Coord, Points%A_Index%, `,
  1104.       NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  1105.    }  
  1106.    return DllCall("gdiplus\GdipFillPolygon", "uint", pGraphics, "uint", pBrush, "uint", &PointF, "int", Points0, "int", FillMode)
  1107. }
  1108.  
  1109. ;#####################################################################################
  1110.  
  1111. ; Function                              Gdip_FillPie
  1112. ; Description                   This function uses a brush to fill a pie in the Graphics of a bitmap
  1113. ;
  1114. ; pGraphics                             Pointer to the Graphics of a bitmap
  1115. ; pBrush                                Pointer to a brush
  1116. ; x                                             x-coordinate of the top left of the pie
  1117. ; y                                             y-coordinate of the top left of the pie
  1118. ; w                                             width of the pie
  1119. ; h                                             height of the pie
  1120. ; StartAngle                    specifies the angle between the x-axis and the starting point of the pie
  1121. ; SweepAngle                    specifies the angle between the starting and ending points of the pie
  1122. ;
  1123. ; return                                status enumeration. 0 = success
  1124.  
  1125. Gdip_FillPie(pGraphics, pBrush, x, y, w, h, StartAngle, SweepAngle)
  1126. {
  1127.    return DllCall("gdiplus\GdipFillPie", "uint", pGraphics, "uint", pBrush
  1128.    , "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  1129. }
  1130.  
  1131. ;#####################################################################################
  1132.  
  1133. ; Function                              Gdip_FillEllipse
  1134. ; Description                   This function uses a brush to fill an ellipse in the Graphics of a bitmap
  1135. ;
  1136. ; pGraphics                             Pointer to the Graphics of a bitmap
  1137. ; pBrush                                Pointer to a brush
  1138. ; x                                             x-coordinate of the top left of the ellipse
  1139. ; y                                             y-coordinate of the top left of the ellipse
  1140. ; w                                             width of the ellipse
  1141. ; h                                             height of the ellipse
  1142. ;
  1143. ; return                                status enumeration. 0 = success
  1144.  
  1145. Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h)
  1146. {
  1147.         return DllCall("gdiplus\GdipFillEllipse", "uint", pGraphics, "uint", pBrush, "float", x, "float", y, "float", w, "float", h)
  1148. }
  1149.  
  1150. ;#####################################################################################
  1151.  
  1152. ; Function                              Gdip_FillRegion
  1153. ; Description                   This function uses a brush to fill a region in the Graphics of a bitmap
  1154. ;
  1155. ; pGraphics                             Pointer to the Graphics of a bitmap
  1156. ; pBrush                                Pointer to a brush
  1157. ; Region                                Pointer to a Region
  1158. ;
  1159. ; return                                status enumeration. 0 = success
  1160. ;
  1161. ; notes                                 You can create a region Gdip_CreateRegion() and then add to this
  1162.  
  1163. Gdip_FillRegion(pGraphics, pBrush, Region)
  1164. {
  1165.         return DllCall("gdiplus\GdipFillRegion", "uint", pGraphics, "uint", pBrush, "uint", Region)
  1166. }
  1167.  
  1168. ;#####################################################################################
  1169.  
  1170. ; Function                              Gdip_FillPath
  1171. ; Description                   This function uses a brush to fill a path in the Graphics of a bitmap
  1172. ;
  1173. ; pGraphics                             Pointer to the Graphics of a bitmap
  1174. ; pBrush                                Pointer to a brush
  1175. ; Region                                Pointer to a Path
  1176. ;
  1177. ; return                                status enumeration. 0 = success
  1178.  
  1179. Gdip_FillPath(pGraphics, pBrush, Path)
  1180. {
  1181.         return DllCall("gdiplus\GdipFillPath", "uint", pGraphics, "uint", pBrush, "uint", Path)
  1182. }
  1183.  
  1184. ;#####################################################################################
  1185.  
  1186. ; Function                              Gdip_DrawImagePointsRect
  1187. ; Description                   This function draws a bitmap into the Graphics of another bitmap and skews it
  1188. ;
  1189. ; pGraphics                             Pointer to the Graphics of a bitmap
  1190. ; pBitmap                               Pointer to a bitmap to be drawn
  1191. ; Points                                Points passed as x1,y1|x2,y2|x3,y3 (3 points: top left, top right, bottom left) describing the drawing of the bitmap
  1192. ; sx                                    x-coordinate of source upper-left corner
  1193. ; sy                                    y-coordinate of source upper-left corner
  1194. ; sw                                    width of source rectangle
  1195. ; sh                                    height of source rectangle
  1196. ; Matrix                                a matrix used to alter image attributes when drawing
  1197. ;
  1198. ; return                                status enumeration. 0 = success
  1199. ;
  1200. ; notes                                 if sx,sy,sw,sh are missed then the entire source bitmap will be used
  1201. ;                                               Matrix can be omitted to just draw with no alteration to ARGB
  1202. ;                                               Matrix may be passed as a digit from 0 - 1 to change just transparency
  1203. ;                                               Matrix can be passed as a matrix with any delimiter
  1204.  
  1205. Gdip_DrawImagePointsRect(pGraphics, pBitmap, Points, sx="", sy="", sw="", sh="", Matrix=1)
  1206. {
  1207.         StringSplit, Points, Points, |
  1208.         VarSetCapacity(PointF, 8*Points0)  
  1209.         Loop, %Points0%
  1210.         {
  1211.                 StringSplit, Coord, Points%A_Index%, `,
  1212.                 NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  1213.         }
  1214.  
  1215.         if (Matrix&1 = "")
  1216.                 ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
  1217.         else if (Matrix != 1)
  1218.                 ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
  1219.                
  1220.         if (sx = "" && sy = "" && sw = "" && sh = "")
  1221.         {
  1222.                 sx := 0, sy := 0
  1223.                 sw := Gdip_GetImageWidth(pBitmap)
  1224.                 sh := Gdip_GetImageHeight(pBitmap)
  1225.         }
  1226.  
  1227.         E := DllCall("gdiplus\GdipDrawImagePointsRect", "uint", pGraphics, "uint", pBitmap
  1228.         , "uint", &PointF, "int", Points0, "float", sx, "float", sy, "float", sw, "float", sh
  1229.         , "int", 2, "uint", ImageAttr, "uint", 0, "uint", 0)
  1230.         if ImageAttr
  1231.                 Gdip_DisposeImageAttributes(ImageAttr)
  1232.         return E
  1233. }
  1234.  
  1235. ;#####################################################################################
  1236.  
  1237. ; Function                              Gdip_DrawImage
  1238. ; Description                   This function draws a bitmap into the Graphics of another bitmap
  1239. ;
  1240. ; pGraphics                             Pointer to the Graphics of a bitmap
  1241. ; pBitmap                               Pointer to a bitmap to be drawn
  1242. ; dx                                    x-coord of destination upper-left corner
  1243. ; dy                                    y-coord of destination upper-left corner
  1244. ; dw                                    width of destination image
  1245. ; dh                                    height of destination image
  1246. ; sx                                    x-coordinate of source upper-left corner
  1247. ; sy                                    y-coordinate of source upper-left corner
  1248. ; sw                                    width of source image
  1249. ; sh                                    height of source image
  1250. ; Matrix                                a matrix used to alter image attributes when drawing
  1251. ;
  1252. ; return                                status enumeration. 0 = success
  1253. ;
  1254. ; notes                                 if sx,sy,sw,sh are missed then the entire source bitmap will be used
  1255. ;                                               Gdip_DrawImage performs faster
  1256. ;                                               Matrix can be omitted to just draw with no alteration to ARGB
  1257. ;                                               Matrix may be passed as a digit from 0 - 1 to change just transparency
  1258. ;                                               Matrix can be passed as a matrix with any delimiter. For example:
  1259. ;                                               MatrixBright=
  1260. ;                                               (
  1261. ;                                               1.5             |0              |0              |0              |0
  1262. ;                                               0               |1.5    |0              |0              |0
  1263. ;                                               0               |0              |1.5    |0              |0
  1264. ;                                               0               |0              |0              |1              |0
  1265. ;                                               0.05    |0.05   |0.05   |0              |1
  1266. ;                                               )
  1267. ;
  1268. ; notes                                 MatrixBright = 1.5|0|0|0|0|0|1.5|0|0|0|0|0|1.5|0|0|0|0|0|1|0|0.05|0.05|0.05|0|1
  1269. ;                                               MatrixGreyScale = 0.299|0.299|0.299|0|0|0.587|0.587|0.587|0|0|0.114|0.114|0.114|0|0|0|0|0|1|0|0|0|0|0|1
  1270. ;                                               MatrixNegative = -1|0|0|0|0|0|-1|0|0|0|0|0|-1|0|0|0|0|0|1|0|0|0|0|0|1
  1271.  
  1272. Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1)
  1273. {
  1274.         if (Matrix&1 = "")
  1275.                 ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
  1276.         else if (Matrix != 1)
  1277.                 ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
  1278.  
  1279.         if (sx = "" && sy = "" && sw = "" && sh = "")
  1280.         {
  1281.                 if (dx = "" && dy = "" && dw = "" && dh = "")
  1282.                 {
  1283.                         sx := dx := 0, sy := dy := 0
  1284.                         sw := dw := Gdip_GetImageWidth(pBitmap)
  1285.                         sh := dh := Gdip_GetImageHeight(pBitmap)
  1286.                 }
  1287.                 else
  1288.                 {
  1289.                         sx := sy := 0
  1290.                         sw := Gdip_GetImageWidth(pBitmap)
  1291.                         sh := Gdip_GetImageHeight(pBitmap)
  1292.                 }
  1293.         }
  1294.  
  1295.         E := DllCall("gdiplus\GdipDrawImageRectRect", "uint", pGraphics, "uint", pBitmap
  1296.         , "float", dx, "float", dy, "float", dw, "float", dh
  1297.         , "float", sx, "float", sy, "float", sw, "float", sh
  1298.         , "int", 2, "uint", ImageAttr, "uint", 0, "uint", 0)
  1299.         if ImageAttr
  1300.                 Gdip_DisposeImageAttributes(ImageAttr)
  1301.         return E
  1302. }
  1303.  
  1304. ;#####################################################################################
  1305.  
  1306. ; Function                              Gdip_SetImageAttributesColorMatrix
  1307. ; Description                   This function creates an image matrix ready for drawing
  1308. ;
  1309. ; Matrix                                a matrix used to alter image attributes when drawing
  1310. ;                                               passed with any delimeter
  1311. ;
  1312. ; return                                returns an image matrix on sucess or 0 if it fails
  1313. ;
  1314. ; notes                                 MatrixBright = 1.5|0|0|0|0|0|1.5|0|0|0|0|0|1.5|0|0|0|0|0|1|0|0.05|0.05|0.05|0|1
  1315. ;                                               MatrixGreyScale = 0.299|0.299|0.299|0|0|0.587|0.587|0.587|0|0|0.114|0.114|0.114|0|0|0|0|0|1|0|0|0|0|0|1
  1316. ;                                               MatrixNegative = -1|0|0|0|0|0|-1|0|0|0|0|0|-1|0|0|0|0|0|1|0|0|0|0|0|1
  1317.  
  1318. Gdip_SetImageAttributesColorMatrix(Matrix)
  1319. {
  1320.         VarSetCapacity(ColourMatrix, 100, 0)
  1321.         Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
  1322.         StringSplit, Matrix, Matrix, |
  1323.         Loop, 25
  1324.         {
  1325.                 Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
  1326.                 NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
  1327.         }
  1328.         DllCall("gdiplus\GdipCreateImageAttributes", "uint*", ImageAttr)
  1329.         DllCall("gdiplus\GdipSetImageAttributesColorMatrix", "uint", ImageAttr, "int", 1, "int", 1, "uint", &ColourMatrix, "int", 0, "int", 0)
  1330.         return ImageAttr
  1331. }
  1332.  
  1333. ;#####################################################################################
  1334.  
  1335. ; Function                              Gdip_GraphicsFromImage
  1336. ; Description                   This function gets the graphics for a bitmap used for drawing functions
  1337. ;
  1338. ; pBitmap                               Pointer to a bitmap to get the pointer to its graphics
  1339. ;
  1340. ; return                                returns a pointer to the graphics of a bitmap
  1341. ;
  1342. ; notes                                 a bitmap can be drawn into the graphics of another bitmap
  1343.  
  1344. Gdip_GraphicsFromImage(pBitmap)
  1345. {
  1346.     DllCall("gdiplus\GdipGetImageGraphicsContext", "uint", pBitmap, "uint*", pGraphics)
  1347.     return pGraphics
  1348. }
  1349.  
  1350. ;#####################################################################################
  1351.  
  1352. ; Function                              Gdip_GraphicsFromHDC
  1353. ; Description                   This function gets the graphics from the handle to a device context
  1354. ;
  1355. ; hdc                                   This is the handle to the device context
  1356. ;
  1357. ; return                                returns a pointer to the graphics of a bitmap
  1358. ;
  1359. ; notes                                 You can draw a bitmap into the graphics of another bitmap
  1360.  
  1361. Gdip_GraphicsFromHDC(hdc)
  1362. {
  1363.     DllCall("gdiplus\GdipCreateFromHDC", "uint", hdc, "uint*", pGraphics)
  1364.     return pGraphics
  1365. }
  1366.  
  1367. ;#####################################################################################
  1368.  
  1369. ; Function                              Gdip_GetDC
  1370. ; Description                   This function gets the device context of the passed Graphics
  1371. ;
  1372. ; hdc                                   This is the handle to the device context
  1373. ;
  1374. ; return                                returns the device context for the graphics of a bitmap
  1375.  
  1376. Gdip_GetDC(pGraphics)
  1377. {
  1378.         DllCall("gdiplus\GdipGetDC", "uint", pGraphics, "uint*", hdc)
  1379.         return hdc
  1380. }
  1381.  
  1382. ;#####################################################################################
  1383.  
  1384. ; Function                              Gdip_ReleaseDC
  1385. ; Description                   This function releases a device context from use for further use
  1386. ;
  1387. ; pGraphics                             Pointer to the graphics of a bitmap
  1388. ; hdc                                   This is the handle to the device context
  1389. ;
  1390. ; return                                status enumeration. 0 = success
  1391.  
  1392. Gdip_ReleaseDC(pGraphics, hdc)
  1393. {
  1394.         return DllCall("gdiplus\GdipReleaseDC", "uint", pGraphics, "uint", hdc)
  1395. }
  1396.  
  1397. ;#####################################################################################
  1398.  
  1399. ; Function                              Gdip_GraphicsClear
  1400. ; Description                   Clears the graphics of a bitmap ready for further drawing
  1401. ;
  1402. ; pGraphics                             Pointer to the graphics of a bitmap
  1403. ; ARGB                                  The colour to clear the graphics to
  1404. ;
  1405. ; return                                status enumeration. 0 = success
  1406. ;
  1407. ; notes                                 By default this will make the background invisible
  1408. ;                                               Using clipping regions you can clear a particular area on the graphics rather than clearing the entire graphics
  1409.  
  1410. Gdip_GraphicsClear(pGraphics, ARGB=0x00ffffff)
  1411. {
  1412.     return DllCall("gdiplus\GdipGraphicsClear", "uint", pGraphics, "int", ARGB)
  1413. }
  1414.  
  1415. ;#####################################################################################
  1416.  
  1417. ; Function                              Gdip_BlurBitmap
  1418. ; Description                   Gives a pointer to a blurred bitmap from a pointer to a bitmap
  1419. ;
  1420. ; pBitmap                               Pointer to a bitmap to be blurred
  1421. ; Blur                                  The Amount to blur a bitmap by from 1 (least blur) to 100 (most blur)
  1422. ;
  1423. ; return                                If the function succeeds, the return value is a pointer to the new blurred bitmap
  1424. ;                                               -1 = The blur parameter is outside the range 1-100
  1425. ;
  1426. ; notes                                 This function will not dispose of the original bitmap
  1427.  
  1428. Gdip_BlurBitmap(pBitmap, Blur)
  1429. {
  1430.         if (Blur > 100) || (Blur < 1)
  1431.                 return -1      
  1432.        
  1433.         sWidth := Gdip_GetImageWidth(pBitmap), sHeight := Gdip_GetImageHeight(pBitmap)
  1434.         dWidth := sWidth//Blur, dHeight := sHeight//Blur
  1435.  
  1436.         pBitmap1 := Gdip_CreateBitmap(dWidth, dHeight)
  1437.         G1 := Gdip_GraphicsFromImage(pBitmap1)
  1438.         Gdip_SetInterpolationMode(G1, 7)
  1439.         Gdip_DrawImage(G1, pBitmap, 0, 0, dWidth, dHeight, 0, 0, sWidth, sHeight)
  1440.  
  1441.         Gdip_DeleteGraphics(G1)
  1442.  
  1443.         pBitmap2 := Gdip_CreateBitmap(sWidth, sHeight)
  1444.         G2 := Gdip_GraphicsFromImage(pBitmap2)
  1445.         Gdip_SetInterpolationMode(G2, 7)
  1446.         Gdip_DrawImage(G2, pBitmap1, 0, 0, sWidth, sHeight, 0, 0, dWidth, dHeight)
  1447.  
  1448.         Gdip_DeleteGraphics(G2)
  1449.         Gdip_DisposeImage(pBitmap1)
  1450.         return pBitmap2
  1451. }
  1452.  
  1453. ;#####################################################################################
  1454.  
  1455. ; Function:                     Gdip_SaveBitmapToFile
  1456. ; Description:                  Saves a bitmap to a file in any supported format onto disk
  1457. ;  
  1458. ; pBitmap                               Pointer to a bitmap
  1459. ; sOutput                       The name of the file that the bitmap will be saved to. Supported extensions are: .BMP,.DIB,.RLE,.JPG,.JPEG,.JPE,.JFIF,.GIF,.TIF,.TIFF,.PNG
  1460. ; Quality                       If saving as jpg (.JPG,.JPEG,.JPE,.JFIF) then quality can be 1-100 with default at maximum quality
  1461. ;
  1462. ; return                        If the function succeeds, the return value is zero, otherwise:
  1463. ;                                               -1 = Extension supplied is not a supported file format
  1464. ;                                               -2 = Could not get a list of encoders on system
  1465. ;                                               -3 = Could not find matching encoder for specified file format
  1466. ;                                               -4 = Could not get WideChar name of output file
  1467. ;                                               -5 = Could not save file to disk
  1468. ;
  1469. ; notes                                 This function will use the extension supplied from the sOutput parameter to determine the output format
  1470.  
  1471. Gdip_SaveBitmapToFile(pBitmap, sOutput, Quality=75)
  1472. {
  1473.         SplitPath, sOutput,,, Extension
  1474.         if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
  1475.                 return -1
  1476.         Extension := "." Extension
  1477.  
  1478.         DllCall("gdiplus\GdipGetImageEncodersSize", "uint*", nCount, "uint*", nSize)
  1479.         VarSetCapacity(ci, nSize)
  1480.         DllCall("gdiplus\GdipGetImageEncoders", "uint", nCount, "uint", nSize, "uint", &ci)
  1481.         if !(nCount && nSize)
  1482.                 return -2
  1483.    
  1484.         Loop, %nCount%
  1485.         {
  1486.                 Location := NumGet(ci, 76*(A_Index-1)+44)
  1487.                 if !A_IsUnicode
  1488.                 {
  1489.                         nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
  1490.                         VarSetCapacity(sString, nSize)
  1491.                         DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "str", sString, "int", nSize, "uint", 0, "uint", 0)
  1492.                         if !InStr(sString, "*" Extension)
  1493.                                 continue
  1494.                 }
  1495.                 else
  1496.                 {
  1497.                         nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
  1498.                         sString := ""
  1499.                         Loop, %nSize%
  1500.                                 sString .= Chr(NumGet(Location+0, 2*(A_Index-1), "char"))
  1501.                         if !InStr(sString, "*" Extension)
  1502.                                 continue
  1503.                 }
  1504.                 pCodec := &ci+76*(A_Index-1)
  1505.                 break
  1506.         }
  1507.         if !pCodec
  1508.                 return -3
  1509.  
  1510.         if (Quality != 75)
  1511.         {
  1512.                 Quality := (Quality < 0) ? 0 : (Quality > 100) ? 100 : Quality
  1513.                 if Extension in .JPG,.JPEG,.JPE,.JFIF
  1514.                 {
  1515.                         DllCall("gdiplus\GdipGetEncoderParameterListSize", "uint", pBitmap, "uint", pCodec, "uint*", nSize)
  1516.                         VarSetCapacity(EncoderParameters, nSize, 0)
  1517.                         DllCall("gdiplus\GdipGetEncoderParameterList", "uint", pBitmap, "uint", pCodec, "uint", nSize, "uint", &EncoderParameters)
  1518.                         Loop, % NumGet(EncoderParameters)      ;%
  1519.                         {
  1520.                                 if (NumGet(EncoderParameters, (28*(A_Index-1))+20) = 1) && (NumGet(EncoderParameters, (28*(A_Index-1))+24) = 6)
  1521.                                 {
  1522.                                    p := (28*(A_Index-1))+&EncoderParameters
  1523.                                    NumPut(Quality, NumGet(NumPut(4, NumPut(1, p+0)+20)))
  1524.                                    break
  1525.                                 }
  1526.                         }      
  1527.           }
  1528.         }
  1529.  
  1530.         if !A_IsUnicode
  1531.         {
  1532.                 nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", 0, "int", 0)
  1533.                 VarSetCapacity(wOutput, nSize*2)
  1534.                 DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", &wOutput, "int", nSize)
  1535.                 VarSetCapacity(wOutput, -1)
  1536.                 if !VarSetCapacity(wOutput)
  1537.                         return -4
  1538.                 E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &wOutput, "uint", pCodec, "uint", p ? p : 0)
  1539.         }
  1540.         else
  1541.                 E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &sOutput, "uint", pCodec, "uint", p ? p : 0)
  1542.         return E ? -5 : 0
  1543. }
  1544.  
  1545. ;#####################################################################################
  1546.  
  1547. ; Function                              Gdip_GetPixel
  1548. ; Description                   Gets the ARGB of a pixel in a bitmap
  1549. ;
  1550. ; pBitmap                               Pointer to a bitmap
  1551. ; x                                             x-coordinate of the pixel
  1552. ; y                                             y-coordinate of the pixel
  1553. ;
  1554. ; return                                Returns the ARGB value of the pixel
  1555.  
  1556. Gdip_GetPixel(pBitmap, x, y)
  1557. {
  1558.         DllCall("gdiplus\GdipBitmapGetPixel", "uint", pBitmap, "int", x, "int", y, "uint*", ARGB)
  1559.         return ARGB
  1560. }
  1561.  
  1562. ;#####################################################################################
  1563.  
  1564. ; Function                              Gdip_SetPixel
  1565. ; Description                   Sets the ARGB of a pixel in a bitmap
  1566. ;
  1567. ; pBitmap                               Pointer to a bitmap
  1568. ; x                                             x-coordinate of the pixel
  1569. ; y                                             y-coordinate of the pixel
  1570. ;
  1571. ; return                                status enumeration. 0 = success
  1572.  
  1573. Gdip_SetPixel(pBitmap, x, y, ARGB)
  1574. {
  1575.    return DllCall("gdiplus\GdipBitmapSetPixel", "uint", pBitmap, "int", x, "int", y, "int", ARGB)
  1576. }
  1577.  
  1578. ;#####################################################################################
  1579.  
  1580. ; Function                              Gdip_GetImageWidth
  1581. ; Description                   Gives the width of a bitmap
  1582. ;
  1583. ; pBitmap                               Pointer to a bitmap
  1584. ;
  1585. ; return                                Returns the width in pixels of the supplied bitmap
  1586.  
  1587. Gdip_GetImageWidth(pBitmap)
  1588. {
  1589.    DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
  1590.    return Width
  1591. }
  1592.  
  1593. ;#####################################################################################
  1594.  
  1595. ; Function                              Gdip_GetImageHeight
  1596. ; Description                   Gives the height of a bitmap
  1597. ;
  1598. ; pBitmap                               Pointer to a bitmap
  1599. ;
  1600. ; return                                Returns the height in pixels of the supplied bitmap
  1601.  
  1602. Gdip_GetImageHeight(pBitmap)
  1603. {
  1604.    DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
  1605.    return Height
  1606. }
  1607.  
  1608. ;#####################################################################################
  1609.  
  1610. ; Function                              Gdip_GetDimensions
  1611. ; Description                   Gives the width and height of a bitmap
  1612. ;
  1613. ; pBitmap                               Pointer to a bitmap
  1614. ; Width                                 ByRef variable. This variable will be set to the width of the bitmap
  1615. ; Height                                ByRef variable. This variable will be set to the height of the bitmap
  1616. ;
  1617. ; return                                No return value
  1618. ;                                               Gdip_GetDimensions(pBitmap, ThisWidth, ThisHeight) will set ThisWidth to the width and ThisHeight to the height
  1619.  
  1620. Gdip_GetImageDimensions(pBitmap, ByRef Width, ByRef Height)
  1621. {
  1622.         DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
  1623.         DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
  1624. }
  1625.  
  1626. ;#####################################################################################
  1627.  
  1628. Gdip_GetDimensions(pBitmap, ByRef Width, ByRef Height)
  1629. {
  1630.         Gdip_GetImageDimensions(pBitmap, Width, Height)
  1631. }
  1632.  
  1633. ;#####################################################################################
  1634.  
  1635. Gdip_GetImagePixelFormat(pBitmap)
  1636. {
  1637.         DllCall("gdiplus\GdipGetImagePixelFormat", "uint", pBitmap, "uint*", Format)
  1638.         return Format
  1639. }
  1640.  
  1641. ;#####################################################################################
  1642.  
  1643. ; Function                              Gdip_GetDpiX
  1644. ; Description                   Gives the horizontal dots per inch of the graphics of a bitmap
  1645. ;
  1646. ; pBitmap                               Pointer to a bitmap
  1647. ; Width                                 ByRef variable. This variable will be set to the width of the bitmap
  1648. ; Height                                ByRef variable. This variable will be set to the height of the bitmap
  1649. ;
  1650. ; return                                No return value
  1651. ;                                               Gdip_GetDimensions(pBitmap, ThisWidth, ThisHeight) will set ThisWidth to the width and ThisHeight to the height
  1652.  
  1653. Gdip_GetDpiX(pGraphics)
  1654. {
  1655.         DllCall("gdiplus\GdipGetDpiX", "uint", pGraphics, "float*", dpix)
  1656.         return Round(dpix)
  1657. }
  1658.  
  1659. ;#####################################################################################
  1660.  
  1661. Gdip_GetDpiY(pGraphics)
  1662. {
  1663.         DllCall("gdiplus\GdipGetDpiY", "uint", pGraphics, "float*", dpiy)
  1664.         return Round(dpiy)
  1665. }
  1666.  
  1667. ;#####################################################################################
  1668.  
  1669. Gdip_GetImageHorizontalResolution(pBitmap)
  1670. {
  1671.         DllCall("gdiplus\GdipGetImageHorizontalResolution", "uint", pBitmap, "float*", dpix)
  1672.         return Round(dpix)
  1673. }
  1674.  
  1675. ;#####################################################################################
  1676.  
  1677. Gdip_GetImageVerticalResolution(pBitmap)
  1678. {
  1679.         DllCall("gdiplus\GdipGetImageVerticalResolution", "uint", pBitmap, "float*", dpiy)
  1680.         return Round(dpiy)
  1681. }
  1682.  
  1683. ;#####################################################################################
  1684.  
  1685. Gdip_BitmapSetResolution(pBitmap, dpix, dpiy)
  1686. {
  1687.         return DllCall("gdiplus\GdipBitmapSetResolution", "uint", pBitmap, "float", dpix, "float", dpiy)
  1688. }
  1689.  
  1690. ;#####################################################################################
  1691.  
  1692. Gdip_CreateBitmapFromFile(sFile, IconNumber=1, IconSize="")
  1693. {
  1694.         SplitPath, sFile,,, ext
  1695.         if ext in exe,dll
  1696.         {
  1697.                 Sizes := IconSize ? IconSize : 256 "|" 128 "|" 64 "|" 48 "|" 32 "|" 16
  1698.                 VarSetCapacity(buf, 40)
  1699.                 Loop, Parse, Sizes, |
  1700.                 {
  1701.                         DllCall("PrivateExtractIcons", "str", sFile, "int", IconNumber-1, "int", A_LoopField, "int", A_LoopField, "uint*", hIcon, "uint*", 0, "uint", 1, "uint", 0)
  1702.                         if !hIcon
  1703.                                 continue
  1704.  
  1705.                         if !DllCall("GetIconInfo", "uint", hIcon, "uint", &buf)
  1706.                         {
  1707.                                 DestroyIcon(hIcon)
  1708.                                 continue
  1709.                         }
  1710.                         hbmColor := NumGet(buf, 16)
  1711.                         hbmMask  := NumGet(buf, 12)
  1712.  
  1713.                         if !(hbmColor && DllCall("GetObject", "uint", hbmColor, "int", 24, "uint", &buf))
  1714.                         {
  1715.                                 DestroyIcon(hIcon)
  1716.                                 continue
  1717.                         }
  1718.                         break
  1719.                 }
  1720.                 if !hIcon
  1721.                         return -1
  1722.  
  1723.                 Width := NumGet(buf, 4, "int"),  Height := NumGet(buf, 8, "int")
  1724.                 hbm := CreateDIBSection(Width, -Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
  1725.  
  1726.                 if !DllCall("DrawIconEx", "uint", hdc, "int", 0, "int", 0, "uint", hIcon, "uint", Width, "uint", Height, "uint", 0, "uint", 0, "uint", 3)
  1727.                 {
  1728.                         DestroyIcon(hIcon)
  1729.                         return -2
  1730.                 }
  1731.  
  1732.                 VarSetCapacity(dib, 84)
  1733.                 DllCall("GetObject", "uint", hbm, "int", 84, "uint", &dib)
  1734.                 Stride := NumGet(dib, 12), Bits := NumGet(dib, 20)
  1735.  
  1736.                 DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", Stride, "int", 0x26200A, "uint", Bits, "uint*", pBitmapOld)
  1737.                 pBitmap := Gdip_CreateBitmap(Width, Height), G := Gdip_GraphicsFromImage(pBitmap)
  1738.                 Gdip_DrawImage(G, pBitmapOld, 0, 0, Width, Height, 0, 0, Width, Height)
  1739.                 SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
  1740.                 Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmapOld)
  1741.                 DestroyIcon(hIcon)
  1742.         }
  1743.         else
  1744.         {
  1745.                 if !A_IsUnicode
  1746.                 {
  1747.                         VarSetCapacity(wFile, 1023)
  1748.                         DllCall("kernel32\MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sFile, "int", -1, "uint", &wFile, "int", 512)
  1749.                         DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &wFile, "uint*", pBitmap)
  1750.                 }
  1751.                 else
  1752.                         DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &sFile, "uint*", pBitmap)
  1753.         }
  1754.         return pBitmap
  1755. }
  1756.  
  1757. ;#####################################################################################
  1758.  
  1759. Gdip_CreateBitmapFromHBITMAP(hBitmap, Palette=0)
  1760. {
  1761.         DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "uint", hBitmap, "uint", Palette, "uint*", pBitmap)
  1762.         return pBitmap
  1763. }
  1764.  
  1765. ;#####################################################################################
  1766.  
  1767. Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff)
  1768. {
  1769.         DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "uint", pBitmap, "uint*", hbm, "int", Background)
  1770.         return hbm
  1771. }
  1772.  
  1773. ;#####################################################################################
  1774.  
  1775. Gdip_CreateBitmapFromHICON(hIcon)
  1776. {
  1777.         DllCall("gdiplus\GdipCreateBitmapFromHICON", "uint", hIcon, "uint*", pBitmap)
  1778.         return pBitmap
  1779. }
  1780.  
  1781. ;#####################################################################################
  1782.  
  1783. Gdip_CreateHICONFromBitmap(pBitmap)
  1784. {
  1785.         DllCall("gdiplus\GdipCreateHICONFromBitmap", "uint", pBitmap, "uint*", hIcon)
  1786.         return hIcon
  1787. }
  1788.  
  1789. ;#####################################################################################
  1790.  
  1791. Gdip_CreateBitmap(Width, Height, Format=0x26200A)
  1792. {
  1793.     DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, "uint", 0, "uint*", pBitmap)
  1794.     Return pBitmap
  1795. }
  1796.  
  1797. ;#####################################################################################
  1798.  
  1799. Gdip_CreateBitmapFromClipboard()
  1800. {
  1801.         if !DllCall("OpenClipboard", "uint", 0)
  1802.                 return -1
  1803.         if !DllCall("IsClipboardFormatAvailable", "uint", 8)
  1804.                 return -2
  1805.         if !hBitmap := DllCall("GetClipboardData", "uint", 2)
  1806.                 return -3
  1807.         if !pBitmap := Gdip_CreateBitmapFromHBITMAP(hBitmap)
  1808.                 return -4
  1809.         if !DllCall("CloseClipboard")
  1810.                 return -5
  1811.         DeleteObject(hBitmap)
  1812.         return pBitmap
  1813. }
  1814.  
  1815. ;#####################################################################################
  1816.  
  1817. Gdip_SetBitmapToClipboard(pBitmap)
  1818. {
  1819.         hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  1820.         DllCall("GetObject", "uint", hBitmap, "int", VarSetCapacity(oi, 84, 0), "uint", &oi)
  1821.         hdib := DllCall("GlobalAlloc", "uint", 2, "uint", 40+NumGet(oi, 44))
  1822.         pdib := DllCall("GlobalLock", "uint", hdib)
  1823.         DllCall("RtlMoveMemory", "uint", pdib, "uint", &oi+24, "uint", 40)
  1824.         DllCall("RtlMoveMemory", "Uint", pdib+40, "Uint", NumGet(oi, 20), "uint", NumGet(oi, 44))
  1825.         DllCall("GlobalUnlock", "uint", hdib)
  1826.         DllCall("DeleteObject", "uint", hBitmap)
  1827.         DllCall("OpenClipboard", "uint", 0)
  1828.         DllCall("EmptyClipboard")
  1829.         DllCall("SetClipboardData", "uint", 8, "uint", hdib)
  1830.         DllCall("CloseClipboard")
  1831. }
  1832.  
  1833. ;#####################################################################################
  1834.  
  1835. Gdip_CloneBitmapArea(pBitmap, x, y, w, h, Format=0x26200A)
  1836. {
  1837.         DllCall("gdiplus\GdipCloneBitmapArea", "float", x, "float", y, "float", w, "float", h
  1838.         , "int", Format, "uint", pBitmap, "uint*", pBitmapDest)
  1839.         return pBitmapDest
  1840. }
  1841.  
  1842. ;#####################################################################################
  1843. ; Create resources
  1844. ;#####################################################################################
  1845.  
  1846. Gdip_CreatePen(ARGB, w)
  1847. {
  1848.    DllCall("gdiplus\GdipCreatePen1", "int", ARGB, "float", w, "int", 2, "uint*", pPen)
  1849.    return pPen
  1850. }
  1851.  
  1852. ;#####################################################################################
  1853.  
  1854. Gdip_CreatePenFromBrush(pBrush, w)
  1855. {
  1856.         DllCall("gdiplus\GdipCreatePen2", "uint", pBrush, "float", w, "int", 2, "uint*", pPen)
  1857.         return pPen
  1858. }
  1859.  
  1860. ;#####################################################################################
  1861.  
  1862. Gdip_BrushCreateSolid(ARGB=0xff000000)
  1863. {
  1864.         DllCall("gdiplus\GdipCreateSolidFill", "int", ARGB, "uint*", pBrush)
  1865.         return pBrush
  1866. }
  1867.  
  1868. ;#####################################################################################
  1869.  
  1870. ; HatchStyleHorizontal = 0
  1871. ; HatchStyleVertical = 1
  1872. ; HatchStyleForwardDiagonal = 2
  1873. ; HatchStyleBackwardDiagonal = 3
  1874. ; HatchStyleCross = 4
  1875. ; HatchStyleDiagonalCross = 5
  1876. ; HatchStyle05Percent = 6
  1877. ; HatchStyle10Percent = 7
  1878. ; HatchStyle20Percent = 8
  1879. ; HatchStyle25Percent = 9
  1880. ; HatchStyle30Percent = 10
  1881. ; HatchStyle40Percent = 11
  1882. ; HatchStyle50Percent = 12
  1883. ; HatchStyle60Percent = 13
  1884. ; HatchStyle70Percent = 14
  1885. ; HatchStyle75Percent = 15
  1886. ; HatchStyle80Percent = 16
  1887. ; HatchStyle90Percent = 17
  1888. ; HatchStyleLightDownwardDiagonal = 18
  1889. ; HatchStyleLightUpwardDiagonal = 19
  1890. ; HatchStyleDarkDownwardDiagonal = 20
  1891. ; HatchStyleDarkUpwardDiagonal = 21
  1892. ; HatchStyleWideDownwardDiagonal = 22
  1893. ; HatchStyleWideUpwardDiagonal = 23
  1894. ; HatchStyleLightVertical = 24
  1895. ; HatchStyleLightHorizontal = 25
  1896. ; HatchStyleNarrowVertical = 26
  1897. ; HatchStyleNarrowHorizontal = 27
  1898. ; HatchStyleDarkVertical = 28
  1899. ; HatchStyleDarkHorizontal = 29
  1900. ; HatchStyleDashedDownwardDiagonal = 30
  1901. ; HatchStyleDashedUpwardDiagonal = 31
  1902. ; HatchStyleDashedHorizontal = 32
  1903. ; HatchStyleDashedVertical = 33
  1904. ; HatchStyleSmallConfetti = 34
  1905. ; HatchStyleLargeConfetti = 35
  1906. ; HatchStyleZigZag = 36
  1907. ; HatchStyleWave = 37
  1908. ; HatchStyleDiagonalBrick = 38
  1909. ; HatchStyleHorizontalBrick = 39
  1910. ; HatchStyleWeave = 40
  1911. ; HatchStylePlaid = 41
  1912. ; HatchStyleDivot = 42
  1913. ; HatchStyleDottedGrid = 43
  1914. ; HatchStyleDottedDiamond = 44
  1915. ; HatchStyleShingle = 45
  1916. ; HatchStyleTrellis = 46
  1917. ; HatchStyleSphere = 47
  1918. ; HatchStyleSmallGrid = 48
  1919. ; HatchStyleSmallCheckerBoard = 49
  1920. ; HatchStyleLargeCheckerBoard = 50
  1921. ; HatchStyleOutlinedDiamond = 51
  1922. ; HatchStyleSolidDiamond = 52
  1923. ; HatchStyleTotal = 53
  1924. Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0)
  1925. {
  1926.         DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "int", ARGBfront, "int", ARGBback, "uint*", pBrush)
  1927.         return pBrush
  1928. }
  1929.  
  1930. ;#####################################################################################
  1931.  
  1932. Gdip_CreateTextureBrush(pBitmap, WrapMode=1, x=0, y=0, w="", h="")
  1933. {
  1934.         if !(w && h)
  1935.                 DllCall("gdiplus\GdipCreateTexture", "uint", pBitmap, "int", WrapMode, "uint*", pBrush)
  1936.         else
  1937.                 DllCall("gdiplus\GdipCreateTexture2", "uint", pBitmap, "int", WrapMode, "float", x, "float", y, "float", w, "float", h, "uint*", pBrush)
  1938.         return pBrush
  1939. }
  1940.  
  1941. ;#####################################################################################
  1942.  
  1943. ; WrapModeTile = 0
  1944. ; WrapModeTileFlipX = 1
  1945. ; WrapModeTileFlipY = 2
  1946. ; WrapModeTileFlipXY = 3
  1947. ; WrapModeClamp = 4
  1948. Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1)
  1949. {
  1950.         CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
  1951.         DllCall("gdiplus\GdipCreateLineBrush", "uint", &PointF1, "uint", &PointF2, "int", ARGB1, "int", ARGB2, "int", WrapMode, "uint*", LGpBrush)
  1952.         return LGpBrush
  1953. }
  1954.  
  1955. ;#####################################################################################
  1956.  
  1957. ; LinearGradientModeHorizontal = 0
  1958. ; LinearGradientModeVertical = 1
  1959. ; LinearGradientModeForwardDiagonal = 2
  1960. ; LinearGradientModeBackwardDiagonal = 3
  1961. Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1)
  1962. {
  1963.         CreateRectF(RectF, x, y, w, h)
  1964.         DllCall("gdiplus\GdipCreateLineBrushFromRect", "uint", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, "uint*", LGpBrush)
  1965.         return LGpBrush
  1966. }
  1967.  
  1968. ;#####################################################################################
  1969.  
  1970. Gdip_CloneBrush(pBrush)
  1971. {
  1972.         DllCall("gdiplus\GdipCloneBrush", "uint", pBrush, "uint*", pBrushClone)
  1973.         return pBrushClone
  1974. }
  1975.  
  1976. ;#####################################################################################
  1977. ; Delete resources
  1978. ;#####################################################################################
  1979.  
  1980. Gdip_DeletePen(pPen)
  1981. {
  1982.    return DllCall("gdiplus\GdipDeletePen", "uint", pPen)
  1983. }
  1984.  
  1985. ;#####################################################################################
  1986.  
  1987. Gdip_DeleteBrush(pBrush)
  1988. {
  1989.    return DllCall("gdiplus\GdipDeleteBrush", "uint", pBrush)
  1990. }
  1991.  
  1992. ;#####################################################################################
  1993.  
  1994. Gdip_DisposeImage(pBitmap)
  1995. {
  1996.    return DllCall("gdiplus\GdipDisposeImage", "uint", pBitmap)
  1997. }
  1998.  
  1999. ;#####################################################################################
  2000.  
  2001. Gdip_DeleteGraphics(pGraphics)
  2002. {
  2003.    return DllCall("gdiplus\GdipDeleteGraphics", "uint", pGraphics)
  2004. }
  2005.  
  2006. ;#####################################################################################
  2007.  
  2008. Gdip_DisposeImageAttributes(ImageAttr)
  2009. {
  2010.         return DllCall("gdiplus\GdipDisposeImageAttributes", "uint", ImageAttr)
  2011. }
  2012.  
  2013. ;#####################################################################################
  2014.  
  2015. Gdip_DeleteFont(hFont)
  2016. {
  2017.    return DllCall("gdiplus\GdipDeleteFont", "uint", hFont)
  2018. }
  2019.  
  2020. ;#####################################################################################
  2021.  
  2022. Gdip_DeleteStringFormat(hFormat)
  2023. {
  2024.    return DllCall("gdiplus\GdipDeleteStringFormat", "uint", hFormat)
  2025. }
  2026.  
  2027. ;#####################################################################################
  2028.  
  2029. Gdip_DeleteFontFamily(hFamily)
  2030. {
  2031.    return DllCall("gdiplus\GdipDeleteFontFamily", "uint", hFamily)
  2032. }
  2033.  
  2034. ;#####################################################################################
  2035.  
  2036. Gdip_DeleteMatrix(Matrix)
  2037. {
  2038.    return DllCall("gdiplus\GdipDeleteMatrix", "uint", Matrix)
  2039. }
  2040.  
  2041. ;#####################################################################################
  2042. ; Text functions
  2043. ;#####################################################################################
  2044.  
  2045. Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0)
  2046. {
  2047.         IWidth := Width, IHeight:= Height
  2048.        
  2049.         RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
  2050.         RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
  2051.         RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
  2052.         RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
  2053.         RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
  2054.         RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
  2055.         RegExMatch(Options, "i)NoWrap", NoWrap)
  2056.         RegExMatch(Options, "i)R(\d)", Rendering)
  2057.         RegExMatch(Options, "i)S(\d+)(p*)", Size)
  2058.  
  2059.         if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
  2060.                 PassBrush := 1, pBrush := Colour2
  2061.        
  2062.         if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
  2063.                 return -1
  2064.  
  2065.         Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
  2066.         Loop, Parse, Styles, |
  2067.         {
  2068.                 if RegExMatch(Options, "\b" A_loopField)
  2069.                 Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
  2070.         }
  2071.  
  2072.         Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
  2073.         Loop, Parse, Alignments, |
  2074.         {
  2075.                 if RegExMatch(Options, "\b" A_loopField)
  2076.                         Align |= A_Index//2.1      ; 0|0|1|1|2|2
  2077.         }
  2078.  
  2079.         xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
  2080.         ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
  2081.         Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
  2082.         Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
  2083.         if !PassBrush
  2084.                 Colour := "0x" (Colour2 ? Colour2 : "ff000000")
  2085.         Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
  2086.         Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
  2087.  
  2088.         hFamily := Gdip_FontFamilyCreate(Font)
  2089.         hFont := Gdip_FontCreate(hFamily, Size, Style)
  2090.         FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
  2091.         hFormat := Gdip_StringFormatCreate(FormatStyle)
  2092.         pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
  2093.         if !(hFamily && hFont && hFormat && pBrush && pGraphics)
  2094.                 return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
  2095.    
  2096.         CreateRectF(RC, xpos, ypos, Width, Height)
  2097.         Gdip_SetStringFormatAlign(hFormat, Align)
  2098.         Gdip_SetTextRenderingHint(pGraphics, Rendering)
  2099.         ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  2100.  
  2101.         if vPos
  2102.         {
  2103.                 StringSplit, ReturnRC, ReturnRC, |
  2104.                
  2105.                 if (vPos = "vCentre") || (vPos = "vCenter")
  2106.                         ypos += (Height-ReturnRC4)//2
  2107.                 else if (vPos = "Top") || (vPos = "Up")
  2108.                         ypos := 0
  2109.                 else if (vPos = "Bottom") || (vPos = "Down")
  2110.                         ypos := Height-ReturnRC4
  2111.                
  2112.                 CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
  2113.                 ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  2114.         }
  2115.  
  2116.         if !Measure
  2117.                 E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
  2118.  
  2119.         if !PassBrush
  2120.                 Gdip_DeleteBrush(pBrush)
  2121.         Gdip_DeleteStringFormat(hFormat)  
  2122.         Gdip_DeleteFont(hFont)
  2123.         Gdip_DeleteFontFamily(hFamily)
  2124.         return E ? E : ReturnRC
  2125. }
  2126.  
  2127. ;#####################################################################################
  2128.  
  2129. Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF)
  2130. {
  2131.         if !A_IsUnicode
  2132.         {
  2133.                 nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", 0, "int", 0)
  2134.                 VarSetCapacity(wString, nSize*2)
  2135.                 DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", &wString, "int", nSize)
  2136.                 return DllCall("gdiplus\GdipDrawString", "uint", pGraphics
  2137.                 , "uint", &wString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", pBrush)
  2138.         }
  2139.         else
  2140.         {
  2141.                 return DllCall("gdiplus\GdipDrawString", "uint", pGraphics
  2142.                 , "uint", &sString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", pBrush)
  2143.         }      
  2144. }
  2145.  
  2146. ;#####################################################################################
  2147.  
  2148. Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
  2149. {
  2150.         VarSetCapacity(RC, 16)
  2151.         if !A_IsUnicode
  2152.         {
  2153.                 nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", 0, "int", 0)
  2154.                 VarSetCapacity(wString, nSize*2)  
  2155.                 DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", &wString, "int", nSize)
  2156.                 DllCall("gdiplus\GdipMeasureString", "uint", pGraphics
  2157.                 , "uint", &wString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", &RC, "uint*", Chars, "uint*", Lines)
  2158.         }
  2159.         else
  2160.         {
  2161.                 DllCall("gdiplus\GdipMeasureString", "uint", pGraphics
  2162.                 , "uint", &sString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", &RC, "uint*", Chars, "uint*", Lines)
  2163.         }
  2164.         return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
  2165. }
  2166.  
  2167. ; Near = 0
  2168. ; Center = 1
  2169. ; Far = 2
  2170. Gdip_SetStringFormatAlign(hFormat, Align)
  2171. {
  2172.    return DllCall("gdiplus\GdipSetStringFormatAlign", "uint", hFormat, "int", Align)
  2173. }
  2174.  
  2175. ; StringFormatFlagsDirectionRightToLeft    = 0x00000001
  2176. ; StringFormatFlagsDirectionVertical       = 0x00000002
  2177. ; StringFormatFlagsNoFitBlackBox           = 0x00000004
  2178. ; StringFormatFlagsDisplayFormatControl    = 0x00000020
  2179. ; StringFormatFlagsNoFontFallback          = 0x00000400
  2180. ; StringFormatFlagsMeasureTrailingSpaces   = 0x00000800
  2181. ; StringFormatFlagsNoWrap                  = 0x00001000
  2182. ; StringFormatFlagsLineLimit               = 0x00002000
  2183. ; StringFormatFlagsNoClip                  = 0x00004000
  2184. Gdip_StringFormatCreate(Format=0, Lang=0)
  2185. {
  2186.    DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, "uint*", hFormat)
  2187.    return hFormat
  2188. }
  2189.  
  2190. ; Regular = 0
  2191. ; Bold = 1
  2192. ; Italic = 2
  2193. ; BoldItalic = 3
  2194. ; Underline = 4
  2195. ; Strikeout = 8
  2196. Gdip_FontCreate(hFamily, Size, Style=0)
  2197. {
  2198.    DllCall("gdiplus\GdipCreateFont", "uint", hFamily, "float", Size, "int", Style, "int", 0, "uint*", hFont)
  2199.    return hFont
  2200. }
  2201.  
  2202. Gdip_FontFamilyCreate(Font)
  2203. {
  2204.         if !A_IsUnicode
  2205.         {
  2206.                 nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &Font, "int", -1, "uint", 0, "int", 0)
  2207.                 VarSetCapacity(wFont, nSize*2)
  2208.                 DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &Font, "int", -1, "uint", &wFont, "int", nSize)
  2209.                 DllCall("gdiplus\GdipCreateFontFamilyFromName", "uint", &wFont, "uint", 0, "uint*", hFamily)
  2210.         }
  2211.         else
  2212.                 DllCall("gdiplus\GdipCreateFontFamilyFromName", "uint", &Font, "uint", 0, "uint*", hFamily)
  2213.         return hFamily
  2214. }
  2215.  
  2216. ;#####################################################################################
  2217. ; Matrix functions
  2218. ;#####################################################################################
  2219.  
  2220. Gdip_CreateAffineMatrix(m11, m12, m21, m22, x, y)
  2221. {
  2222.    DllCall("gdiplus\GdipCreateMatrix2", "float", m11, "float", m12, "float", m21, "float", m22, "float", x, "float", y, "uint*", Matrix)
  2223.    return Matrix
  2224. }
  2225.  
  2226. Gdip_CreateMatrix()
  2227. {
  2228.    DllCall("gdiplus\GdipCreateMatrix", "uint*", Matrix)
  2229.    return Matrix
  2230. }
  2231.  
  2232. ;#####################################################################################
  2233. ; GraphicsPath functions
  2234. ;#####################################################################################
  2235.  
  2236. ; Alternate = 0
  2237. ; Winding = 1
  2238. Gdip_CreatePath(BrushMode=0)
  2239. {
  2240.         DllCall("gdiplus\GdipCreatePath", "int", BrushMode, "uint*", Path)
  2241.         return Path
  2242. }
  2243.  
  2244. Gdip_AddPathEllipse(Path, x, y, w, h)
  2245. {
  2246.         return DllCall("gdiplus\GdipAddPathEllipse", "uint", Path, "float", x, "float", y, "float", w, "float", h)
  2247. }
  2248.  
  2249. Gdip_AddPathPolygon(Path, Points)
  2250. {
  2251.         StringSplit, Points, Points, |
  2252.         VarSetCapacity(PointF, 8*Points0)  
  2253.         Loop, %Points0%
  2254.         {
  2255.                 StringSplit, Coord, Points%A_Index%, `,
  2256.                 NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  2257.         }  
  2258.  
  2259.         return DllCall("gdiplus\GdipAddPathPolygon", "uint", Path, "uint", &PointF, "int", Points0)
  2260. }
  2261.  
  2262. Gdip_DeletePath(Path)
  2263. {
  2264.         return DllCall("gdiplus\GdipDeletePath", "uint", Path)
  2265. }
  2266.  
  2267. ;#####################################################################################
  2268. ; Quality functions
  2269. ;#####################################################################################
  2270.  
  2271. ; SystemDefault = 0
  2272. ; SingleBitPerPixelGridFit = 1
  2273. ; SingleBitPerPixel = 2
  2274. ; AntiAliasGridFit = 3
  2275. ; AntiAlias = 4
  2276. Gdip_SetTextRenderingHint(pGraphics, RenderingHint)
  2277. {
  2278.         return DllCall("gdiplus\GdipSetTextRenderingHint", "uint", pGraphics, "int", RenderingHint)
  2279. }
  2280.  
  2281. ; Default = 0
  2282. ; LowQuality = 1
  2283. ; HighQuality = 2
  2284. ; Bilinear = 3
  2285. ; Bicubic = 4
  2286. ; NearestNeighbor = 5
  2287. ; HighQualityBilinear = 6
  2288. ; HighQualityBicubic = 7
  2289. Gdip_SetInterpolationMode(pGraphics, InterpolationMode)
  2290. {
  2291.    return DllCall("gdiplus\GdipSetInterpolationMode", "uint", pGraphics, "int", InterpolationMode)
  2292. }
  2293.  
  2294. ; Default = 0
  2295. ; HighSpeed = 1
  2296. ; HighQuality = 2
  2297. ; None = 3
  2298. ; AntiAlias = 4
  2299. Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
  2300. {
  2301.    return DllCall("gdiplus\GdipSetSmoothingMode", "uint", pGraphics, "int", SmoothingMode)
  2302. }
  2303.  
  2304. ; CompositingModeSourceOver = 0 (blended)
  2305. ; CompositingModeSourceCopy = 1 (overwrite)
  2306. Gdip_SetCompositingMode(pGraphics, CompositingMode=0)
  2307. {
  2308.    return DllCall("gdiplus\GdipSetCompositingMode", "uint", pGraphics, "int", CompositingMode)
  2309. }
  2310.  
  2311. ;#####################################################################################
  2312. ; Extra functions
  2313. ;#####################################################################################
  2314.  
  2315. Gdip_Startup()
  2316. {
  2317.         if !DllCall("GetModuleHandle", "str", "gdiplus")
  2318.                 DllCall("LoadLibrary", "str", "gdiplus")
  2319.         VarSetCapacity(si, 16, 0), si := Chr(1)
  2320.         DllCall("gdiplus\GdiplusStartup", "uint*", pToken, "uint", &si, "uint", 0)
  2321.         return pToken
  2322. }
  2323.  
  2324. Gdip_Shutdown(pToken)
  2325. {
  2326.         DllCall("gdiplus\GdiplusShutdown", "uint", pToken)
  2327.         if hModule := DllCall("GetModuleHandle", "str", "gdiplus")
  2328.                 DllCall("FreeLibrary", "uint", hModule)
  2329.         return 0
  2330. }
  2331.  
  2332. ; Prepend = 0; The new operation is applied before the old operation.
  2333. ; Append = 1; The new operation is applied after the old operation.
  2334. Gdip_RotateWorldTransform(pGraphics, Angle, MatrixOrder=0)
  2335. {
  2336.         return DllCall("gdiplus\GdipRotateWorldTransform", "uint", pGraphics, "float", Angle, "int", MatrixOrder)
  2337. }
  2338.  
  2339. Gdip_ScaleWorldTransform(pGraphics, x, y, MatrixOrder=0)
  2340. {
  2341.         return DllCall("gdiplus\GdipScaleWorldTransform", "uint", pGraphics, "float", x, "float", y, "int", MatrixOrder)
  2342. }
  2343.  
  2344. Gdip_TranslateWorldTransform(pGraphics, x, y, MatrixOrder=0)
  2345. {
  2346.         return DllCall("gdiplus\GdipTranslateWorldTransform", "uint", pGraphics, "float", x, "float", y, "int", MatrixOrder)
  2347. }
  2348.  
  2349. Gdip_ResetWorldTransform(pGraphics)
  2350. {
  2351.         return DllCall("gdiplus\GdipResetWorldTransform", "uint", pGraphics)
  2352. }
  2353.  
  2354. Gdip_GetRotatedTranslation(Width, Height, Angle, ByRef xTranslation, ByRef yTranslation)
  2355. {
  2356.         pi := 3.14159, TAngle := Angle*(pi/180)
  2357.  
  2358.         Bound := (Angle >= 0) ? Mod(Angle, 360) : 360-Mod(-Angle, -360)
  2359.         if ((Bound >= 0) && (Bound <= 90))
  2360.                 xTranslation := Height*Sin(TAngle), yTranslation := 0
  2361.         else if ((Bound > 90) && (Bound <= 180))
  2362.                 xTranslation := (Height*Sin(TAngle))-(Width*Cos(TAngle)), yTranslation := -Height*Cos(TAngle)
  2363.         else if ((Bound > 180) && (Bound <= 270))
  2364.                 xTranslation := -(Width*Cos(TAngle)), yTranslation := -(Height*Cos(TAngle))-(Width*Sin(TAngle))
  2365.         else if ((Bound > 270) && (Bound <= 360))
  2366.                 xTranslation := 0, yTranslation := -Width*Sin(TAngle)
  2367. }
  2368.  
  2369. Gdip_GetRotatedDimensions(Width, Height, Angle, ByRef RWidth, ByRef RHeight)
  2370. {
  2371.         pi := 3.14159, TAngle := Angle*(pi/180)
  2372.         if !(Width && Height)
  2373.                 return -1
  2374.         RWidth := Ceil(Abs(Width*Cos(TAngle))+Abs(Height*Sin(TAngle)))
  2375.         RHeight := Ceil(Abs(Width*Sin(TAngle))+Abs(Height*Cos(Tangle)))
  2376. }
  2377.  
  2378. ; RotateNoneFlipNone   = 0
  2379. ; Rotate90FlipNone     = 1
  2380. ; Rotate180FlipNone    = 2
  2381. ; Rotate270FlipNone    = 3
  2382. ; RotateNoneFlipX      = 4
  2383. ; Rotate90FlipX        = 5
  2384. ; Rotate180FlipX       = 6
  2385. ; Rotate270FlipX       = 7
  2386. ; RotateNoneFlipY      = Rotate180FlipX
  2387. ; Rotate90FlipY        = Rotate270FlipX
  2388. ; Rotate180FlipY       = RotateNoneFlipX
  2389. ; Rotate270FlipY       = Rotate90FlipX
  2390. ; RotateNoneFlipXY     = Rotate180FlipNone
  2391. ; Rotate90FlipXY       = Rotate270FlipNone
  2392. ; Rotate180FlipXY      = RotateNoneFlipNone
  2393. ; Rotate270FlipXY      = Rotate90FlipNone
  2394.  
  2395. Gdip_ImageRotateFlip(pBitmap, RotateFlipType=1)
  2396. {
  2397.         return DllCall("gdiplus\GdipImageRotateFlip", "uint", pBitmap, "int", RotateFlipType)
  2398. }
  2399.  
  2400. ; Replace = 0
  2401. ; Intersect = 1
  2402. ; Union = 2
  2403. ; Xor = 3
  2404. ; Exclude = 4
  2405. ; Complement = 5
  2406. Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0)
  2407. {
  2408.    return DllCall("gdiplus\GdipSetClipRect", "uint", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
  2409. }
  2410.  
  2411. Gdip_SetClipPath(pGraphics, Path, CombineMode=0)
  2412. {
  2413.    return DllCall("gdiplus\GdipSetClipPath", "uint", pGraphics, "uint", Path, "int", CombineMode)
  2414. }
  2415.  
  2416. Gdip_ResetClip(pGraphics)
  2417. {
  2418.    return DllCall("gdiplus\GdipResetClip", "uint", pGraphics)
  2419. }
  2420.  
  2421. Gdip_GetClipRegion(pGraphics)
  2422. {
  2423.         Region := Gdip_CreateRegion()
  2424.         DllCall("gdiplus\GdipGetClip", "uint" pGraphics, "uint*", Region)
  2425.         return Region
  2426. }
  2427.  
  2428. Gdip_SetClipRegion(pGraphics, Region, CombineMode=0)
  2429. {
  2430.         return DllCall("gdiplus\GdipSetClipRegion", "uint", pGraphics, "uint", Region, "int", CombineMode)
  2431. }
  2432.  
  2433. Gdip_CreateRegion()
  2434. {
  2435.         DllCall("gdiplus\GdipCreateRegion", "uint*", Region)
  2436.         return Region
  2437. }
  2438.  
  2439. Gdip_DeleteRegion(Region)
  2440. {
  2441.         return DllCall("gdiplus\GdipDeleteRegion", "uint", Region)
  2442. }
  2443.  
  2444. ;#####################################################################################
  2445. ; BitmapLockBits
  2446. ;#####################################################################################
  2447.  
  2448. Gdip_LockBits(pBitmap, x, y, w, h, ByRef Stride, ByRef Scan0, ByRef BitmapData, LockMode = 3, PixelFormat = 0x26200a)
  2449. {  
  2450.         CreateRect(Rect, x, y, w, h)
  2451.         VarSetCapacity(BitmapData, 21, 0)
  2452.         E := DllCall("Gdiplus\GdipBitmapLockBits", "uint", pBitmap, "uint", &Rect, "uint", LockMode, "int", PixelFormat, "uint", &BitmapData)
  2453.         Stride := NumGet(BitmapData, 8)
  2454.         Scan0 := NumGet(BitmapData, 16)
  2455.         return E
  2456. }
  2457.  
  2458. ;#####################################################################################
  2459.  
  2460. Gdip_UnlockBits(pBitmap, ByRef BitmapData)
  2461. {
  2462.         return DllCall("Gdiplus\GdipBitmapUnlockBits", "uint", pBitmap, "uint", &BitmapData)
  2463. }
  2464.  
  2465. ;#####################################################################################
  2466.  
  2467. Gdip_SetLockBitPixel(ARGB, Scan0, x, y, Stride)
  2468. {
  2469.         Numput(ARGB, Scan0+0, (x*4)+(y*Stride))
  2470. }
  2471.  
  2472. ;#####################################################################################
  2473.  
  2474. Gdip_GetLockBitPixel(Scan0, x, y, Stride)
  2475. {
  2476.         return NumGet(Scan0+0, (x*4)+(y*Stride))
  2477. }
  2478.  
  2479. ;#####################################################################################
  2480.  
  2481. Gdip_PixelateBitmap(pBitmap, ByRef pBitmapOut, BlockSize)
  2482. {
  2483.         static PixelateBitmap
  2484.         if !PixelateBitmap
  2485.         {
  2486.                 MCode_PixelateBitmap := "83EC388B4424485355568B74245C99F7FE8B5C244C8B6C2448578BF88BCA894C241C897C243485FF0F8E2E0300008B44245"
  2487.                 . "499F7FE897C24448944242833C089542418894424308944242CEB038D490033FF397C2428897C24380F8E750100008BCE0FAFCE894C24408DA4240000"
  2488.                 . "000033C03BF08944241089442460894424580F8E8A0000008B5C242C8D4D028BD52BD183C203895424208D3CBB0FAFFE8BD52BD142895424248BD52BD"
  2489.                 . "103F9897C24148974243C8BCF8BFE8DA424000000008B5C24200FB61C0B03C30FB619015C24588B5C24240FB61C0B015C24600FB61C11015C241083C1"
  2490.                 . "0483EF0175D38B7C2414037C245C836C243C01897C241475B58B7C24388B6C244C8B5C24508B4C244099F7F9894424148B44245899F7F9894424588B4"
  2491.                 . "4246099F7F9894424608B44241099F7F98944241085F60F8E820000008D4B028BC32BC18D68038B44242C8D04B80FAFC68BD32BD142895424248BD32B"
  2492.                 . "D103C18944243C89742420EB038D49008BC88BFE0FB64424148B5C24248804290FB644245888010FB644246088040B0FB644241088040A83C10483EF0"
  2493.                 . "175D58B44243C0344245C836C2420018944243C75BE8B4C24408B5C24508B6C244C8B7C2438473B7C2428897C24380F8C9FFEFFFF8B4C241C33D23954"
  2494.                 . "24180F846401000033C03BF2895424108954246089542458895424148944243C0F8E82000000EB0233D2395424187E6F8B4C243003C80FAF4C245C8B4"
  2495.                 . "424280FAFC68D550203CA8D0C818BC52BC283C003894424208BC52BC2408BFD2BFA8B54241889442424895424408B4424200FB614080FB60101542414"
  2496.                 . "8B542424014424580FB6040A0FB61439014424600154241083C104836C24400175CF8B44243C403BC68944243C7C808B4C24188B4424140FAFCE99F7F"
  2497.                 . "9894424148B44245899F7F9894424588B44246099F7F9894424608B44241099F7F98944241033C08944243C85F60F8E7F000000837C2418007E6F8B4C"
  2498.                 . "243003C80FAF4C245C8B4424280FAFC68D530203CA8D0C818BC32BC283C003894424208BC32BC2408BFB2BFA8B54241889442424895424400FB644241"
  2499.                 . "48B5424208804110FB64424580FB654246088018B4424248814010FB654241088143983C104836C24400175CF8B44243C403BC68944243C7C818B4C24"
  2500.                 . "1C8B44245C0144242C01742430836C2444010F85F4FCFFFF8B44245499F7FE895424188944242885C00F8E890100008BF90FAFFE33D2897C243C89542"
  2501.                 . "45489442438EB0233D233C03BCA89542410895424608954245889542414894424400F8E840000003BF27E738B4C24340FAFCE03C80FAF4C245C034C24"
  2502.                 . "548D55028BC52BC283C003894424208BC52BC2408BFD03CA894424242BFA89742444908B5424200FB6040A0FB611014424148B442424015424580FB61"
  2503.                 . "4080FB6040F015424600144241083C104836C24440175CF8B4424408B7C243C8B4C241C33D2403BC1894424400F8C7CFFFFFF8B44241499F7FF894424"
  2504.                 . "148B44245899F7FF894424588B44246099F7FF894424608B44241099F7FF8944241033C08944244085C90F8E8000000085F67E738B4C24340FAFCE03C"
  2505.                 . "80FAF4C245C034C24548D53028BC32BC283C003894424208BC32BC2408BFB03CA894424242BFA897424448D49000FB65424148B4424208814010FB654"
  2506.                 . "24580FB644246088118B5424248804110FB644241088043983C104836C24440175CF8B4424408B7C243C8B4C241C403BC1894424407C808D04B500000"
  2507.                 . "00001442454836C2438010F858CFEFFFF33D233C03BCA89542410895424608954245889542414894424440F8E9A000000EB048BFF33D2395424180F8E"
  2508.                 . "7D0000008B4C24340FAFCE03C80FAF4C245C8B4424280FAFC68D550203CA8D0C818BC52BC283C003894424208BC52BC240894424248BC52BC28B54241"
  2509.                 . "8895424548DA424000000008B5424200FB6140A015424140FB611015424588B5424240FB6140A015424600FB614010154241083C104836C24540175CF"
  2510.                 . "8B4424448B4C241C403BC1894424440F8C6AFFFFFF0FAF4C24188B44241499F7F9894424148B44245899F7F9894424588B44246099F7F9894424608B4"
  2511.                 . "4241099F7F98944241033C03944241C894424540F8E7B0000008B7C241885FF7E688B4C24340FAFCE03C80FAF4C245C8B4424280FAFC68D530203CA8D"
  2512.                 . "0C818BC32BC283C003894424208BC32BC2408BEB894424242BEA0FB65424148B4424208814010FB65424580FB644246088118B5424248804110FB6442"
  2513.                 . "41088042983C10483EF0175D18B442454403B44241C894424547C855F5E5D33C05B83C438C3"
  2514.                 VarSetCapacity(PixelateBitmap, StrLen(MCode_PixelateBitmap)//2)
  2515.                 Loop % StrLen(MCode_PixelateBitmap)//2          ;%
  2516.                         NumPut("0x" SubStr(MCode_PixelateBitmap, (2*A_Index)-1, 2), PixelateBitmap, A_Index-1, "char")
  2517.         }
  2518.  
  2519.         Gdip_GetImageDimensions(pBitmap, Width, Height)
  2520.         if (Width != Gdip_GetImageWidth(pBitmapOut) || Height != Gdip_GetImageHeight(pBitmapOut))
  2521.                 return -1
  2522.         if (BlockSize > Width || BlockSize > Height)
  2523.                 return -2
  2524.  
  2525.         E1 := Gdip_LockBits(pBitmap, 0, 0, Width, Height, Stride1, Scan01, BitmapData1)
  2526.         E2 := Gdip_LockBits(pBitmapOut, 0, 0, Width, Height, Stride2, Scan02, BitmapData2)
  2527.         if (E1 || E2)
  2528.                 return -3
  2529.  
  2530.         E := DllCall(&PixelateBitmap, "uint", Scan01, "uint", Scan02, "int", Width, "int", Height, "int", Stride1, "int", BlockSize)
  2531.         Gdip_UnlockBits(pBitmap, BitmapData1), Gdip_UnlockBits(pBitmapOut, BitmapData2)
  2532.         return 0
  2533. }
  2534.  
  2535. ;#####################################################################################
  2536.  
  2537. Gdip_ToARGB(A, R, G, B)
  2538. {
  2539.         return (A << 24) | (R << 16) | (G << 8) | B
  2540. }
  2541.  
  2542. ;#####################################################################################
  2543.  
  2544. Gdip_FromARGB(ARGB, ByRef A, ByRef R, ByRef G, ByRef B)
  2545. {
  2546.         A := (0xff000000 & ARGB) >> 24
  2547.         R := (0x00ff0000 & ARGB) >> 16
  2548.         G := (0x0000ff00 & ARGB) >> 8
  2549.         B := 0x000000ff & ARGB
  2550. }
  2551.  
  2552. ;#####################################################################################
  2553.  
  2554. Gdip_AFromARGB(ARGB)
  2555. {
  2556.         return (0xff000000 & ARGB) >> 24
  2557. }
  2558.  
  2559. ;#####################################################################################
  2560.  
  2561. Gdip_RFromARGB(ARGB)
  2562. {
  2563.         return (0x00ff0000 & ARGB) >> 16
  2564. }
  2565.  
  2566. ;#####################################################################################
  2567.  
  2568. Gdip_GFromARGB(ARGB)
  2569. {
  2570.         return (0x0000ff00 & ARGB) >> 8
  2571. }
  2572.  
  2573. ;#####################################################################################
  2574.  
  2575. Gdip_BFromARGB(ARGB)
  2576. {
  2577.         return 0x000000ff & ARGB
  2578. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top