daily pastebin goal
72%
SHARE
TWEET

AHK_L - 3D apple

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