ScreenSaver: immagine in dissolvenza

« Older   Newer »
  Share  
Dragon[ITA]
CAT_IMG Posted on 23/5/2010, 13:18     +1   -1




visto che vanno di "moda" gli screensaver ho appena fatto questo, eccolo:

SPOILER (click to view)
#include <gdiplus.au3>
#include <guiconstantsex.au3>
#include <guiconstants.au3>
#include <windowsconstants.au3>
_GDIPlus_Startup()
$GUI = GUICreate("ScrSaver",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP)
GUISetState()
$brush = _GDIPlus_BrushCreateSolid(0x30000000)
$gr = _GDIPlus_GraphicsCreateFromHWND($GUI)
_GDIPlus_GraphicsClear($gr)
_GDIPlus_GraphicsSetSmoothingMode($gr,1)
$imm = _GDIPlus_ImageLoadFromFile("immagine.png")
HotKeySet("{ESC}","Stop")
HotKeySet("{SPACE}","Stop")
HotKeySet("{ENTER}","Stop")
While 1
Switch GUIGetMsg()
Case -11
Exit
Case -7
Exit
Case -9
Exit
EndSwitch
_GDIPlus_GraphicsDrawImage($gr,$imm,Random(0,@DesktopWidth,1),Random(0,@DesktopHeight,1))
_GDIPlus_GraphicsFillRect($gr,0,0,@DesktopWidth,@DesktopHeight,$brush)
WEnd

Func Stop()
Sleep(100)
Exit
EndFunc


Questa è l'immagine che dovete avere per farlo funzionare:
image
potete mettere quella che volete basta che stia nella stessa directory dello screensaver e si chiami "immagine.png"
 
Top
MHack
CAT_IMG Posted on 23/5/2010, 14:21     +1   -1




Molto carino ^^ Cerca di diminuire leggermente lo sfarfallamento e aumentare la dissolvenza, forse verrebbe più bello ;)
 
Top
Dragon[ITA]
CAT_IMG Posted on 23/5/2010, 14:38     +1   -1




ci sono riuscito.. ecco qui lo script aggiornato:

SPOILER (click to view)
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author: myName

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------
#include <gdiplus.au3>
#include <guiconstantsex.au3>
#include <guiconstants.au3>
#include <windowsconstants.au3>
_GDIPlus_Startup()
$GUI = GUICreate("ScrSaver",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP)
GUISetState()
$brush = _GDIPlus_BrushCreateSolid(0x15000000)
$graf = _GDIPlus_GraphicsCreateFromHWND($GUI)
$grBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, @DesktopHeight, $graf) ;create bitmap
$gr = _GDIPlus_ImageGetGraphicsContext($grBitmap) ;create buffer
_GDIPlus_GraphicsClear($gr)
_GDIPlus_GraphicsSetSmoothingMode($gr,2)
$imm = _GDIPlus_ImageLoadFromFile("immagine.png")
_GDIPlus_GraphicsDrawImage($graf,$grBitmap,0,0)
HotKeySet("{ESC}","Stop")
HotKeySet("{SPACE}","Stop")
HotKeySet("{ENTER}","Stop")
While 1
Switch GUIGetMsg()
Case -11
Exit
Case -7
Exit
Case -9
Exit
EndSwitch
_GDIPlus_GraphicsDrawImage($gr,$imm,Random(0,@DesktopWidth,1),Random(0,@DesktopHeight,1))
_GDIPlus_GraphicsFillRect($gr,0,0,@DesktopWidth,@DesktopHeight,$brush)
_GDIPlus_GraphicsDrawImage($graf,$grBitmap,0,0)
WEnd

Func Stop()
Sleep(100)
Exit
EndFunc
 
Top
Gianlu-thebest
CAT_IMG Posted on 23/5/2010, 18:05     +1   -1




Stupendo!!
 
Top
Dragon[ITA]
CAT_IMG Posted on 24/5/2010, 13:13     +1   -1




grazie
 
Top
MHack
CAT_IMG Posted on 24/5/2010, 13:20     +1   -1




Adesso è più bello IMHO ;)
 
Top
VforVentordici
icon6  CAT_IMG Posted on 26/5/2010, 00:00     +1   -1




Bellissimmoo :))
 
Top
lollofieretto
CAT_IMG Posted on 26/5/2010, 16:27     +1   -1




bellissimissimo =)
 
Top
Dragon[ITA]
CAT_IMG Posted on 27/5/2010, 13:30     +1   -1




ho aggiornato il codice ora utilizza meno cpu (da 45% a 20% nel mio pc)

SPOILER (click to view)
#include <gdiplus.au3>
#include <guiconstantsex.au3>
#include <guiconstants.au3>
#include <windowsconstants.au3>
_GDIPlus_Startup()
$GUI = GUICreate("ScrSaver",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP)
GUISetCursor(16)
GUISetState()
$brush = _GDIPlus_BrushCreateSolid(0x25000000)
$graf = _GDIPlus_GraphicsCreateFromHWND($GUI)
$grBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, @DesktopHeight, $graf) ;create bitmap
$gr = _GDIPlus_ImageGetGraphicsContext($grBitmap) ;create buffer
_GDIPlus_GraphicsClear($gr)
_GDIPlus_GraphicsSetSmoothingMode($gr,2)
$imm = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\immagine.png")
_GDIPlus_GraphicsDrawImage($graf,$grBitmap,0,0)
HotKeySet("{ESC}","Stop")
HotKeySet("{SPACE}","Stop")
HotKeySet("{ENTER}","Stop")
$timer = TimerInit()
While 1
Switch GUIGetMsg()
Case -11
Exit
Case -7
Exit
Case -9
Exit
EndSwitch
If timerdiff($timer) > 20 Then
$timer = TimerInit()
Draw()
EndIf
WEnd
_GDIPlus_Shutdown()

Func Draw()
_GDIPlus_GraphicsDrawImage($gr,$imm,Random(0,@DesktopWidth-200,1),Random(0,@DesktopHeight-100,1))
_GDIPlus_GraphicsDrawImage($graf,$grBitmap,0,0)
_GDIPlus_GraphicsFillRect($gr,0,0,@DesktopWidth,@DesktopHeight,$brush)
EndFunc

Func Stop()
Sleep(100)
Exit
EndFunc
 
Top
bradipooso
CAT_IMG Posted on 27/5/2010, 14:48     +1   -1




ingegnoso.. ingegnoso
 
Top
ACIDBURN16
CAT_IMG Posted on 28/5/2010, 11:03     +1   -1




Bello, bravo ;)
 
Top
10 replies since 23/5/2010, 13:18   243 views
  Share