Jump to content
Sign in to follow this  
UEZ

Some Graphical Examples using GDI+ Vol. I

Recommended Posts

@Eukalyptus: Thanks you very much for publishing your GDI+ examples here in this thread! :D YOUR ARE REALLY GREAT! :graduated:

In my opinion this thread is now a very good resource for the GDI+ stuff!

Unfortunately I cannot update the 1# post with screenshots and links because after forum update all formats will be lost! :D

As soon as the problem is solved I will update the 1# post :(!

@all: feel free to post more examples!!!!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ,

the problem with editing posts is when they have links in them afaik. If you replace hyerlinks with [ u r l ] http://www.someurl[ u r l ] , but without the spaces in the tags, then you might be able to edit your first post again.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thanks for the hint martin but as far as I can remember I did it that way. I disabled rich text edit and it seems to work now with Iron properly because I was able to add another example (#28).

It is not clearly represented but seems to be working now...

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

How to use a context menu in a transparent window?

At the moment it only works sometimes when you click on the top (painted) parts of the window.

I want a menu when you right click on any soild (painted) part, so that clicking on the Black Dot for example brings up a context menu.

The idea here is use the context menu to bring up a GUI with Sliders for Sizing etc.

Here`s the Contextmenu code part

;  ================== Handle WM_CONTEXT MENU message for right click ===================
Func _WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam)
Local $aPos
    $aPos = MouseGetPos()
    _GUICtrlMenu_TrackPopupMenu($hContext, $hWnd, $aPos [0], $aPos [1], 1, 1, 1)
    Consolewrite ("WM ContextMenu " &" X = " &$aPos [0] &" Y = " &$aPos [1] &@CRLF)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_CONTEXTMENU
; =========================================================================================

Here`s the test code I`ve been working on (using UZE Simple clock example)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <String.au3>
#include <GuiMenu.au3>
Global Const $width = 640
Global Const $height = 480
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2
Global $brush_color, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1, $y2, $a, $b, $c, $r, $g, $b
Global $i = 0, $j = 360, $m = 0, $n = 0
Global $radius_x, $radius_y
Global $title = "From GDI+ Code by : UEZ 2009!"
Global $hGUI,$hBrush, $Gray1 = 0xE0EEEEEE, $Gray2 = 0xD0DDDDDD
Global $iX = 0, $iY = 0, $Col, $hPen, $iWidth = 100, $iHeight =100
Global $sc_hBrush, $sc_hFormat, $sc_hFamily, $sc_hFont, $hFont2, $sc_text_color, $text_sin, $text_scroller, $sc_tLayout, $sc_pen, $sc_brush
Global $letter_distance, $x, $y, $lenght, $end, $scroller_length, $sc_k
Global $pColor = 0xFF0000F0
Global $White = 0xF0FFFFFF
Global $hContext
Global Const $sc_font_size = 48
Global Const $WHEEL_DELTA = 120
 
$sc_text = "#*** |||| __Transparent Text Srcoller with Clock__ |||| ***#"
Opt("GUIOnEventMode", 1)
$GUI= GUICreate($title, $width, $height, -1, -1, 0, $WS_EX_LAYERED + $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($GUI)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
$sc_hBrush = _GDIPlus_BrushCreateSolid ()
$sc_hPen = _GDIPlus_PenCreate($pColor, 1)
$ScreenDc = _WinAPI_GetDC($GUI)
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
_WinAPI_SelectObject($dc, $gdibitmap)
; _WinAPI_UpdateLayeredWindow parameters
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $width)
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
Global $alpha = 200
Global $alpha_steps = 5
DllStructSetData($tBlend, "Alpha", $alpha)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
; Context Menu
$cMenu1 = GUICtrlCreateDummy()
$ContextMenu = GUICtrlCreateContextMenu()
$hContextMenu = GUICtrlGetHandle(-1)
$cm1 = GUICtrlCreateMenuItem('Menu Item 1', $ContextMenu)
$cm2 = GUICtrlCreateMenuItem('Menu Item 2', $ContextMenu)
$cm3 = GUICtrlCreateMenuItem('Menu Item 3', $ContextMenu)
GUISetState()
GUIRegisterMsg($WM_NCHITTEST,   "WM_NCHITTEST")  ;Drag Window
GUIRegisterMsg($WM_CONTEXTMENU, "_WM_CONTEXTMENU")  ;Context Menu
GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")  ;Adjust Trans
;Setup Scroll Font
$sc_text_color = 0xFF6209D6
$sc_htextBrush = _GDIPlus_BrushCreateSolid($sc_text_color)
$sc_hFormat = _GDIPlus_StringFormatCreate()
$sc_hFamily = _GDIPlus_FontFamilyCreate("Arial")
$sc_hFont = _GDIPlus_FontCreate($sc_hFamily, $sc_font_size, 2)
$sc_pen = _GDIPlus_PenCreate(0)
$sc_brush = _GDIPlus_BrushCreateSolid(0)
$tLayout = _GDIPlus_RectFCreate(0, 0)
;Text Ini
$sc_letter_distance = $sc_font_size
$sc_length = $sc_font_size * 1.666 * 0.36
$sc_k = $width
$end = 0
$scroller_length = StringLen($sc_text) * $sc_length
$sc_FontY = $Height - $height/4 + 40
 
;Time init
  $Time_hBrush = _GDIPlus_BrushCreateSolid(0xFF008080)
  $Time_hFormat = _GDIPlus_StringFormatCreate()
  $Time_hFamily = _GDIPlus_FontFamilyCreate("Verdana")
  $Time_hFont   = _GDIPlus_FontCreate ($Time_hFamily, 48, 3)
  $Time_hLayout = _GDIPlus_RectFCreate(0, 0, $Width, 80)
Do
_GDIPlus_GraphicsClear($backbuffer, 0x00000000)
 
;  _GDIPlus_GraphicsFillEllipse($backbuffer, $width/2-10, $height/2-10, 20, 20)
DrawCorners()
DrawTime()
ScrollText()
;~  _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($GUI, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
_WinAPI_DeleteObject($gdibitmap)
; ===== For Context Menu ======
    $msg = GUIGetMsg()
    Switch $msg
        Case 0
        Case $cm1
            ConsoleWrite("Menu Item 1" & @CRLF)
        Case $cm2
            ConsoleWrite("LV Menu Item 2" & @CRLF)
        Case $cm3
            ConsoleWrite("LV Menu Item 3" & @CRLF)
            Exit
EndSwitch
 
Until False * Not Sleep(30)
 
; Draw the digital time
Func DrawTime()
  Local $sString, $aSize
;  if ($aLast[0][0] = $aCurr[0][0]) and ($aLast[0][1] = $aCurr[0][1]) then Return
  $sString = StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC)
  $aSize   = _GDIPlus_GraphicsMeasureString($Backbuffer, $sString, $Time_hFont, $Time_hLayout, $Time_hFormat)
  DllStructSetData($Time_hLayout, "X", $Width/2 - (DllStructGetData($aSize[0], "Width") / 2))   ; $Width - String length/2
DllStructSetData($Time_hLayout, "Y", 0)             ; Clock at top
;  DllStructSetData($Time_hLayout, "Y", $Height/2 - (DllStructGetData($aSize[0], "Height") / 2))  ; Clock in middle
; _GDIPlus_GraphicsFillRect($aTime[$eGraphic], 0, 0, $iRadius * 2, $iRadius * 2)
  _GDIPlus_GraphicsDrawStringEx($BackBuffer, $sString, $Time_hFont, $Time_hLayout, $Time_hFormat, $Time_hBrush)
;  ResourceSet($hTime, $aTime)
EndFunc
;  ================== Handle WM_CONTEXT MENU message for right click ===================
Func _WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam)
Local $aPos
    $aPos = MouseGetPos()
    _GUICtrlMenu_TrackPopupMenu($hContext, $hWnd, $aPos [0], $aPos [1], 1, 1, 1)
    Consolewrite ("WM ContextMenu " &" X = " &$aPos [0] &" Y = " &$aPos [1] &@CRLF)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_CONTEXTMENU
; =========================================================================================
; ================ SCROLL TEXT ====================
Func ScrollText()
$sc_FontX = $sc_k + $sc_letter_distance
DllStructSetData($tLayout, "x", $sc_FontX)
DllStructSetData($tLayout, "y", $sc_FontY)
_GDIPlus_GraphicsDrawStringEx($BackBuffer, $sc_text, $sc_hFont, $tLayout, $sc_hFormat, $sc_htextBrush)
$sc_k -= 5
If -$scroller_length >= $sc_k Then
  $sc_k = $Width
EndIf
EndFunc
Func DrawCorners()
Local $Lgth = 20
$hPen1 = _GDIPlus_PenCreate(0xFF0000AA, 10)
;Top Right
      _GDIPlus_GraphicsDrawLine($backBuffer, $Width, 0, $Width - $Lgth, 0, $hPen1)
      _GDIPlus_GraphicsDrawLine($backBuffer, $Width, 0, $Width , $Lgth, $hPen1)
;Top Left
      _GDIPlus_GraphicsDrawLine($backBuffer, 0, 0, 0, $Lgth, $hPen1)
      _GDIPlus_GraphicsDrawLine($backBuffer, 0, 0, $Lgth, 0, $hPen1)  
  
  _GDIPlus_GraphicsFillEllipse($backBuffer, $Width/2 - 20, $Height/2 -20 ,40, 40)   ; Draw a Dot to Clock On
;Bottom Right
      _GDIPlus_GraphicsDrawLine($backBuffer, $Width, $Height, $Width, $Height - $Lgth, $hPen1)
      _GDIPlus_GraphicsDrawLine($backBuffer, $Width, $Height, $Width - $Lgth, $Height, $hPen1)  
;Bottom Left  
      _GDIPlus_GraphicsDrawLine($backBuffer, 0, $Height, 0, $Height - $Lgth, $hPen1)
      _GDIPlus_GraphicsDrawLine($backBuffer, 0, $Height, $Lgth , $Height, $hPen1)  
_GDIPlus_PenDispose($hPen1)  
EndFunc
; Handle the WM_NCHITTEST message so our window can be dragged
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
  if $hWnd= $GUI then Return $HTCAPTION
   ConsoleWrite($GUI &@LF)
EndFunc
; MouseWheel for Win Trans
Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam)
  Local $mouseData, $n1
      $mouseData = _WinAPI_HiWord($wParam) ;/ $WHEEL_DELTA
Select
;Case $wParam = $WM_MOUSEWHEEL And WinActive($GUI)
;WM_MOUSEWHEEL = 0x020A
Case WinActive($GUI)
   If $mouseData > 0 Then ;wheel up
    If $alpha + $alpha_steps <= 512 Then $alpha += $alpha_steps
    Switch $alpha
     Case 0 To 255
      DllStructSetData($tBlend, "Alpha", $alpha)          ; Set Alpha (Transparency) Level
      DllStructSetData($tBlend, "Format", 1)
     Case 256 To 512
      DllStructSetData($tBlend, "Alpha", $alpha - 256)
      DllStructSetData($tBlend, "Format", 0)
    EndSwitch
   Else ;wheel down
    If $alpha - $alpha_steps > 0 Then $alpha -= $alpha_steps
    Switch $alpha
     Case 0 To 255
      DllStructSetData($tBlend, "Alpha", $alpha) ;wheel up
      DllStructSetData($tBlend, "Format", 1)
     Case 256 To 512
      DllStructSetData($tBlend, "Alpha", $alpha - 256) ;wheel up
      DllStructSetData($tBlend, "Format", 0)
    EndSwitch
   EndIf
   ConsoleWrite($alpha & @CRLF)
EndSelect
EndFunc ;==>WM_MOUSEWHEEL
Func Close()
_WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($GUI, $ScreenDc)
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_FontFamilyDispose($hFamily2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
 
  _GDIPlus_FontDispose      ($Time_hFont  )
  _GDIPlus_FontFamilyDispose  ($Time_hFamily)
  _GDIPlus_StringFormatDispose($Time_hFormat)
  _GDIPlus_BrushDispose    ($Time_hBrush)
_GDIPlus_Shutdown()
WinClose($GUI)
Exit
EndFunc   ;==>Close

Thanks for your help.

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Use these lines instead to get the context menu when mouse is over the black ellipse and rmb is pressed:

...
; Context Menu
$cMenu1 = GUICtrlCreateLabel("", $Width/2 - 40, $Height/2 - 40 , 80, 80)
$ContextMenu = GUICtrlCreateContextMenu($cMenu1)
...

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks, that works, but the label stops the clickdrag function from working if you click on on the label.

I did this instead.

; ============= Handle the WM_NCHITTEST message so our window can be dragged ===============
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
Local $hMenu, $Win, $WinX, $WinY, $mX, $mY
;  if $hWnd= $GUI and _isPressed(02) Then _GUICtrlMenu_TrackPopupMenu($Cmenu, $hWnd, $aPos [0], $aPos [1], 1, 1, 1)
;MouseCoordMode set to 0    relative coords to the active window
if $hWnD = $GUI and _IsPressed (01) then Return $HTCAPTION
if $hWnd = $GUI and _IsPressed (02) then
    Beep(100,10)
; ConsoleWrite($GUI &" HIT!! "&@CRLF)
#cs
  $WinPos = WingetPos($GUI)
  $WinX = $WinPos[0]
  $WinY = $WinPos[0]
 
     $aPos = MouseGetPos()
  $mX = $aPos [0]
  $mY = $aPos [1]
  ConsoleWrite("MouseCoords = " &$WinX + $mX &" " &$WinY + $mY &@CRLF)
#ce
$hMenu = _GUICtrlMenu_CreatePopup ()
_GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Properties", $item1)
_GUICtrlMenu_InsertMenuItem ($hMenu, 1, "Item 2", $item2)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "Item 3", $item3)
_GUICtrlMenu_TrackPopupMenu ($hMenu, $GUI, -1,-1 ,1,0 )
_GUICtrlMenu_DestroyMenu ($hMenu)
Return True
endif
EndFunc
#;======================================================================
; =========  Handle WM_COMMAND messages =======================
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch $iwParam
  Case $item1
   Properties()
   ConsoleWrite("Item 1 = " &$item1 &@CRLF)
  Case $item2
   ConsoleWrite("Item 2 = " &$item2 &@CRLF)  
  Case $item3
   ConsoleWrite("Item 3 = " &$item3 &@CRLF) 
EndSwitch
EndFunc   ;==>WM_COMMAND
;=============================================================
Func Properties()
   $SliderGUI = GUICreate("Properites", $width/4, $height/8 -1, -1)
;   GUISetOnEvent($GUI_EVENT_CLOSE, "SliderGUIClose")
   GUISetState()
;
EndFunc

This works with affecting the drag function.

Just have to work out a way of getting events from the SliderWindow now... :D


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

I`ve moved this as I felt it needed its own thread, to stop cluttering up this one. :D


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Some "basic" examples of using (some) the GDIP functions.

I`ve tried to keep them as simple as possible.

They don`t do anything exciting, the goal here is provide simple examples of the GDIP functions in a standard form, like the autoit help does.

The function descriptions are from GDIP.au3.

Please post your own (simple please) GDIP examples here! :D

##include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
; Name...........: _GDIPlus_GraphicsSetClipRect
; Description ...: Updates the clipping region of a Graphics object to a region that is the combination of itself and a rectangle
; Syntax.........: _GDIPlus_GraphicsSetClipRect($hGraphics, $nX, $nY, $nWidth, $nHeight[, $iCombineMode = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
;                 $nX       - X coordinate of the upper-left corner of the rectangle
;                 $nY       - Y coordinate of the upper-left corner of the rectangle
;                 $nWidth   - Width of the rectangle
;                 $nHeight   - Height of the rectangle
;                 $iCombineMode - Regions combination mode:
;                 |0 - The existing region is replaced by the new region
;                 |1 - The existing region is replaced by the intersection of itself and the new region
;                 |2 - The existing region is replaced by the union of itself and the new region
;                 |3 - The existing region is replaced by the result of performing an XOR on the two regions
;                 |4 - The existing region is replaced by the portion of itself that is outside of the new region
;                 |5 - The existing region is replaced by the portion of the new region that is outside of the existing region
Global Const $GUI_Width = 400, $GUI_Height = 300
; Create GUI
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
;_SetClip($hGraphic, 50, 50, 300, 200)
Global $nX = 50, $nY = 50, $nWidth = 300, $nHeight = 200
_GDIPlus_GraphicsSetClipRect($hGraphic, $nX, $nY, $nWidth, $nHeight,0) ; change 0 to 3 to invert mask
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_PathDispose($hPath)
_GDIPlus_Shutdown ()

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathAddEllipse
; Description ...: Adds an ellipse to the current figure a path
; Syntax.........: _GDIPlus_PathAddEllipse($hPath, $nX, $nY, $nWidth, $nHeight)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
;                 $nX     - The X coordinate of the upper left corner of the rectangle that bounds the ellipse
;                 $nY     - The Y coordinate of the upper left corner of the rectangle that bounds the ellipse
;                 $nWidth  - The width of the rectangle that bounds the ellipse
;                 $nHeight - The height of the rectangle that bounds the ellipse
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsSetClipPath
; Description ...: Updates the clipping region of this Graphics object to a region that is the combination of itself and the
;                 +region specified by a graphics path
; Syntax.........: _GDIPlus_GraphicsSetClipPath($hGraphics, $hPath[, $iCombineMode = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
;                 $hPath    - Pointer to a GraphicsPath object that specifies the region to be combined with the clipping
;                 +region of the Graphics object
;                 $iCombineMode - Regions combination mode:
;                 |0 - The existing region is replaced by the new region
;                 |1 - The existing region is replaced by the intersection of itself and the new region
;                 |2 - The existing region is replaced by the union of itself and the new region
;                 |3 - The existing region is replaced by the result of performing an XOR on the two regions
;                 |4 - The existing region is replaced by the portion of itself that is outside of the new region
;                 |5 - The existing region is replaced by the portion of the new region that is outside of the existing region
Global Const $GUI_Width = 400, $GUI_Height = 400
Global $hPath
; Create GUI
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
_SetClipCircle($hGraphic, 50, 50, 300, 300)
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_Shutdown()
_GDIPlus_Shutdown ()
Func _SetClipCircle($hGraphics, $x, $y, $width, $height)
  
$hPath = _GDIPlus_PathCreate()
  _GDIPlus_PathAddEllipse($hPath, $X, $Y, $Width, $Height)
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask
EndFunc

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
Global Const $GUI_Width = 400, $GUI_Height = 400
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathAddString
; Description ...: Adds the outline of a string to a path
; Syntax.........: _GDIPlus_PathAddString($hPath, $sString, $tLayout[, $hFamily = 0[, $iStyle = 0[, $nSize = 8.5[, $hFormat = 0]]]])
; Parameters ....: $hPath   - Pointer to a GraphicsPath object
;                 $sString - String to be drawn
;                 $tLayout - $tagGDIPRECTF structure that bounds the string
;                 $hFamily - Pointer to a FontFamily object that specifies the font family for the string
;                 $iStyle  - The style of the typeface. Can be a combination of the following:
;                 |0 - Normal weight or thickness of the typeface
;                 |1 - Bold typeface
;                 |2 - Italic typeface
;                 |4 - Underline
;                 |8 - Strikethrough
;                 $nSize   - The em size, in world units, of the string characters
;                 $hFormat - Pointer to a StringFormat object that specifies layout information for the string
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsDrawPath
; Description ...: Draws a sequence of lines and curves defined by a GraphicsPath object
; Syntax.........: _GDIPlus_GraphicsDrawPath($hGraphics, $hPath[, $hPen = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
;                 $hPath   - Pointer to a GraphicsPath object that specifies the sequence of lines and curves that make up the
;                 +path
;                 $hPen   - Handle to a pen object that is used to draw the splines. If 0, a solid black pen with a width of
;                 +1 will be used.
; Create GUI
;$GUI= GUICreate($title, $width, $height, -1, -1, 0, $WS_EX_LAYERED + $WS_EX_TOPMOST)
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
;Init Text
$stext = "autoit"
$ISize = 125
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Trebuchet MS")
$hFont = _GDIPlus_FontCreate($hFamily, $Isize, 2)
$tLayout = _GDIPlus_RectFCreate(0, 0)
;Mask everything outside text region
_SetClipText($hGraphic, $sText, 0, 100, $GUI_Width, $GUI_Height, "Trebuchet MS", $ISize)
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_PathDispose($hPath)
_GDIPlus_Shutdown ()
Func _SetClipText($hGraphics, $sText, $x, $y, $width, $height, $sFont, $iSize)
;Create Path object,
$hPath = _GDIPlus_PathCreate()
$aSize   = _GDIPlus_GraphicsMeasureString($hGraphics, $sText, $sFont, $tLayout, $hFormat)
DllStructSetData($tLayout, "X", $x)  ;Postion text in Window
DllStructSetData($tLayout, "Y", $y)

  _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $ISize, $hFormat)
  
    _GDIPlus_StringFormatDispose ($hFormat)  
    _GDIPlus_FontFamilyDispose($hFamily)
  
    ;Trace path with pen
_GDIPlus_GraphicsDrawPath($hGraphics, $hPath, 0)
    ;Apply mask
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask
EndFunc

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathAddPolygon
; Description ...: Adds a polygon to a path
; Syntax.........: _GDIPlus_PathAddPolygon($hPath, $aPoints)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
;                 $aPoints - Array of points that define the vertices of the polygon:
;                 |[0][0] - Number of points
;                 |[1][0] - Point 1 X position
;                 |[1][1] - Point 1 Y position
;                 |[2][0] - Point 2 X position
;                 |[2][1] - Point 2 Y position
;                 |[n][0] - Point n X position
;                 |[n][1] - Point n Y position
; ===============================================================================================================================
Global Const $GUI_Width = 400, $GUI_Height = 400, $scale = 200
Global $hPath
;Points to Draw a Star
Global $POLY_POINTS[12][2] = [[11,0],[151,156],[146,25],[197,119],[285,120],[199,168],[226,260],[152,199], _
    [66,260],[104,167],[25,120],[109,120]]
; Create GUI
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
_SetClipPoly($hGraphic, 50, 50, 300, 300)
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_Shutdown()
_GDIPlus_Shutdown ()
Func _SetClipPoly($hGraphics, $x, $y, $width, $height)
$hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddPolygon($hPath, $POLY_POINTS)
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask
EndFunc

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathAddLine
; Description ...: Adds a line to the current figure of a path
; Syntax.........: _GDIPlus_PathAddLine($hPath, $nX1, $nY1, $nX2, $nY2)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
;                 $nX1   - The X coordinate of the starting point of the line
;                 $nY1   - The Y coordinate of the starting point of the line
;                 $nX2   - The X coordinate of the ending point of the line
;                 $nY2   - The Y coordinate of the ending point of the line
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathReverse
; Description ...: Reverses the order of the points that define a path's lines and curves
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathCloseFigure
; Description ...: Closes the current figure of a path
; Syntax.........: _GDIPlus_PathCloseFigure($hPath)
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathFlatten
; Description ...: Applies a transformation to a path and converts each curve in the path to a sequence of connected lines
; Syntax.........: _GDIPlus_PathFlatten($hPath[, $nFlatness = $FlatnessDefault[, $hMatrix = 0]])
; Parameters ....: $hPath   - Pointer to a GraphicsPath object
;                 $nFlatness - Real number that specifies the maximum error between the path and its flattened approximation.
;                 +Reducing the flatness increases the number of line segments in the approximation
;                 $hMatrix   - Pointer to a Matrix object that specifies the transformation to be applied to the path's data
;                 +points
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsDrawPath
; Description ...: Draws a sequence of lines and curves defined by a GraphicsPath object
; Syntax.........: _GDIPlus_GraphicsDrawPath($hGraphics, $hPath[, $hPen = 0])
Global Const $GUI_Width = 400, $GUI_Height = 400
Global $hPath
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()

_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
$hPath = _CreateSpiralPath($GUI_Width, $GUI_Height, 2, 1.06, 0.05)
    ;Trace path with pen
_GDIPlus_GraphicsDrawPath($hGraphic, $hPath, 0)
    ;Apply mask
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask

    ;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_Shutdown()
_GDIPlus_Shutdown ()
;From the Spiral Bitmap Demo by eukalyptus
Func _CreateSpiralPath($iW, $iH, $fSqr = 2, $fMul = 1.1, $fStep = 0.03)
    Local $hPath = _GDIPlus_PathCreate(0)
    Local $iCnt = 0, $iW2 = $iW / 2, $iH2 = $iH / 2
    Local $iX, $iY, $iXOld = $iW2, $iYOld = $iH2
    Do
        $iX = Cos($iCnt) * $iCnt ^ $fSqr + $iW2
        $iY = Sin($iCnt) * $iCnt ^ $fSqr + $iH2
        _GDIPlus_PathAddLine($hPath, $iXOld, $iYOld, $iX, $iY)
        $iXOld = $iX
        $iYOld = $iY
        $iCnt += $fStep
    Until ($iX < 0 Or $iX > $iW) And ($iY < 0 Or $iY > $iH)
    _GDIPlus_PathReverse($hPath)
    $iXOld = $iW2
    $iYOld = $iH2
    $fSqr *= $fMul
    For $i = 0 To $iCnt Step $fStep
        $iX = Cos($i) * $i ^ $fSqr + $iW2
        $iY = Sin($i) * $i ^ $fSqr + $iH2
        _GDIPlus_PathAddLine($hPath, $iXOld, $iYOld, $iX, $iY)
        $iXOld = $iX
        $iYOld = $iY
    Next
    _GDIPlus_PathCloseFigures($hPath)
    _GDIPlus_PathFlatten($hPath)
    Return $hPath
EndFunc   ;==>_CreateSpiralPath

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathAddPie
; Description ...: Adds a pie to a path
; Syntax.........: _GDIPlus_PathAddPie($hPath, $nX, $nY, $nWidth, $nHeight, $nStartAngle, $nSweepAngle)
; Parameters ....: $hPath  - Pointer to a GraphicsPath object
;                 $nX         - The X coordinate of the upper left corner of the rectangle that bounds the ellipse that bounds
;                 +the pie
;                 $nY         - The Y coordinate of the upper left corner of the rectangle that bounds the ellipse that bounds
;                 +the pie
;                 $nWidth     - The width of the rectangle that bounds the ellipse that bounds the pie
;                 $nHeight   - The height of the rectangle that bounds the ellipse that bounds the pie
;                 $nStartAngle - The angle, in degrees, between the X axis and the starting point of the arc  that  defines  the
;                 +pie. A positive value specifies clockwise rotation.
;                 $nSweepAngle - The angle, in degrees, between the starting and ending points of the arc that defines the  pie.
;                 +A positive value specifies clockwise rotation.
Global Const $GUI_Width = 400, $GUI_Height = 400
Global $hPath
; Create GUI
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
_SetClipPie($hGraphic, 50, 50, 300, 300, 45, 285)
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_PathDispose($hPath)
_GDIPlus_Shutdown ()

Func _SetClipPie($hGraphics, $x, $y, $width, $height,$Start, $Sweep)
  
$hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddPie($hPath, $X, $Y, $Width, $Height, $Start, $Sweep)
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask
EndFunc

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
Global Const $GUI_Width = 400, $GUI_Height = 400
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathAddLine
; Description ...: Adds a line to the current figure of a path
; Syntax.........: _GDIPlus_PathAddLine($hPath, $nX1, $nY1, $nX2, $nY2)
; Parameters ....: $hPath - Pointer to a GraphicsPath object
;                 $nX1   - The X coordinate of the starting point of the line
;                 $nY1   - The Y coordinate of the starting point of the line
;                 $nX2   - The X coordinate of the ending point of the line
;                 $nY2   - The Y coordinate of the ending point of the line
; Create GUI
;$GUI= GUICreate($title, $width, $height, -1, -1, 0, $WS_EX_LAYERED + $WS_EX_TOPMOST)
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX, $WS_EX_TOPMOST)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
;Mask everything outside of Rect region
_PathAddLine()
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIP_PathDispose($hPath)
_GDIPlus_Shutdown ()
Func _PathAddLine()
;Create Path object,
$hPath = _GDIPlus_PathCreate()
;draw a square
_GDIPlus_PathAddLine($hPath, 10, 10, 200, 10)
_GDIPlus_PathAddLine($hPath, 200, 10, 200, 200)
_GDIPlus_PathAddLine($hPath, 200, 200, 10, 200)
_GDIPlus_PathAddLine($hPath, 10, 200, 10, 10)
 
    ;Trace path with pen
_GDIPlus_GraphicsDrawPath($hGraphic, $hPath, 0)
    ;Apply mask
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask
EndFunc

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <GDIP.au3>
Global Const $GUI_Width = 400, $GUI_Height = 400
Global $hPath
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsSetClipPath
; Description ...: Updates the clipping region of this Graphics object to a region that is the combination of itself and the
;                 +region specified by a graphics path
; Syntax.........: _GDIPlus_GraphicsSetClipPath($hGraphics, $hPath[, $iCombineMode = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
;                 $hPath    - Pointer to a GraphicsPath object that specifies the region to be combined with the clipping
;                 +region of the Graphics object
;                 $iCombineMode - Regions combination mode:
;                 |0 - The existing region is replaced by the new region
;                 |1 - The existing region is replaced by the intersection of itself and the new region
;                 |2 - The existing region is replaced by the union of itself and the new region
;                 |3 - The existing region is replaced by the result of performing an XOR on the two regions
;                 |4 - The existing region is replaced by the portion of itself that is outside of the new region
;                 |5 - The existing region is replaced by the portion of the new region that is outside of the existing region
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PathReset
; Description ...: Empties a path and sets the fill mode to alternate (0)
; Syntax.........: _GDIPlus_PathReset($hPath)
; Parameters ....: $hPath - Pointer to a GraphicsPath object

; Create GUI
$hGUI = GUICreate("GDI+", $GUI_Width, $GUI_Height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
;AntiAlias
;_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
;Create Path object
$hPath = _GDIPlus_PathCreate()
_PathDrawRect()
DrawLines()
msgbox(0,"", "PathAddLine Done")
_GDIPlus_PathReset($hPath)
_GDIPlus_GraphicsClear($hGraphic, 0xFFd4d0c8)
msgbox(0,"", "PathAddReset Done")
_PathDrawTriangle()
DrawLines()

Func DrawLines()
;Draw diagonal lines across entire gui
For $X = 0 to $GUI_Width Step 4
    _GDIPlus_GraphicsDrawLine($hGraphic, $X,0,$GUI_Width, $GUI_Height-$X)
Next
For $X = $GUI_Width to 4 Step -4
    _GDIPlus_GraphicsDrawLine($hGraphic, 0,$X,$GUI_Width-$X, $GUI_Height)
Next
EndFunc
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_PathDispose($hPath)
_GDIPlus_Shutdown ()
Func _PathDrawRect()
;draw a square
_GDIPlus_PathAddLine($hPath, 10, 10, 200, 10)
_GDIPlus_PathAddLine($hPath, 200, 10, 200, 200)
_GDIPlus_PathAddLine($hPath, 200, 200, 10, 200)
_GDIPlus_PathAddLine($hPath, 10, 200, 10, 10) 
    ;Trace path with pen
; _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, 0)
    ;Apply mask
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 3) ; change 0 to 3 to invert mask
EndFunc
Func _PathDrawTriangle()
_GDIPlus_PathAddLine($hPath, 100, 10, 190, 190)
_GDIPlus_PathAddLine($hPath, 190, 190, 10, 190)
_GDIPlus_PathAddLine($hPath, 10, 190, 100, 10)
;Trace path with pen
_GDIPlus_GraphicsDrawPath($hGraphic, $hPath, 0)
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath) ;Reset ClipPath
    ;Apply mask
_GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 0) ; change 0 to 3 to invert mask
EndFunc
Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Thanks Lakes for your contribution to GDI+ and this topic!!!

Here another example made by eukalyptus

Project Text on glass ball

;by eukalyptus
#include <gdiplus.au3>
#include <guiconstantsex.au3>
#include <windowsconstants.au3>

Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)

Global $iWidth = 400;@DesktopWidth
Global $iHeight = 400;@DesktopHeight

Global $fRX = 0.1
Global $fRY = 1.5
Global $fRZ = -0.3

Global Const $PI = ATan(1) * 4
Global Const $PI2 = $PI * 2
Global Const $Deg2Rad = $PI / 180
Global Const $Rad2Deg = 180 / $PI

_GDIPlus_Startup()
Global $hGui = GUICreate("3D Test by Eukalyptus", $iWidth, $iHeight)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)
_GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2)
_GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)

Global $hBmpScale = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
Global $hGfxScale = _GDIPlus_ImageGetGraphicsContext($hBmpScale)
_GDIPlus_GraphicsClear($hGfxScale, 0xFF000000)
Global $fScale = 0.02
DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfxScale, "int", 5)
DllCall($ghGDIPDll, "uint", "GdipTranslateWorldTransform", "hwnd", $hGfxScale, "float", -($iWidth / 2 * $fScale), "float", -($iHeight / 2 * $fScale), "int", 0)
DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGfxScale, "float", 1 + $fScale, "float", 1 + $fScale, "int", 0)

Global $hPenBG = _GDIPlus_PenCreate(0xFF005500, 1)
Global $hPenFG = _GDIPlus_PenCreate(0xFF00FF00, 2)
DllCall($ghGDIPDll, "uint", "GdipSetPenLineJoin", "hwnd", $hPenFG, "int", 2)
Global $hPenGL = _GDIPlus_PenCreate(0x2400AAFF, 1)
Global $hBrush = _GDIPlus_BrushCreateSolid(0x30000000)

GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")

GUISetState()

GUICreate("Rotate", 200, 100, 0, 0, -1, -1, $hGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $cSliderX = GUICtrlCreateSlider(10, 10, 180, 30)
GUICtrlSetData(-1, 50 + ($fRX * 10))
GUICtrlSetOnEvent(-1, "_SetRotate")
Global $cSliderY = GUICtrlCreateSlider(10, 40, 180, 30)
GUICtrlSetData(-1, 50 + ($fRY * 10))
GUICtrlSetOnEvent(-1, "_SetRotate")
Global $cSliderZ = GUICtrlCreateSlider(10, 70, 180, 30)
GUICtrlSetData(-1, 50 + ($fRZ * 10))
GUICtrlSetOnEvent(-1, "_SetRotate")
GUISetState()


Global $aPnt = _CreateBall("GDI+ AutoIt Script|3D Text-Ball|by Eukalyptus", 0.65, 0.25, $iWidth, $iHeight, 0.7)

While 1
    _Draw()
    ;Sleep(10)
WEnd


Func _SetRotate()
    Switch @GUI_CtrlId
        Case $cSliderX
            $fRX = (50 - GUICtrlRead($cSliderX)) / 10
        Case $cSliderY
            $fRY = (50 - GUICtrlRead($cSliderY)) / 10
        Case $cSliderZ
            $fRZ = (50 - GUICtrlRead($cSliderZ)) / 10
    EndSwitch
EndFunc   ;==>_SetRotate



Func _Draw()

    Local $iW2 = $iWidth / 2
    Local $iH2 = $iHeight / 2

    Local Static $fA = 0, $fB = 0, $fC = 0
    $fA += $fRX
    $fB += $fRY
    $fC += $fRZ

    If $fA >= 360 Then
        $fA -= 360
    ElseIf $fA <= 0 Then
        $fA += 360
    EndIf

    If $fB >= 360 Then
        $fB -= 360
    ElseIf $fB <= 0 Then
        $fB += 360
    EndIf

    If $fC >= 360 Then
        $fC -= 360
    ElseIf $fC <= 0 Then
        $fC += 360
    EndIf

    _Rotate($aPnt[0], $aPnt[3], $aPnt[4], $aPnt[1], $aPnt[2], $fA, $fB, $fC, $iW2, $iH2)

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath2", "ptr", $aPnt[6], "ptr", $aPnt[7], "int", $aPnt[0], "int", 0, "int*", 0)
    Local $hPath = $aResult[5]

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    Local $hPath_FG = $aResult[2]
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    Local $hPath_BG = $aResult[2]

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePathIter", "int*", 0, "hwnd", $hPath)
    Local $hPathIter = $aResult[1]
    Local $aIter = $aPnt[8]

    For $i = 1 To $aIter[0][0]
        DllCall($ghGDIPDll, "uint", "GdipPathIterNextSubpathPath", "hwnd", $hPathIter, "int*", 0, "hwnd", $aIter[$i][1], "int*", 0)
        If DllStructGetData($aPnt[2], 1, ($aIter[$i][2]) + 1) > 20 Then
            DllCall($ghGDIPDll, "uint", "GdipAddPathPath", "hwnd", $hPath_BG, "hwnd", $aIter[$i][1], "int", 1)
        Else
            DllCall($ghGDIPDll, "uint", "GdipAddPathPath", "hwnd", $hPath_FG, "hwnd", $aIter[$i][1], "int", 1)
        EndIf
    Next

    DllCall($ghGDIPDll, "uint", "GdipDeletePathIter", "hwnd", $hPathIter)

    For $i = 1 To 3
        _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBmpScale, 0, 0)
        _GDIPlus_GraphicsFillRect($hGfxBuffer, 0, 0, $iWidth, $iHeight, $hBrush)

        DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfxBuffer, "hwnd", $hPenGL, "hwnd", $hPath)

        _GDIPlus_GraphicsDrawImage($hGfxScale, $hBmpBuffer, 0, 0)
    Next
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfxBuffer, "hwnd", $hPenBG, "hwnd", $hPath_BG)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfxBuffer, "hwnd", $hPenFG, "hwnd", $hPath_FG)

    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath_BG)
    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath_FG)

    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
EndFunc   ;==>_Draw


Func _Rotate($iCount, ByRef $tP_O, ByRef $tPZ_O, ByRef $tP_N, ByRef $tPZ_N, $fA, $fB, $fC, $iW2, $iH2)
    $fA *= $Deg2Rad
    $fB *= $Deg2Rad
    $fC *= $Deg2Rad

    Local $fX, $fY, $fZ, $fPX, $fPY, $fPZ

    For $i = 0 To $iCount - 1
        $fPX = DllStructGetData($tP_O, 1, $i * 2 + 1)
        $fPY = DllStructGetData($tP_O, 1, $i * 2 + 2)
        $fPZ = DllStructGetData($tPZ_O, 1, $i + 1)

        $fY = $fPY * Cos($fA) - $fPZ * Sin($fA)
        $fZ = $fPY * Sin($fA) + $fPZ * Cos($fA)
        $fPY = $fY
        $fPZ = $fZ

        $fX = $fPX * Cos($fB) + $fPZ * Sin($fB)
        $fZ = -$fPX * Sin($fB) + $fPZ * Cos($fB)
        $fPX = $fX

        DllStructSetData($tP_N, 1, $fPX * Cos($fC) - $fPY * Sin($fC) + $iW2, $i * 2 + 1)
        DllStructSetData($tP_N, 1, $fPY * Cos($fC) + $fPX * Sin($fC) + $iH2, $i * 2 + 2)
        DllStructSetData($tPZ_N, 1, $fZ, $i + 1)
    Next

EndFunc   ;==>_Rotate


Func _CreateBall($sText, $fScaleX, $fScaleY, $iW, $iH, $fBallSize, $sFont = "Arial", $fFlat = 5)
    Local $aSplit = StringSplit($sText, "|")

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    Local $hPath = $aResult[2]

    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local $tBounds = _GDIPlus_RectFCreate(0, 0, 0, 0)

    For $i = 1 To $aSplit[0]
        DllCall($ghGDIPDll, "uint", "GdipAddPathString", "hwnd", $hPath, "wstr", $aSplit[$i], "int", -1, "hwnd", $hFamily, "int", 0, "float", 50, "ptr", DllStructGetPtr($tLayout), "hwnd", $hFormat)
        DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", DllStructGetPtr($tBounds), "hwnd", 0, "hwnd", 0)
        DllStructSetData($tLayout, "Y", DllStructGetData($tBounds, "Y") + DllStructGetData($tBounds, "Height"))
    Next

    DllCall($ghGDIPDll, "uint", "GdipFlattenPath", "hwnd", $hPath, "hwnd", 0, "float", $fFlat)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)

    $aResult = DllCall($ghGDIPDll, "uint", "GdipGetPointCount", "hwnd", $hPath, "int*", 0)
    Local $iCount = $aResult[2]
    Local $tPathData = DllStructCreate("int;ptr;ptr")
    Local $tPoints = DllStructCreate("float[" & $iCount * 2 & "]")
    Local $tTypes = DllStructCreate("ubyte[" & $iCount & "]")
    Local $tPointsZ = DllStructCreate("float[" & $iCount & "]")

    DllStructSetData($tPathData, 1, $iCount)
    DllStructSetData($tPathData, 2, DllStructGetPtr($tPoints))
    DllStructSetData($tPathData, 3, DllStructGetPtr($tTypes))

    DllCall($ghGDIPDll, "uint", "GdipGetPathData", "hwnd", $hPath, "ptr", DllStructGetPtr($tPathData))

    Local $fRad = $iH / 2 * $fBallSize
    If $iH > $iW Then $fRad = $iW / 2 * $fBallSize

    Local $fPIY = $PI * $fScaleY

    Local $fX, $fY, $fZ, $fA, $fB, $fPX, $fPY, $fPZ
    Local $fBX = (DllStructGetData($tBounds, "X") + DllStructGetData($tBounds, "Width")) / $fScaleX
    Local $fBY = (DllStructGetData($tBounds, "Y") + DllStructGetData($tBounds, "Height")) / $fScaleY

    For $i = 0 To $iCount - 1
        $fX = DllStructGetData($tPoints, 1, $i * 2 + 1)
        $fY = DllStructGetData($tPoints, 1, $i * 2 + 2)

        $fB = $PI - $fX * $PI2 / $fBX
        $fA = $fPIY - $fY * $PI2 / $fBY
        $fPX = 0
        $fPY = 0
        $fPZ = $fRad

        $fY = $fPY * Cos($fA) - $fPZ * Sin($fA)
        $fZ = $fPY * Sin($fA) + $fPZ * Cos($fA)
        $fPY = $fY
        $fPZ = $fZ

        $fX = $fPX * Cos($fB) + $fPZ * Sin($fB)
        $fZ = -$fPX * Sin($fB) + $fPZ * Cos($fB)

        DllStructSetData($tPoints, 1, $fX, $i * 2 + 1)
        DllStructSetData($tPoints, 1, $fY, $i * 2 + 2)
        DllStructSetData($tPointsZ, 1, $fZ, $i + 1)
    Next

    Local $tPointsRotate = DllStructCreate("float[" & $iCount * 2 & "]")
    Local $tPointsZRotate = DllStructCreate("float[" & $iCount & "]")

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePathIter", "int*", 0, "hwnd", $hPath)
    Local $hPathIter = $aResult[1]
    $aResult = DllCall($ghGDIPDll, "uint", "GdipPathIterGetSubpathCount", "hwnd", $hPathIter, "int*", 0)
    Local $iSubCount = $aResult[2]
    Local $aIter[$iCount + 1][3] = [[$iSubCount]]
    For $i = 1 To $iSubCount
        $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
        $aIter[$i][1] = $aResult[2]
        $aResult = DllCall($ghGDIPDll, "uint", "GdipPathIterNextSubpath", "hwnd", $hPathIter, "int*", 0, "int*", 0, "int*", 0, "int*", 0)
        $aIter[$i][2] = $aResult[3]
    Next
    DllCall($ghGDIPDll, "uint", "GdipDeletePathIter", "hwnd", $hPathIter)

    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)

    Local $aReturn[9]
    $aReturn[0] = $iCount
    $aReturn[1] = $tPointsRotate
    $aReturn[2] = $tPointsZRotate
    $aReturn[3] = $tPoints
    $aReturn[4] = $tPointsZ
    $aReturn[5] = $tTypes
    $aReturn[6] = DllStructGetPtr($tPointsRotate)
    $aReturn[7] = DllStructGetPtr($tTypes)
    $aReturn[8] = $aIter

    Return $aReturn
EndFunc   ;==>_CreateBall


Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_PAINT


Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_ERASEBKGND


Func _Exit()
    Local $aIter = $aPnt[8]
    For $i = 1 To $aIter[0][0]
        DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $aIter[$i][1])
    Next
    _GDIPlus_PenDispose($hPenBG)
    _GDIPlus_PenDispose($hPenFG)
    _GDIPlus_PenDispose($hPenGL)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGfxScale)
    _GDIPlus_BitmapDispose($hBmpScale)
    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _GDIPlus_BitmapDispose($hBmpBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>_Exit

@eukalyptus: I hope you don't mind! :D

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@eukalyptus: I hope you don't mind! :oops:

:D

Here's another one, inspired by UEZ´s Perfect Illusion...

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global Const $PI = ATan(1) * 4
Global Const $PI2 = $PI * 2
Global $iFrms = 40 ; Frames pro Sinusschwingung
Global $iFldX = 19 ; Anzahl Felder X ~[5..50]
Global $iFldZ = 32 ; Anzahl Felder Z ~[8..80]
Global $fSize = 0.7 ; Größe eines Feldes [0..1]
Global $fWaveCnt = 1.3 ; Anzahl der Wellenberge ~[1..5]
Global $fAmp = 0.12 ; Amplitude ~[0.01..0.3]
Global $fAmpOff = 0.05 ; Min Balkenhöhe
Global $fSineXOff = 2.7 ; "Schräge" der Wellen ~[-10..10]
Global $iColor = 0xCC1122FF
Global $iWidth = 1000 ; @DesktopWidth
Global $iHeight = 500 ; @DesktopHeight
Global $fPersp = 0.1
Global $fYOff = -0.2
_GDIPlus_Startup()
Global $hGui = GUICreate("GDI+ Script by Eukalyptus", $iWidth, $iHeight)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $hDC = _WinAPI_GetDC($hGui)
Global $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
Global $hBmpTmp = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
_WinAPI_DeleteObject($hBMP)
$hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmpTmp)
_GDIPlus_BitmapDispose($hBmpTmp)
Global $hCDC = _WinAPI_CreateCompatibleDC($hDC)
Global $hOBJ = _WinAPI_SelectObject($hCDC, $hBMP)
Global $hGfxBuffer = _GDIPlus_GraphicsCreateFromHDC($hCDC)
_GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)
GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUIRegisterMsg($WM_ERASEBKGND, "WM_PAINT")
GUISetState()
Global $aBmpFrame[$iFrms], $aGfxFrame[$iFrms]
For $i = 0 To $iFrms - 1
$aBmpFrame[$i] = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGfxBuffer)
$aGfxFrame[$i] = _GDIPlus_ImageGetGraphicsContext($aBmpFrame[$i])
_GDIPlus_GraphicsSetSmoothingMode($aGfxFrame[$i], 2)
_GDIPlus_GraphicsClear($aGfxFrame[$i], 0xFF000000)
Next
ProgressOn("please wait", "...")
Global $iTimer = TimerInit()
Global $aFloor = _CreateFloor()
_DrawFrames()
ConsoleWrite("! " & TimerDiff($iTimer) & @CRLF)
ProgressOff()
Global $iFrame = 0
While Sleep(1)
If TimerDiff($iTimer) >= 30 Then
  _GDIPlus_GraphicsDrawImage($hGfxBuffer, $aBmpFrame[$iFrame], 0, 0)
  _WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hCDC, 0, 0, 0x00CC0020)
  $iFrame += 1
  If $iFrame >= $iFrms Then $iFrame = 0
  $iTimer = TimerInit()
EndIf
WEnd
Func _DrawFrames()
Local $fY, $fAmpPersp, $fAmpPerspOff
Local $tPolyTop = DllStructCreate("float[8];")
Local $pPolyTop = DllStructGetPtr($tPolyTop)
Local $tPolyFront = DllStructCreate("float[8];")
Local $pPolyFront = DllStructGetPtr($tPolyFront)
Local $tPolySide = DllStructCreate("float[8];")
Local $pPolySide = DllStructGetPtr($tPolySide)
Local $hBrushTop = _GDIPlus_BrushCreateSolid($iColor)
Local $hBrushFront = _GDIPlus_BrushCreateSolid($iColor)
Local $hBrushSide = _GDIPlus_BrushCreateSolid($iColor)
Local $iAlpha = BitAND(BitShift($iColor, 24), 0xFF)
Local $iRed = BitAND(BitShift($iColor, 16), 0xFF)
Local $iGreen = BitAND(BitShift($iColor, 8), 0xFF)
Local $iBlue = BitAND($iColor, 0xFF)
For $z = 1 To $aFloor[1][0][0]
  ProgressSet(15 + ($z * 85 / $iFldZ))
  _GDIPlus_BrushSetSolidColor($hBrushTop, BitOR(BitShift($iAlpha, -24), BitShift($z * $iRed / $iFldZ, -16), BitShift($z * $iGreen / $iFldZ, -8), $z * $iBlue / $iFldZ))
  _GDIPlus_BrushSetSolidColor($hBrushSide, BitOR(BitShift($iAlpha, -24), BitShift($z * $iRed / $iFldZ * 0.2, -16), BitShift($z * $iGreen / $iFldZ * 0.2, -8), $z * $iBlue / $iFldZ * 0.2))
  _GDIPlus_BrushSetSolidColor($hBrushFront, BitOR(BitShift($iAlpha, -24), BitShift($z * $iRed / $iFldZ * 0.4, -16), BitShift($z * $iGreen / $iFldZ * 0.4, -8), $z * $iBlue / $iFldZ * 0.4))
  $fAmpPersp = $iHeight * $fPersp * $fAmp + ($iHeight * $fAmp * $z / $iFldZ)
  $fAmpPerspOff = $iHeight * $fPersp * $fAmpOff + ($iHeight * $fAmpOff * $z / $iFldZ)
  For $x = $aFloor[0][1][0] To Ceiling($aFloor[0][1][0] / 2) + 1 Step -1
   If $aFloor[$z][$x][0] < $iWidth Then
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][0], 1)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][6], 3)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][6], 5)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][7], 6)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][0], 7)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][1], 8)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][4], 1)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][6], 3)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][6], 5)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][7], 6)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][4], 7)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][5], 8)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][0], 1)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][2], 3)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][4], 5)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][6], 7)
    For $iFrame = 0 To $iFrms - 1
     $fY = (Sin(($z * $PI2 / $iFldZ * $fWaveCnt) + ($iFrame * $PI2 / $iFrms) + ($x * $fSineXOff / $iFldX)) + 1) * $fAmpPersp + $fAmpPerspOff
     DllStructSetData($tPolySide, 1, $aFloor[$z][$x][1] - $fY, 2)
     DllStructSetData($tPolySide, 1, $aFloor[$z][$x][7] - $fY, 4)
     DllCall($ghGDIPDll, "int", "GdipFillPolygon", "handle", $aGfxFrame[$iFrame], "handle", $hBrushSide, "ptr", $pPolySide, "int", 4, "int", 0)
     DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][5] - $fY, 2)
     DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][7] - $fY, 4)
     DllCall($ghGDIPDll, "int", "GdipFillPolygon", "handle", $aGfxFrame[$iFrame], "handle", $hBrushFront, "ptr", $pPolyFront, "int", 4, "int", 0)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][1] - $fY, 2)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][3] - $fY, 4)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][5] - $fY, 6)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][7] - $fY, 8)
     DllCall($ghGDIPDll, "int", "GdipFillPolygon", "handle", $aGfxFrame[$iFrame], "handle", $hBrushTop, "ptr", $pPolyTop, "int", 4, "int", 0)
    Next
   EndIf
  Next
  For $x = 1 To Ceiling($aFloor[0][1][0] / 2)
   If $aFloor[$z][$x][2] > 0 Then
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][4], 1)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][2], 3)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][2], 5)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][3], 6)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][4], 7)
    DllStructSetData($tPolySide, 1, $aFloor[$z][$x][5], 8)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][4], 1)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][6], 3)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][6], 5)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][7], 6)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][4], 7)
    DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][5], 8)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][0], 1)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][2], 3)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][4], 5)
    DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][6], 7)
    For $iFrame = 0 To $iFrms - 1
     $fY = (Sin(($z * $PI2 / $iFldZ * $fWaveCnt) + ($iFrame * $PI2 / $iFrms) + ($x * $fSineXOff / $iFldX)) + 1) * $fAmpPersp + $fAmpPerspOff
     DllStructSetData($tPolySide, 1, $aFloor[$z][$x][5] - $fY, 2)
     DllStructSetData($tPolySide, 1, $aFloor[$z][$x][3] - $fY, 4)
     DllCall($ghGDIPDll, "int", "GdipFillPolygon", "handle", $aGfxFrame[$iFrame], "handle", $hBrushSide, "ptr", $pPolySide, "int", 4, "int", 0)
     DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][5] - $fY, 2)
     DllStructSetData($tPolyFront, 1, $aFloor[$z][$x][7] - $fY, 4)
     DllCall($ghGDIPDll, "int", "GdipFillPolygon", "handle", $aGfxFrame[$iFrame], "handle", $hBrushFront, "ptr", $pPolyFront, "int", 4, "int", 0)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][1] - $fY, 2)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][3] - $fY, 4)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][5] - $fY, 6)
     DllStructSetData($tPolyTop, 1, $aFloor[$z][$x][7] - $fY, 8)
     DllCall($ghGDIPDll, "int", "GdipFillPolygon", "handle", $aGfxFrame[$iFrame], "handle", $hBrushTop, "ptr", $pPolyTop, "int", 4, "int", 0)
    Next
   EndIf
  Next
Next
_GDIPlus_BrushDispose($hBrushTop)
_GDIPlus_BrushDispose($hBrushFront)
_GDIPlus_BrushDispose($hBrushSide)
EndFunc   ;==>_DrawFrames



Func _CreateFloor()
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
Local $hPath = $aResult[2]
Local $iOver = $iWidth * $iFldX / ($iWidth * $fPersp)
Local $fOff = (1 - $fSize) / 2
Local $iCntX = $iFldX + $iOver * 2
For $z = 0 To $iFldZ - 1
  ProgressSet($z * 5 / $iFldZ)
  For $x = -$iOver To $iFldX + $iOver - 1
   DllCall($ghGDIPDll, "uint", "GdipAddPathRectangle", "hwnd", $hPath, "float", $x + $fOff, "float", $z + $fOff, "float", $fSize, "float", $fSize)
  Next
Next
Local $tPoints = DllStructCreate("float[8];")
DllStructSetData($tPoints, 1, $iWidth / 2 - $iWidth * $fPersp, 1)
DllStructSetData($tPoints, 1, $iHeight / 2 + $iHeight * $fPersp + $iHeight * $fYOff, 2)
DllStructSetData($tPoints, 1, $iWidth / 2 + $iWidth * $fPersp, 3)
DllStructSetData($tPoints, 1, $iHeight / 2 + $iHeight * $fPersp + $iHeight * $fYOff, 4)
DllStructSetData($tPoints, 1, 0, 5)
DllStructSetData($tPoints, 1, $iHeight, 6)
DllStructSetData($tPoints, 1, $iWidth, 7)
DllStructSetData($tPoints, 1, $iHeight, 8)
DllCall($ghGDIPDll, "uint", "GdipWarpPath", "hwnd", $hPath, "hwnd", 0, "ptr", DllStructGetPtr($tPoints), "int", 4, "float", 0, "float", 0, "float", $iFldX, "float", $iFldZ * 0.9, "int", 0, "float", 0)
Local $tPntFloor = DllStructCreate("float[" & $iFldZ * $iCntX * 4 * 2 & "];")
DllCall($ghGDIPDll, "uint", "GdipGetPathPoints", "hwnd", $hPath, "ptr", DllStructGetPtr($tPntFloor), "int", $iFldZ * $iCntX * 4)
DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
Local $aReturn[$iFldZ + 1][$iCntX + 1][8]
$aReturn[1][0][0] = $iFldZ
$aReturn[0][1][0] = $iCntX
Local $iIdx
For $z = 0 To $iFldZ - 1
  ProgressSet(5 + $z * 10 / $iFldZ)
  For $x = 0 To $iCntX - 1
   $iIdx = $z * $iCntX * 8 + $x * 8 + 1
   For $j = 0 To 7
    $aReturn[$z + 1][$x + 1][$j] = DllStructGetData($tPntFloor, 1, $iIdx + $j)
   Next
  Next
Next
Return $aReturn
EndFunc   ;==>_CreateFloor



Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
_WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hCDC, 0, 0, 0x00CC0020)
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_PAINT

Func _Exit()
For $i = 0 To $iFrms - 1
  _GDIPlus_BitmapDispose($aBmpFrame[$i])
  _GDIPlus_GraphicsDispose($aGfxFrame[$i])
Next
_GDIPlus_GraphicsDispose($hGfxBuffer)
_WinAPI_SelectObject($hCDC, $hOBJ)
_WinAPI_DeleteObject($hBMP)
_WinAPI_DeleteDC($hCDC)
_WinAPI_ReleaseDC($hGui, $hDC)
_GDIPlus_Shutdown()
Exit
EndFunc   ;==>_Exit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By UEZ
      This project has been discontinued!
       
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from the live web site cannot be downloaded although they are visible!
       
      Here the download link of the source code only: AutoIt Sysinternal Tools Synchronizer v0.99.6 build 2020-09-23 beta.7z  (1557 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • By UEZ
      Here another example to mark the desktop to get the marked region for capturing. This example is not perfect and not very fast (room for improvements).
      ;Coded by UEZ build 2020-08-07 beta ;Code cleanup up mLipok ; ;Short instruction: mark area on your desktop and press return key to capture. #include <APISysConstants.au3> #include <Array.au3> ;#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ; enum _PROCESS_DPI_AWARENESS -> https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx Global Enum $DPI_AWARENESS_INVALID = -1, $PROCESS_DPI_UNAWARE = 0, $PROCESS_SYSTEM_DPI_AWARE, $PROCESS_PER_MONITOR_DPI_AWARE ;https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context Global Enum $Context_UnawareGdiScaled = -5, $Context_PerMonitorAwareV2, $Context_PerMonitorAware, $Context_SystemAware, $Context_Unaware _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAware) Global $__g_hGUI_MarkArea, $__g_hGUI_Bg, $__g_iLabel_TL, $__g_iLabel_TM, $__g_iLabel_TR, $__g_iLabel_LM, $__g_iLabel_RM, $__g_iLabel_BL, $__g_iLabel_BM, _ $__g_iLabel_BR, $__g_iOldCursor, $__g_iW, $__g_iH, $__g_iColor_ResizeDots = 0xFFFFFF, $__g_iBorder = 4, $__g_bSelectionDone = False Global $aRect = _GDIPlus_MarkScreenRegionAnimated() Global $hImage_Capture = _ScreenCapture_Capture(@TempDir & "\Test.png", $aRect[0], $aRect[1], $aRect[0] + $aRect[2] - 1, $aRect[1] + $aRect[3] - 1, False) ShellExecute(@TempDir & "\Test.png") ;_ArrayDisplay($aRect, "Marked area coordinates") Func _GDIPlus_MarkScreenRegionAnimated($bAnim = True) _GDIPlus_Startup() Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) $__g_hGUI_Bg = GUICreate("", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], $aFullScreen[1], BitOR($WS_CLIPCHILDREN, $WS_POPUP), $WS_EX_TOPMOST) ;to avoid cursor flickering and for proper control read WinSetTrans($__g_hGUI_Bg, "", 0x01) $__g_hGUI_MarkArea = GUICreate("", 1, 1, -1, -1, $bAnim ? $WS_POPUP : BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED), $__g_hGUI_Bg) GUISetBkColor(0xABCDEF, $__g_hGUI_MarkArea) If Not $bAnim Then $__g_iColor_ResizeDots = 0xFF0000 $__g_iLabel_TL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_LM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;left mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_RM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;right mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) GUISetState(@SW_SHOWNA, $__g_hGUI_Bg) GUISetState(@SW_SHOW, $__g_hGUI_MarkArea) $__g_iOldCursor = MouseGetCursor() GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) _WinAPI_SetLayeredWindowAttributes($__g_hGUI_MarkArea, 0xABCDEF, 0xF0) Local $aMPos, $aPrevMPos[2] = [MouseGetPos(0) + 1, MouseGetPos(1) + 1], $iID, $aCI, $iX, $iY, $aOldWinPos, $aOldMPos, $bMoved Local $aGUIStartPos, $iKey_Exit = GUICtrlCreateButton("", $aFullScreen[0] - 10, $aFullScreen[1] - 10, 1, 1), $aAccelKeys[1][2] = [["{ENTER}", $iKey_Exit]] GUISetAccelerators($aAccelKeys, $__g_hGUI_Bg) GUISetAccelerators($aAccelKeys, $__g_hGUI_MarkArea) #forceref $bMoved Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iKey_Exit If $bAnim Then GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID) GUIRegisterMsg($WM_ERASEBKGND, "") EndIf _GDIPlus_Shutdown() Local $aResult = WinGetPos($__g_hGUI_MarkArea) $aResult[2] = WinGetClientSize($__g_hGUI_MarkArea)[0] $aResult[3] = WinGetClientSize($__g_hGUI_MarkArea)[1] GUIDelete($__g_hGUI_MarkArea) GUIDelete($__g_hGUI_Bg) If Not $__g_bSelectionDone Then $aResult = 0 Return $aResult EndSwitch $aMPos = MouseGetPos() If ($aMPos[0] <> $aPrevMPos[0] Or $aMPos[1] <> $aPrevMPos[1]) And (Not $__g_bSelectionDone) Then WinMove($__g_hGUI_MarkArea, "", $aMPos[0], $aMPos[1]) $aPrevMPos = $aMPos EndIf $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If $aCI[2] And (Not $__g_bSelectionDone) Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $bAnim Then GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", 1, "uint", 50, "ptr", 0)[0] EndIf While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) $aMPos = MouseGetPos() $__g_iW = Abs($aMPos[0] - $aGUIStartPos[0]) + 1 $__g_iH = Abs($aMPos[1] - $aGUIStartPos[1]) + 1 If $aMPos[0] < $aGUIStartPos[0] Then $iX = $aMPos[0] Else $iX = $aGUIStartPos[0] EndIf If $aMPos[1] < $aGUIStartPos[1] Then $iY = $aMPos[1] Else $iY = $aGUIStartPos[1] EndIf WinMove($__g_hGUI_MarkArea, "", $iX, $iY, $__g_iW, $__g_iH) UpdateCtrlPos($bAnim) WEnd $__g_bSelectionDone = True GUISetCursor(3, 1, $__g_hGUI_MarkArea) ElseIf $aCI[3] And $__g_bSelectionDone Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If _WinAPI_PtInRectEx(MouseGetPos(0), MouseGetPos(1), $aGUIStartPos[0], $aGUIStartPos[1], $aGUIStartPos[0] + $aGUIStartPos[2], $aGUIStartPos[1] + $aGUIStartPos[3]) Then $aMPos = MouseGetPos() $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) While $aCI[3] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aGUIStartPos[0] - ($aMPos[0] - MouseGetPos(0)), $aGUIStartPos[1] - ($aMPos[1] - MouseGetPos(1)), $__g_iW, $__g_iH) GUISetCursor(0, 1, $__g_hGUI_Bg) GUISetCursor(0, 1, $__g_hGUI_MarkArea) WEnd GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndIf EndIf If $__g_bSelectionDone Then $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If @error Then ContinueLoop Switch $aCI[4] Case $__g_iLabel_TL GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), MouseGetPos(1), $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BR GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TR GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BL GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_LM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_RM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2], $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2], $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case Else GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndSwitch EndIf Until False EndFunc ;==>_GDIPlus_MarkScreenRegionAnimated Func UpdateCtrlPos($bAnim = True) Local Const $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "") $__g_iW = $aGUIStartPos[2] $__g_iH = $aGUIStartPos[3] ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TL, 0, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TM, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_LM, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_RM, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BL, 0, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BM, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") EndFunc ;==>UpdateCtrlPos Func PlayBorderAnim() Local $aWinPos = WinGetClientSize($__g_hGUI_MarkArea), $iW = $aWinPos[0], $iH = $aWinPos[1] Local Static $fOffset = 0 Local Const $iSize = $__g_iBorder / 2 Local Const $hDC = _WinAPI_GetDC($__g_hGUI_MarkArea) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Local Const $hPen = _GDIPlus_PenCreate(0xFF0178D7, $iSize), $hPen2 = _GDIPlus_PenCreate(0xFFFFFFFF, $iSize), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $__g_iColor_ResizeDots), $hPen3 = _GDIPlus_PenCreate(0xFF000000) _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASHDOT) _GDIPlus_GraphicsClear($hCanvas, 0xFFABCDEF) ;for faster performance direct dll calls DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen2, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) $fOffset += 0.5 _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($__g_hGUI_MarkArea, $hDC) _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_PenDispose($hPen3) _GDIPlus_BrushDispose($hBrush) EndFunc ;==>PlayBorderAnim Func WM_ERASEBKGND($hWnd, $iMsgm, $wParam, $lParam) ;suppress repainting to avoid flickering but causes some other side effects #forceref $iMsgm, $wParam, $lParam, $hWnd Local Const $hBrush = _WinAPI_CreateSolidBrush(0xEFCDAB) ;BGR format ;~ _WinAPI_RedrawWindow($__g_hGUI_MarkArea, 0, 0, BitOR($RDW_NOERASE, $RDW_NOCHILDREN, $RDW_NOFRAME, $RDW_VALIDATE)) _WinAPI_SetClassLongEx($__g_hGUI_MarkArea, $GCL_HBRBACKGROUND, $hBrush) _WinAPI_DeleteObject($hBrush) Return 0 EndFunc ;==>WM_ERASEBKGND ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext = $Context_PerMonitorAware, $hGUI = 0, $iMode = 3) ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 3) ? 3 : $iMode Switch $iMode Case 1 Local $hDC = _WinAPI_GetDC($hGUI) Local $aResult1 = DllCall("user32.dll", "ptr", "GetDpiFromDpiAwarenessContext", "ptr", $hDC) If @error Or Not IsArray($aResult1) Then Return SetError(11, 0, 0) _WinAPI_ReleaseDC(0, $hDC) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult1[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(12, 0, 0) Case 2 ;~ If Not $hGUI Then $hGUI = WinGetHandle(AutoItWinGetTitle()) Local $aResult2 = DllCall("user32.dll", "int", "GetWindowDpiAwarenessContext", "ptr", $hGUI) If @error Or Not IsArray($aResult2) Then Return SetError(21, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult2[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(22, 0, 0) Case 3 Local $aResult31 = DllCall("user32.dll", "ptr", "GetThreadDpiAwarenessContext") If @error Or Not IsArray($aResult31) Then Return SetError(31, 0, 0) Local $aResult32 = DllCall("user32.dll", "ptr", "GetAwarenessFromDpiAwarenessContext", "ptr", $aResult31[0]) If @error Or Not IsArray($aResult32) Then Return SetError(32, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetThreadDpiAwarenessContext", "int", $aResult32[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(33, 0, 0) EndSwitch Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext  
      Just press the lmb and move your mouse. When lmb is released you can adjust the size of the window by dragging the white rectangle to any direction. Rmb will move the marked area.
      Press ESC to get the coordinates of the marked region.
      If you have any improvements, please post it here.
       
      Tested on Win10 x64 only.
       
    • By Bilgus
      This is an update or derivative work of Beege 's Scrolling Line Graph UDF
      https://www.autoitscript.com/forum/topic/109599-scrolling-line-graph-udf
       
      I noticed a few issues for my use case with the UDF one being that adding a sample required updating the waveform
      High CPU usage went hand in hand with that requirement
      Another issue was just how long updating took to complete
      I've hopefully rectified that with this version
       
      There are a few changes (only 1 line per graph for instance)
      The addition of a function AddSample (uses graphics paths to speed up drawing samples on update) Gridlines are only generated once A sample finished line can be added UpdateGraph allows you to compress the discarded portion of the graph (it looks kinda cool but uses more CPU) Lower Cpu usage Uses real Control Ids - it is a label control underneath so you get click events and can display text when control is disabled Example (Waveform.au3)
       
      Example 2 (peak.au3)
      UDF
      Updated:
      Previous Downloads [38 / 38/ 0]
      SSLG.au3 waveform.au3 Peak.au3
    • By nacerbaaziz
      hello autoit team
      please i've a question for you.
      am creating a audio player
      and in this audio player i want to show the current trac info
      such as the total time and the position ... etc
      i know i can show it as label
      but the screen reader for the blind read the text every change
      because it have a screen scan
      what i want is to show this informations but such image or icon
      i mean i need to create
      GUICtrlCreatepic or GUICtrlCreateicon ....
      or some thing as that
      and show this informations as image on it
      i think that i can do that with the 
      _GDIPlus functions
      but i couldn't find the currect way to do it
      i tried the _GDIPlus_GraphicsDrawString
      but i couldn't know how it work
      what i need is a small example that create a GUI
      and add a multy line text to it as graphic or image.
      so i need a simple way because it will changed every sec
      i hope any one can help me to do that
      global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc  
    • By UEZ
      I was inspired by a CSS example to create a procedural graphic without any shader or ray tracing technique.
      Here the result using GDI+ only:

       
      Blue Orb.au3
      ;Inspired from https://codepen.io/bradleytaunt/details/VwvzKyb ;Coded by UEZ build 2020-05-07 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If @OSBuild < 7600 Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "ERROR", "This demo requires GDIPlus v1.1", 10) _GDIPlus_Startup() Global Const $iW = 1200, $iH = 700, $iSize_globe = 450 Global Const $hGUI = GUICreate("GDI+ Procedural Gfx / Blue Orb v1.20 by UEZ", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) ;~ _GDIPlus_GraphicsSetCompositingQuality($hGfx, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HALF) ;draw background Global Const $hBrush_bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xFF1E88E5, 0xFF1565C0, 2) _GDIPlus_LineBrushSetSigmaBlend ($hBrush_bg, 0.95, 1) ;create blurry edge _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hBrush_bg) ;draw blurred text Global Const $hImage_text = _GDIPlus_BitmapCreateFromScan0($iW, $iH / 2) Global Const $hGfx_text = _GDIPlus_ImageGetGraphicsContext($hImage_text) Global Const $hPath_text = _GDIPlus_PathCreate() Global Const $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global Const $hStringFormat = _GDIPlus_StringFormatCreate() Global Const $hBrush_txt = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xE0FFFFFF, 0xA01A237E) ;_GDIPlus_BrushCreateSolid(0xF02E86FB) _GDIPlus_LineBrushSetSigmaBlend($hBrush_txt, 0.66, 1) Global Const $hPen_txt = _GDIPlus_PenCreate(0x801A237E, 1) _GDIPlus_StringFormatSetAlign($hStringFormat, 1) _GDIPlus_StringFormatSetLineAlign($hStringFormat, 1) _GDIPlus_GraphicsSetSmoothingMode($hGfx_text, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) _GDIPlus_GraphicsSetTextRenderingHint($hGfx_text, $GDIP_TextRenderingHintAntialias) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx_text, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsSetCompositingQuality($hGfx_text, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) Global $tLayout = _GDIPlus_RectFCreate() $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = -$iH * 0.05 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt) _GDIPlus_GraphicsDrawPath($hGfx_text, $hPath_text, $hPen_txt) Global Const $hEffect_blur_text = _GDIPlus_EffectCreateBlur(20) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, 0, $iW, $iH / 2) ;draw shadow of the text Global Const $hBrush_txt_shadow = _GDIPlus_BrushCreateSolid(0x40000000) _GDIPlus_GraphicsClear($hGfx_text, 0) _GDIPlus_PathReset($hPath_text) $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = 0 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt_shadow) Global Const $hEffect_blur_text_shadow = _GDIPlus_EffectCreateBlur(60) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, $iH * 0.55, $iW, $iH / 8) ;draw shadow Global Const $iW_shadow1 = $iSize_globe * 0.85, $iH_shadow1 = $iSize_globe * 0.1, $iW_shadow2 = $iSize_globe * 0.60, _ $iW_shadow_Img = $iW_shadow1 * 2, $iH_shadowImg = $iH_shadow1 * 4 Global Const $hImage_shadow = _GDIPlus_BitmapCreateFromScan0($iW_shadow_Img, $iH_shadowImg) Global Const $hGfx_shadow = _GDIPlus_ImageGetGraphicsContext($hImage_shadow) _GDIPlus_GraphicsSetSmoothingMode($hGfx_shadow, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) Global Const $hBrush_shadow = _GDIPlus_BrushCreateSolid(0x66000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow1) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow1, $iH_shadow1, $hBrush_shadow) _GDIPlus_BrushSetSolidColor($hBrush_shadow, 0xB3000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow2) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow2, $iH_shadow1, $hBrush_shadow) Global Const $hEffect_blur_shadow = _GDIPlus_EffectCreateBlur(32) _GDIPlus_BitmapApplyEffect($hImage_shadow, $hEffect_blur_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_shadow, ($iW - $iW_shadow_Img) / 2, $iH / 2 + $iH_shadow1 * 2.20, $iW_shadow_Img, $iH_shadowImg) ;draw globe Global Const $hPath_globe = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath_globe, ($iW - $iSize_globe) / 2, ($iH - $iSize_globe) / 2, $iSize_globe, $iSize_globe) Global Const $hLBrush_globe1 = _GDIPlus_LineBrushCreate($iW / 2, ($iH - $iSize_globe) / 2, $iW / 2, ($iH + $iSize_globe) / 2, 0, 0, 1) Global $aInterpolations[5][2] $aInterpolations[0][0] = 4 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFFEEEEEE $aInterpolations[2][1] = 0.10 $aInterpolations[3][0] = 0xFF2E86FB $aInterpolations[3][1] = 0.50 $aInterpolations[4][0] = 0xFF1A237E $aInterpolations[4][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe1, $aInterpolations) _GDIPlus_GraphicsFillPath($hGfx, $hPath_globe, $hLBrush_globe1) Global Const $iSize_globe2 = $iSize_globe * 0.85, $iSize_globe2_Img = $iSize_globe2 * 1.5 Global Const $hImage_globe2 = _GDIPlus_BitmapCreateFromScan0($iSize_globe2_Img, $iSize_globe2_Img) Global Const $hGfx_globe2 = _GDIPlus_ImageGetGraphicsContext($hImage_globe2) Global Const $hBrush_globe2 = _GDIPlus_BrushCreateSolid(0x7F000000) ;draw shadow and blur it Global Const $px = ($iSize_globe2_Img - $iSize_globe2) / 2, $py = ($iSize_globe2_Img - $iSize_globe2) / 2 _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py + ($iSize_globe - $iSize_globe2) * 0.25, $iSize_globe2, $iSize_globe2, $hBrush_globe2) Global Const $hEffect_blur_shadow2 = _GDIPlus_EffectCreateBlur(15) _GDIPlus_BitmapApplyEffect($hImage_globe2, $hEffect_blur_shadow2) ;draw 2nd smaller globe and blur it, too Global Const $hLBrush_globe2 = _GDIPlus_LineBrushCreate($iW / 2, $py, $iW / 2, $py + $iSize_globe2, 0, 0) Dim $aInterpolations[4][2] $aInterpolations[0][0] = 3 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFF2E86FB $aInterpolations[2][1] = 0.60 $aInterpolations[3][0] = 0xFF283593 $aInterpolations[3][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe2, $aInterpolations) _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py, $iSize_globe2, $iSize_globe2, $hLBrush_globe2) Global Const $hImage_globe2_blur = _Blur($hImage_globe2, $iSize_globe, $iSize_globe) ;windows gdi+ blur doesn't work properly _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_globe2_blur, ($iW - $iSize_globe2_Img) / 2 - ($iSize_globe - $iSize_globe2) / 8, ($iH - $iSize_globe2_Img) / 2, $iSize_globe2_Img, $iSize_globe2_Img) GUISetState() _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $iW, $iH) ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Blue Orb v1.20.png") ;clean-up ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_EffectDispose($hEffect_blur_text) _GDIPlus_EffectDispose($hEffect_blur_text_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow2) _GDIPlus_PathDispose($hPath_text) _GDIPlus_PathDispose($hPath_globe) _GDIPlus_PenDispose($hPen_txt) _GDIPlus_BrushDispose($hBrush_txt) _GDIPlus_BrushDispose($hBrush_txt_shadow) _GDIPlus_BrushDispose($hBrush_bg) _GDIPlus_BrushDispose($hLBrush_globe1) _GDIPlus_BrushDispose($hLBrush_globe2) _GDIPlus_BrushDispose($hBrush_globe2) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_text) _GDIPlus_ImageDispose($hImage_shadow) _GDIPlus_ImageDispose($hImage_globe2) _GDIPlus_ImageDispose($hImage_globe2_blur) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_GraphicsDispose($hGfx_text) _GDIPlus_GraphicsDispose($hGfx_shadow) _GDIPlus_GraphicsDispose($hGfx_globe2) _GDIPlus_Shutdown() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Func _Blur($hBitmap, $iW, $iH, $fScale = 0.0525, $dx1 = 0, $dy1 = 0, $dx2 = 0, $dy2 = 0, $qual = 6) ; by eukalyptus Local $hBmpSmall = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxSmall, $GDIP_PIXELOFFSETMODE_HALF) Local $hBmpBig = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxBig, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy1) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur  
      I hope you like it.
       
      Feel free to post your examples here, too. 
×
×
  • Create New...