Advertisement
pastamaker

turning photos

May 24th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance,force
  2.  
  3.  
  4. #HotkeyInterval 2000  ; This is  the default value (milliseconds).
  5. #MaxHotkeysPerInterval 2000
  6. #Include, <Gdip>
  7. SetBatchLines,-1
  8. ptoken:=Gdip_Startup()
  9. counter:=90
  10. width:=450
  11. height:=450
  12. Gui, -Caption   +LastFound +E0x80000 -DPIScale
  13.  
  14. Gui,Show,x10 y10 w%width% h%Height%,something
  15. hwnd1:= WinExist()
  16.  
  17. hbm := CreateDIBSection(Width, Height)
  18. hdc := CreateCompatibleDC()
  19. obm := SelectObject(hdc, hbm)
  20. G := Gdip_GraphicsFromHDC(hdc)
  21. Gdip_SetSmoothingMode(G, 4)
  22.  
  23.  
  24. pBrush1  := Gdip_BrushCreateSolid("0xffffffff")  
  25. pBrush2 := Gdip_BrushCreateSolid("0xFF000000")  
  26. ;get a bitmap of a specified window
  27. SetWorkingDir,C:\Users\Admin\Desktop\gdip_roasted
  28. pBitmapWin1 := Gdip_CreateBitmapFromFile("weat.png")
  29. pBitmapWin2 := Gdip_CreateBitmapFromFile("back.png")
  30. pBitmapWin3 := Gdip_CreateBitmapFromFile("car.png")
  31. pBitmapWin4 := Gdip_CreateBitmapFromFile("flower.png")
  32.  
  33. UpdateLayeredWindow(hwnd1, hdc, 200, 100, Width, Height)
  34.  
  35. Gdip_FillRectangle(g, pBrush2, 0, 0,Width, Height)
  36. SoundBeep
  37. UpdateLayeredWindow(hwnd1, hdc, 200, 100, Width, Height)
  38.  
  39.  
  40.  
  41.  
  42. SetTimer,Game_Loop,1
  43.  
  44. return
  45. game_loop:
  46. ;~ SoundBeep,,1500
  47.  
  48. Gdip_FillRectangle(g, pBrush2, 0, 0,Width, Height)
  49.  
  50.  
  51. gosub draw
  52. UpdateLayeredWindow(hwnd1, hdc)
  53. return
  54.  
  55. draw:
  56. turn_in_graphics( g,width/3,height/3,counter,pBitmapWin1)
  57. turn_in_graphics( g,width/3,2*height/3,counter,pBitmapWin2)
  58. turn_in_graphics( g,2*width/3,2*height/3,counter,pBitmapWin3)
  59. turn_in_graphics( g,2*width/3,height/3,counter,pBitmapWin4)
  60. ;~ draw:
  61. ;~ Gdip_GetRotatedDimensions(250, 250, counter, RWidth, RHeight)
  62. ;~ MsgBox,% "Rwidth: " RWidth "`nrheight: " rheight
  63.  
  64. ;~ ; xTranslation and yTranslation now contain the distance to shift the image by
  65. ;~ Gdip_GetRotatedTranslation(250, 250, counter, xTranslation, yTranslation)
  66. ;~ MsgBox,% "xTranslation: " xTranslation "`nyTranslation: " yTranslation
  67. ;~ pBitmap := Gdip_CreateBitmap(RWidth, RHeight)                       ; Create a new bitmap
  68. ;~ Gg := Gdip_GraphicsFromImage(pBitmap)                                ; Get a pointer to the graphics of the bitmap
  69. ;~ Gdip_SetSmoothingMode(Gg, 4)
  70. ;~ ; Best interpolation is 5 - it's like no antialias
  71. ;~ Gdip_SetInterpolationMode(Gg, 7)
  72. ;~ Gdip_TranslateWorldTransform(Gg, xTranslation, yTranslation)
  73. ;~ Gdip_RotateWorldTransform(Gg, counter)
  74.  
  75.  
  76. ;~ Gdip_DrawImage(Gg, pBitmapWin, 0,0, 250, 250 )   ; Draw the original image onto the new bitmap
  77. ;~ Gdip_ResetWorldTransform(Gg)
  78. ;~ Gdip_DrawImage(G, pBitmap, 250-RWidth/2, 250-rheight/2, RWidth, RHeight)
  79.  
  80.                
  81. return
  82. ;#Include,C:\Users\Admin\Desktop\gdip_roasted\turnbitmapandreturn.ahk
  83. x::
  84. Gdip_Shutdown(pToken)
  85. ExitApp
  86.  
  87.  
  88. a::
  89. counter-=5
  90. counter:=mod(counter,360)
  91.  
  92. return
  93.  
  94. d::
  95. counter+=5
  96. counter:=mod(counter,360)
  97.  
  98. return
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105. ;~ xbitmap
  106. turn_bitmap(byref xbitmap,xturn){
  107. xWidth := Gdip_GetImageWidth(xbitmap)
  108. xHeight := Gdip_GetImageHeight(xbitmap)
  109.  
  110.  
  111. Gdip_GetRotatedDimensions(xWidth, xHeight, xturn, xRWidth, xRHeight)
  112. ;~ MsgBox,% "Rwidth: " RWidth "`nrheight: " rheight
  113.  
  114. ; xTranslation and yTranslation now contain the distance to shift the image by
  115. Gdip_GetRotatedTranslation(xWidth, xHeight, xturn, xxTranslation, xyTranslation)
  116. ;~ MsgBox,% "xTranslation: " xTranslation "`nyTranslation: " yTranslation
  117. xpBitmap := Gdip_CreateBitmap(xRWidth, xRHeight)                       ; Create a new bitmap
  118. xg := Gdip_GraphicsFromImage(xpBitmap)                                ; Get a pointer to the graphics of the bitmap
  119. Gdip_SetSmoothingMode(xg, 4)
  120. ; Best interpolation is 5 - it's like no antialias
  121. Gdip_SetInterpolationMode(xg, 7)
  122. Gdip_TranslateWorldTransform(xg, xxTranslation, xyTranslation)
  123. Gdip_RotateWorldTransform(xg, xturn)
  124.  
  125.  
  126. Gdip_DrawImage(xg, xbitmap, 0,0, xWidth, xHeight)   ; Draw the original image onto the new bitmap
  127. Gdip_ResetWorldTransform(xg)
  128. ;~ Gdip_DisposeImage(xBitmap)
  129. ;~ xBitmap := Gdip_CreateBitmap(xRWidth, xRHeight)                       ; Create a new bitmap
  130. ;~ xg0 := Gdip_GraphicsFromImage(xBitmap)
  131. ;~ Gdip_DrawImage(xg0, xpBitmap, 0,0, xrWidth, xrHeight)
  132. ;~ SetWorkingDir,C:\Users\Admin\Desktop\gdip_roasted\newque
  133. ;~ if(xturn = 120){
  134.     ;~ SoundBeep,,1400
  135. ;~ Gdip_SaveBitmapToFile(xpBitmap, "me120.png")
  136. ;~ }
  137. ;~ SetWorkingDir,C:\Users\Admin\Desktop\gdip_roasted
  138. xbitmap:=xpbitmap
  139. }
  140. ;~ Gdip_DrawImage(G, pBitmap, 250-RWidth/2, 250-rheight/2, 3000, 3000, 0, 0, 3000, 3000)
  141.  
  142.  
  143.  
  144.  
  145. turn_in_graphics(byref xg,xx,xy,xturn,xbitmap){
  146.     ToolTip,% xturn
  147.     turn_bitmap(xbitmap,xturn)
  148.     xWidth := Gdip_GetImageWidth(xbitmap)
  149. xHeight := Gdip_GetImageHeight(xbitmap)
  150.     Gdip_DrawImage(xG, xBitmap, xx-xWidth/2, xy-xheight/2, xWidth, xHeight)
  151.    
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement