UEZ Posted November 12, 2010 Author Share Posted November 12, 2010 @Eukalyptus: Thanks you very much for publishing your GDI+ examples here in this thread! YOUR ARE REALLY GREAT! 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! 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
taietel Posted November 12, 2010 Share Posted November 12, 2010 In my opinion this thread is now a very good resource for the GDI+ stuff!Agree! It's awesome! Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
BlueLord Posted November 14, 2010 Share Posted November 14, 2010 hy, where i find :"<GDIP.au3>" Thanks Link to comment Share on other sites More sharing options...
UEZ Posted November 14, 2010 Author Share Posted November 14, 2010 You can find the GDIP.au3 here: or in the AiO archive.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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
martin Posted April 4, 2011 Share Posted April 4, 2011 (edited) 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 April 4, 2011 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. Link to comment Share on other sites More sharing options...
UEZ Posted April 4, 2011 Author Share Posted April 4, 2011 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Lakes Posted November 1, 2011 Share Posted November 1, 2011 (edited) 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) expandcollapse popup#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 November 1, 2011 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
UEZ Posted November 2, 2011 Author Share Posted November 2, 2011 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Lakes Posted November 2, 2011 Share Posted November 2, 2011 Thanks, that works, but the label stops the clickdrag function from working if you click on on the label. I did this instead. expandcollapse popup; ============= 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... 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Lakes Posted November 4, 2011 Share Posted November 4, 2011 I`ve moved this as I felt it needed its own thread, to stop cluttering up this one. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Lakes Posted November 8, 2011 Share Posted November 8, 2011 (edited) 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! expandcollapse popup##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 () expandcollapse popup#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 expandcollapse popup#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 expandcollapse popup#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 expandcollapse popup#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 expandcollapse popup#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 expandcollapse popup#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 expandcollapse popup#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 November 16, 2011 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
UEZ Posted November 8, 2011 Author Share Posted November 8, 2011 (edited) Thanks Lakes for your contribution to GDI+ and this topic!!!Here another example made by eukalyptusProject Text on glass ballexpandcollapse popup;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! Br,UEZ Edited November 8, 2011 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Lakes Posted November 8, 2011 Share Posted November 8, 2011 Wow, thats... amazing! 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
eukalyptus Posted November 8, 2011 Share Posted November 8, 2011 @eukalyptus: I hope you don't mind! Here's another one, inspired by UEZ´s Perfect Illusion... expandcollapse popup#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 DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
UEZ Posted November 8, 2011 Author Share Posted November 8, 2011 I'm shocked! 5* from me again! 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Lakes Posted November 8, 2011 Share Posted November 8, 2011 Lost for words, again amazing stuff! 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Lakes Posted November 16, 2011 Share Posted November 16, 2011 Added more path examples to post 171. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Muzaiyan Posted July 27, 2014 Share Posted July 27, 2014 Excellent work! Link to comment Share on other sites More sharing options...
Celtic88 Posted July 29, 2014 Share Posted July 29, 2014 UEZ is the best Link to comment Share on other sites More sharing options...
UEZ Posted July 29, 2014 Author Share Posted July 29, 2014 UEZ is the best LOL. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now