Jump to content

SlideShow Image


Recommended Posts

Posted (edited)

SlideShow Image

Buttons will be grayed out on the first runthrough and enabled when done, interval between images on the first run will depend on the speed of your computer (only a few seconds on my computer).

;https://www.autoitscript.com/forum/topic/211958-slideshow-image/

#include <GDIPlus.au3>
HotKeySet("{ESC}", "_exit")
Global $Image[4], $Current = 3

            _GDIPlus_Startup              ()
$Image[0] = _GDIPlus_BitmapCreateFromFile ("SlideShowImage0.png")
   $Width = _GDIPlus_ImageGetWidth        ($Image[0])
  $Height = _GDIPlus_ImageGetHeight       ($Image[0])
  $Canvas = _GDIPlus_BitmapCreateFromScan0($Width, $Height, $GDIP_PXF32ARGB)
     $Gui =  GUICreate("SlideShow Image", $Width, $Height+30)
    $Prev =  GUICtrlCreateButton("<", $Width/2-50, $Height+2, 50, 26)
    $Next =  GUICtrlCreateButton(">", $Width/2+50, $Height+2, 50, 26)
             GUISetState()
$Graphics = _GDIPlus_GraphicsCreateFromHWND($Gui)
            _GDIPlus_GraphicsDrawImageRect ($Graphics, $Image[0], 0, 0, $Width, $Height)
If Not FileExists("SlideShowImage1.png") Then
    GUICtrlSetState($Prev, 128)
    GUICtrlSetState($Next, 128)
For $Loop = 0 To 2
 $Bitmap  = _GDIPlus_BitmapLockBits($Image[0], 0, 0, $Width, $Height, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB)
  $Pixels =  DllStructCreate("dword[" & $Width * $Height & "];", DllStructGetData($Bitmap, "Scan0"))
 $Bitmap2 = _GDIPlus_BitmapLockBits($Canvas, 0, 0, $Width, $Height, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB)
 $Pixels2 =  DllStructCreate("dword[" & $Width * $Height & "];", DllStructGetData($Bitmap2, "Scan0"))

    For $x = 0 To $Width * $Height
        DllStructSetData($Pixels2, 1, "0xFF" & _
        Hex(BitAnd(BitShift(DllStructGetData($Pixels, 1, $x), $Loop+16), 1)*255, 2) & _
        Hex(BitAnd(BitShift(DllStructGetData($Pixels, 1, $x), $Loop+8), 1)*255, 2) & _
        Hex(BitAnd(BitShift(DllStructGetData($Pixels, 1, $x), $Loop), 1)*255, 2), $x)
    Next
        _GDIPlus_BitmapUnlockBits($Image[0], $Bitmap)
        _GDIPlus_BitmapUnlockBits($Canvas, $Bitmap2)
$Blur = _GDIPlus_EffectCreateBlur(2)

    For $Loop2 = 0 To 3
        _GDIPlus_ImageRotateFlip($Canvas, 1)
        _GDIPlus_BitmapApplyEffect($Canvas, $Blur)
    Next
       _GDIPlus_GraphicsDrawImageRect ($Graphics, $Canvas, 0, 0, $Width, $Height)
       _GDIPlus_ImageSaveToFile($Canvas, "SlideShowImage" & $Loop+1 & ".png")
   Next
   Else
       _GetImages()
EndIf
   
_GetImages()
GUICtrlSetState($Prev, 64)
GUICtrlSetState($Next, 64)

While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $Next
            $Current += 1
            If $Current > 3 Then $Current = 0
                _ShowImage($Current)
        Case $Prev
            $Current -= 1
            If $Current < 0 Then $Current = 3
                _ShowImage($Current)
        EndSwitch
WEnd

Func _GetImages()
    For $i = 1 To 3
        $Image[$i] = _GDIPlus_BitmapCreateFromFile("SlideShowImage" & $i & ".png")
    Next
EndFunc

Func _ShowImage($Current)
    _GDIPlus_GraphicsDrawImageRect ($Graphics, $Image[$Current], 0, 0, $Width, $Height)
EndFunc

Func _exit()
    Exit
EndFunc

 

SlideShowImage0.png

 

SlideShowImage.zip

Edited by Werty

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...