Advertisement
CivReborn

HB Custom Window Maker

Mar 21st, 2019
1,331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Written By: Hellbent aka CivReborn
  2. ; Date Started: March 20th, 2019
  3. ; Last Edit: March 20th, 2019
  4. ; Paste:
  5. ; A simple tool for getting custom windows up and running fast.
  6.  
  7.  
  8.  
  9. #SingleInstance,Force
  10. pToken:=Gdip_Startup()
  11. global Button:=[]
  12. global X_Position_Edit,Y_Position_Edit,W_Position_Edit,H_Position_Edit,Name_Edit,Options_Edit,Title_Edit,Bitmap_Edit
  13. Main:=New Custom_Window(x:="",y:="",w:=400,h:=250,Name:=1,Options:="+AlwaysOnTop -Caption -DPIScale",Title:="HB Custom Window Maker",Background_Bitmap:=Custom_Window_Maker_Tool_Background())
  14.  
  15. Gui,1:Add,Text,x46 y0 w270 h30 BackgroundTrans gMove_Window
  16. Gui,1:Add,Text,x360 y5 w15 h15 BackgroundTrans gMin_Window
  17. Gui,1:Add,Text,x380 y5 w15 h15 BackgroundTrans gGuiClose
  18. Gui,1:Color,222222,222222
  19. Gui,1:Font,caaaaaa s8,Segoe Ui
  20. Gui,1:Add,Edit,x36 y48 w79 h20 -E0x200 Center vX_Position_Edit gSubmit_All ,
  21. Gui,1:Add,Edit,x150 y48 w79 h20 -E0x200 Center vY_Position_Edit gSubmit_All ,
  22. Gui,1:Add,Edit,x36 y88 w79 h20 -E0x200 Center vW_Position_Edit gSubmit_All ,300
  23. Gui,1:Add,Edit,x150 y88 w79 h20 -E0x200 Center vH_Position_Edit gSubmit_All ,200
  24. Gui,1:Add,Edit,x74 y124 w169 h20 -E0x200 Center vName_Edit gSubmit_All ,1
  25. Gui,1:Add,Edit,x74 y154 w169 h20 -E0x200 vOptions_Edit gSubmit_All ,+AlwaysOnTop -Caption -DPIScale
  26. Gui,1:Add,Edit,x74 y184 w169 h20 -E0x200 vTitle_Edit gSubmit_All ,Custom Gui Window
  27. Gui,1:Add,Edit,x74 y214 w169 h20 -E0x200 vBitmap_Edit gSubmit_All ,HB_BITMAP_MAKER()
  28.  
  29.  
  30.  
  31. Button.Push(New Button_Type1(x:=257,y:=35,w:=133,h:=41,text:="Clip New Window",FontSize:=10,name:=Button.Length()+1,label:="Clip_New_Window",Window:=1,Color:="0xFF186498"))
  32. Button.Push(New Button_Type1(x:=257,y+=h,w:=133,h,text:="Clip New Script Partial",FontSize:=10,name:=Button.Length()+1,label:="Clip_New_Script_Partial",Window:=1,Color:="0xFF186498"))
  33. Button.Push(New Button_Type1(x:=257,y+=h,w:=133,h,text:="Clip Custom`nWindow Class",FontSize:=10,name:=Button.Length()+1,label:="Clip_Custom_Window_Class",Window:=1,Color:="0xFF186498"))
  34. Button.Push(New Button_Type1(x:=257,y+=h,w:=133,h,text:="Clip Full New script",FontSize:=10,name:=Button.Length()+1,label:="Clip_Full_New_script",Window:=1,Color:="0xFF186498"))
  35. Button.Push(New Button_Type1(x:=257,y+=h,w:=133,h,text:="Clip Gdip LITE",FontSize:=10,name:=Button.Length()+1,label:="Clip_gdip_lite",Window:=1,Color:="0xFF186498"))
  36. Main.Show_Window()
  37. Submit_All()
  38. SetTimer,Watch_Hover,50
  39. return
  40. GuiClose:
  41. ;~ GuiContextMenu:
  42. *ESC::
  43.     ExitApp
  44.  Submit_All(){
  45.     Gui,1:Submit,NoHide
  46. }
  47. Move_Window(){
  48.     PostMessage,0xA1,2
  49. }
  50.  
  51. Min_Window(){
  52.     Gui,1:Minimize
  53. }
  54.  
  55. Watch_Hover(){
  56.     Static Index,lctrl,Hover_On
  57.     MouseGetPos,,,,ctrl,2
  58.     if(!Hover_On&&ctrl){
  59.         loop,% Button.Length()
  60.             if(ctrl=Button[A_Index].hwnd)
  61.                 Button[A_Index].Draw_Hover(),lctrl:=ctrl,Index:=A_Index,Hover_On:=1,break
  62.     }else if(Hover_On=1)
  63.         if((!ctrl||lctrl!=ctrl)&&Button[Index].isPressed=0)
  64.             Button[Index].Draw_Default(),Hover_On:=0
  65. }
  66.  
  67. Clip_New_Window(){
  68.     if(!Button[A_GuiControl].Draw_Pressed())
  69.         return
  70.     if(X_Position_Edit&&Y_Position_Edit){
  71.         Clipboard:="Main := New Custom_Window( x:= " X_Position_Edit " , y:= " Y_Position_Edit " , w:= " W_Position_Edit " , h:= " H_Position_Edit  " , Name:= """ Name_Edit """ , Options:= """ Options_Edit """ , Title:= """ Title_Edit """ , Background_Bitmap:= " Bitmap_Edit " )`n`nMain.Show_Window()"
  72.     }else if(X_Position_Edit&&!Y_Position_Edit)
  73.         Clipboard:="Main := New Custom_Window( x:= " X_Position_Edit " , y:= """" , w:= " W_Position_Edit " , h:= " H_Position_Edit  " , Name:= """ Name_Edit """ , Options:= """ Options_Edit """ , Title:= """ Title_Edit """ , Background_Bitmap:= " Bitmap_Edit " )`n`nMain.Show_Window()"
  74.     else if(!X_Position_Edit&&Y_Position_Edit)
  75.         Clipboard:="Main := New Custom_Window( x:= """" , y:= " Y_Position_Edit " , w:= " W_Position_Edit " , h:= " H_Position_Edit  " , Name:= """ Name_Edit """ , Options:= """ Options_Edit """ , Title:= """ Title_Edit """ , Background_Bitmap:= " Bitmap_Edit " )`n`nMain.Show_Window()"
  76.     else
  77.         Clipboard:="Main := New Custom_Window( x:= """" , y:= """" , w:= " W_Position_Edit " , h:= " H_Position_Edit  " , Name:= """ Name_Edit """ , Options:= """ Options_Edit """ , Title:= """ Title_Edit """ , Background_Bitmap:= " Bitmap_Edit " )`n`nMain.Show_Window()"
  78.     SoundBeep,500
  79.     SoundBeep,600
  80. }
  81.  
  82. Clip_Full_New_script(){
  83.     if(!Button[A_GuiControl].Draw_Pressed())
  84.         return
  85.     temp:=""
  86.     temp.=Set_Partial_Script_Var() "`n`n`n"
  87.     temp.=Set_Custom_Window_Class_Var() "`n`n`n"
  88.     temp.=Set_Gdip_Lite_Var_1() "`n`n`n"
  89.     temp.=Set_Gdip_Lite_Var_2() "`n`n`n"
  90.     Clipboard:=temp
  91.     Sleep,100
  92.     temp:=""
  93.     SoundBeep,500
  94.     SoundBeep,600
  95. }
  96. Clip_Custom_Window_Class(){
  97.     if(!Button[A_GuiControl].Draw_Pressed())
  98.         return
  99.     Clipboard:=Set_Custom_Window_Class_Var() "`n`n`n"
  100.     SoundBeep,500
  101.     SoundBeep,600
  102. }
  103. Clip_gdip_lite(){
  104.     if(!Button[A_GuiControl].Draw_Pressed())
  105.         return
  106.     temp:=""
  107.     Temp.=Set_Gdip_Lite_Var_1() "`n`n`n"
  108.     Temp.=Set_Gdip_Lite_Var_2() "`n`n`n"
  109.     Clipboard:=Temp
  110.     Sleep,100
  111.     Temp:=""
  112.     SoundBeep,500
  113.     SoundBeep,600
  114. }
  115. Clip_New_Script_Partial(){
  116.     if(!Button[A_GuiControl].Draw_Pressed())
  117.         return
  118.     Clipboard:=Set_Partial_Script_Var() "`n`n`n"
  119.     SoundBeep,500
  120.     SoundBeep,600
  121. }
  122.  
  123. class Button_Type1  {
  124.     __New(x,y,w,h,text,FontSize,name,label,Window,Color:="0xFF186498",Set:=0){
  125.         This.X:=X,This.Y:=Y,This.W:=W,This.H:=H,This.FontSize:=FontSize,This.Text:=Text,This.Name:=Name,This.Label:=Label,This.Color:=Color,This.Window:=Window,This.isPressed:=0,This.Set:=Set
  126.         This.Create_Default_Button()
  127.         This.Create_Hover_Button()
  128.         This.Create_Pressed_Button()
  129.         This.Add_Trigger()
  130.         This.Draw_Default()
  131.     }
  132.     Add_Trigger(){
  133.         global
  134.         Gui,% This.Window ":Add",Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " v" This.Name " g" This.Label " 0xE"
  135.         GuiControlGet,hwnd,% This.Window ":hwnd",% This.Name
  136.         This.Hwnd:=hwnd
  137.     }
  138.     Create_Default_Button(){
  139.         ;Bitmap Created Using: HB Bitmap Maker
  140.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  141.          G := Gdip_GraphicsFromImage( pBitmap )
  142.         Gdip_SetSmoothingMode( G , 2 )
  143.         Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
  144.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  145.         Gdip_DeleteBrush( Brush )
  146.         Brush := Gdip_BrushCreateSolid( "0xFF060B0F" )
  147.         Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-7 , 5 )
  148.         Gdip_DeleteBrush( Brush )
  149.         Brush := Gdip_BrushCreateSolid( "0xFF262B2F" )
  150.         Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , This.W-7 , This.H-9 , 5 )
  151.         Gdip_DeleteBrush( Brush )
  152.         Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H-10 , "0xFF3F444A" , "0xFF24292D" , 1 , 1 )
  153.         Gdip_FillRoundedRectangle( G , Brush , 4 , 5 , This.W-9 , This.H-11 , 5 )
  154.         Gdip_DeleteBrush( Brush )
  155.         Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W-30 , This.H+21 , "0xFF2D343C" , "0xFF004488" , 1 , 1 )
  156.         Gdip_FillRoundedRectangle( G , Brush , 4 , 7 , This.W-9 , This.H-13 , 5 )
  157.         Gdip_DeleteBrush( Brush )
  158.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter caaF0F0F0 x0 y1" , "Segoe UI" , This.W , This.H )
  159.         Gdip_DeleteGraphics( G )
  160.         This.Default_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  161.         Gdip_DisposeImage(pBitmap)
  162.     }
  163.     Create_Hover_Button(){
  164.         ;Bitmap Created Using: HB Bitmap Maker
  165.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  166.          G := Gdip_GraphicsFromImage( pBitmap )
  167.         Gdip_SetSmoothingMode( G , 2 )
  168.         Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
  169.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  170.         Gdip_DeleteBrush( Brush )
  171.         Brush := Gdip_BrushCreateSolid( "0xFF151A20" )
  172.         Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-7 , 5 )
  173.         Gdip_DeleteBrush( Brush )
  174.         Brush := Gdip_BrushCreateSolid( "0xFF2B3036" )
  175.         Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , This.W-7 , This.H-9 , 5 )
  176.         Gdip_DeleteBrush( Brush )
  177.         Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H-10 , "0xFF464D55" , "0xFF1E2329" , 1 , 1 )
  178.         Gdip_FillRoundedRectangle( G , Brush , 4 , 5 , This.W-9 , This.H-11 , 5 )
  179.         Gdip_DeleteBrush( Brush )
  180.         Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W-30 , This.H+1 , "0xFF2D343C" , This.Color , 1 , 1 )
  181.         Gdip_FillRoundedRectangle( G , Brush , 4 , 7 , This.W-9 , This.H-13 , 5 )
  182.         Gdip_DeleteBrush( Brush )
  183.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x-1 y2" , "Segoe UI" , This.W , This.H )
  184.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x-1 y1" , "Segoe UI" , This.W , This.H )
  185.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x-1 y0" , "Segoe UI" , This.W , This.H )
  186.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x0 y0" , "Segoe UI" , This.W , This.H )
  187.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x1 y2" , "Segoe UI" , This.W , This.H )
  188.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter cFF000000 x1 y1" , "Segoe UI" , This.W , This.H )
  189.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter caaF0F0F0 x0 y1" , "Segoe UI" , This.W , This.H )
  190.         Gdip_DeleteGraphics( G )
  191.         This.Hover_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  192.         Gdip_DisposeImage(pBitmap)
  193.     }
  194.     Create_Pressed_Button(){
  195.         ;Bitmap Created Using: HB Bitmap Maker
  196.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  197.          G := Gdip_GraphicsFromImage( pBitmap )
  198.         Gdip_SetSmoothingMode( G , 4 )
  199.         Brush := Gdip_BrushCreateSolid( "0xFF1C2125" )
  200.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  201.         Gdip_DeleteBrush( Brush )
  202.         Brush := Gdip_BrushCreateSolid( "0xFF31363B" )
  203.         Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-6 , 5 )
  204.         Gdip_DeleteBrush( Brush )
  205.         Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H , "0xFF151A20" , "0xFF151A20" , 1 , 1 )
  206.         Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , This.W-5 , This.H-8 , 5 )
  207.         Gdip_DeleteBrush( Brush )
  208.         Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W-7 , This.H+10  , "0xFF003366" , "0xFF42474D"  , 1 , 1 )
  209.         Gdip_FillRoundedRectangle( G , Brush , 3 , 4 , This.W-7 , This.H-10 , 5 )
  210.         Gdip_DeleteBrush( Brush )
  211.         Gdip_TextToGraphics( G , This.Text , "s" This.FontSize " Bold Center vcenter caaF0F0F0 x0 y0" , "Segoe UI" , This.W , This.H )
  212.         Gdip_DeleteGraphics( G )
  213.         This.Pressed_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  214.         Gdip_DisposeImage(pBitmap)
  215.     }
  216.     Draw_Default(){
  217.         SetImage(This.Hwnd, This.Default_Bitmap)
  218.     }
  219.     Draw_Hover(){
  220.         SetImage(This.Hwnd, This.Hover_Bitmap)
  221.     }
  222.     Draw_Pressed(){
  223.         SetImage(This.Hwnd, This.Pressed_Bitmap)
  224.         SetTimer,Watch_Hover,Off
  225.         While(GetKeyState("LButton"))
  226.             sleep,10
  227.         SetTimer,Watch_Hover,On
  228.         MouseGetPos,,,,ctrl,2
  229.         if(ctrl!=This.hwnd){
  230.             This.Draw_Default()
  231.             return false
  232.         }else   {
  233.             This.Draw_Hover()
  234.             return true
  235.         }
  236.     }
  237. }
  238.  
  239. Class Custom_Window {
  240.     __New(x:="",y:="",w:=300,h:=200,Name:=1,Options:="+AlwaysOnTop -Caption -DPIScale",Title:="",Background_Bitmap:=""){
  241.         This.X:=x
  242.         This.Y:=y
  243.         This.W:=w
  244.         This.H:=h
  245.         This.Name:=Name
  246.         This.Title:=Title
  247.         This.Options:=Options
  248.         This.Background_Bitmap:=Background_Bitmap
  249.         This.Create_Window()
  250.     }
  251.     Create_Window(){
  252.         Gui,% This.Name ":New",%  This.Options " +LastFound"
  253.         This.Hwnd:=WinExist()
  254.         if(This.Background_Bitmap)
  255.             This.Draw_Background_Bitmap()
  256.     }
  257.     Draw_Background_Bitmap(){
  258.         This.Bitmap:=Gdip_CreateHBITMAPFromBitmap(This.Background_Bitmap)
  259.         Gdip_DisposeImage(This.Background_Bitmap)
  260.         Gui,% This.Name ":Add",Picture,% "x0 y0 w" This.W " h" This.H " 0xE"
  261.         GuiControlGet,hwnd,% This.Name ":hwnd",Static1
  262.         This.Background_Hwnd:=hwnd
  263.         SetImage(This.Background_Hwnd,This.Bitmap)
  264.     }
  265.     Show_Window(){
  266.         if(This.X&&This.Y)
  267.             Gui,% This.Name ":Show",% "x" This.X " y" This.Y " w" This.W " h" This.H,% This.Title
  268.         else if(This.X&&!This.Y)
  269.             Gui,% This.Name ":Show",% "x" This.X  " w" This.W " h" This.H,% This.Title
  270.         else if(!This.X&&This.Y)
  271.             Gui,% This.Name ":Show",% "y" This.Y  " w" This.W " h" This.H,% This.Title
  272.         else
  273.             Gui,% This.Name ":Show",% " w" This.W " h" This.H,% This.Title
  274.     }
  275. }
  276.  
  277. Custom_Window_Maker_Tool_Background(){
  278.     ;Bitmap Created Using: HB Bitmap Maker
  279.     pBitmap:=Gdip_CreateBitmap( 400 , 250 )
  280.      G := Gdip_GraphicsFromImage( pBitmap )
  281.     Gdip_SetSmoothingMode( G , 4 )
  282.     Brush := Gdip_CreateLineBrush( 79 , 39 , 174 , 181 , "0xFF3399FF" , "0xFF000000" , 1 )
  283.     Gdip_FillRectangle( G , Brush , 0 , 0 , 400 , 250 )
  284.     Gdip_DeleteBrush( Brush )
  285.     Brush := Gdip_CreateLineBrush( 43 , -30 , 237 , 269 , "0xFF777777" , "0xFF000000" , 1 )
  286.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  287.     Gdip_DeleteBrush( Brush )
  288.     Gdip_DrawRectangle( G , Pen , 0 , 0 , 399 , 249 )
  289.     Gdip_DeletePen( Pen )
  290.     Brush := Gdip_BrushCreateSolid( "0xFF333333" )
  291.     Gdip_FillRectangle( G , Brush , 5 , 30 , 389 , 214 )
  292.     Gdip_DeleteBrush( Brush )
  293.     ;move window
  294.     Brush := Gdip_CreateLineBrushFromRect( 7 , 3 , 188 , 23 , "0xFF777777" , "0xFF222222" , 1 , 1 )
  295.     Gdip_FillRoundedRectangle( G , Brush , 46 , 4 , 270 , 22 , 5 )
  296.     Gdip_DeleteBrush( Brush )
  297.     Pen := Gdip_CreatePen( "0xFF333333" , 1 )
  298.     Gdip_DrawRoundedRectangle( G , Pen , 46 , 4 , 270 , 22 , 5 )
  299.     Gdip_DeletePen( Pen )
  300.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  301.     Gdip_TextToGraphics( G , "HB Custom Window Maker" , "s12 Center vCenter Bold c" Brush " x85 y2" , "Segoe UI" , 190 , 24 )
  302.     Gdip_DeleteBrush( Brush )
  303.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  304.     Gdip_TextToGraphics( G , "HB Custom Window Maker" , "s12 Center vCenter Bold c" Brush " x87 y2" , "Segoe UI" , 190 , 24 )
  305.     Gdip_DeleteBrush( Brush )
  306.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  307.     Gdip_TextToGraphics( G , "HB Custom Window Maker" , "s12 Center vCenter Bold c" Brush " x87 y4" , "Segoe UI" , 190 , 24 )
  308.     Gdip_DeleteBrush( Brush )
  309.     Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  310.     Gdip_TextToGraphics( G , "HB Custom Window Maker" , "s12 Center vCenter Bold c" Brush " x85 y4" , "Segoe UI" , 190 , 24 )
  311.     Gdip_DeleteBrush( Brush )
  312.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  313.     Gdip_TextToGraphics( G , "HB Custom Window Maker" , "s12 Center vCenter Bold c" Brush " x86 y3" , "Segoe UI" , 190 , 24 )
  314.     Gdip_DeleteBrush( Brush )
  315.     ;close window
  316.     Brush := Gdip_CreateLineBrushFromRect( 380 , 3 , 16 , 17 , "0xFF777777" , "0xFF222222" , 1 , 1 )
  317.     Gdip_FillRectangle( G , Brush , 380 , 5 , 15 , 15 )
  318.     Gdip_DeleteBrush( Brush )
  319.     Brush := Gdip_CreateLineBrush( 388 , 21 , 387 , -7 , "0xFF202020" , "0xFFF0F0F0" , 1 )
  320.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  321.     Gdip_DeleteBrush( Brush )
  322.     Gdip_DrawRectangle( G , Pen , 380 , 5 , 15 , 15 )
  323.     Gdip_DeletePen( Pen )
  324.     ;min window
  325.     Brush := Gdip_CreateLineBrushFromRect( 380 , 3 , 16 , 17 , "0xFF777777" , "0xFF222222" , 1 , 1 )
  326.     Gdip_FillRectangle( G , Brush , 360 , 5 , 15 , 15 )
  327.     Gdip_DeleteBrush( Brush )
  328.     Brush := Gdip_CreateLineBrush( 388 , 21 , 387 , -7 , "0xFF202020" , "0xFFF0F0F0" , 1 )
  329.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  330.     Gdip_DeleteBrush( Brush )
  331.     Gdip_DrawRectangle( G , Pen , 360 , 5 , 15 , 15 )
  332.     Gdip_DeletePen( Pen )
  333.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  334.     Gdip_TextToGraphics( G , "_" , "s16 Center vCenter Bold c" Brush " x343 y-16" , "Segoe UI" , 50 , 50 )
  335.     Gdip_DeleteBrush( Brush )
  336.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  337.     Gdip_TextToGraphics( G , "X" , "s12 Center vCenter c" Brush " x363 y-11" , "Segoe UI" , 50 , 50 )
  338.     Gdip_DeleteBrush( Brush )
  339.     Brush := Gdip_BrushCreateHatch( "0xaa333333" , "0x77000000" , 39 )
  340.     Gdip_FillRectangle( G , Brush , 10 , 35 , 240 , 204 )
  341.     Gdip_DeleteBrush( Brush )
  342.     Pen := Gdip_CreatePen( "0xFF222222" , 1 )
  343.     Gdip_DrawRectangle( G , Pen , 10 , 35 , 241 , 205 )
  344.     Gdip_DeletePen( Pen )
  345.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  346.     Gdip_TextToGraphics( G , "X :" , "s10  vCenter Bold c" Brush " x14 y49" , "Arial" , 50 , 22 )
  347.     Gdip_DeleteBrush( Brush )
  348.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  349.     Gdip_TextToGraphics( G , "Y :" , "s10  vCenter Bold c" Brush " x129 y49" , "Arial" , 50 , 22 )
  350.     Gdip_DeleteBrush( Brush )
  351.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  352.     Gdip_TextToGraphics( G , "W :" , "s10 vCenter Bold c" Brush " x14 y88" , "Arial" , 50 , 22 )
  353.     Gdip_DeleteBrush( Brush )
  354.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  355.     Gdip_TextToGraphics( G , "H :" , "s10  vCenter Bold c" Brush " x129 y88" , "Arial" , 50 , 22 )
  356.     Gdip_DeleteBrush( Brush )
  357.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  358.     Gdip_TextToGraphics( G , "Name :" , "s10 vCenter Bold c" Brush " x14 y124" , "Arial" , 50 , 22 )
  359.     Gdip_DeleteBrush( Brush )
  360.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  361.     Gdip_TextToGraphics( G , "Options :" , "s10 vCenter Bold c" Brush " x14 y154" , "Arial" , 50 , 22 )
  362.     Gdip_DeleteBrush( Brush )
  363.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  364.     Gdip_TextToGraphics( G , "Title :" , "s10 vCenter Bold c" Brush " x14 y185" , "Arial" , 50 , 22 )
  365.     Gdip_DeleteBrush( Brush )
  366.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  367.     Gdip_TextToGraphics( G , "Bitmap :" , "s10 vCenter Bold c" Brush " x14 y216" , "Arial" , 50 , 22 )
  368.     Gdip_DeleteBrush( Brush )
  369.     Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  370.     Gdip_FillRoundedRectangle( G , Brush , 254 , 33 , 137 , 208 , 5 )
  371.     Gdip_DeleteBrush( Brush )
  372.     Brush := Gdip_CreateLineBrushFromRect( 256 , 29 , 136 , 212 , "0xFF666666" , "0xFF000000" , 1 , 1 )
  373.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  374.     Gdip_DeleteBrush( Brush )
  375.     Gdip_DrawRoundedRectangle( G , Pen , 255 , 33 , 137 , 208 , 5 )
  376.     Gdip_DeletePen( Pen )
  377.     ;x edit
  378.     Brush := Gdip_CreateLineBrushFromRect( 34 , 48 , 79 , 20 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  379.     Gdip_FillRoundedRectangle( G , Brush , 35 , 47 , 80 , 22 , 0 )
  380.     Gdip_DeleteBrush( Brush )
  381.     Brush := Gdip_CreateLineBrushFromRect( 31 , 44 , 84 , 25 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  382.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  383.     Gdip_DeleteBrush( Brush )
  384.     Gdip_DrawRoundedRectangle( G , Pen , 35 , 47 , 80 , 22 , 0 )
  385.     Gdip_DeletePen( Pen )
  386.     ;y edit
  387.     Brush := Gdip_CreateLineBrushFromRect( 34 , 48 , 79 , 20 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  388.     Gdip_FillRoundedRectangle( G , Brush , 149 , 47 , 80 , 22 , 0 )
  389.     Gdip_DeleteBrush( Brush )
  390.     Brush := Gdip_CreateLineBrushFromRect( 31 , 44 , 84 , 25 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  391.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  392.     Gdip_DeleteBrush( Brush )
  393.     Gdip_DrawRoundedRectangle( G , Pen , 149 , 47 , 80 , 22 , 0 )
  394.     Gdip_DeletePen( Pen )
  395.     ;w edit
  396.     Brush := Gdip_CreateLineBrushFromRect( 34 , 48 , 79 , 20 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  397.     Gdip_FillRoundedRectangle( G , Brush , 35 , 87 , 80 , 22 , 0 )
  398.     Gdip_DeleteBrush( Brush )
  399.     Brush := Gdip_CreateLineBrushFromRect( 34 , 84 , 81 , 24 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  400.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  401.     Gdip_DeleteBrush( Brush )
  402.     Gdip_DrawRoundedRectangle( G , Pen , 35 , 87 , 80 , 22 , 0 )
  403.     Gdip_DeletePen( Pen )
  404.     ;h edit
  405.     Brush := Gdip_CreateLineBrushFromRect( 34 , 48 , 79 , 20 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  406.     Gdip_FillRoundedRectangle( G , Brush , 149 , 87 , 80 , 22 , 0 )
  407.     Gdip_DeleteBrush( Brush )
  408.     Brush := Gdip_CreateLineBrushFromRect( 34 , 84 , 81 , 24 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  409.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  410.     Gdip_DeleteBrush( Brush )
  411.     Gdip_DrawRoundedRectangle( G , Pen , 149 , 87 , 80 , 22 , 0 )
  412.     Gdip_DeletePen( Pen )
  413.     ;name edit
  414.     Brush := Gdip_CreateLineBrushFromRect( 72 , 121 , 170 , 23 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  415.     Gdip_FillRoundedRectangle( G , Brush , 73 , 123 , 170 , 22 , 0 )
  416.     Gdip_DeleteBrush( Brush )
  417.     ;options edit
  418.     Brush := Gdip_CreateLineBrushFromRect( 76 , 148 , 166 , 25 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  419.     Gdip_FillRoundedRectangle( G , Brush , 73 , 153 , 170 , 22 , 0 )
  420.     Gdip_DeleteBrush( Brush )
  421.     ;title edit
  422.     Brush := Gdip_CreateLineBrushFromRect( 75 , 182 , 168 , 23 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  423.     Gdip_FillRoundedRectangle( G , Brush , 73 , 183 , 170 , 22 , 0 )
  424.     Gdip_DeleteBrush( Brush )
  425.     ;bitmap edit
  426.     Brush := Gdip_CreateLineBrushFromRect( 73 , 213 , 170 , 18 , "0xFF3399FF" , "0xFF1E1E1E" , 1 , 1 )
  427.     Gdip_FillRoundedRectangle( G , Brush , 73 , 213 , 170 , 22 , 0 )
  428.     Gdip_DeleteBrush( Brush )
  429.     Brush := Gdip_CreateLineBrushFromRect( 72 , 120 , 172 , 26 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  430.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  431.     Gdip_DeleteBrush( Brush )
  432.     Gdip_DrawRoundedRectangle( G , Pen , 73 , 123 , 170 , 22 , 0 )
  433.     Gdip_DeletePen( Pen )
  434.     Brush := Gdip_CreateLineBrushFromRect( 75 , 149 , 172 , 26 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  435.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  436.     Gdip_DeleteBrush( Brush )
  437.     Gdip_DrawRoundedRectangle( G , Pen , 73 , 153 , 170 , 22 , 0 )
  438.     Gdip_DeletePen( Pen )
  439.     Brush := Gdip_CreateLineBrushFromRect( 72 , 180 , 167 , 25 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  440.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  441.     Gdip_DeleteBrush( Brush )
  442.     Gdip_DrawRoundedRectangle( G , Pen , 73 , 183 , 170 , 22 , 0 )
  443.     Gdip_DeletePen( Pen )
  444.     Brush := Gdip_CreateLineBrushFromRect( 72 , 212 , 167 , 25 , "0xFFF0F0F0" , "0xFF222222" , 1 , 1 )
  445.     Pen := Gdip_CreatePenFromBrush( Brush , 1 )
  446.     Gdip_DeleteBrush( Brush )
  447.     Gdip_DrawRoundedRectangle( G , Pen , 73 , 213 , 170 , 22 , 0 )
  448.     Gdip_DeletePen( Pen )
  449.     Gdip_DeleteGraphics( G )
  450.     return pBitmap
  451. }
  452.  
  453. ;######################################################################################################################################
  454. ;#####################################################                          #######################################################
  455. ;#####################################################        Gdip LITE         #######################################################
  456. ;#####################################################                          #######################################################
  457. ;######################################################################################################################################
  458. ; Gdip standard library v1.45 by tic (Tariq Porter) 07/09/11
  459. ; Modifed by Rseding91 using fincs 64 bit compatible Gdip library 5/1/2013
  460. BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster=""){
  461.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  462.     return DllCall("gdi32\BitBlt", Ptr, dDC, "int", dx, "int", dy, "int", dw, "int", dh, Ptr, sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
  463. }
  464. Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1){
  465.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  466.     if (Matrix&1 = "")
  467.         ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
  468.     else if (Matrix != 1)
  469.         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")
  470.     if(sx = "" && sy = "" && sw = "" && sh = ""){
  471.         if(dx = "" && dy = "" && dw = "" && dh = ""){
  472.             sx := dx := 0, sy := dy := 0
  473.             sw := dw := Gdip_GetImageWidth(pBitmap)
  474.             sh := dh := Gdip_GetImageHeight(pBitmap)
  475.         }else   {
  476.             sx := sy := 0,sw := Gdip_GetImageWidth(pBitmap),sh := Gdip_GetImageHeight(pBitmap)
  477.         }
  478.     }
  479.     E := DllCall("gdiplus\GdipDrawImageRectRect", Ptr, pGraphics, Ptr, pBitmap, "float", dx, "float", dy, "float", dw, "float", dh, "float", sx, "float", sy, "float", sw, "float", sh, "int", 2, Ptr, ImageAttr, Ptr, 0, Ptr, 0)
  480.     if ImageAttr
  481.         Gdip_DisposeImageAttributes(ImageAttr)
  482.     return E
  483. }
  484. Gdip_SetImageAttributesColorMatrix(Matrix){
  485.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  486.     VarSetCapacity(ColourMatrix, 100, 0)
  487.     Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
  488.     StringSplit, Matrix, Matrix, |
  489.     Loop, 25
  490.     {
  491.         Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
  492.         NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
  493.     }
  494.     DllCall("gdiplus\GdipCreateImageAttributes", A_PtrSize ? "UPtr*" : "uint*", ImageAttr)
  495.     DllCall("gdiplus\GdipSetImageAttributesColorMatrix", Ptr, ImageAttr, "int", 1, "int", 1, Ptr, &ColourMatrix, Ptr, 0, "int", 0)
  496.     return ImageAttr
  497. }
  498. Gdip_GetImageWidth(pBitmap){
  499.    DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width)
  500.    return Width
  501. }
  502. Gdip_GetImageHeight(pBitmap){
  503.    DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height)
  504.    return Height
  505. }
  506. Gdip_DeletePen(pPen){
  507.    return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
  508. }
  509. Gdip_DeleteBrush(pBrush){
  510.    return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
  511. }
  512. Gdip_DisposeImage(pBitmap){
  513.    return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
  514. }
  515. Gdip_DeleteGraphics(pGraphics){
  516.    return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
  517. }
  518. Gdip_DisposeImageAttributes(ImageAttr){
  519.     return DllCall("gdiplus\GdipDisposeImageAttributes", A_PtrSize ? "UPtr" : "UInt", ImageAttr)
  520. }
  521. Gdip_DeleteFont(hFont){
  522.    return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
  523. }
  524. Gdip_DeleteStringFormat(hFormat){
  525.    return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
  526. }
  527. Gdip_DeleteFontFamily(hFamily){
  528.    return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
  529. }
  530. CreateCompatibleDC(hdc=0){
  531.    return DllCall("CreateCompatibleDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  532. }
  533. SelectObject(hdc, hgdiobj){
  534.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  535.     return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
  536. }
  537. DeleteObject(hObject){
  538.    return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
  539. }
  540. GetDC(hwnd=0){
  541.     return DllCall("GetDC", A_PtrSize ? "UPtr" : "UInt", hwnd)
  542. }
  543. GetDCEx(hwnd, flags=0, hrgnClip=0){
  544.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  545.     return DllCall("GetDCEx", Ptr, hwnd, Ptr, hrgnClip, "int", flags)
  546. }
  547. ReleaseDC(hdc, hwnd=0){
  548.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  549.     return DllCall("ReleaseDC", Ptr, hwnd, Ptr, hdc)
  550. }
  551. DeleteDC(hdc){
  552.    return DllCall("DeleteDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  553. }
  554. Gdip_SetClipRegion(pGraphics, Region, CombineMode=0){
  555.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  556.     return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
  557. }
  558. CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0){
  559.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  560.     hdc2 := hdc ? hdc : GetDC()
  561.     VarSetCapacity(bi, 40, 0)
  562.     NumPut(w, bi, 4, "uint"), NumPut(h, bi, 8, "uint"), NumPut(40, bi, 0, "uint"), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16, "uInt"), NumPut(bpp, bi, 14, "ushort")
  563.     hbm := DllCall("CreateDIBSection", Ptr, hdc2, Ptr, &bi, "uint", 0, A_PtrSize ? "UPtr*" : "uint*", ppvBits, Ptr, 0, "uint", 0, Ptr)
  564.     if !hdc
  565.         ReleaseDC(hdc2)
  566.     return hbm
  567. }
  568. Gdip_GraphicsFromImage(pBitmap){
  569.     DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  570.     return pGraphics
  571. }
  572. Gdip_GraphicsFromHDC(hdc){
  573.     DllCall("gdiplus\GdipCreateFromHDC", A_PtrSize ? "UPtr" : "UInt", hdc, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  574.     return pGraphics
  575. }
  576. Gdip_GetDC(pGraphics){
  577.     DllCall("gdiplus\GdipGetDC", A_PtrSize ? "UPtr" : "UInt", pGraphics, A_PtrSize ? "UPtr*" : "UInt*", hdc)
  578.     return hdc
  579. }
  580. Gdip_Startup(){
  581.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  582.     if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
  583.         DllCall("LoadLibrary", "str", "gdiplus")
  584.     VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
  585.     DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
  586.     return pToken
  587. }
  588. Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0){
  589.     IWidth := Width, IHeight:= Height
  590.     RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
  591.     RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
  592.     RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
  593.     RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
  594.     RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
  595.     RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
  596.     RegExMatch(Options, "i)NoWrap", NoWrap)
  597.     RegExMatch(Options, "i)R(\d)", Rendering)
  598.     RegExMatch(Options, "i)S(\d+)(p*)", Size)
  599.     if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
  600.         PassBrush := 1, pBrush := Colour2
  601.     if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
  602.         return -1
  603.     Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
  604.     Loop, Parse, Styles, |
  605.     {
  606.         if RegExMatch(Options, "\b" A_loopField)
  607.         Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
  608.     }
  609.     Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
  610.     Loop, Parse, Alignments, |
  611.     {
  612.         if RegExMatch(Options, "\b" A_loopField)
  613.             Align |= A_Index//2.1      ; 0|0|1|1|2|2
  614.     }
  615.     xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
  616.     ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
  617.     Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
  618.     Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
  619.     if !PassBrush
  620.         Colour := "0x" (Colour2 ? Colour2 : "ff000000")
  621.     Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
  622.     Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
  623.     hFamily := Gdip_FontFamilyCreate(Font)
  624.     hFont := Gdip_FontCreate(hFamily, Size, Style)
  625.     FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
  626.     hFormat := Gdip_StringFormatCreate(FormatStyle)
  627.     pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
  628.     if !(hFamily && hFont && hFormat && pBrush && pGraphics)
  629.         return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
  630.     CreateRectF(RC, xpos, ypos, Width, Height)
  631.     Gdip_SetStringFormatAlign(hFormat, Align)
  632.     Gdip_SetTextRenderingHint(pGraphics, Rendering)
  633.     ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  634.     if vPos
  635.     {
  636.         StringSplit, ReturnRC, ReturnRC, |
  637.         if (vPos = "vCentre") || (vPos = "vCenter")
  638.             ypos += (Height-ReturnRC4)//2
  639.         else if (vPos = "Top") || (vPos = "Up")
  640.             ypos := 0
  641.         else if (vPos = "Bottom") || (vPos = "Down")
  642.             ypos := Height-ReturnRC4
  643.         CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
  644.         ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  645.     }
  646.     if !Measure
  647.         E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
  648.     if !PassBrush
  649.         Gdip_DeleteBrush(pBrush)
  650.     Gdip_DeleteStringFormat(hFormat)  
  651.     Gdip_DeleteFont(hFont)
  652.     Gdip_DeleteFontFamily(hFamily)
  653.     return E ? E : ReturnRC
  654. }
  655. Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF){
  656.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  657.     if (!A_IsUnicode)
  658.     {
  659.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
  660.         VarSetCapacity(wString, nSize*2)
  661.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
  662.     }
  663.     return DllCall("gdiplus\GdipDrawString", Ptr, pGraphics, Ptr, A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr, hFormat, Ptr, pBrush)
  664. }
  665. Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1){
  666.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  667.     CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
  668.     DllCall("gdiplus\GdipCreateLineBrush", Ptr, &PointF1, Ptr, &PointF2, "Uint", ARGB1, "Uint", ARGB2, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  669.     return LGpBrush
  670. }
  671. Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1){
  672.     CreateRectF(RectF, x, y, w, h)
  673.     DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" : "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  674.     return LGpBrush
  675. }
  676. Gdip_CloneBrush(pBrush){
  677.     DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
  678.     return pBrushClone
  679. }
  680. Gdip_FontFamilyCreate(Font){
  681.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  682.     if (!A_IsUnicode)
  683.     {
  684.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
  685.         VarSetCapacity(wFont, nSize*2)
  686.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, Ptr, &wFont, "int", nSize)
  687.     }
  688.     DllCall("gdiplus\GdipCreateFontFamilyFromName", Ptr, A_IsUnicode ? &Font : &wFont, "uint", 0, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
  689.     return hFamily
  690. }
  691. Gdip_SetStringFormatAlign(hFormat, Align){
  692.    return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
  693. }
  694. Gdip_StringFormatCreate(Format=0, Lang=0){
  695.    DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
  696.    return hFormat
  697. }
  698. Gdip_FontCreate(hFamily, Size, Style=0){
  699.    DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily, "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
  700.    return hFont
  701. }
  702. Gdip_CreatePen(ARGB, w){
  703.    DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  704.    return pPen
  705. }
  706. Gdip_CreatePenFromBrush(pBrush, w){
  707.     DllCall("gdiplus\GdipCreatePen2", A_PtrSize ? "UPtr" : "UInt", pBrush, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  708.     return pPen
  709. }
  710. Gdip_BrushCreateSolid(ARGB=0xff000000){
  711.     DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  712.     return pBrush
  713. }
  714. Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0){
  715.     DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "UInt", ARGBfront, "UInt", ARGBback, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  716.     return pBrush
  717. }
  718. CreateRectF(ByRef RectF, x, y, w, h){
  719.    VarSetCapacity(RectF, 16)
  720.    NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
  721. }
  722. Gdip_SetTextRenderingHint(pGraphics, RenderingHint){
  723.     return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
  724. }
  725. Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF){
  726.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  727.     VarSetCapacity(RC, 16)
  728.     if !A_IsUnicode
  729.     {
  730.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
  731.         VarSetCapacity(wString, nSize*2)  
  732.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
  733.     }
  734.     DllCall("gdiplus\GdipMeasureString", Ptr, pGraphics, Ptr, A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr, hFormat, Ptr, &RC, "uint*", Chars, "uint*", Lines)
  735.     return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
  736. }
  737. CreateRect(ByRef Rect, x, y, w, h){
  738.     VarSetCapacity(Rect, 16)
  739.     NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
  740. }
  741. CreateSizeF(ByRef SizeF, w, h){
  742.    VarSetCapacity(SizeF, 8)
  743.    NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")    
  744. }
  745. CreatePointF(ByRef PointF, x, y){
  746.    VarSetCapacity(PointF, 8)
  747.    NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")    
  748. }
  749. Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  750.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  751.     return DllCall("gdiplus\GdipDrawArc", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  752. }
  753. Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  754.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  755.     return DllCall("gdiplus\GdipDrawPie", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  756. }
  757. Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2){
  758.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  759.     return DllCall("gdiplus\GdipDrawLine", Ptr, pGraphics, Ptr, pPen, "float", x1, "float", y1, "float", x2, "float", y2)
  760. }
  761. Gdip_DrawLines(pGraphics, pPen, Points){
  762.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  763.     StringSplit, Points, Points, |
  764.     VarSetCapacity(PointF, 8*Points0)  
  765.     Loop, %Points0%
  766.     {
  767.         StringSplit, Coord, Points%A_Index%, `,
  768.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  769.     }
  770.     return DllCall("gdiplus\GdipDrawLines", Ptr, pGraphics, Ptr, pPen, Ptr, &PointF, "int", Points0)
  771. }
  772. Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h){
  773.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  774.     return DllCall("gdiplus\GdipFillRectangle", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
  775. }
  776. Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r){
  777.     Region := Gdip_GetClipRegion(pGraphics)
  778.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  779.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  780.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  781.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  782.     E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
  783.     Gdip_SetClipRegion(pGraphics, Region, 0)
  784.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  785.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  786.     Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
  787.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
  788.     Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
  789.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  790.     Gdip_SetClipRegion(pGraphics, Region, 0)
  791.     Gdip_DeleteRegion(Region)
  792.     return E
  793. }
  794. Gdip_GetClipRegion(pGraphics){
  795.     Region := Gdip_CreateRegion()
  796.     DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
  797.     return Region
  798. }
  799. Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0){
  800.    return DllCall("gdiplus\GdipSetClipRect",  A_PtrSize ? "UPtr" : "UInt", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
  801. }
  802. Gdip_SetClipPath(pGraphics, Path, CombineMode=0){
  803.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  804.     return DllCall("gdiplus\GdipSetClipPath", Ptr, pGraphics, Ptr, Path, "int", CombineMode)
  805. }
  806. Gdip_ResetClip(pGraphics){
  807.    return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
  808. }
  809. Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h){
  810.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  811.     return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
  812. }
  813. Gdip_FillRegion(pGraphics, pBrush, Region){
  814.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  815.     return DllCall("gdiplus\GdipFillRegion", Ptr, pGraphics, Ptr, pBrush, Ptr, Region)
  816. }
  817. Gdip_FillPath(pGraphics, pBrush, Path){
  818.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  819.     return DllCall("gdiplus\GdipFillPath", Ptr, pGraphics, Ptr, pBrush, Ptr, Path)
  820. }
  821. Gdip_CreateRegion(){
  822.     DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
  823.     return Region
  824. }
  825. Gdip_DeleteRegion(Region){
  826.     return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
  827. }
  828. Gdip_CreateBitmap(Width, Height, Format=0x26200A){
  829.     DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
  830.     Return pBitmap
  831. }
  832. Gdip_SetSmoothingMode(pGraphics, SmoothingMode){
  833.    return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
  834. }
  835. Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h){
  836.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  837.     return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
  838. }
  839. Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r){
  840.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  841.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  842.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  843.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  844.     E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
  845.     Gdip_ResetClip(pGraphics)
  846.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  847.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  848.     Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
  849.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
  850.     Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
  851.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  852.     Gdip_ResetClip(pGraphics)
  853.     return E
  854. }
  855. Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h){
  856.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  857.     return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
  858. }
  859. Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff){
  860.     DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hbm, "int", Background)
  861.     return hbm
  862. }
  863. SetImage(hwnd, hBitmap){
  864.     SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
  865.     E := ErrorLevel
  866.     DeleteObject(E)
  867.     return E
  868. }
  869.  
  870. Set_Gdip_Lite_Var_1(){
  871.         Gdip_LITE_Part1 =
  872.     (% ` Join`r`n
  873. ;######################################################################################################################################
  874. ;#####################################################                          #######################################################
  875. ;#####################################################        Gdip LITE         #######################################################
  876. ;#####################################################                          #######################################################
  877. ;######################################################################################################################################
  878. ; Gdip standard library v1.45 by tic (Tariq Porter) 07/09/11
  879. ; Modifed by Rseding91 using fincs 64 bit compatible Gdip library 5/1/2013
  880. BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster=""){
  881.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  882.     return DllCall("gdi32\BitBlt", Ptr, dDC, "int", dx, "int", dy, "int", dw, "int", dh, Ptr, sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
  883. }
  884. Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1){
  885.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  886.     if (Matrix&1 = "")
  887.         ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
  888.     else if (Matrix != 1)
  889.         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")
  890.     if(sx = "" && sy = "" && sw = "" && sh = ""){
  891.         if(dx = "" && dy = "" && dw = "" && dh = ""){
  892.             sx := dx := 0, sy := dy := 0
  893.             sw := dw := Gdip_GetImageWidth(pBitmap)
  894.             sh := dh := Gdip_GetImageHeight(pBitmap)
  895.         }else   {
  896.             sx := sy := 0,sw := Gdip_GetImageWidth(pBitmap),sh := Gdip_GetImageHeight(pBitmap)
  897.         }
  898.     }
  899.     E := DllCall("gdiplus\GdipDrawImageRectRect", Ptr, pGraphics, Ptr, pBitmap, "float", dx, "float", dy, "float", dw, "float", dh, "float", sx, "float", sy, "float", sw, "float", sh, "int", 2, Ptr, ImageAttr, Ptr, 0, Ptr, 0)
  900.     if ImageAttr
  901.         Gdip_DisposeImageAttributes(ImageAttr)
  902.     return E
  903. }
  904. Gdip_SetImageAttributesColorMatrix(Matrix){
  905.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  906.     VarSetCapacity(ColourMatrix, 100, 0)
  907.     Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
  908.     StringSplit, Matrix, Matrix, |
  909.     Loop, 25
  910.     {
  911.         Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
  912.         NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
  913.     }
  914.     DllCall("gdiplus\GdipCreateImageAttributes", A_PtrSize ? "UPtr*" : "uint*", ImageAttr)
  915.     DllCall("gdiplus\GdipSetImageAttributesColorMatrix", Ptr, ImageAttr, "int", 1, "int", 1, Ptr, &ColourMatrix, Ptr, 0, "int", 0)
  916.     return ImageAttr
  917. }
  918. Gdip_GetImageWidth(pBitmap){
  919.    DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width)
  920.    return Width
  921. }
  922. Gdip_GetImageHeight(pBitmap){
  923.    DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height)
  924.    return Height
  925. }
  926. Gdip_DeletePen(pPen){
  927.    return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
  928. }
  929. Gdip_DeleteBrush(pBrush){
  930.    return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
  931. }
  932. Gdip_DisposeImage(pBitmap){
  933.    return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
  934. }
  935. Gdip_DeleteGraphics(pGraphics){
  936.    return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
  937. }
  938. Gdip_DisposeImageAttributes(ImageAttr){
  939.     return DllCall("gdiplus\GdipDisposeImageAttributes", A_PtrSize ? "UPtr" : "UInt", ImageAttr)
  940. }
  941. Gdip_DeleteFont(hFont){
  942.    return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
  943. }
  944. Gdip_DeleteStringFormat(hFormat){
  945.    return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
  946. }
  947. Gdip_DeleteFontFamily(hFamily){
  948.    return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
  949. }
  950. CreateCompatibleDC(hdc=0){
  951.    return DllCall("CreateCompatibleDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  952. }
  953. SelectObject(hdc, hgdiobj){
  954.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  955.     return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
  956. }
  957. DeleteObject(hObject){
  958.    return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
  959. }
  960. GetDC(hwnd=0){
  961.     return DllCall("GetDC", A_PtrSize ? "UPtr" : "UInt", hwnd)
  962. }
  963. GetDCEx(hwnd, flags=0, hrgnClip=0){
  964.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  965.     return DllCall("GetDCEx", Ptr, hwnd, Ptr, hrgnClip, "int", flags)
  966. }
  967. ReleaseDC(hdc, hwnd=0){
  968.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  969.     return DllCall("ReleaseDC", Ptr, hwnd, Ptr, hdc)
  970. }
  971. DeleteDC(hdc){
  972.    return DllCall("DeleteDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  973. }
  974. Gdip_SetClipRegion(pGraphics, Region, CombineMode=0){
  975.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  976.     return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
  977. }
  978. CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0){
  979.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  980.     hdc2 := hdc ? hdc : GetDC()
  981.     VarSetCapacity(bi, 40, 0)
  982.     NumPut(w, bi, 4, "uint"), NumPut(h, bi, 8, "uint"), NumPut(40, bi, 0, "uint"), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16, "uInt"), NumPut(bpp, bi, 14, "ushort")
  983.     hbm := DllCall("CreateDIBSection", Ptr, hdc2, Ptr, &bi, "uint", 0, A_PtrSize ? "UPtr*" : "uint*", ppvBits, Ptr, 0, "uint", 0, Ptr)
  984.     if !hdc
  985.         ReleaseDC(hdc2)
  986.     return hbm
  987. }
  988. Gdip_GraphicsFromImage(pBitmap){
  989.     DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  990.     return pGraphics
  991. }
  992. Gdip_GraphicsFromHDC(hdc){
  993.     DllCall("gdiplus\GdipCreateFromHDC", A_PtrSize ? "UPtr" : "UInt", hdc, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  994.     return pGraphics
  995. }
  996. Gdip_GetDC(pGraphics){
  997.     DllCall("gdiplus\GdipGetDC", A_PtrSize ? "UPtr" : "UInt", pGraphics, A_PtrSize ? "UPtr*" : "UInt*", hdc)
  998.     return hdc
  999. }
  1000.     )
  1001.     return Gdip_LITE_Part1
  1002. }
  1003. Set_Gdip_Lite_Var_2(){
  1004.     Gdip_LITE_Part2 =
  1005.     (% ` Join`r`n
  1006. Gdip_Startup(){
  1007.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1008.     if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
  1009.         DllCall("LoadLibrary", "str", "gdiplus")
  1010.     VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
  1011.     DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
  1012.     return pToken
  1013. }
  1014. Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0){
  1015.     IWidth := Width, IHeight:= Height
  1016.     RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
  1017.     RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
  1018.     RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
  1019.     RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
  1020.     RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
  1021.     RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
  1022.     RegExMatch(Options, "i)NoWrap", NoWrap)
  1023.     RegExMatch(Options, "i)R(\d)", Rendering)
  1024.     RegExMatch(Options, "i)S(\d+)(p*)", Size)
  1025.     if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
  1026.         PassBrush := 1, pBrush := Colour2
  1027.     if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
  1028.         return -1
  1029.     Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
  1030.     Loop, Parse, Styles, |
  1031.     {
  1032.         if RegExMatch(Options, "\b" A_loopField)
  1033.         Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
  1034.     }
  1035.     Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
  1036.     Loop, Parse, Alignments, |
  1037.     {
  1038.         if RegExMatch(Options, "\b" A_loopField)
  1039.             Align |= A_Index//2.1      ; 0|0|1|1|2|2
  1040.     }
  1041.     xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
  1042.     ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
  1043.     Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
  1044.     Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
  1045.     if !PassBrush
  1046.         Colour := "0x" (Colour2 ? Colour2 : "ff000000")
  1047.     Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
  1048.     Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
  1049.     hFamily := Gdip_FontFamilyCreate(Font)
  1050.     hFont := Gdip_FontCreate(hFamily, Size, Style)
  1051.     FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
  1052.     hFormat := Gdip_StringFormatCreate(FormatStyle)
  1053.     pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
  1054.     if !(hFamily && hFont && hFormat && pBrush && pGraphics)
  1055.         return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
  1056.     CreateRectF(RC, xpos, ypos, Width, Height)
  1057.     Gdip_SetStringFormatAlign(hFormat, Align)
  1058.     Gdip_SetTextRenderingHint(pGraphics, Rendering)
  1059.     ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  1060.     if vPos
  1061.     {
  1062.         StringSplit, ReturnRC, ReturnRC, |
  1063.         if (vPos = "vCentre") || (vPos = "vCenter")
  1064.             ypos += (Height-ReturnRC4)//2
  1065.         else if (vPos = "Top") || (vPos = "Up")
  1066.             ypos := 0
  1067.         else if (vPos = "Bottom") || (vPos = "Down")
  1068.             ypos := Height-ReturnRC4
  1069.         CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
  1070.         ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  1071.     }
  1072.     if !Measure
  1073.         E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
  1074.     if !PassBrush
  1075.         Gdip_DeleteBrush(pBrush)
  1076.     Gdip_DeleteStringFormat(hFormat)  
  1077.     Gdip_DeleteFont(hFont)
  1078.     Gdip_DeleteFontFamily(hFamily)
  1079.     return E ? E : ReturnRC
  1080. }
  1081. Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF){
  1082.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1083.     if (!A_IsUnicode)
  1084.     {
  1085.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
  1086.         VarSetCapacity(wString, nSize*2)
  1087.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
  1088.     }
  1089.     return DllCall("gdiplus\GdipDrawString", Ptr, pGraphics, Ptr, A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr, hFormat, Ptr, pBrush)
  1090. }
  1091. Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1){
  1092.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1093.     CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
  1094.     DllCall("gdiplus\GdipCreateLineBrush", Ptr, &PointF1, Ptr, &PointF2, "Uint", ARGB1, "Uint", ARGB2, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  1095.     return LGpBrush
  1096. }
  1097. Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1){
  1098.     CreateRectF(RectF, x, y, w, h)
  1099.     DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" : "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  1100.     return LGpBrush
  1101. }
  1102. Gdip_CloneBrush(pBrush){
  1103.     DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
  1104.     return pBrushClone
  1105. }
  1106. Gdip_FontFamilyCreate(Font){
  1107.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1108.     if (!A_IsUnicode)
  1109.     {
  1110.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
  1111.         VarSetCapacity(wFont, nSize*2)
  1112.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, Ptr, &wFont, "int", nSize)
  1113.     }
  1114.     DllCall("gdiplus\GdipCreateFontFamilyFromName", Ptr, A_IsUnicode ? &Font : &wFont, "uint", 0, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
  1115.     return hFamily
  1116. }
  1117. Gdip_SetStringFormatAlign(hFormat, Align){
  1118.    return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
  1119. }
  1120. Gdip_StringFormatCreate(Format=0, Lang=0){
  1121.    DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
  1122.    return hFormat
  1123. }
  1124. Gdip_FontCreate(hFamily, Size, Style=0){
  1125.    DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily, "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
  1126.    return hFont
  1127. }
  1128. Gdip_CreatePen(ARGB, w){
  1129.    DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  1130.    return pPen
  1131. }
  1132. Gdip_CreatePenFromBrush(pBrush, w){
  1133.     DllCall("gdiplus\GdipCreatePen2", A_PtrSize ? "UPtr" : "UInt", pBrush, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  1134.     return pPen
  1135. }
  1136. Gdip_BrushCreateSolid(ARGB=0xff000000){
  1137.     DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  1138.     return pBrush
  1139. }
  1140. Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0){
  1141.     DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "UInt", ARGBfront, "UInt", ARGBback, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  1142.     return pBrush
  1143. }
  1144. CreateRectF(ByRef RectF, x, y, w, h){
  1145.    VarSetCapacity(RectF, 16)
  1146.    NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
  1147. }
  1148. Gdip_SetTextRenderingHint(pGraphics, RenderingHint){
  1149.     return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
  1150. }
  1151. Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF){
  1152.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1153.     VarSetCapacity(RC, 16)
  1154.     if !A_IsUnicode
  1155.     {
  1156.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
  1157.         VarSetCapacity(wString, nSize*2)  
  1158.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
  1159.     }
  1160.     DllCall("gdiplus\GdipMeasureString", Ptr, pGraphics, Ptr, A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr, hFormat, Ptr, &RC, "uint*", Chars, "uint*", Lines)
  1161.     return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
  1162. }
  1163. CreateRect(ByRef Rect, x, y, w, h){
  1164.     VarSetCapacity(Rect, 16)
  1165.     NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
  1166. }
  1167. CreateSizeF(ByRef SizeF, w, h){
  1168.    VarSetCapacity(SizeF, 8)
  1169.    NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")    
  1170. }
  1171. CreatePointF(ByRef PointF, x, y){
  1172.    VarSetCapacity(PointF, 8)
  1173.    NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")    
  1174. }
  1175. Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  1176.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1177.     return DllCall("gdiplus\GdipDrawArc", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  1178. }
  1179. Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  1180.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1181.     return DllCall("gdiplus\GdipDrawPie", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  1182. }
  1183. Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2){
  1184.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1185.     return DllCall("gdiplus\GdipDrawLine", Ptr, pGraphics, Ptr, pPen, "float", x1, "float", y1, "float", x2, "float", y2)
  1186. }
  1187. Gdip_DrawLines(pGraphics, pPen, Points){
  1188.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1189.     StringSplit, Points, Points, |
  1190.     VarSetCapacity(PointF, 8*Points0)  
  1191.     Loop, %Points0%
  1192.     {
  1193.         StringSplit, Coord, Points%A_Index%, `,
  1194.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  1195.     }
  1196.     return DllCall("gdiplus\GdipDrawLines", Ptr, pGraphics, Ptr, pPen, Ptr, &PointF, "int", Points0)
  1197. }
  1198. Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h){
  1199.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1200.     return DllCall("gdiplus\GdipFillRectangle", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
  1201. }
  1202. Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r){
  1203.     Region := Gdip_GetClipRegion(pGraphics)
  1204.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  1205.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  1206.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  1207.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  1208.     E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
  1209.     Gdip_SetClipRegion(pGraphics, Region, 0)
  1210.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  1211.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  1212.     Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
  1213.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
  1214.     Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
  1215.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  1216.     Gdip_SetClipRegion(pGraphics, Region, 0)
  1217.     Gdip_DeleteRegion(Region)
  1218.     return E
  1219. }
  1220. Gdip_GetClipRegion(pGraphics){
  1221.     Region := Gdip_CreateRegion()
  1222.     DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
  1223.     return Region
  1224. }
  1225. Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0){
  1226.    return DllCall("gdiplus\GdipSetClipRect",  A_PtrSize ? "UPtr" : "UInt", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
  1227. }
  1228. Gdip_SetClipPath(pGraphics, Path, CombineMode=0){
  1229.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1230.     return DllCall("gdiplus\GdipSetClipPath", Ptr, pGraphics, Ptr, Path, "int", CombineMode)
  1231. }
  1232. Gdip_ResetClip(pGraphics){
  1233.    return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
  1234. }
  1235. Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h){
  1236.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1237.     return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
  1238. }
  1239. Gdip_FillRegion(pGraphics, pBrush, Region){
  1240.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1241.     return DllCall("gdiplus\GdipFillRegion", Ptr, pGraphics, Ptr, pBrush, Ptr, Region)
  1242. }
  1243. Gdip_FillPath(pGraphics, pBrush, Path){
  1244.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1245.     return DllCall("gdiplus\GdipFillPath", Ptr, pGraphics, Ptr, pBrush, Ptr, Path)
  1246. }
  1247. Gdip_CreateRegion(){
  1248.     DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
  1249.     return Region
  1250. }
  1251. Gdip_DeleteRegion(Region){
  1252.     return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
  1253. }
  1254. Gdip_CreateBitmap(Width, Height, Format=0x26200A){
  1255.     DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
  1256.     Return pBitmap
  1257. }
  1258. Gdip_SetSmoothingMode(pGraphics, SmoothingMode){
  1259.    return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
  1260. }
  1261. Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h){
  1262.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1263.     return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
  1264. }
  1265. Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r){
  1266.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  1267.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  1268.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  1269.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  1270.     E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
  1271.     Gdip_ResetClip(pGraphics)
  1272.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  1273.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  1274.     Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
  1275.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
  1276.     Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
  1277.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  1278.     Gdip_ResetClip(pGraphics)
  1279.     return E
  1280. }
  1281. Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h){
  1282.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1283.     return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
  1284. }
  1285. Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff){
  1286.     DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hbm, "int", Background)
  1287.     return hbm
  1288. }
  1289. SetImage(hwnd, hBitmap){
  1290.     SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
  1291.     E := ErrorLevel
  1292.     DeleteObject(E)
  1293.     return E
  1294. }
  1295. Gdip_FillPolygon(pGraphics, pBrush, Points, FillMode=0){
  1296.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  1297.     StringSplit, Points, Points, |
  1298.     VarSetCapacity(PointF, 8*Points0)  
  1299.     Loop, %Points0%
  1300.     {
  1301.         StringSplit, Coord, Points%A_Index%, `,
  1302.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  1303.     }  
  1304.     return DllCall("gdiplus\GdipFillPolygon", Ptr, pGraphics, Ptr, pBrush, Ptr, &PointF, "int", Points0, "int", FillMode)
  1305. }
  1306.  
  1307.     )
  1308.     return Gdip_LITE_Part2
  1309. }
  1310.  
  1311. Set_Partial_Script_Var(){
  1312.     New_Partial_Script=
  1313.     (% ` Join`r`n
  1314. #SingleInstance,Force
  1315. #NoEnv
  1316. ListLines,Off
  1317. SetBatchLines,-1
  1318. pToken:=Gdip_Startup()
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325. /*
  1326. Gui,1:Add,Text,x6 y3 w190 h24 BackgroundTrans gMove_Window
  1327. Gui,1:Add,Text,x360 y5 w15 h15 BackgroundTrans gMin_Window
  1328. Gui,1:Add,Text,x380 y5 w15 h15 BackgroundTrans gGuiClose
  1329. Gui,1:Color,222222,222222
  1330. Gui,1:Font,cWhite s8
  1331. */
  1332.  
  1333.  
  1334.  
  1335.  
  1336. return
  1337. GuiClose:
  1338. GuiContextMenu:
  1339. *Esc::
  1340.     ExitApp
  1341.  
  1342. Move_Window(){
  1343.     PostMessage,0xA1,2
  1344. }
  1345.  
  1346. Min_Window(){
  1347.     Gui,1:Minimize
  1348. }
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.    
  1367.    
  1368.     )
  1369.     return New_Partial_Script
  1370. }
  1371.  
  1372. Set_Custom_Window_Class_Var(){
  1373.     Custom_Window_Class_Var =
  1374.     (% ` Join`r`n
  1375. Class Custom_Window {
  1376.     __New(x:="",y:="",w:=300,h:=200,Name:=1,Options:="+AlwaysOnTop -Caption -DPIScale",Title:="",Background_Bitmap:=""){
  1377.         This.X:=x
  1378.         This.Y:=y
  1379.         This.W:=w
  1380.         This.H:=h
  1381.         This.Name:=Name
  1382.         This.Title:=Title
  1383.         This.Options:=Options
  1384.         This.Background_Bitmap:=Background_Bitmap
  1385.         This.Create_Window()
  1386.     }
  1387.     Create_Window(){
  1388.         Gui,% This.Name ":New",%  This.Options " +LastFound"
  1389.         This.Hwnd:=WinExist()
  1390.         if(This.Background_Bitmap)
  1391.             This.Draw_Background_Bitmap()
  1392.     }
  1393.     Draw_Background_Bitmap(){
  1394.         This.Bitmap:=Gdip_CreateHBITMAPFromBitmap(This.Background_Bitmap)
  1395.         Gdip_DisposeImage(This.Background_Bitmap)
  1396.         Gui,% This.Name ":Add",Picture,% "x0 y0 w" This.W " h" This.H " 0xE"
  1397.         GuiControlGet,hwnd,% This.Name ":hwnd",Static1
  1398.         This.Background_Hwnd:=hwnd
  1399.         SetImage(This.Background_Hwnd,This.Bitmap)
  1400.     }
  1401.     Show_Window(){
  1402.         if(This.X&&This.Y)
  1403.             Gui,% This.Name ":Show",% "x" This.X " y" This.Y " w" This.W " h" This.H,% This.Title
  1404.         else if(This.X&&!This.Y)
  1405.             Gui,% This.Name ":Show",% "x" This.X  " w" This.W " h" This.H,% This.Title
  1406.         else if(!This.X&&This.Y)
  1407.             Gui,% This.Name ":Show",% "y" This.Y  " w" This.W " h" This.H,% This.Title
  1408.         else
  1409.             Gui,% This.Name ":Show",% " w" This.W " h" This.H,% This.Title
  1410.     }
  1411. }  
  1412.     )
  1413.     return Custom_Window_Class_Var
  1414. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement