_GDIPlus_GraphicsDrawPicSlider()

  • Hey, ich hab in den letzten Tagen im Internet ein Vorher/Nacher Bild von Japan gesehen, da ist mir die Idee gekommen soetwas auch in AutoIt zu Coden.
    Ich weiß nicht, ob es man es als UDF bezeichnen kann, da es nur eine (Mit Startup 2) Funktionen sind.

    Also, man kann X Koordinaten, Y Koordinaten, Breite und Höhe einer Fläche auswählen auf der 2 Bilder, durch eine Art Balken getrennt sind. Nun kann man den Balken so verschieben, das ein bestimmtes Bild größer ist als das andere, das andere wird dann sehr klein.
    Schaut es euch an und gebt nützliche Rückmeldung, wie ihr es findet und ob es Verbesserungsvorschläge gibt.

    Die (UDF?):

    [autoit]

    Func _GDIPlus_PicSliderStartup($iX, $iY, $iWidth)
    $SliderX = ($iX + $iWidth / 2)
    $SliderY = $iY
    $hImage1X = 0
    $hImage1Width = _GDIPlus_ImageGetWidth($hImage1) * ($SliderX / ($iX + $iWidth - 50 - $iX))
    $himage2X = 0
    $hImage2Width = _GDIPlus_ImageGetWidth($hImage2)
    EndFunc ;==>_GDIPlus_PicSliderStartup

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

    Func _Gdiplus_GraphicsDrawPicSlider($hGraphics, $iX, $iY, $iWidth, $iHeight, $hImage1, $hImage2, $hBrush)
    $CursorInfo = GUIGetCursorInfo()
    If IsArray($CursorInfo) Then
    If $CursorInfo[0] >= $iX + 40 And $CursorInfo[0] <= ($iX + $iWidth) - 40 And $CursorInfo[1] >= $iY And $CursorInfo[1] <= $iY + $iHeight Then
    $SliderX = $CursorInfo[0] - 10
    $hImage1Width = _GDIPlus_ImageGetWidth($hImage1) * ($SliderX / ($iX + $iWidth - 50-$iX))
    EndIf
    EndIf
    $DrawWidth = $SliderX
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage2, $iX + 52, $iY, $iWidth - 52, $iHeight)
    _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage1, 0, 0, $hImage1Width, _GDIPlus_ImageGetHeight($hImage1), $iX, $iY, $DrawWidth, $iHeight)
    _GDIPlus_GraphicsFillRect($hGraphics, $SliderX, $SliderY, 20, $iHeight, $hBrush)
    EndFunc ;==>_Gdiplus_GraphicsDrawPicSlider

    [/autoit]

    Beispielscript:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <GDIPlus.au3>

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

    Opt("GUIOnEventMode", 1)
    _GDIPlus_Startup()

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

    Global $iWidth = 700, $iHeight = 500, $SliderX, $SliderY, $DrawWidth
    Global $hImage1X
    Global $hImage1Width
    Global $himage2X
    Global $hImage2Width
    $File1 = FileOpenDialog("Wählen Sie ein Bild.", @DesktopDir & "\", "(*.jpg;*.png)")
    $File2 = FileOpenDialog("Wählen Sie ein Bild.", @DesktopDir & "\", "(*.jpg;*.png)")
    $hWnd = GUICreate("GDI+ PicSlider", $iWidth, $iHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    GUISetState()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hImage1 = _GDIPlus_ImageLoadFromFile($File1)
    $hImage2 = _GDIPlus_ImageLoadFromFile($File2)
    $hBrush = _GDIPlus_BrushCreateSolid(0xff500000)
    _GDIPlus_PicSliderStartup(0, 0, 700)

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

    While Sleep(0)
    _GDIPlus_GraphicsClear($hBackbuffer, 0xffffffff)
    $hPicSlider = _GDIPlus_GraphicsDrawPicSlider($hBackbuffer, 0, 0, 700, 400, $hImage1, $hImage2, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight)
    WEnd

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

    Func _GDIPlus_PicSliderStartup($iX, $iY, $iWidth)
    $SliderX = ($iX + $iWidth / 2)
    $SliderY = $iY
    $hImage1X = 0
    $hImage1Width = _GDIPlus_ImageGetWidth($hImage1) * ($SliderX / ($iX + $iWidth - 50 - $iX))
    $himage2X = 0
    $hImage2Width = _GDIPlus_ImageGetWidth($hImage2)
    EndFunc ;==>_GDIPlus_PicSliderStartup

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

    Func _Gdiplus_GraphicsDrawPicSlider($hGraphics, $iX, $iY, $iWidth, $iHeight, $hImage1, $hImage2, $hBrush)
    $CursorInfo = GUIGetCursorInfo()
    If IsArray($CursorInfo) Then
    If $CursorInfo[0] >= $iX + 40 And $CursorInfo[0] <= ($iX + $iWidth) - 40 And $CursorInfo[1] >= $iY And $CursorInfo[1] <= $iY + $iHeight Then
    $SliderX = $CursorInfo[0] - 10
    $hImage1Width = _GDIPlus_ImageGetWidth($hImage1) * ($SliderX / ($iX + $iWidth - 50-$iX))
    EndIf
    EndIf
    $DrawWidth = $SliderX
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage2, $iX + 52, $iY, $iWidth - 52, $iHeight)
    _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage1, 0, 0, $hImage1Width, _GDIPlus_ImageGetHeight($hImage1), $iX, $iY, $DrawWidth, $iHeight)
    _GDIPlus_GraphicsFillRect($hGraphics, $SliderX, $SliderY, 20, $iHeight, $hBrush)
    EndFunc ;==>_Gdiplus_GraphicsDrawPicSlider

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

    Func _exit()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_ImageDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_exit

    [/autoit]

    Danke im Vorraus für Rückmeldungen :)

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

    Einmal editiert, zuletzt von BadBunny (20. März 2011 um 10:39)

  • Coole Idee das in autoit umzusetzen.
    Doch ihrwie siht das bissl doof aus wen die Bilder zusammen gequetscht werden :S
    Kann man dass nicht so machen dass man 2 Bilder übereinander hat Sprich 2 Instantzen und wen man Instantz 1 wegschiebt Instantz 2 hervor kommt??

    Btw Source Seite von wo die Idee herstammt :D
    Befor and After japan

    Greez
    Skilkor

  • hab es. boxen hat ja nicht so lang gedauert.

    Spoiler anzeigen
    [autoit]


    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>
    #Include <Misc.au3>
    ;Ihr müsst folgende 2 werte auf existierende bilder anpassen:
    ;@ScriptDir & "\a.jpg"
    ;@ScriptDir & "\b.jpg"
    ;die funktion resize "zwingt" die bilder in die auflösung $width2 * $height2
    ;script = alphastatus, kann sicher noch verfeinert werden.
    global $Width2 = 300, $Height2 = 200, $hClonea, $hCloneb
    $hGUI = GUICreate("GDI+", 400, 300)
    $d2 = GUICtrlCreateSlider(50, 270, 300, 20)
    ;GUICtrlSetOnEvent(-1, "_slider")
    GUICtrlSetLimit(-1, 299, 1)
    GUICtrlSetData(-1, 1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
    GUISetbkColor(0xe0e0e0)
    GUISetState()
    Opt("GuiOnEventMode", 1)
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hgui)
    resize(@ScriptDir & "\a.jpg", @ScriptDir & "\tempa.jpg")
    resize(@ScriptDir & "\b.jpg", @ScriptDir & "\tempb.jpg")
    $hBitmapa = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\tempa.jpg")
    $hBitmapb = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\tempb.jpg")
    _slider()

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

    func _slider()
    $hand = GUICtrlRead($d2)
    _GDIPlus_ImageDispose ($hClonea)
    _GDIPlus_ImageDispose ($hCloneb)
    $hClonea = _GDIPlus_BitmapCloneArea ($hbitmapa, 0, 0, $hand, 200)
    $hCloneb = _GDIPlus_BitmapCloneArea ($hbitmapb, $hand, 0, 300-$hand, 200)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hclonea, 50, 50, $hand, 200)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hcloneb, 50+$hand, 50, 300-$hand, 200)
    endfunc

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

    func _quit()
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_ImageDispose ($hClonea)
    _GDIPlus_ImageDispose ($hCloneb)
    _WinAPI_DeleteObject ($hBitmapa)
    _WinAPI_DeleteObject ($hBitmapb)
    _GDIPlus_Shutdown ()
    Exit
    EndFunc

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

    While 1
    sleep(20)
    while _IsPressed(01)
    sleep(20)
    _slider()
    wend
    WEnd

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

    func resize($input, $output)
    $hBitmap1 = _WinAPI_CreateBitmap($Width2, $Height2, 1, 32)
    $hImage = _GDIPlus_ImageLoadFromFile($input)
    $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)
    $hGraphic1 = _GDIPlus_ImageGetGraphicsContext($hImage1)
    _GDIPlus_GraphicsDrawImageRect($hGraphic1, $hImage, 0, 0, $Width2, $Height2)
    _GDIPlus_BitmapDispose($hImage)
    _GDIPlus_ImageSaveToFile($hImage1, $output)
    _GDIPlus_BitmapDispose($hImage1)
    _WinAPI_DeleteObject ($hBitmap1)
    endfunc

    [/autoit]

    bin mal gespannt was es für das script noch für ideen gibt :)

  • So, hier die neue Version OHNE zerquetschen :D Das Problem: Man kann die X Koordinaten des PicSliders nur auf 0 lassen, ansonsten entsteht eine Verschiebung da ich mit % gerechnet hab. Kännt jemand eine bessere Lösung?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <GDIPlus.au3>

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

    Opt("GUIOnEventMode", 1)
    _GDIPlus_Startup()

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

    Global $iWidth = 700, $iHeight = 500, $SliderX, $SliderY, $DrawWidth
    Global $hImage1X
    Global $hImage1Width
    Global $himage2X
    Global $hImage2Width
    $File1 = FileOpenDialog("Wählen Sie ein Bild.", @DesktopDir & "\", "(*.jpg;*.png)")
    $File2 = FileOpenDialog("Wählen Sie ein Bild.", @DesktopDir & "\", "(*.jpg;*.png)")
    $hWnd = GUICreate("GDI+ PicSlider", $iWidth, $iHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    GUISetState()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hImage1 = _GDIPlus_ImageLoadFromFile($File1)
    $hImage2 = _GDIPlus_ImageLoadFromFile($File2)
    $hBrush = _GDIPlus_BrushCreateSolid(0xff500000)
    _GDIPlus_PicSliderStartup(0, 0, 700)

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

    While Sleep(0)
    _GDIPlus_GraphicsClear($hBackbuffer, 0xffffffff)
    $hPicSlider = _GDIPlus_GraphicsDrawPicSlider($hBackbuffer, 0, 0, 700, 400, $hImage1, $hImage2, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight)
    WEnd

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

    Func _GDIPlus_PicSliderStartup($iX, $iY, $iWidth)
    $SliderX = ($iX + $iWidth / 2)
    $SliderY = $iY
    $hImage1X = 0
    $hImage1Width = _GDIPlus_ImageGetWidth($hImage1) * ($SliderX / ($iX + $iWidth - 50 - $iX))
    $himage2X = 0
    $hImage2Width = _GDIPlus_ImageGetWidth($hImage2)
    EndFunc ;==>_GDIPlus_PicSliderStartup

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

    Func _Gdiplus_GraphicsDrawPicSlider($hGraphics, $iX, $iY, $iWidth, $iHeight, $hImage1, $hImage2, $hBrush)
    $CursorInfo = GUIGetCursorInfo()
    If IsArray($CursorInfo) Then
    If $CursorInfo[0] >= $iX + 40 And $CursorInfo[0] <= ($iX + $iWidth) - 40 And $CursorInfo[1] >= $iY And $CursorInfo[1] <= $iY + $iHeight Then
    $SliderX = $CursorInfo[0] - 10
    $hImage1Width = _GDIPlus_ImageGetWidth($hImage1) * ($SliderX / ($iX + $iWidth - 50-$iX))
    EndIf
    EndIf
    $DrawWidth = $SliderX
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage2, $iX + 52, $iY, $iWidth - 52, $iHeight)
    _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage1, 0, 0, $hImage1Width, _GDIPlus_ImageGetHeight($hImage1), $iX, $iY, $DrawWidth, $iHeight)
    _GDIPlus_GraphicsFillRect($hGraphics, $SliderX, $SliderY, 20, $iHeight, $hBrush)
    EndFunc ;==>_Gdiplus_GraphicsDrawPicSlider

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

    Func _exit()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_ImageDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_exit

    [/autoit]

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • moin moin,

    habe hier auch nochmal ne weitere version: nun sind keine dateien erforderlich, das script kann direkt gestartet werden.
    die bildauswahl erfolgt dann einfach per klick auf die 2 mini-bilder:
    [Blockierte Grafik: http://www.andygo1.de/03-2011/20.03.2011--11_25_45--WCNy.jpg]

    Spoiler anzeigen
    [autoit]


    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>
    #Include <Misc.au3>
    global $Width2 = 640, $Height2 = 360, $Width3 = 0, $Height3 = 0, $hClonea, $hCloneb, $hBitmapa, $hBitmapb
    $hGUI = GUICreate("Picture Slider", 660, 440)
    $d2 = GUICtrlCreateSlider(10, 412, 640, 20)
    GUICtrlSetLimit(-1, 639, 1)
    GUICtrlSetData(-1, 320)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
    GUISetbkColor(0xe0e0e0)
    GUISetState()
    Opt("GuiOnEventMode", 1)
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hgui)
    bkg("a", 0xff000000)
    bkg("b", 0xffff0000)
    GUICtrlCreateLabel("Bild 1:", 50, 20, 40, 15)
    GUICtrlCreateLabel("Bild 2:", 200, 20, 40, 15)
    $pica = GUICtrlCreatePic (@ScriptDir & "\tempa.jpg", 90, 10, 45, 30)
    GUICtrlSetOnEvent(-1, "_sela")
    $picb = GUICtrlCreatePic (@ScriptDir & "\tempb.jpg", 240, 10, 45, 30)
    GUICtrlSetOnEvent(-1, "_selb")
    _slider()
    $mylo = @WindowsDir & "\"
    func bkg($side, $col)
    $hBitmap1 = _WinAPI_CreateBitmap(640,360,1,32)
    $pen = _GDIPlus_BrushCreateSolid($col)
    if $side = "a" then
    $hBitmapa = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)
    $hGraphic1 = _GDIPlus_ImageGetGraphicsContext($hBitmapa)
    _GDIPlus_GraphicsFillRect($hGraphic1, 0, 0, 640, 360, $Pen)
    _GDIPlus_ImageSaveToFile($hBitmapa, @ScriptDir & "\temp"&$side&".jpg")
    Else
    $hBitmapb = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)
    $hGraphic1 = _GDIPlus_ImageGetGraphicsContext($hBitmapb)
    _GDIPlus_GraphicsFillRect($hGraphic1, 0, 0, 640, 360, $Pen)
    _GDIPlus_ImageSaveToFile($hBitmapb, @ScriptDir & "\temp"&$side&".jpg")
    endif
    _WinAPI_DeleteObject ($hBitmap1)
    _GDIPlus_BrushDispose($pen)
    endfunc

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

    func _slider()
    $hand = GUICtrlRead($d2)
    _GDIPlus_ImageDispose ($hClonea)
    _GDIPlus_ImageDispose ($hCloneb)
    $hClonea = _GDIPlus_BitmapCloneArea ($hbitmapa, 0, 0, $hand, 360)
    $hCloneb = _GDIPlus_BitmapCloneArea ($hbitmapb, $hand, 0, 640-$hand, 360)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hclonea, 10, 50, $hand, 360)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hcloneb, 10+$hand, 50, 640-$hand, 360)
    endfunc

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

    func _quit()
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_ImageDispose ($hClonea)
    _GDIPlus_ImageDispose ($hCloneb)
    _GDIPlus_BitmapDispose ($hBitmapa)
    _GDIPlus_BitmapDispose ($hBitmapb)
    _GDIPlus_Shutdown ()
    Exit
    EndFunc

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

    While 1
    sleep(20)
    while _IsPressed(01)
    sleep(20)
    _slider()
    wend
    WEnd

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

    func resize($inp, $outp)
    $hBitmap1 = _WinAPI_CreateBitmap(640,360,1,32)
    $hImage = _GDIPlus_ImageLoadFromFile($inp)
    $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)
    $hGraphic1 = _GDIPlus_ImageGetGraphicsContext($hImage1)
    _GDIPlus_GraphicsDrawImageRect($hGraphic1, $hImage, $Width3, $Height3, $Width2, $Height2)
    _GDIPlus_BitmapDispose($hImage)
    _GDIPlus_ImageSaveToFile($hImage1, $outp)
    _GDIPlus_BitmapDispose($hImage1)
    _WinAPI_DeleteObject ($hBitmap1)
    endfunc

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

    func _sela()
    _GDIPlus_BitmapDispose ($hBitmapa)
    _select($pica, "a", 0xff000000)
    $hBitmapa = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\tempa.jpg")
    _slider()
    endfunc
    func _selb()
    _GDIPlus_BitmapDispose ($hBitmapb)
    _select($picb, "b", 0xffff0000)
    $hBitmapb = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\tempb.jpg")
    _slider()
    endfunc
    func _select($pic, $temp, $rc)
    $cstm2pre = FileOpenDialog("Browse...", $mylo, "Images (*.jpg;*.png;*.gif;*.bmp;*.tif)", 1 + 2 + 4)
    $cstm22 = StringLeft ($cstm2pre, stringinstr ($cstm2pre, "|") - 1) & "\"
    $cstm2pre = StringTrimLeft ($cstm2pre, stringinstr ($cstm2pre, "|"))
    if stringinstr ($cstm2pre, "|", 0, 1, 1) > 0 then
    $user = $cstm22 & StringLeft ($cstm2pre, stringinstr ($cstm2pre, "|") - 1)
    Else
    $user = $cstm22 & $cstm2pre
    if stringleft ($user, 1) = "\" then $user = stringtrimleft ($user, 1)
    endif
    $mylo = StringLeft($user, StringInStr ($user, "\", 0, -1))
    if StringInStr("jpg|png|gif|bmp|tif", StringRight($user, 3)) = 0 then
    bkg($temp, $rc)
    else
    repic($user, 640, 360)
    resize($user, @ScriptDir & "\temp"&$temp&".jpg")
    endif
    GUICtrlSetImage($pic, @ScriptDir & "\temp"&$temp&".jpg")
    endfunc
    func repic($rp, $rp1, $rp2)
    $tp = _GDIPlus_BitmapCreateFromFile($rp)
    $Width = _GDIPlus_ImageGetWidth($tp)
    $Height = _GDIPlus_ImageGetHeight($tp)
    _GDIPlus_BitmapDispose ($tp)
    $i = $rp1
    $xa = $Width / $rp1
    while $Height / $xa > $rp2
    $i -= 1
    $xa = $Width / $i
    wend
    $Width2 = $Width
    $Height2 = $Height
    if $Width > $rp1 or $Height > $rp2 then
    $Width2 = int($Width / $xa)
    $Height2 = int($Height / $xa)
    endif
    if $rp2 = 99999 Then
    $width2 = $rp1
    $height2 = int(($rp1/$width)*$height)
    Else
    $Width3 = 0
    $Height3 = 0
    if int(($rp1 - $Width2) / 2) > 1 then $Width3 = int(($rp1 - $Width2) / 2)
    if int(($rp2 - $Height2) / 2) > 1 then $Height3 = int(($rp2 - $Height2) / 2)
    endif
    endfunc

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

    Edit: Habe das Script nochma aktualisiert. Bilder werden jetz maßstabsgetreu (also unverzerrt) skaliert und zentriert dargestellt.

    Einmal editiert, zuletzt von andygo (20. März 2011 um 17:43)