Jump to content

Recommended Posts

Posted (edited)

Estou tentando usar o UDF feito por@AlmiranteAlkex  para exibir as imagens em fullscreen mas quando coloco em fullscreen só a tela fica toda preta mas a imagem não ocupa a tela inteira, alguém sabe como fazer a imagem ocupar a tela inteira usando essa UDF?

Link para baixar o UDF e os arquivos:   https://www.autoitscript.com/forum/applications/core/interface/file/attachment.php?id=37773

Edited by Belini
Posted (edited)

@Werty _  with SplashImageOn() it doesn't work, it just flashes without showing images

I managed to open the image in full screen, but it flickers between image changes and there is no video effect

Files used in my test:  https://mega.nz/file/wIsXxCSB#0B6n4zq-AMsRYRDWKyKfLqOOY9wuA4STEwEELJz8Z6Q

 

Edited by Belini
Posted

I messed up the original "SDL Example image viewer.au3" listing a bit....
... also put the "Imgs" folder there...

#include "SDL_image.au3"
#include "SDL_gfx.au3"
#include "SDL.au3"

OnAutoItExitRegister("_Quit")

_SDL_Startup_gfx()
_SDL_Init_image()
_SDL_Init($_SDL_INIT_VIDEO)

$Surface = _SDL_SetVideoMode(@DesktopWidth, @DesktopHeight, 32, BitOR($_SDL_SWSURFACE, $_SDL_FULLSCREEN))     ; , $_SDL_DOUBLEBUF ))    ;Software surfaces doesn't need to be locked ;)

$Image = _IMG_Load(".\imgs\1.jpg")

$Struct = DllStructCreate($tagSDL_SURFACE, $Image)
$W = DllStructGetData($Struct, "w")
$H = DllStructGetData($Struct, "h")
$ZoomX = @DesktopWidth / $W
$ZoomY = @DesktopHeight / $H

For $i = 1 To 169
    $Image = _IMG_Load(".\imgs\" & $i & ".jpg")
    $SurfaceZoom = _SDL_zoomSurface($Image, $ZoomX, $ZoomY, 1)
    _SDL_FreeSurface($Image)
    ; $Surface = _SDL_GuiCreate($W/$Zoom & "x" & $H/$Zoom, $W,  $H , 32, $_SDL_SWSURFACE)
    _SDL_BlitSurface($SurfaceZoom, 0, $Surface, 0)
    _SDL_FreeSurface($SurfaceZoom)
    _SDL_Flip($Surface)
Next
_Quit()
#cs
While 1
    Sleep(10)
WEnd
#ce
Func _Quit()
    ConsoleWrite("Once upon a time... You saw me ;)" & @CRLF)            ;This will like neeever happen.... Almost.
    If IsDeclared("Surface") Then _SDL_FreeSurface($Surface)
    If $__SDL_DLL <> -1 Then _SDL_Quit()
    If $__SDL_DLL_image <> -1 Then _SDL_Shutdown_image()
    If $__SDL_DLL_gfx <> -1 Then _SDL_Shutdown_gfx()
EndFunc   ;==>_Quit

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)

@Gianni stopped blinking but the image exchange is slow and I even got a good speed but then the image doesn't occupy the whole screen.

#include "SDL_image.au3"
#include "SDL.au3"

HotKeySet("{esc}", "_Quit")

global $conta_img = 0

_SDL_Init_image()
_SDL_Init($_SDL_INIT_VIDEO)

$Surface = _SDL_SetVideoMode(@DesktopWidth, @DesktopHeight, 32, BitOR($_SDL_SWSURFACE, $_SDL_FULLSCREEN))     ; , $_SDL_DOUBLEBUF ))    ;Software surfaces doesn't need to be locked ;)

AdlibRegister("Player_jpg", 50)

while 1
    sleep(1000)
wend

func Player_jpg()
    $conta_img += 1
    if $conta_img > 169 then $conta_img = 1
    $Image = _IMG_Load(".\imgs\" & $conta_img & ".jpg")
    _SDL_BlitSurface($Image, 0, $Surface, 0)
    _SDL_FreeSurface($Image)
    _SDL_Flip($Surface)
endfunc

Func _Quit()
    ConsoleWrite("Once upon a time... You saw me ;)" & @CRLF)            ;This will like neeever happen.... Almost.
    If IsDeclared("Surface") Then _SDL_FreeSurface($Surface)
    If $__SDL_DLL <> -1 Then _SDL_Quit()
    If $__SDL_DLL_image <> -1 Then _SDL_Shutdown_image()

 

Edited by Belini
Posted

Can anyone give a tip on how to show the image in fullscreen without getting slow using sdl?

Posted

Don't know if you tried it but first Download the AutoItX package from the official website.

Extract the package and copy the "AutoItX3.dll" file to your AutoIt installation folder.
Initialize SDL and create a fullscreen window:
 

_SDL_Init()
_SDL_SetHint($SDL_HINT_RENDER_SCALE_QUALITY, "1") ; Optional: Set rendering quality hint

; Create a fullscreen SDL window
Global $window = _SDL_CreateWindow("Fullscreen Image", $SDL_WINDOWPOS_UNDEFINED, $SDL_WINDOWPOS_UNDEFINED, @DesktopWidth, @DesktopHeight, BitOR($SDL_WINDOW_FULLSCREEN, $SDL_WINDOW_SHOWN))
If Not $window Then
    MsgBox(16, "Error", "Failed to create SDL window.")
    _SDL_Quit()
    Exit
EndIf

; Create a renderer for the window
Global $renderer = _SDL_CreateRenderer($window, -1, $SDL_RENDERER_ACCELERATED)
If Not $renderer Then
    MsgBox(16, "Error", "Failed to create SDL renderer.")
    _SDL_DestroyWindow($window)
    _SDL_Quit()
    Exit
EndIf

Load and render the image on the renderer:
 

; Load the image using SDL_Image
Global $imageSurface = _IMG_Load("path/to/image.jpg")
If Not $imageSurface Then
    MsgBox(16, "Error", "Failed to load image.")
    _SDL_DestroyRenderer($renderer)
    _SDL_DestroyWindow($window)
    _SDL_Quit()
    Exit
EndIf

; Create a texture from the image surface
Global $imageTexture = _SDL_CreateTextureFromSurface($renderer, $imageSurface)
If Not $imageTexture Then
    MsgBox(16, "Error", "Failed to create texture.")
    _SDL_FreeSurface($imageSurface)
    _SDL_DestroyRenderer($renderer)
    _SDL_DestroyWindow($window)
    _SDL_Quit()
    Exit
EndIf

; Clear the renderer and render the image texture
_SDL_RenderClear($renderer)
_SDL_RenderCopy($renderer, $imageTexture, 0, 0)
_SDL_RenderPresent($renderer)

Process the SDL events and handle the window close event:

 

Local $event = _SDL_EventStruct()
Local $quit = False

While Not $quit
    While _SDL_PollEvent($event)
        If $event.type = $SDL_QUIT Then
            $quit = True
        EndIf
    WEnd

    ; Your main program logic goes here

WEnd

Clean up and quit SDL when finished:

 

_SDL_DestroyTexture($imageTexture)
_SDL_FreeSurface($imageSurface)
_SDL_DestroyRenderer($renderer)
_SDL_DestroyWindow($window)
_SDL_Quit()

for example like this:
 

#include <AutoItX3.dll>
#include <SDL.au3>
#include <SDL_Image.au3>

_SDL_Init()
_SDL_SetHint($SDL_HINT_RENDER_SCALE_QUALITY, "1") ; Optional: Set rendering quality hint

Global $window = _SDL_CreateWindow("Fullscreen Image", $SDL_WINDOWPOS_UNDEFINED, $SDL_WINDOWPOS_UNDEFINED, @DesktopWidth, @DesktopHeight, BitOR($SDL_WINDOW_FULLSCREEN, $SDL_WINDOW_SHOWN))
If Not $window Then
    MsgBox(16, "Error", "Failed to create SDL window.")
    _SDL_Quit()
    Exit
EndIf

Global $renderer = _SDL_CreateRenderer($window, -1, $SDL_RENDERER_ACCELERATED)
If Not $renderer Then
    MsgBox(16, "Error", "Failed to create SDL renderer.")
    _SDL_DestroyWindow($window)
    _SDL_Quit()
    Exit
EndIf

Global $imageSurface = _IMG_Load("path/to/image.jpg")
If Not $imageSurface Then
    MsgBox(16, "Error", "Failed to load image.")
    _SDL_DestroyRenderer($renderer)
    _SDL_DestroyWindow($window)
    _SDL_Quit()
    Exit
EndIf

Global $imageTexture = _SDL_CreateTextureFromSurface($renderer, $imageSurface)
If Not $imageTexture Then
    MsgBox(16, "Error", "Failed to create texture.")
    _SDL_FreeSurface($imageSurface)
    _SDL_DestroyRenderer($renderer)
    _SDL_DestroyWindow($window)
    _SDL_Quit()
    Exit
EndIf

_SDL_RenderClear($renderer)
_SDL_RenderCopy($renderer, $imageTexture, 0, 0)
_SDL_RenderPresent($renderer)

Local $event = _SDL_EventStruct()
Local $quit = False

While Not $quit
    While _SDL_PollEvent($event)
        If $event.type = $SDL_QUIT Then
            $quit = True
        EndIf
    WEnd

    ; Your main program logic goes here

WEnd

_SDL_DestroyTexture($imageTexture)
_SDL_FreeSurface($imageSurface)
_SDL_DestroyRenderer($renderer)
_SDL_DestroyWindow($window)
_SDL_Quit()



replace path with your path 

❤️

Posted

@20Ice18  here did not work, it gives an error when I put the include AutoItX3.dll

without putting the dll in the folder: 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "G:\SDL v14\Teste SDL\Novo(a) AutoIt v3 Script.au3"    
G:\SDL v14\Teste SDL\Novo(a) AutoIt v3 Script.au3 (1) : ==> Error opening the file.: 
#include <AutoItX3.dll> 

>Exit code: 1

Error when placing the dll:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "G:\SDL v14\Teste SDL\Novo(a) AutoIt v3 Script.au3"    
G:\SDL v14\Teste SDL\Novo(a) AutoIt v3 Script.au3 (65) : ==> Unterminated string.: 
ÿt$ÿ4Ð?Æ??$\" 

>Exit code: 1

@20Ice18 what version of autoit did you test on and what version of AutoItX3.dll did you use?

Posted

As described here you can't use #include this way.
It doesn't make sense to call AutoItX from AutoIt. AutoItX is made to be called from other programming languages to use a subset of AutoIt.

And I do not think that sylremo is completely wrong with his estimation.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

@20Ice18, feeding AI with the author's question as a prompt might not always be a good idea, let alone pasting its response without even running it yourself. As we speak, I can clearly see that you have wasted both your and others' time, as these out-of-context responses create more confusion than helps.
We appreciated your efforts, but I'd suggest you take your time finding solutions in the future 😄

Posted (edited)

actually including AutoItX3.dll won't work but what about making the image full screen with good speed does anyone have any tips?

Edited by Belini
Posted

Word of warning about the link with the files used, when i ran it my computer crashed when trying to press escape, and ofcourse I had alot of work open. :(

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

Posted

@Gianni still slow as before even changing from 32 to 8 like you suggested

@Werty I'm sorry for the work you lost and I don't understand why it happened because the _Quit() function just closes the resources that were opened and what I did was just create a hotkey to call the _Quit() function
 

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
  • Recently Browsing   0 members

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