GDI+ Kreisförmiger Ausschnitt einer Bitmap

  • Das hier ist eigentlich nur ein Beispielscript. ;)
    Es soll zeigen, wie man aus einer Bitmap (oder einem Teil davon) einen Brush erstellt.
    Die Funktion habe ich aus der GDIP.au3, welche erweiterte GDI+ Funktionen enthält.

    Morgen erstelle ich ein schöneres und übersichtlicheres Beispiel, wenn Bedarf besteht. ;)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $iGUIWidth = 400
    $iGUIHeight = 400
    $GUIColorBG = 0xFFFFFFFF

    [/autoit] [autoit][/autoit] [autoit]

    $iX = 50 ;X-Koordinate des rechteckigen Bitmap Ausschnitts
    $iY = 50 ;Y-Koordinate des rechteckigen Bitmap Ausschnitts
    $iX2 = 100 ;X-Koordinate der Ellipse
    $iY2 = 100 ;Y-Koordinate der Ellipse
    $iWidth = 50 ;Breite des rechteckigen Bitmap Ausschnitts
    $iHeight = 50 ;Höhe des rechteckigen Bitmap Ausschnitts
    $iWidth2 = 50 ;Breite der Ellipse
    $iHeight2 = 50 ;Höhe der Ellipse

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("Test", $iGUIWidth, $iGUIHeight)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsClear($hGraphic, $GUIColorBG)
    _GDIPlus_GraphicsClear($hBuffer, $GUIColorBG)

    [/autoit] [autoit][/autoit] [autoit]

    $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test.png")

    [/autoit] [autoit][/autoit] [autoit]

    $hTextureBrush = _GDIPlus_TextureCreate2($hImage, $iX, $iY, $iWidth, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsFillEllipse($hBuffer, $iX2, $iY2, $iWidth2, $iHeight2, $hTextureBrush)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_BrushDispose($hTextureBrush)
    _GDIPlus_Shutdown()
    Exit
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    ;Die Funktionen sind nicht von mir!!
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_TextureCreate
    ; Description ...: Creates a TextureBrush object based on an image and a wrap mode
    ; Syntax.........: _GDIPlus_TextureCreate($hImage[, $iWrapMode = 0])
    ; Parameters ....: $hImage - Pointer to an Image object
    ; $iWrapMode - Wrap mode that specifies how repeated copies of an image are used to tile an area when it is
    ; +painted with the texture brush:
    ; |0 - Tiling without flipping
    ; |1 - Tiles are flipped horizontally as you move from one tile to the next in a row
    ; |2 - Tiles are flipped vertically as you move from one tile to the next in a column
    ; |3 - Tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column
    ; |4 - No tiling takes place
    ; Return values .: Success - Pointer to a new TextureBrush object
    ; Failure - 0 and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: The size of the brush defaults to the size of the image, so the entire image is used by the brush
    ; After you are done with the object, call _GDIPlus_BrushDispose to release the object resources
    ; Related .......: _GDIPlus_BrushDispose
    ; Link ..........; @@MsdnLink@@ GdipCreateTexture
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_TextureCreate($hImage, $iWrapMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "hwnd", $hImage, "int", $iWrapMode, "int*", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[3]
    EndFunc ;==>_GDIPlus_TextureCreate

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_TextureCreate2
    ; Description ...: Creates a TextureBrush object based on an image, a wrap mode and a defining rectangle
    ; Syntax.........: _GDIPlus_TextureCreate2($hImage, $nX, $nY, $nWidth, $nHeight[, $iWrapMode = 0])
    ; Parameters ....: $hImage - Pointer to an Image object
    ; $nX - Leftmost coordinate of the image portion to be used by this brush
    ; $nY - Uppermost coordinate of the image portion to be used by this brush
    ; $nWidth - Width of the brush and width of the image portion to be used by the brush
    ; $nHeight - Height of the brush and height of the image portion to be used by the brush
    ; $iWrapMode - Wrap mode that specifies how repeated copies of an image are used to tile an area when it is
    ; +painted with the texture brush:
    ; |0 - Tiling without flipping
    ; |1 - Tiles are flipped horizontally as you move from one tile to the next in a row
    ; |2 - Tiles are flipped vertically as you move from one tile to the next in a column
    ; |3 - Tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column
    ; |4 - No tiling takes place
    ; Return values .: Success - Pointer to a new TextureBrush object
    ; Failure - 0 and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: After you are done with the object, call _GDIPlus_BrushDispose to release the object resources
    ; Related .......: _GDIPlus_BrushDispose
    ; Link ..........; @@MsdnLink@@ GdipCreateTexture2
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_TextureCreate2($hImage, $nX, $nY, $nWidth, $nHeight, $iWrapMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture2", "hwnd", $hImage, "int", $iWrapMode, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int*", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[7]
    EndFunc ;==>_GDIPlus_TextureCreate2

    [/autoit]
  • Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2009
    #include <GDIplus.au3>
    #include <GUIConstantsEx.au3>
    #include <Memory.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $width = @DesktopWidth / 1.5
    Local Const $height = @DesktopHeight / 1.5
    Local Const $pi_div_180 = 4 * ATan(1) / 180

    [/autoit] [autoit][/autoit] [autoit]

    Local $hwnd = GUICreate("Border Collision with texture objects by UEZ d-_-b", $width, $height, -1, -1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    GUISetOnEvent($GUI_EVENT_CLOSE, "Close") ;$GUI_EVENT_CLOSE = -3
    GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Move") ;move main window
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphics)
    Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsClear($hBackbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 4)

    [/autoit] [autoit][/autoit] [autoit]

    Local $img = Load_BMP_From_Mem(Image())
    Local $iX = _GDIPlus_ImageGetWidth ($img)
    Local $iY = _GDIPlus_ImageGetHeight ($img)

    [/autoit] [autoit][/autoit] [autoit]

    Local $max_dots = 10
    Local $max_speed = 5
    Local $iWidth = $iX
    Local $iHeight = $iY
    Dim $coordinates[$max_dots][5], $angle
    Dim $brush[$max_dots]
    Local $hImage[$max_dots]
    Local $hContext
    Local $hBrush
    Local $sleep = 30

    [/autoit] [autoit][/autoit] [autoit]

    Initialize()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113
    DllCall("User32.dll", "int", "SetTimer", "hwnd", $hwnd, "int", 0, "int", $sleep, "int", 0) ;set GUIRegisterMsg($WM_TIMER, "Draw") timer

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Until False * Not Sleep(100000)

    [/autoit] [autoit][/autoit] [autoit]

    Func Move() ;move whole window when pressed lmb and hold continuing drawing of window content
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", $WM_NCLBUTTONDOWN, "int", 2, "int", 0) ;$WM_NCLBUTTONDOWN = 0x00A1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Draw()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000)
    Draw_Dots()
    Calculate_New_Position()
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $width, $height)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Initialize()
    For $k = 0 To $max_dots - 1
    $hImage[$k] = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
    $hBrush = _GDIPlus_TextureCreate2($img, 0, 0, $iX, $iY, 0)
    $hContext = _GDIPlus_ImageGetGraphicsContext($hImage[$k])
    $rand = Random(1, 2, 1)
    Switch $rand
    Case 1
    _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iWidth, $iHeight, $hBrush)
    Case 2
    _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iWidth, $iHeight, $hBrush)
    EndSwitch
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_BrushDispose($hBrush)
    New_Coordinates($k)
    Next
    EndFunc ;==>Initialize

    [/autoit] [autoit][/autoit] [autoit]

    Func Draw_Dots()
    Local $i, $temp_x, $temp_y
    For $i = 0 To $max_dots - 1
    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hImage[$i], $coordinates[$i][0], $coordinates[$i][1], $iWidth, $iHeight)
    Next
    EndFunc ;==>Draw_Dots

    [/autoit] [autoit][/autoit] [autoit]

    Func New_Coordinates($k)
    $coordinates[$k][0] = $width / 2 ;Random($width / 20, $width - $width / 20, 1);start x position
    $coordinates[$k][1] = $height / 2 ;Random($height / 20, $height - $height / 20, 1) ;start y position
    $coordinates[$k][2] = Random(1, $max_speed, 1) ;speed of pixel
    $angle = Random(0, 359, 1)
    ;~ ConsoleWrite("Angle: " & $angle & "°" & @CRLF)
    $coordinates[$k][3] = $coordinates[$k][2] * Cos($angle * $pi_div_180)
    $coordinates[$k][4] = $coordinates[$k][2] * Sin($angle * $pi_div_180)
    EndFunc ;==>New_Coordinates

    [/autoit] [autoit][/autoit] [autoit]

    Func Calculate_New_Position()
    Local $k
    For $k = 0 To $max_dots - 1
    $coordinates[$k][0] += $coordinates[$k][3] ;increase x coordinate with appropriate slope
    $coordinates[$k][1] += $coordinates[$k][4] ;increase y coordinate with appropriate slope
    If $coordinates[$k][0] <= 0 Then ;border collision x left
    $coordinates[$k][0] = 1
    $coordinates[$k][3] *= -1
    ElseIf $coordinates[$k][0] >= $width - $iWidth Then ;border collision x right
    $coordinates[$k][0] = $width - ($iWidth + 1)
    $coordinates[$k][3] *= -1
    EndIf
    If $coordinates[$k][1] <= 0 Then ;border collision y top
    $coordinates[$k][1] = 1
    $coordinates[$k][4] *= -1
    ElseIf $coordinates[$k][1] >= $height - $iHeight Then ;border collision y bottom
    $coordinates[$k][1] = $height - ($iHeight + 1)
    $coordinates[$k][4] *= -1
    EndIf
    Next
    EndFunc ;==>Calculate_New_Position

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[6]
    EndFunc ;==>_GDIPlus_BitmapCreateFromScan0

    [/autoit] [autoit][/autoit] [autoit]

    Func Close()
    GUIRegisterMsg($WM_TIMER, "")
    For $k = 0 To $max_dots-1
    _GDIPlus_ImageDispose($hImage[$k])
    Next
    _GDIPlus_ImageDispose($img)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>close

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_TextureCreate2($hImage, $nX, $nY, $nWidth, $nHeight, $iWrapMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture2", "hwnd", $hImage, "int", $iWrapMode, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[7])
    EndFunc ;==>_GDIPlus_TextureCreate2

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================================================================
    ; Function Name: Load_BMP_From_Mem
    ; Description: Loads a image which is saved as a binary string and converts it to a bitmap or hbitmap
    ;
    ; Parameters: $mem_image: the binary string which contains any valid image which is supported by GDI+
    ; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created
    ;
    ; Remark: hbitmap format is used generally for GUI internal images
    ;
    ; Requirement(s): GDIPlus.au3, Memory.au3
    ; Return Value(s): Success: handle to bitmap or hbitmap, Error: 0
    ; Error codes: 1: $mem_image is not a binary string
    ;
    ; Author(s): UEZ
    ; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines
    ; Version: v0.95 Build 2011-06-11 Beta
    ;=======================================================================================
    Func Load_BMP_From_Mem($mem_image, $hHBITMAP = False)
    ;~ If Not IsBinary($mem_image) Then Return SetError(1, 0, 0) ;not working properly
    Local $declared = True
    If Not $ghGDIPDll Then
    _GDIPlus_Startup()
    $declared = False
    EndIf
    Local Const $memBitmap = Binary($mem_image) ;load image saved in variable (memory) and convert it to binary
    Local Const $len = BinaryLen($memBitmap) ;get length of image
    Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002)
    Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
    Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
    DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE
    Local $hStream = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0)
    $hStream = $hStream[3]
    Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface
    $hBitmap = $hBitmap[2]
    Local Const $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
    DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
    "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak
    $tMem = 0
    If $hHBITMAP Then
    Local Const $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    If Not $declared Then _GDIPlus_Shutdown()
    Return $hHBmp
    EndIf
    If Not $declared Then _GDIPlus_Shutdown()
    Return $hBitmap
    EndFunc ;==>Load_BMP_From_Mem

    [/autoit] [autoit][/autoit] [autoit]

    Func Image()
    Local $Image = '0xFFD8FFE000104A46494600010101004800480000FFDB0043000302020302020303030304030304050805050404050A070706080C0A0C0C0B0A0B0B0D0E12100D0E110E0B0B1016101113141515150C'
    $Image &= '0F171816141812141514FFDB00430103040405040509050509140D0B0D1414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414FF'
    $Image &= 'C2001108008300D103012200021101031101FFC4001C0000020301010101000000000000000000020300010506040708FFC4001B01000202030100000000000000000000000102000403050607FFDA00'
    $Image &= '0C03010002100310000001FA1514F15B614550555C22AAE996A8A8ACAB8CA32465AA2165A031600060C80242450C845D8119724B2FBB455A8BC147420518C0225457CBAB99D74D973B7DCF2DD2D2C7AF'
    $Image &= '37A7475E55AD52C6E320018B2AC180540484892430A0CB2FD20B2B5B7954C1481462000B0405E96625F3F4FF003CD9FCDBD659FD2CCCBDED4EB3C3A1E5DFD4ECB9C097975A0262D5D60D5B2AC4C4A8D5'
    $Image &= 'D19724B2FD50B2A95D50B450A85828016D5880AF468CD8F3FF0040C6EDBB4A0B76BCEBAA7CEB07EABF1AE32D1D66FBF434480C6A300301954260CA1462454B99DFB0168E1BAA168A448B831950345027'
    $Image &= 'D4815CAFFA0FC67EA5DB63EC24E73AFA5C37114BE879F6B55294E8C4ABC33A201312AA06AD91626245492C3F6D4742EAC1C09140E0C7120E048916820E739DFA1F0FDB55DACCF13BD379E6A3559C1ECF'
    $Image &= '9ED3E63B1BEDB0263E53784182CA0B6032284C580CB961BB8A3A974058222C1A29120E0489070204E1EF85AC5C656D97A0E9DBE921F34DC70FD83C6E0AABAD7A889D30583019140D5B28C92D37737263'
    $Image &= 'BB4274D16A7889819FD4F8F20C1F36EAC8CE1F6E4A8BC6F4F9330DDF572DD0571E9F46679310E8EA8EB28510B28098955ADA0EAA872D1ED6E47B92A46943248212080122000931458C8A06A455584905'
    $Image &= '8C905548C002428152645924B27FFFC40029100001030302060202030000000000000002010304000511122006101315304014211622314250FFDA0008010100010502F597FC871ED04304D50A33E26F'
    $Image &= 'C77629EF5F422B69DCEA0C2520BC4B2948D6757255C522EAF4FEF2370041198E468E5756027B61A06891546032262F34B18BD22210A7D819020DAF462DA655BEEB664912C63C4912D869A39149A23329'
    $Image &= '92DABBF1B97390C898210249310658B7C6C3109B7855A3874EB8D14C98FF0054B6AEEC6F214348AD37A8E0B64B113B6B92D9069793B1187867BB1623E939284D1C1F1E2B1B4873413146A44E615868D6'
    $Image &= 'E23CB892F0B29EE4C1F49ED8B4BBF1BEE9725B6870ACEF9F64ABDDD02DB0D1308E9F4DBAFEFB57CD798DD68D6BBBCDB18A7124B9A8BF659FDA70FC606DF45A87A9D93B57CF3A33633803A85D11AB7342'
    $Image &= '27758BF262AA66AD01A616D5F3DC5AFAA55C54767A0CFF0014569781D6DB465BF55CB702935001B2F12D2EF2CA2392270AF73979F9F3E8AF6E365DF61D77C85477E8B85E233D51EEADBA3DCA2D7708AB'
    $Image &= '40F36EEF5F09009D1418C55DAE1D769874E5A229A170E46A3E19A5E1B76BF1B76A3D9E3B4076486549C3F1C4C4748FA6BBD77AF2FFC40023110002010304020301000000000000000001020300111204'
    $Image &= '213031102213404120FFDA0008010301013F01FA5A68559726A64123911754C313635627AA3C514CD175406647C5B5E9C58DAB49111EEDD54A416F51C5F00923F4A943C3EA7C36B318B03B52BABF47C1'
    $Image &= 'E08E568FAA9E632DAF44D85CD492191AF50B15716E39D846B91A772DFB5A7D3AE191FDA4D2AABE5C7220917134342D96E76A02C2DF78FF003FFFC4002A11000104010107030501000000000000000100'
    $Image &= '020311040510121320213141062242143233405171FFDA0008010201013F01FD290EE506A3A7362C60F98FBCA7B4C6EDD2875EDCF4AB6D03F72D3CF1D8EE2BEC8ECA5C0C9DEBAB5212DF6F95FEF310A9'
    $Image &= '108273C0E8B44C7C778328EA5552CDD1247CCE9E0176A7C2C8C5FCADAD839291088D845F42B4184C6C2EAE8501BC6828E311356A71326C4903FF009CE422111B3D3D925EEFA5213230DEC16A1ACB8678'
    $Image &= 'C7F805ADE7BA3C3DD1F2E9B0731548858992EC39C4CCF0A4F54C1C1B637DCA491D2BCC8EEE564E74B96D6B643DB9AF68737C85BD1790AA03DD35B8CA46C03A82AA2F079800A82A0A82A0A952A54800A9'
    $Image &= '52A0A82FFFC4003D10000200030307060D030500000000000001020003111221510413223141617110408191D1F0233233344252627292A1B1C1F11450E1354373B2C2FFDA0008010100063F02FDFAC8'
    $Image &= '169B0AD38469CDB2D820BBE7AFE50AA133C58D066F6F4180B350A31BC6AE7009B8DEC3DAB80A7CDB925CFCF599C52D2A50102B018812A66A96971248DAC70BCF5E261D6D1702979C76FDBAF958D34540'
    $Image &= '2CD80EE22EE66083465350634C147F571E06199746C2D9BE5F8403D507F312B243304CCAA601A08752D45DECDC6EE9C6A713B4F25D7189AE41A3E8592D5141FCDAEB8A198B3189DA74DB79EFB399E910'
    $Image &= '2B898B2E030C18541E220E4F522D8F1C9D6C3575FF001846539C59A72C975328DFE1225CA679626D156CBCCB556B2C48B4359B857A604E9593BBCB22A1AEBF85F7C685557D761F411EACB41F282CD73B'
    $Image &= '1B4DD9F6E64AA05A66340203BAD16D19563597A8D5F4EA8CDB836D40ADF5AF7A44CB4D6744F185CAB2B32A636C0B7AF0F6BBDD16A74856D26299C5AB00DAFEA7A22B26AF2B6C9AEAF77B3E913332EAE9'
    $Image &= '3009A2871FC57A6334BE229D2389C3BF6F33A300C3022164326A1A3EA90282BC6948AADA9775343B3A604D5734AF84A817AD6FAD05F4D7F98FD5AA01353C66A6B5DA396CBCA461BC466F23739449D94D'
    $Image &= '4BBABB634A5B0E17C5A5368623990BC822F046B11E152BEDCBEC89818B0050EB42BB37C4A614FD3DCF687F70ECA6EE57C9251A484D19847A670E1DF8F20F55CD1BEC7EDF8E692C8979C2E71A53BDD125'
    $Image &= 'E96482C856B5B34370EAA723E9819430A4A5DB5C698453EB0CD87CF925FF00913FD8734B405A32F58C576F7DD0EB91BA34998C1991C57A8F6E02085CB9B7AAD9523AAF82C6A58EB63793164693FAA35C'
    $Image &= '4AB6B6DDC934ADC00A5DC6F1D51A3314FB332E68150B497A5A2D5BF50FBF573560B2B606B3E871FADD0F6C2B81451A3777BE36FC4626305000A2DD8EDFF986352AF2C175B3B7770318880755A6634E9A'
    $Image &= '7DB9A89C3D1B9F863D1F7E4C70036C0537B6B63BF92C4B519AF45C9B808545F15450736AA1CD0C17BDD01892C463CCEE15E98D1C8918639F114FD1CB270194AC7F4D246E78F0D91B4A1893FC47943F01'
    $Image &= '8F2A7E031A2C49F74C5D2548E348ACC7932B7674479C4BF8A3CE657C51A1311FDD6AF30D250DC445F93C93C6588F3695D0B1E6D2FAA299954DEA23C79C3A476468651F12479697D462F9C9D4628F2D26'
    $Image &= '36348F2657DD630195E682378EC802B5DE7F64FFC40026100100020104020104030100000000000001001121103141516171812091A1B1C1D1F0E1FFDA0008010100013F21A952B47475E7EA63B47463'
    $Image &= 'B68B4BD6B5657D2EAE8EAE8C631DF4BD6A54A952A26B503A8770DB40ED5FFA92D7E0B23C2E5F08C894BA0AEACC7DDC0AD400E942AB3E163F4BA98E8CE21A26A91231D371B0FAE07B76095F3DC332C1F1'
    $Image &= '5074AB377A51376AAE2A5D412D41DC578931BA90631AAC778D8C78B7CBD1A3F69980652FD16B7833DD08B566D18CA8C62475B952A5695A2448D32ECC583B64E4A53E78DE214D7613D8A1EF3480A8104F'
    $Image &= 'AB8AA864D926D58864342152C8CD8B514AD2422C15D9582ADA0BFC7F76DB18C070BCBE7AEA4E2FB1CFD92AD56E6A96A8F073B6C030119512318CE34A952A244D5224A4CAA8C172BA4B9F517240D20416'
    $Image &= '41071B2E0AB6DEE6E871B40A572D995476BBCB730EAA42C00280B596DC2A99442F4487DB074963C336B6CDA95ECDDF78F755079BEEED032F6C757C11D3FD0AF42318C608FD172B424A892A24C92A47CB'
    $Image &= '4BFA17E250F586A6F8DF40A6EE32A8704BE3D82EFCABCCAEBC8DCE1B9E7A8E37B0BADE98B5D63AAB6628D9DF58A8FBDBEC0E6E0551B72C8F27F6C6D5DAED8BB6B212BDDDE5C1B9BB3C60E0FA72F92BA1'
    $Image &= 'AB1D0FD4A8912244952F84F6865D5B9E8E0451C143AE4E8B08A03602857709CB896D53803659D0B6C5DB8A37589D9682EFCDCB8C9E43B47457BB3871E7DC4004574BDBB7C9755997B0FDD2BF1BFDAE15'
    $Image &= '1AED0631891231D2A5448C3091226990B372E767FB9EA63D3C0B1F7B8F8B977D8762B5D202EBCCC133E28A57B69BE6BADF47CEB50F7FAB67B6CD8D4EFE2179DBD975E8F868C4D06A74A952A309122448'
    $Image &= '9125EB94CD64ACDD3CA3E61624C3B87FC1B268EA39A729E0F0145F12A85B5CAB60E230C0BBB83E63BCABF0A49D1D1D4E951224A8912244951220DF0B45D8615F67D297DA9041AABBAAD2BF222FCF5FC1'
    $Image &= '614FBFCCB3CCBB5F6172CDB2532675FF003CED1C00F0299607B3931B8C1778177BAAFEFEDF2C2A002CEE421B1C2FE119B46318231952A24A8912244891224D98231B2EDA37979505318BACDC1C2A9745'
    $Image &= 'B8B5F0F633C7FE1E601A40A576F6C418AECB902EFE40BF44014874304E0C01C57F0EA489A08E95125448C495122448912302607EC9F25FC278955286CA5ADC2E89610D81B2B7F8E0F0106D67116E7142'
    $Image &= '74ECBB53C6FE38BEEA576F41CF9D1D18918C7795F42448C489122449B3FCCBD16DCF1F038F81399A37F9FAABE63125463AB1227D65448D95AE9A469E903F611C27722CA72F697FE6A02397B5A9BCD9FF'
    $Image &= '003D46ADDF1FF1867E0CC835F275FDA5F83DD188FF005A1B7F9093F0107E9AD46313427D55A7EF089F99D3FC47AAF49106E16E3C043FA8E71222BB53C59F91FE25FC37B085B867849D8C86BF9596B4DF'
    $Image &= 'F2CB3221C32C66857182FE862463A1A3A3AB18C74318E8C5D0E8918B166ED3FFDA000C03010002000300000010A9F698DD32D349FEDBE7C1FF0095BE93B53D5D5FF44077FD736150F47BD92B5407FF00'
    $Image &= 'FDD7687879DC12CC72FF00F89B64EF56E1CAAFFF00E357BD5D615AAF36E8FF00BEDDFF00EF4C53ECD0FE97B4CBFF00FEF67FA7D52BB6BF7007F8E2F420E2782763840FFFC40020110101010003000202'
    $Image &= '030000000000000001001110213120413061517191FFDA0008010301013F10786649926667E4F0FBBE023A4FF60437204E9999F8B3681E1F6137EC323AF6D01C04BDC0924C9E761D984114EAC27E92DB'
    $Image &= '66F186DFDAD7EEC9E0FC5E17EFD7F1238F646C9E4DD7F97EE24CFE0C9842BDA4B00F510A0F470CCFC998F8B799412074581E4CCFCB1FA6C7DDBBBB9D91F6493649E36DB782DB7F03FFC4002211010002'
    $Image &= '010402030101000000000000000100111021315161417181B1F020D1FFDA0008010201013F10AAC05425C20C20C306525609A29ABE657C29A0DB5FDAC70969030D9A60FF002C30902E0F0DBCF98BA52D'
    $Image &= '17EFE1DE5DBD75D4D60A9DCEA712DD2D6F9841B864634C141D6377F87F7CC466BE4DA02D52E81F03C772A17EF0C0CB90A43345C2D33CABC751C02D6170F960E42591E2A6CC30613F80127B1E181E85CB'
    $Image &= '074A5D797BE862BDDA5BAF30C08650608E06FECB6EA2122E6DE2FDC52352E5B10D242106A1830F70257DBFEC55FCFDC374481356FDC46C6BC4BC6C1EE553A4210DF1C09D13A274478253888E253894E2'
    $Image &= '70253894E21C53AA7FFFC400261001010100020104030002030100000000011100213141105161718191A1B1C1D1E1F0F1FFDA0008010100013F10E99E4E60663BF6C27C6E6FC615BE951E247227A13E'
    $Image &= '71C70E38533C1EDBADDD9F7BBB968CC27532E5F7AF33419AA63DDC6BCEB95CF8D2DC930D1EDBAC94DD3C74E7ADCB0DF4E0F06BD3E70A6EF8F19E79C7273B88EE8FA138B3AC7BF1C7A21CC72C99F6F39E'
    $Image &= '5BEBA0719EF276647536EE72C0C340E0228129F04E8C69D240EA8B3C0F389000B29E545E056835848F79A48D25121C891458A082E07FE71EDBDCBD7A27B63667BC218733702FBE7BDC9FAEBD0A53D397'
    $Image &= 'C9F5AC39D3CDE66E4F9DC18778433C37054B2FC13070106EC0A0474080F2CC68E160A95258221314204828079C029C648C83513A0D0C14A00128C0824201848DDD34FAC6D6AC48298B68A900A5059DD6'
    $Image &= '0AE1111444791111104444130B7DF0BCFE73C31F3E374677DFA557DB5E7E3767A1E3975E320DD7666B271F27A1F0626B221005721448A28A2A088815EE02A800554000AF0659B8EA57910505E2AF4620'
    $Image &= 'C08288AA423D246049F3C324F8038282BCAB5489FA6B1D422F1C528318A506314632243D4E98AD5111C81085800E8C68A22882799318017078E67A1E5ACE13EFAC678C78FAF41DFA17DE7C679DEE6FBF'
    $Image &= '4F1FDC9FAD41D0708C7A0413E0A95C06C80A488A3808FC23113918ACFC68A185E14E8302383F798B2B008802484671755CA409804852157014D50828C14118D22823912ED56DC51022293805B549A2BC'
    $Image &= 'DB356947940155AAD555556A6C945700A384207C8BE81F8C23870CDD1F3B977E33C69CFC678F8F42FC759AE3473DAEE4FC663C6FC86B508A01B1AA80082B62015050B2BFA50E0A89CC1050660D4D9C4B'
    $Image &= '0216B44604691147930A845120A9420F239089DE4AEC1E7CA3456B0C5A015C534CECD3440413E008CF60B622F2CE21C5B80142633917A8A78F254A02A12D545050BA328ED0C51002DD16E4C95DC3F585'
    $Image &= '5309BABC64B9331F9F4639C8F3A3F3ABBF4EA7398C85B8533844A223107AEC302AFE63425DA0C2A083703CA54441342AAAA96F779CE8BF40ED1200A900E60603ED1A22160500908C967A8212CF055440'
    $Image &= '3381588D3C265C62075600B04D41124356821CF79783DD088F80BE3CE0D96A8A3144F71111188888227A05C2EB75BBB1BBCB4F77D0F2F6F450FAD4DFB3767F752CC9704816C00C41112C51111108A442'
    $Image &= '1C9E483DD55BE23C5A2805739778A1E1C1439318333FDDA467313109151620BBE9F2F1A6342749464F3D05EF014F50219E13D808FB24EC55486ECFFBF491DC8E13271C611BE8F3EA667ACFC77071DEE2'
    $Image &= '78D3ACE340F6C1CF8F4FB2FD6EE2686202822A61254A9222B3C7D80690E2D1C1876E5EDC40D0EF1543201BD822B00808484AAD55F2AD5AB95B4AB33859BEEA000AAF038445A0CB8683CA7D0AFF000C23'
    $Image &= 'D75938FAC7FB9238DB84C9319E8C1A3DF1BE3EB3EE3AD5373EF6FD0619866EDDD0EC42546239CA801505670171293381A868480547A232E89DA3EF09CA511CA99EA233082E50381550E3ACD099440641'
    $Image &= '429029520A5439D4CE23CEA18AD7A900A2C10663857C15050743548F2554FD527240251A05468145F17383898CC0DC98CC28FEFD0A9BD8FD66BC68E898F3EB9A5E8541146D13B33A998549027110C078'
    $Image &= '505371090081B1008364441209A74087C007E020CE2AC0C8A9B029A56F6F356259D1816F962A00117B2516EE0F408FCC78D402A0014061EE2FE72709CE487F9DD8FE7716EF7931FCA67AFE7A033DBCEF'
    $Image &= 'FE987C7A2FE1AFA7E34193D3B1AAB1F2F09A7BE393202C868040015604EDABF955FCE910F0B16B005055E0A879501474EB51542C2828A50A01EB21A4508FCE28B349D1C262208220442E06E2D5140050'
    $Image &= '150559CAAF9C95C39B93978C3BDC985719708BD1F8C83F132375743003AF5FEFDD9EDB9B441144681889F397F3E00BFCCB357B16A2E013C828F675C0003ECE0390006EE4CFBB76C3CF8CFC64C39D47D0'
    $Image &= '1F1DE10F582E4FCE73FECC901CA28AFB2C67EB4D76B071BDE4590CB188C7E0572CF25443F466463583DF490FECD115CF2969F934A919EC37FA4FEE6E3A302AFE40FE99803B0514F9A8313760637FC337'
    $Image &= '17FA4FF0B9C807C7FBE4D65E06FF00CD9D2313FEB24CF2DC78F1853DBD014D6BF1E8747393DB5E3E73F4CCD64B8E831E0A3F63ADDC7B547F2DEE74BFB83FC0C941BEFCBFDE4C375FA3151FCCB9BB5960'
    $Image &= 'FC4FF9CC433C151F61C1F08F0A0FE874CF9631FA43FCE04E441D7E88BF1334D42B431F8103EA4CC9DBA20FC5FF009E545E4EC01EF00FE64A64B0C9F78F0EE4C291308E864DD5DD3D3CB5F45EA2E7D0B3'
    $Image &= 'EF19A1964BB83E87BC5B8E6E7261937FFFD9'
    Return $Image
    EndFunc

    [/autoit]

    Ich muss mal schauen, wo ich den Code habe, wo sich die Objekte noch dabei drehen... (ist in der Physik Engine 2 enthalten)

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    2 Mal editiert, zuletzt von UEZ (12. Juni 2011 um 09:55)

  • Zitat

    wow hätte nich gedacht das das mit so kurzem code geht


    Im Prinzip ist es ja auch nur ein DLLCall. ;)
    Der eigentliche, schwierigere, Teil steckt in der gdiplus.dll.


    Edit: Gibt es eigentlich Beispiele zur GDIP.au3? ?(
    Das wäre ja irgendwie ganz hilfreich. :D

  • Hi name22,

    ich stehe mal wieder völlig auf dem Schlauch:
    Wie kann ich bei Deinem Beispielscript mittels "_GDIPlus_GraphicsDrawImageRectRect" das Bild verkleinern und auch abspeichern? Das verkleinerte Bild bekomme ich in die Gui; aber ich bekomme es nicht abgespeichert.
    Nachdem ich hin und her probiert habe, bin ich endgültig verwirrt.
    Kannst Du mir da auf die Sprünge helfen?
    Vielen Dank schon mal vorab.

    Auch wenn ich nichts weiß, muss ich nicht alles glauben

    Einmal editiert, zuletzt von Peri Petie (24. Juli 2015 um 14:10)

  • Hey, "_GDIPlus_ImageResize" kannte ich überhaupt noch nicht; werde ich mir aber anschauen.
    Vielleicht ist es mit dieser Funktion etwas simpler. Vielen Dank für den Tipp.
    Zwischenzeitlich hatte ich aber weiter gebastelt und es tatsächlich hinbekommen.
    Nachfolgend das Script von Dir aus dem ersten Posting, erweitert um Skalierung und Speicherung des neuen Bildes:

    Auch wenn ich nichts weiß, muss ich nicht alles glauben