Image Viewer with fading effect
Posted: Wed Jul 12, 2006 2:16 pm
Hi,
I'd like to do a dia show, where all pictures are resized to full screen and faded in and out...
I searched in the forum, but all sprite commands seem to have a transparent color (128/128/128) and there are no image commands to do so... I also found a skinwindow library here, but there I get memory access errors (I don't like libraries)...
So my "solution" is a little bit crazy, I need 3 windows - one for the (black) background and two other for the fading effect - this works slow and seems to be "a little bit" complicate. So, anyone has a better solution for doing the fading?
Thanks,
Michael
I'd like to do a dia show, where all pictures are resized to full screen and faded in and out...
I searched in the forum, but all sprite commands seem to have a transparent color (128/128/128) and there are no image commands to do so... I also found a skinwindow library here, but there I get memory access errors (I don't like libraries)...
So my "solution" is a little bit crazy, I need 3 windows - one for the (black) background and two other for the fading effect - this works slow and seems to be "a little bit" complicate. So, anyone has a better solution for doing the fading?
Thanks,
Michael
Code: Select all
Procedure Init()
EnableExplicit
Enumeration
#Back
#Pict1
#Pict2
EndEnumeration
Global Bild1=LoadImage(100,"Picture1.bmp")
Global Bild2=LoadImage(200,"Picture2.bmp")
Global ScreenX=GetSystemMetrics_(#SM_CXSCREEN)
Global ScreenY=GetSystemMetrics_(#SM_CYSCREEN)
;InitSprite()
Global WinBack=OpenWindow(#Back,0,0,ScreenX,ScreenY,"",#PB_Window_BorderLess|#PB_Window_Invisible)
Global WinPict1=OpenWindow(#Pict1,0,0,ScreenX,ScreenY,"",#PB_Window_BorderLess|#PB_Window_Invisible)
Global WinPict2=OpenWindow(#Pict2,0,0,ScreenX,ScreenY,"",#PB_Window_BorderLess|#PB_Window_Invisible)
SetWindowColor(#Back,0)
SetWindowColor(#Pict1,0)
SetWindowColor(#Pict2,0)
HideWindow(#Back,0)
CreateGadgetList(WinPict1)
ImageGadget(100,0,0,ScreenX,ScreenY,Bild1)
CreateGadgetList(WinPict2)
ImageGadget(200,0,0,ScreenX,ScreenY,Bild2)
SetWindowLong_(WinBack,#GWL_EXSTYLE,GetWindowLong_(WinBack,#GWL_EXSTYLE)|#WS_EX_TOOLWINDOW|#WS_EX_TOPMOST)
SetWindowLong_(WinPict1,#GWL_EXSTYLE,GetWindowLong_(WinPict1,#GWL_EXSTYLE)|#WS_EX_LAYERED|#WS_EX_TOOLWINDOW|#WS_EX_TOPMOST)
SetWindowLong_(WinPict2,#GWL_EXSTYLE,GetWindowLong_(WinPict2,#GWL_EXSTYLE)|#WS_EX_LAYERED|#WS_EX_TOOLWINDOW|#WS_EX_TOPMOST)
SetLayeredWindowAttributes_(WinPict1,0,0,#LWA_ALPHA)
SetLayeredWindowAttributes_(WinPict2,0,0,#LWA_ALPHA)
HideWindow(#Pict1,0)
HideWindow(#Pict2,0)
UpdateWindow_(WinPict1)
UpdateWindow_(WinPict2)
EndProcedure
Procedure Schwupp(a,b)
Protected i
#Overlaped=128
For i=0 To 511-#Overlaped Step 12
Select i
Case 0 To 255-#Overlaped
SetLayeredWindowAttributes_(WinPict1,0,255-i,#LWA_ALPHA)
Case 256-#Overlaped To 255
SetLayeredWindowAttributes_(WinPict1,0,255-i,#LWA_ALPHA)
SetLayeredWindowAttributes_(WinPict2,0,i-256+#Overlaped,#LWA_ALPHA)
Default
SetLayeredWindowAttributes_(WinPict2,0,i-256+#Overlaped,#LWA_ALPHA)
EndSelect
Next i
EndProcedure
Procedure Main()
Init()
Schwupp(0,255)
EndProcedure
Main()