imagenes en secuencia

Pregunta Sin Miedo no te cortes cualquier cosa para empezar - Autoit se comienza facilmente.Para Ordenes o Comandos sueltos. Ver nota como preguntar.
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

imagenes en secuencia

Mensaje por mikeeps2 »

hola amigos , aqui fastidiandolos una ves mas , se podra hacer en autoit un pequeno script utilizando 3 o 4 imagenes para darle secuencia , para que paresca que esta dando vueltas , por ejemplo , quiero utilizarlo para que de la ilucion que esta dando vueltas las azpas de un ventilador , pero no puedo utilizar gif animado , me toca hacerlo asi , seria 3 o 4 imagenes de diferentes angulos las azpas , y cuando estan en secuencia , da esa ilucion que esta dando vueltas

aqui les agrego las 3 imagenes en .png que hice a ver si se puede hacer esto con autoit

gracias
Adjuntos
Fan_01.png
Fan_01.png (10.36 KiB) Visto 5642 veces
Fan_02.png
Fan_02.png (13.21 KiB) Visto 5642 veces
Fan_03.png
Fan_03.png (12.04 KiB) Visto 5642 veces
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Hola Bro.

Bueno aquí te dejo este ejemplo usando GDI modificando un poco uno codigo de UEZ.

Coloca la imagen Fan_01.png en el mismo directorio que el código.

Código: Seleccionar todo

#include <GDIPlus.au3>

Global $bStatus=False
Global $hGUI = GUICreate("", 512, 512)
Global $oBotton=GUICtrlCreateButton("Encender",10,10,80,30)
_GDIPlus_Startup()
$hArrowTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Fan_01.png")
$iW = _GDIPlus_ImageGetWidth($hArrowTexture)
$iH = _GDIPlus_ImageGetHeight($hArrowTexture)
$iW2 = $iW / 2
$iH2 = $iH / 2

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$hArrowBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH+40, $hBackbuffer)
$hArrowGC = _GDIPlus_ImageGetGraphicsContext($hArrowBitmap)
$hArrowMatrix = _GDIPlus_MatrixCreate()


GUISetState()

AdlibRegister("Rotate", 10)
Sleep(10)
AdlibUnRegister("Rotate")


While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Rotate")
            _GDIPlus_MatrixDispose($hArrowMatrix)
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_GraphicsDispose($hArrowGC)
            _GDIPlus_BitmapDispose($hBitmap)
            _GDIPlus_BitmapDispose($hArrowBitmap)
            _GDIPlus_BitmapDispose($hArrowTexture)
            _GDIPlus_ImageDispose($hBackbuffer)
            _GDIPlus_Shutdown()
            Exit
		Case $oBotton
			if $bStatus=False Then
				AdlibRegister("Rotate", 20)
				$bStatus=True
				GUICtrlSetData($oBotton,"Apagar")
			Else
			AdlibUnRegister("Rotate")
			$bStatus=False
			GUICtrlSetData($oBotton,"Encender")
			EndIf

    EndSwitch
WEnd

Func Rotate()
    _GDIPlus_GraphicsClear($hBackbuffer,  0xFFFFFFFFF)

    _GDIPlus_MatrixTranslate($hArrowMatrix, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point
    _GDIPlus_MatrixRotate($hArrowMatrix, 10) ; rotate it around it's middle origin point
    _GDIPlus_GraphicsSetTransform($hArrowGC, $hArrowMatrix)
    _GDIPlus_MatrixTranslate($hArrowMatrix, -$iW2, -$iW2)

    _GDIPlus_GraphicsClear($hArrowGC, 0xFFFFFFFFF) ; show the GC
    _GDIPlus_GraphicsDrawImageRect($hArrowGC, $hArrowTexture, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hArrowBitmap,0, -30) ; move it's GC by an offset so the image is at the correct XY using it's origin

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 50, 50, $iW, $iH)
EndFunc
Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

hola dany , mira meti las 3 imagenes dentro de la misma carpeta , y lo ejecuto y me sale este errror

C:\Documents and Settings\AUTOMATION\Desktop\IMAGEN MOVE\IMAGEN MOV.au3 (57) : ==> Unable to parse line.:
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFFF)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFFF^ ERROR
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Mete solo una la "Fan_01.png"


que versión de autoit tienes?
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

supuestamente dice la v3.3.8.1

yo desabilite esta linea

; _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFFF)

y luego dio error en otra linea , esta

; _GDIPlus_GraphicsClear($hArrowGC, 0xFFFFFFFFF) ; show the GC

y la desabilite tambien , y me abrio el scriopt , le doy al boton encender , pero el ventilador hace como empesar pero luego se pone todo circulo , asi mira

, pense que se usarian las 3 imagenes para que hicera el efecto de girar
Adjuntos
untitled30.JPG
untitled30.JPG (103.75 KiB) Visto 5618 veces
untitled29.JPG
untitled29.JPG (102.25 KiB) Visto 5618 veces
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Prueba este código a ver que tal:

Código: Seleccionar todo

#include <GDIPlus.au3>

Global $bStatus=False
Global $hGUI = GUICreate("", 512, 512)
Global $oBotton=GUICtrlCreateButton("Encender",10,10,80,30)
_GDIPlus_Startup()
$hArrowTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Fan_01.png")
$iW = _GDIPlus_ImageGetWidth($hArrowTexture)
$iH = _GDIPlus_ImageGetHeight($hArrowTexture)
$iW2 = $iW / 2
$iH2 = $iH / 2

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$hArrowBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH+40, $hBackbuffer)
$hArrowGC = _GDIPlus_ImageGetGraphicsContext($hArrowBitmap)
$hArrowMatrix = _GDIPlus_MatrixCreate()


GUISetState()

AdlibRegister("Rotate", 10)
Sleep(10)
AdlibUnRegister("Rotate")


While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Rotate")
            _GDIPlus_MatrixDispose($hArrowMatrix)
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_GraphicsDispose($hArrowGC)
            _GDIPlus_BitmapDispose($hBitmap)
            _GDIPlus_BitmapDispose($hArrowBitmap)
            _GDIPlus_BitmapDispose($hArrowTexture)
            _GDIPlus_ImageDispose($hBackbuffer)
            _GDIPlus_Shutdown()
            Exit
		Case $oBotton
			if $bStatus=False Then
				AdlibRegister("Rotate", 20)
				$bStatus=True
				GUICtrlSetData($oBotton,"Apagar")
			Else
			AdlibUnRegister("Rotate")
			$bStatus=False
			GUICtrlSetData($oBotton,"Encender")
			EndIf

    EndSwitch
WEnd

Func Rotate()
    _GDIPlus_GraphicsClear($hBackbuffer,  0xFFFFFFFFF)

    _GDIPlus_MatrixTranslate($hArrowMatrix, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point
    _GDIPlus_MatrixRotate($hArrowMatrix, 10) ; rotate it around it's middle origin point
    _GDIPlus_GraphicsSetTransform($hArrowGC, $hArrowMatrix)
    _GDIPlus_MatrixTranslate($hArrowMatrix, -$iW2, -$iW2)

    _GDIPlus_GraphicsClear($hArrowGC, 0xFFFFFFFFF) ; show the GC
    _GDIPlus_GraphicsDrawImageRect($hArrowGC, $hArrowTexture, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hArrowBitmap,0, -30) ; move it's GC by an offset so the image is at the correct XY using it's origin

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 50, 50, $iW, $iH)
EndFunc


Func _GDIPlus_GraphicsClear($hGraphics, $iARGB = 0xFF000000)
	Local $aResult = DllCall($ghGDIPDll, "int", "GdipGraphicsClear", "handle", $hGraphics, "dword", $iARGB)
	If @error Then Return SetError(@error, @extended, False)
	If $aResult[0] Then Return SetError(10, $aResult[0], False)

	Return True
EndFunc   ;==>_GDIPlus_GraphicsClear


Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

da error linea 57

C:\Documents and Settings\AUTOMATION\Desktop\IMAGEN MOVE\IMAGEN MOV.au3 (57) : ==> Unable to parse line.:
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFFF)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFFF^ ERROR

si la desabilito da error linea 64

C:\Documents and Settings\AUTOMATION\Desktop\IMAGEN MOVE\IMAGEN MOV.au3 (64) : ==> Unable to parse line.:
_GDIPlus_GraphicsClear($hArrowGC, 0xFFFFFFFFF)
_GDIPlus_GraphicsClear($hArrowGC, 0xFFFFFFFFF^ ERROR

si la desabilito da error ahora en la 72

C:\Documents and Settings\AUTOMATION\Desktop\IMAGEN MOVE\IMAGEN MOV.au3 (72) : ==> Duplicate function name.:
Func _GDIPlus_GraphicsClear($hGraphics, $iARGB = 0xFF000000)


dime algo , una ves me lo hicieron dentro de un plugin , algo similar con estas 3 imagenes .png , que me dijeron que seria que una seguia en consecuencia con la otra , osea seria empiesa la 1 , luego la 2 , luego la 3 y luego la 1 y asi seguia y seguia , entonces daba la ilucion de estar dando vueltas , no habra algun metodo asi mas sencillito
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

mmm estoy 98.1345236543634 seguro que es el SciTE.


Actualiza tu SciTE. y te va a funcionar perfecto. y veres el bonito ventilador girando que tienes en ese codigo :)


Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

dejame ver

si baje la ultma version , y prove el segundo script y no sigue el error pero me dio por provar el primer script y si funciono

ahora dime asi como esta el primero , quiero quitarle la funcion del boton , y dejalo como trasparente solo el ventilador , la idea es que cuando yo necesite que salga la imagen dando vueltas , se abra en la parte del screen que yo le asigne , y luego cuando ya no quiera , que se cierre , me entiendes

osea , yo lo llamo junto con el cmando de prender el ventilador , luego que apague el ventilador , que se vaya
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Algo así:

Código: Seleccionar todo

#include <GDIPlus.au3>

Global $hGUI = GUICreate("", 512, 512)
_GDIPlus_Startup()
$hArrowTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Fan_01.png")
$iW = _GDIPlus_ImageGetWidth($hArrowTexture)
$iH = _GDIPlus_ImageGetHeight($hArrowTexture)
$iW2 = $iW / 2
$iH2 = $iH / 2

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$hArrowBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH+40, $hBackbuffer)
$hArrowGC = _GDIPlus_ImageGetGraphicsContext($hArrowBitmap)
$hArrowMatrix = _GDIPlus_MatrixCreate()


GUISetState()

AdlibRegister("Rotate", 20)



While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Rotate")
            _GDIPlus_MatrixDispose($hArrowMatrix)
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_GraphicsDispose($hArrowGC)
            _GDIPlus_BitmapDispose($hBitmap)
            _GDIPlus_BitmapDispose($hArrowBitmap)
            _GDIPlus_BitmapDispose($hArrowTexture)
            _GDIPlus_ImageDispose($hBackbuffer)
            _GDIPlus_Shutdown()
            Exit


    EndSwitch
WEnd

Func Rotate()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xF0F0F0F0)

    _GDIPlus_MatrixTranslate($hArrowMatrix, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point
    _GDIPlus_MatrixRotate($hArrowMatrix, 10) ; rotate it around it's middle origin point
    _GDIPlus_GraphicsSetTransform($hArrowGC, $hArrowMatrix)
    _GDIPlus_MatrixTranslate($hArrowMatrix, -$iW2, -$iW2)

    _GDIPlus_GraphicsClear($hArrowGC, 0xF0F0F0F0) ; show the GC
    _GDIPlus_GraphicsDrawImageRect($hArrowGC, $hArrowTexture, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hArrowBitmap,0, -30) ; move it's GC by an offset so the image is at the correct XY using it's origin

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 50, 50, $iW, $iH)
EndFunc

Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

correcto algo asi , lo que es posible quitarle el cuadro de afuera , dejar la imagen del ventilados solita , que este transparente en la pantalla

se me olvido , yo trate de usar el comando WinMove para moverlo y ponerlo donde yo quiera , no funciona ese aqui ah ,bueno lo ideal seria que despues de que salga solo pura imagen del ventilador , poder moverla para donde yo quiera

bueno yo encontre esto

BitOR ( $WS_POPUP, $WS_BORDER ) )

lo agregue quedando asi

Global $hGUI = GUICreate("", 512, 512, BitOR ( $WS_POPUP, $WS_BORDER ) )

pero cuando abro el script se me desaparece y solo queda en la barra de abajo
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Esta un Poco mas Difícil déjame ver si lo resuelvo :S
  • ............................................Imagen
    ......................................Imagen
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Listo No era tan difícil :)

Código: Seleccionar todo

#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Global Const $AC_SRC_ALPHA = 1
Global $hGUI = GUICreate("", 512, 512,Default,Default,$WS_POPUP, $WS_EX_LAYERED+$WS_EX_TOPMOST)

_GDIPlus_Startup()
$hArrowTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Fan_01.png")
$iW = _GDIPlus_ImageGetWidth($hArrowTexture)
$iH = _GDIPlus_ImageGetHeight($hArrowTexture)
$iW2 = $iW / 2
$iH2 = $iH / 2

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$hArrowBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH+40, $hBackbuffer)
$hArrowGC = _GDIPlus_ImageGetGraphicsContext($hArrowBitmap)
$hArrowMatrix = _GDIPlus_MatrixCreate()

GUISetState(@SW_SHOW)


AdlibRegister("Rotate", 20)



While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Rotate")
            _GDIPlus_MatrixDispose($hArrowMatrix)
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_GraphicsDispose($hArrowGC)
            _GDIPlus_BitmapDispose($hBitmap)
            _GDIPlus_BitmapDispose($hArrowBitmap)
            _GDIPlus_BitmapDispose($hArrowTexture)
            _GDIPlus_ImageDispose($hBackbuffer)
            _GDIPlus_Shutdown()
            Exit


    EndSwitch
WEnd


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", $AC_SRC_ALPHA)
    _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 Rotate()

    _GDIPlus_GraphicsClear($hBackbuffer,0x00000000)

    _GDIPlus_MatrixTranslate($hArrowMatrix, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point
    _GDIPlus_MatrixRotate($hArrowMatrix, 10) ; rotate it around it's middle origin point
    _GDIPlus_GraphicsSetTransform($hArrowGC, $hArrowMatrix)
    _GDIPlus_MatrixTranslate($hArrowMatrix, -$iW2, -$iW2)

    _GDIPlus_GraphicsClear($hArrowGC, 0x00000000) ; show the GC
    _GDIPlus_GraphicsDrawImageRect($hArrowGC, $hArrowTexture, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hArrowBitmap,0, -30) ; move it's GC by an offset so the image is at the correct XY using it's origin
      SetBitmap($hGUI,$hBitmap,255)
;~     _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 50, 50, $iW, $iH)
EndFunc


Saludos
  • ............................................Imagen
    ......................................Imagen
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

mmmm por si lo quieres mover así:

Código: Seleccionar todo

#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Global Const $AC_SRC_ALPHA = 1
Global $hGUI = GUICreate("", 512, 512,Default,Default,$WS_POPUP, $WS_EX_LAYERED+$WS_EX_TOPMOST)

_GDIPlus_Startup()
$hArrowTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Fan_01.png")
$iW = _GDIPlus_ImageGetWidth($hArrowTexture)
$iH = _GDIPlus_ImageGetHeight($hArrowTexture)
$iW2 = $iW / 2
$iH2 = $iH / 2

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$hArrowBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH+40, $hBackbuffer)
$hArrowGC = _GDIPlus_ImageGetGraphicsContext($hArrowBitmap)
$hArrowMatrix = _GDIPlus_MatrixCreate()

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
AdlibRegister("Rotate", 20)



While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Rotate")
            _GDIPlus_MatrixDispose($hArrowMatrix)
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_GraphicsDispose($hArrowGC)
            _GDIPlus_BitmapDispose($hBitmap)
            _GDIPlus_BitmapDispose($hArrowBitmap)
            _GDIPlus_BitmapDispose($hArrowTexture)
            _GDIPlus_ImageDispose($hBackbuffer)
            _GDIPlus_Shutdown()
            Exit


    EndSwitch
WEnd



Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST

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", $AC_SRC_ALPHA)
    _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 Rotate()

    _GDIPlus_GraphicsClear($hBackbuffer,0x00000000)

    _GDIPlus_MatrixTranslate($hArrowMatrix, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point
    _GDIPlus_MatrixRotate($hArrowMatrix, 10) ; rotate it around it's middle origin point
    _GDIPlus_GraphicsSetTransform($hArrowGC, $hArrowMatrix)
    _GDIPlus_MatrixTranslate($hArrowMatrix, -$iW2, -$iW2)

    _GDIPlus_GraphicsClear($hArrowGC, 0x00000000) ; show the GC
    _GDIPlus_GraphicsDrawImageRect($hArrowGC, $hArrowTexture, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hArrowBitmap,0, -30) ; move it's GC by an offset so the image is at the correct XY using it's origin
      SetBitmap($hGUI,$hBitmap,255)
;~     _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 50, 50, $iW, $iH)
EndFunc





Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

mmmmmmmmmm quedo perecto , pero no me referia a moverlo asi , sino a darle coordenadas , para que se quede en el lugar del screen que yo desee siempre que lo llame

en los script que me has hecho he usado el winmove para posicionarlo en el lugar que yo quiera , algo asi no se podra usar aqui
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Hola. en el principio del código este coloque dos variables $iLeft y $iTop que serán las coordenadas. las coloque por Default para que aparezcan en el centro. vos las podes cambiar y poner en otra parte. o simplemente usar winmove.

Código: Seleccionar todo

#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Global Const $AC_SRC_ALPHA = 1

Global $iLeft=Default,$iTop=Default


_GDIPlus_Startup()
$hArrowTexture = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Fan_01.png")
$iW = _GDIPlus_ImageGetWidth($hArrowTexture)
$iH = _GDIPlus_ImageGetHeight($hArrowTexture)

Global $hGUI = GUICreate("Ventilador", $iW, $iH,$iLeft,$iTop,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_TOPMOST)
$iW2 = $iW / 2
$iH2 = $iH / 2

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$hArrowBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH+40, $hBackbuffer)
$hArrowGC = _GDIPlus_ImageGetGraphicsContext($hArrowBitmap)
$hArrowMatrix = _GDIPlus_MatrixCreate()

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
AdlibRegister("Rotate", 20)




While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Rotate")
            _GDIPlus_MatrixDispose($hArrowMatrix)
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_GraphicsDispose($hArrowGC)
            _GDIPlus_BitmapDispose($hBitmap)
            _GDIPlus_BitmapDispose($hArrowBitmap)
            _GDIPlus_BitmapDispose($hArrowTexture)
            _GDIPlus_ImageDispose($hBackbuffer)
            _GDIPlus_Shutdown()
            Exit


    EndSwitch
WEnd



Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST

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", $AC_SRC_ALPHA)
    _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 Rotate()

    _GDIPlus_GraphicsClear($hBackbuffer,0x00000000)

    _GDIPlus_MatrixTranslate($hArrowMatrix, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point
    _GDIPlus_MatrixRotate($hArrowMatrix, 10) ; rotate it around it's middle origin point
    _GDIPlus_GraphicsSetTransform($hArrowGC, $hArrowMatrix)
    _GDIPlus_MatrixTranslate($hArrowMatrix, -$iW2, -$iW2)

    _GDIPlus_GraphicsClear($hArrowGC, 0x00000000) ; show the GC
    _GDIPlus_GraphicsDrawImageRect($hArrowGC, $hArrowTexture, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $hArrowBitmap,0, -30) ; move it's GC by an offset so the image is at the correct XY using it's origin
      SetBitmap($hGUI,$hBitmap,255)
;~     _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 50, 50, $iW, $iH)
EndFunc

Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

socio ya regrese , ya vistes el video
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Pero no lo entiendo estoy por el correo entra y me explicas
  • ............................................Imagen
    ......................................Imagen
Avatar de Usuario
Dany
Profesional del Autoit
Mensajes: 651
Registrado: 28 Mar 2012, 22:49

Re: imagenes en secuencia

Mensaje por Dany »

Algo simple podria ser esto:

Código: Seleccionar todo

#include <WindowsConstants.au3>
#include <GDIPlus.au3>


Global $iLeft=Default,$iTop=Default
Global $iW=400,$iH=400
Global $iHCurve=$iW/4

$hGUI = GUICreate("", $iW, $iH, $iLeft, $iTop,$WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0x000000,$hGUI)
GUISetState(@SW_SHOW)

_WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000,255)
_GDIPlus_Startup()

local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
local $hPen = _GDIPlus_PenCreate(0xFF0000FF, 15)
;~ _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY)


AdlibRegister("Simular",800)

While 1
    Switch GUIGetMsg()
        Case -3
            AdlibUnRegister("Simular")
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_BitmapDispose($hPen)
            _GDIPlus_Shutdown()
            Exit
    EndSwitch
WEnd


Func Simular()
local Static $i=1
_GDIPlus_GraphicsClear($hGraphic)
_GDIPlus_GraphicsDrawArc($hGraphic,($iW-$iHCurve*$i),0,$iHCurve *$i, $iHCurve*$i, 180, -100,$hPen)
$i+=1
if $i>3 then $i=1
EndFunc


Saludos
  • ............................................Imagen
    ......................................Imagen
mikeeps2
Hacker del Foro
Mensajes: 103
Registrado: 24 May 2008, 16:34

Re: imagenes en secuencia

Mensaje por mikeeps2 »

wowo perfecto , le agregue el winmove como el otro , y trabaja bien

oye una curiosidad de donde el agarra las imagenes , mira que busque y no lo encontre jajjajaaj
me lo escondistes ahora

porqie si yo quisiera usar otra imagen , donde la pongo jajajaj


ah ya la encontre la imagenes , es con comandos , no es imagen , me hicistes trampa jajjajaa
Responder