Sign in to follow this  
Followers 0
wakillon

Animated Splash

28 posts in this topic

#1 ·  Posted (edited)

So, at first, I just wanted a transparent png splash screen and the idea came to me to simulate their movements just for fun

and it gives this : 3 examples
 

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Dim $_GuiDelete

$sPngUrl = 'http://s21.postimg.org/4hofttn9z/20141102175221.png'
$sPngPath = @TempDir & '\temp1.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

; example 1
For $iWidth = 200 To @DesktopWidth/2 Step 10
    $_Gui = GUICreate ( 'gui', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iWidth / $fRatio )
    _SetBitMap ( $_Gui, $hImage, 255, $iWidth, $iWidth / $fRatio )
    GUISetState ( @SW_SHOW )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
While Not $_GuiDelete
    $_GuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
WEnd
Sleep ( 3000 )

; example 2
$sPngUrl = 'http://s17.postimg.org/v95y9tnvj/20141102180621.png'
$sPngPath = @TempDir & '\temp2.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

For $iWidth = 50 To @DesktopWidth/3 Step 10
    $_Gui = GUICreate ( 'gui', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iHeight )
    _SetBitMap ( $_Gui, $hImage, 255, $iWidth, $iHeight )
    GUISetState ( @SW_SHOW )
Next

Sleep ( 3000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
$_GuiDelete= Not $_GuiDelete
While Not $_GuiDelete
    $_GuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
WEnd
Sleep ( 2000 )

; example 3
$sPngUrl = 'http://s11.postimg.org/5xco0uw77/20141102174904.png'
$sPngPath = @TempDir & '\temp3.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

For $iWidth = 300 To @DesktopWidth/2 Step 10
    $_Gui = GUICreate ( '', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iHeight )
    _SetBitMap ( $_Gui, $hImage, 255, $iWidth, $iWidth / $fRatio )
    GUISetState ( @SW_SHOW )
Next

Sleep ( 3000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
$_GuiDelete= Not $_GuiDelete
While Not $_GuiDelete
    $_GuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
WEnd
Exit

Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height )
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC ( 0 )
    $hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC )
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage )
    $hOld = _WinAPI_SelectObject ( $hMemDC, $hBitmap )
    $tSize = DllStructCreate ( $tagSIZE )
    $pSize = DllStructGetPtr ( $tSize )
    DllStructSetData ( $tSize, 'X', $n_width )
    DllStructSetData ( $tSize, 'Y', $n_height )
    $tSource = DllStructCreate ( $tagPOINT )
    $pSource = DllStructGetPtr ( $tSource )
    $tBlend = DllStructCreate ( $tagBLENDFUNCTION )
    $pBlend = DllStructGetPtr ( $tBlend )
    DllStructSetData ( $tBlend, 'Alpha', $iOpacity )
    DllStructSetData ( $tBlend, 'Format', 1 )
    _WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA )
    _WinAPI_ReleaseDC ( 0, $hScrDC )
    _WinAPI_SelectObject ( $hMemDC, $hOld )
    _WinAPI_DeleteObject ( $hBitmap )
    _WinAPI_DeleteDC ( $hMemDC )
EndFunc ;==> _SetBitmap ()

Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage = '' )
    Local $oldImage, $GC, $newBmp, $newGC
    If $sOutImage = '' Then _GDIPlus_Startup ()
    $oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage )
    $GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage )
    $newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC )
    $newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp )
    _GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH )
    _GDIPlus_GraphicsDispose ( $GC )
    _GDIPlus_GraphicsDispose ( $newGC )
    _GDIPlus_ImageDispose ( $oldImage )
    If $sOutImage = '' Then
    Return $newBmp
    Else
    _GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage )
    _GDIPlus_BitmapDispose ( $newBmp )
    _GDIPlus_Shutdown ()
    Return 1
    EndIf
EndFunc ;==> _ImageResize ()
gui erasure is a bit jerky i don't know why...
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Hey buddy, nice script...thanks for sharing :mellow:

Yup, the animation is a little bit 'lag', but it's really nice.

Keep it up !


AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites

Thank's ! :mellow:

I don't know your pc config but if the animation is a little bit 'lag' for you,

change "Step 10" to 20.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

This is really great! Thanks for sharing :mellow:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks ! :P
and as you like it, I put 3 other examples ! :mellow:
 

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Global $bGuiDelete

$sPngUrl = 'http://s27.postimg.org/i5tbtkt9f/20141102181657.png'
$sPngPath = @TempDir & '\temp4.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

; example 4
For $iWidth = 200 To @DesktopWidth/2 Step 15
    $hGui = GUICreate ( 'gui', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iWidth / $fRatio )
    _SetBitMap ( $hGui, $hImage, 255, $iWidth, $iWidth / $fRatio )
    GUISetState ( @SW_SHOW )
    Sleep ( 20 )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
While Not $bGuiDelete
    $bGuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
    Sleep ( 10 )
WEnd
Sleep ( 3000 )

; example 5
$sPngUrl = 'http://s3.postimg.org/psjavjlsj/20141102181755.png'
$sPngPath = @TempDir & '\temp5.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

For $iWidth = 50 To @DesktopWidth/3 Step 20
    $hGui = GUICreate ( 'gui', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iHeight )
    _SetBitMap ( $hGui, $hImage, 255, $iWidth, $iHeight )
    GUISetState ( @SW_SHOW )
    Sleep ( 20 )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
$bGuiDelete= Not $bGuiDelete
While Not $bGuiDelete
    $bGuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
    Sleep ( 10 )
WEnd
Sleep ( 3000 )

; example 6
$sPngUrl = 'http://s21.postimg.org/6gwtk1d7b/20141102181824.png'
$sPngPath = @TempDir & '\temp6.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

For $iWidth = 300 To @DesktopWidth/2 Step 15
    $hGui = GUICreate ( '', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iHeight )
    _SetBitMap ( $hGui, $hImage, 255, $iWidth, $iWidth / $fRatio )
    GUISetState ( @SW_SHOW )
    Sleep ( 20 )
Next

Sleep ( 3000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
$bGuiDelete= Not $bGuiDelete
While Not $bGuiDelete
    $bGuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
    Sleep ( 10 )
WEnd
Exit

Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height )
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC ( 0 )
    $hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC )
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage )
    $hOld = _WinAPI_SelectObject ( $hMemDC, $hBitmap )
    $tSize = DllStructCreate ( $tagSIZE )
    $pSize = DllStructGetPtr ( $tSize )
    DllStructSetData ( $tSize, 'X', $n_width )
    DllStructSetData ( $tSize, 'Y', $n_height )
    $tSource = DllStructCreate ( $tagPOINT )
    $pSource = DllStructGetPtr ( $tSource )
    $tBlend = DllStructCreate ( $tagBLENDFUNCTION )
    $pBlend = DllStructGetPtr ( $tBlend )
    DllStructSetData ( $tBlend, 'Alpha', $iOpacity )
    DllStructSetData ( $tBlend, 'Format', 1 )
    _WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA )
    _WinAPI_ReleaseDC ( 0, $hScrDC )
    _WinAPI_SelectObject ( $hMemDC, $hOld )
    _WinAPI_DeleteObject ( $hBitmap )
    _WinAPI_DeleteDC ( $hMemDC )
EndFunc ;==> _SetBitmap ()

Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage='' )
    Local $oldImage, $GC, $newBmp, $newGC
    If $sOutImage = '' Then _GDIPlus_Startup ()
    $oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage )
    $GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage )
    $newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC )
    $newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp )
    _GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH )
    _GDIPlus_GraphicsDispose ( $GC )
    _GDIPlus_GraphicsDispose ( $newGC )
    _GDIPlus_ImageDispose ( $oldImage )
    If $sOutImage = '' Then
    Return $newBmp
    Else
    _GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage )
    _GDIPlus_BitmapDispose ( $newBmp )
    _GDIPlus_Shutdown ()
    Return 1
    EndIf
EndFunc ;==> _ImageResize ()

Voila, voila !

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Again, very nice. Thanks for all the examples. 5 Stars from me! :mellow:

Share this post


Link to post
Share on other sites

I try to increase the Step to 17, and it works perfectly for me...thanks

5 stars from me :mellow:


AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thanks to all
3 last examples...

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Global $bGuiDelete

$sPngUrl = 'http://s21.postimg.org/pvbw8bpqv/20141102183731.png'
$sPngPath = @TempDir & '\temp7.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

; example 7
For $iWidth = 200 To @DesktopWidth/2 Step 15
    $hGui = GUICreate ( 'gui', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iWidth / $fRatio )
    _SetBitMap ( $hGui, $hImage, 255, $iWidth, $iWidth / $fRatio )
    GUISetState ( @SW_SHOW )
    Sleep ( 20 )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
While Not $bGuiDelete
    $bGuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
    Sleep ( 10 )
WEnd
Sleep ( 3000 )

; example 8
$sPngUrl = 'http://s17.postimg.org/695u3lpgf/20141102183037.png'
$sPngPath = @TempDir & '\temp8.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

For $iWidth = 50 To @DesktopWidth/3 Step 20
    $hGui = GUICreate ( 'gui', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iHeight )
    _SetBitMap ( $hGui, $hImage, 255, $iWidth, $iHeight )
    GUISetState ( @SW_SHOW )
    Sleep ( 20 )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
$bGuiDelete= Not $bGuiDelete
While Not $bGuiDelete
    $bGuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
    Sleep ( 10 )
WEnd
Sleep ( 3000 )

; example 9
$sPngUrl = 'http://s3.postimg.org/4aibj8hzn/20141102190506.png'
$sPngPath = @TempDir & '\temp9.png'
If Not FileExists ( $sPngPath ) Then InetGet ( $sPngUrl, $sPngPath, 1 )
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile ( $sPngPath )
$iWidth = _GDIPlus_ImageGetWidth ( $hImage )
$iHeight = _GDIPlus_ImageGetHeight ( $hImage )
$fRatio = $iWidth / $iHeight

For $iWidth = 300 To @DesktopWidth/2 Step 15
    $hGui = GUICreate ( '', $iWidth , $iWidth / $fRatio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
    $hImage = _ImageResize ( $sPngPath, $iWidth, $iHeight )
    _SetBitMap ( $hGui, $hImage, 255, $iWidth, $iWidth / $fRatio )
    GUISetState ( @SW_SHOW )
;~  Sleep ( 20 )
Next

Sleep ( 3000 )
_GDIPlus_GraphicsDispose ( $hImage )
_GDIPlus_Shutdown ()
$bGuiDelete= Not $bGuiDelete
While Not $bGuiDelete
    $bGuiDelete= Not GUIDelete ( WinGetHandle ( 'gui' ) )
    Sleep ( 10 )
WEnd
Exit

Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height )
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC ( 0 )
    $hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC )
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage )
    $hOld = _WinAPI_SelectObject ( $hMemDC, $hBitmap )
    $tSize = DllStructCreate ( $tagSIZE )
    $pSize = DllStructGetPtr ( $tSize )
    DllStructSetData ( $tSize, 'X', $n_width )
    DllStructSetData ( $tSize, 'Y', $n_height )
    $tSource = DllStructCreate ( $tagPOINT )
    $pSource = DllStructGetPtr ( $tSource )
    $tBlend = DllStructCreate ( $tagBLENDFUNCTION )
    $pBlend = DllStructGetPtr ( $tBlend )
    DllStructSetData ( $tBlend, 'Alpha', $iOpacity )
    DllStructSetData ( $tBlend, 'Format', 1 )
    _WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA )
    _WinAPI_ReleaseDC ( 0, $hScrDC )
    _WinAPI_SelectObject ( $hMemDC, $hOld )
    _WinAPI_DeleteObject ( $hBitmap )
    _WinAPI_DeleteDC ( $hMemDC )
EndFunc ;==> _SetBitmap ()

Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage='' )
    Local $oldImage, $GC, $newBmp, $newGC
    If $sOutImage = '' Then _GDIPlus_Startup ()
    $oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage )
    $GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage )
    $newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC )
    $newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp )
    _GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH )
    _GDIPlus_GraphicsDispose ( $GC )
    _GDIPlus_GraphicsDispose ( $newGC )
    _GDIPlus_ImageDispose ( $oldImage )
    If $sOutImage = '' Then
    Return $newBmp
    Else
    _GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage )
    _GDIPlus_BitmapDispose ( $newBmp )
    _GDIPlus_Shutdown ()
    Return 1
    EndIf
EndFunc ;==> _ImageResize ()
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I take your first example and modified it:

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
HotKeySet("{Esc}", "_exit")
Dim $_GuiDelete

$_PngUrl = 'http://1.2.3.12/bmi/www.autoit.de/wcf/images/future/autoit_logo_gtaspider.png'
$_PngPath = @TempDir & "\autoIt.png"
If Not FileExists($_PngPath) Then InetGet($_PngUrl, $_PngPath, 1)
_GDIPlus_Startup()
$_Image = _GDIPlus_ImageLoadFromFile($_PngPath)
$_Width = _GDIPlus_ImageGetWidth($_Image)
$_Height = _GDIPlus_ImageGetHeight($_Image)
$_Ratio = $_Width / $_Height

$_Gui = GUICreate("gui", 1, 1, 1, 1, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState(@SW_SHOW)
For $_Width = 200 To @DesktopWidth Step 20
    WinMove($_Gui, "", (@DesktopWidth - $_Width) / 2, (@DesktopHeight - $_Height) / 2, $_Width, $_Width / $_Ratio)
    $_Image = _ImageResize($_PngPath, $_Width, $_Width / $_Ratio)
    _SetBitMap($_Gui, $_Image, 255, $_Width, $_Width / $_Ratio)
    Sleep(210-$_Width)
Next

For $_Width = @DesktopWidth To 200 Step -20
    WinMove($_Gui, "", (@DesktopWidth - $_Width) / 2, (@DesktopHeight - $_Height) / 2, $_Width, $_Width / $_Ratio)
    $_Image = _ImageResize($_PngPath, $_Width, $_Width / $_Ratio)
    _SetBitMap($_Gui, $_Image, 255, $_Width, $_Width / $_Ratio)
    Sleep(210-$_Width)
Next
_exit()

Func _exit()
    _GDIPlus_GraphicsDispose($_Image)
    _GDIPlus_Shutdown()
EndFunc   ;==>_exit

Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width, $n_height)
;http://www.autoitscript.com/forum/index.php?showtopic=115391&view=findpost&p=806020
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $n_width)
    DllStructSetData($tSize, "Y", $n_height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>_SetBitmap

Func _ImageResize($sInImage, $newW, $newH, $sOutImage = "")
;http://www.autoitscript.com/forum/index.php?showtopic=115391&view=findpost&p=806020
    Local $oldImage, $GC, $newBmp, $newGC
    If $sOutImage = "" Then _GDIPlus_Startup()
    $oldImage = _GDIPlus_ImageLoadFromFile($sInImage)
    $GC = _GDIPlus_ImageGetGraphicsContext($oldImage)
    $newBmp = _GDIPlus_BitmapCreateFromGraphics($newW, $newH, $GC)
    $newGC = _GDIPlus_ImageGetGraphicsContext($newBmp)
    _GDIPlus_GraphicsDrawImageRect($newGC, $oldImage, 0, 0, $newW, $newH)
    _GDIPlus_GraphicsDispose($GC)
    _GDIPlus_GraphicsDispose($newGC)
    _GDIPlus_ImageDispose($oldImage)
    If $sOutImage = "" Then
        Return $newBmp
    Else
        _GDIPlus_ImageSaveToFile($newBmp, $sOutImage)
        _GDIPlus_BitmapDispose($newBmp)
        _GDIPlus_Shutdown()
        Return 1
    EndIf
EndFunc   ;==>_ImageResize
I think this is the better solution, because the Gui is only created once

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

On my computer, it starts zooming in ok, but when it gets close to its max size, it starts to shake. Same with zooming out. It shakes when it is close to the max size.

Edit: It has to do with the WinMove call. I changed the WinMove location to 0, 0 and it works fine. The math for centering the gui is obviously correct, but I don't know why the GUI would shake like it is currently.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

On my computer, it starts zooming in ok, but when it gets close to its max size, it starts to shake. Same with zooming out. It shakes when it is close to the max size.

Edit: It has to do with the WinMove call. I changed the WinMove location to 0, 0 and it works fine. The math for centering the gui is obviously correct, but I don't know why the GUI would shake like it is currently.

If it shake, try a Png splash fade ! :mellow:

#include <Memory.au3>
#Include <WindowsConstants.au3>
#include <String.au3>
#include <GDIPlus.au3>
#NoTrayIcon
Dim $socket

For $_Load = 1 To 5
    _GDIPlus_Startup ( )    
    Switch $_Load
        Case 1
    $hImage = _GDIPlus_ImageLoadFromInet ( "http://www.autoit.de", "/wcf/images/future/autoit_logo_gtaspider.png" )
        Case 2      
    $hImage = _GDIPlus_ImageLoadFromInet ( "http://upload.wikimedia.org", "/wikipedia/fr/3/38/Guitar_Hero_Logo.png" )
        Case 3      
    $hImage = _GDIPlus_ImageLoadFromInet ( "http://www.sosdevoirs.org", "/blogue/wp-content/uploads/2010/02/vikidia-logo.png" )
        Case 4      
    $hImage = _GDIPlus_ImageLoadFromInet ( "http://arkanfashion.com", "/images/071112_Disney_logo%20copy.png" )
        Case 5      
            $hImage = _GDIPlus_ImageLoadFromInet ( "http://www.canoe.polymtl.ca", "/web/images/stories/Youtube.png" )
    EndSwitch
    $_Width = _GDIPlus_ImageGetWidth ( $hImage )
    $_Height = _GDIPlus_ImageGetHeight ( $hImage )
    $hwnd = GUICreate ( "Display image from memory", $_Width, $_Height, -1, -1, -1, BitOr ( $WS_EX_LAYERED, $WS_EX_TOOLWINDOW ) )
    GUISetState ( )
    WinSetOnTop ( $hwnd,"",1 )
    For $i = 70 to 255 step 2
    _SetBitmap ( $hwnd, $hImage, $i )
    Sleep ( 20 )
    Next
    Sleep ( 1000 )
    For $i = 255 to 0 step -2
    _SetBitmap ( $hwnd, $hImage, $i )
    Sleep ( 20 )
    Next
    _GDIPlus_ImageDispose ( $hImage )
    _GDIPlus_Shutdown ( )
Next

Exit

Func _GDIPlus_ImageLoadFromInet ( $sHost, $sSeite ) ; http://www.autoit.de/index.php?page=Thread&threadID=19707
    If StringInStr ( $sHost, "http://" ) Then $sHost = StringReplace ( $sHost, "http://", "" )
    If StringRegExp ( $sHost, "\.../" ) Then $sHost = Stringreplace ( $sHost, "/", "" )
    TCPStartup ( )
    $sIp = TCPNameToIP ( $sHost )
    $sData = "GET " & $sSeite & " HTTP/1.1" & @Crlf & _
    "Host: " & $sHost & @Crlf & _
    "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)" & @Crlf & _
    "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" & @Crlf & _
    "Accept-Language:de-de,de;q=0.8,en-us;q=0.5,en;q=0.3" & @Crlf & _
    "Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @Crlf & _
    "Connection: close" & @Crlf & @Crlf
    $sSocket = TCPConnect ( $sIp, 80 )
    TCPSend ( $sSocket, $sData )
    If @error Then Return Seterror ( 1 )
    Local $sRecv_header = "", $sRecv_binary = "0x"
    Do
    $sRecv_header = TCPRecv ( $sSocket, 1 )
    Until $sRecv_header <> ""
    Do 
    $sRecv_header &= TCPRecv ( $sSocket, 1 )
    Until StringInStr ( $sRecv_header, @Crlf & @Crlf )
    $aArray_help = _StringBetween ( $sRecv_header, 'Content-Length: ', @Crlf )
    If NOT isarray ( $aArray_help ) Then
    TCPCloseSocket ( $socket )
    TCPShutdown ( )
    Return Seterror ( 1 )
    EndIf
    $iBytes = $aArray_help[0]
    Do
    $sRecv_binary &= StringTrimLeft ( TCPRecv ( $sSocket, 1024, 1 ), 2 )
    Until BinaryLen ( Binary ( $sRecv_binary ) ) >= $iBytes 
    TCPCloseSocket ( $sSocket )
    TCPShutdown ( )
    $memBitmap = Binary ( $sRecv_binary )
    $len = BinaryLen ( $memBitmap )
    $hData = _MemGlobalAlloc ( $len, 0x0002 )
    $pData = _MemGlobalLock ( $hData )
    $tMem = DllStructCreate ( "byte[" & $len & "]", $pData )
    DllStructSetData ( $tMem, 1, $memBitmap )
    _MemGlobalUnlock ( $hData )
    $aResult = DllCall ( "ole32.dll", "int", "CreateStreamOnHGlobal", "hwnd", $pData, "int", True, "ptr*", 0 )
    If @error Then Return SetError ( @error, @extended, 0 )
    $aResult = DllCall ( $ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $aResult[3], "int*", 0 )
    If @error Then Return SetError ( @error, @extended, 0 )
    Return $aResult[2]
EndFunc ;==> _GDIPlus_ImageLoadFromInet ( )

Func _SetBitmap ( $hGUI, $hImage, $iOpacity )
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC ( 0 )
    $hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC )
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage )
    $hOld   = _WinAPI_SelectObject ( $hMemDC, $hBitmap )
    $tSize = DllStructCreate ( $tagSIZE )
    $pSize = DllStructGetPtr ( $tSize )
    DllStructSetData ( $tSize, "X", _GDIPlus_ImageGetWidth ( $hImage ) )
    DllStructSetData ( $tSize, "Y", _GDIPlus_ImageGetHeight ( $hImage ) )
    $tSource = DllStructCreate ( $tagPOINT )
    $pSource = DllStructGetPtr ( $tSource )
    $tBlend = DllStructCreate ( $tagBLENDFUNCTION )
    $pBlend = DllStructGetPtr ( $tBlend )
    DllStructSetData ( $tBlend, "Alpha" , $iOpacity )
    DllStructSetData ( $tBlend, "Format", 1 )
 _WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA )
 _WinAPI_ReleaseDC ( 0, $hScrDC )
 _WinAPI_SelectObject ( $hMemDC, $hOld )
 _WinAPI_DeleteObject ( $hBitmap )
 _WinAPI_DeleteDC ( $hMemDC )
EndFunc ;==> _SetBitmap ( )

Five examples for fun too ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

That looks good. Kep up the good work.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

That looks good. Kep up the good work.

Thank's dantay9 Posted Image

Sorry for the delay, i 'm on holyday in Normandy ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

wakillon,

I've used one of these in the first-run startup sequence for iTunesTweet :blink: Hopefully when I release the update people will like it ;)

James

Hi james, Posted Image

i'm sincerly very proud to help you in your project ! Posted Image

Let me know if people like it !

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

PNG with transparency are great for splashscreen and taking the idea of AutoBert,
I had fun trying differents combinations, and it gives this :

Previous downloads : 1065

AnimatedSplash2014.2.au3

I hope you enjoy these few examples ! :king:

All Png are downloaded on postimg.org at first execution.
 

Edited by wakillon
1 person likes this

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

My God what a beautiful (^.^)

Congratulations nice script very well prepared


-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Share this post


Link to post
Share on other sites

My God what a beautiful (^.^)

Congratulations nice script very well prepared

Thanks ! Posted Image

It would be interesting to create more complex movements...

Don't hesitate to post your ideas ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Skeletor
      By Skeletor
      MS Splash Screens
      The office 2016/17 office suite has made many people turn heads with its functions and especially their splash screen.
      I now present to you, the MS Style Splash Screen. For Rookies, Novices and anyone who wants a ready made splash screen for your gui application.

      You can now download it and also try it out yourself.
      You have three colors to choose from:
      Blue
      Red
      Green
      All three colours are from the famous programs.
      I also included the KODA form to you can have freedom with this splash screen.
      Note: the KODA form does not have the three colours as well as the correct blue. 

      Have fun and enjoy.
      Note:
      I will update the splash to add the automated 3 dots animation at a later stage. 
       
       
    • Skeletor
      By Skeletor
      A gui splash screen. Themed after the famous MS Office Suite.
      Three colours to choose from, Red, Blue and Green.
      You can change the labels to your own application.

      Also bundled with this is the KODA form. So you can open up and see the basic structure of this splash screen.
       
      Splash Screen GUI.zip
    • Skeletor
      By Skeletor
      Hi All,
      I know many newbies search for this feature.
      I decided to share this piece of code with everyone.
      Basically its a "splash screen" that has a transparent image.
      In a nutshell - Gui with a transparent gif.
      Enjoy...
      Download attachment....
       
      Splash Screen GUI.zip
    • wakillon
      By wakillon
      Animated Gif Analyzer
      Display internal infos from animated gifs
      Global and Local Palettes supported
      A value in red indicate that value is false or useless
      Flashing green text ( BK or TR)  indicate background color and transparent color
      Download available in download section

      I created this script because I needed, for an other project, to know in detail the internal characteristics of animated gif
      I had searched a similar soft on internet but I didnt found anything ...
       
    • wakillon
      By wakillon
      Display internal infos from animated gifs
      Global and Local Palettes supported
      A value in red indicate that value is false or useless