Atualização Hwgui 13-09-2026 Gif Animado.
Enviado: 13 Set 2026 11:14
Olá!
Não sei a serventia. Tô paracendo a Microsoft, inventando coisa para usar depois
Brincadeiras a parte, tem quem use esse recurso. Se existe a imagem e tem frames(quadros) dentro dela e a pessoa precisa/deseja pelo menos saber.
A Hwgui tem agora funções que devolvem até a quantidade de quadros dentro do gif. Além de mostrar, estático ou animado.
Exemplo de uso.
Não sei a serventia. Tô paracendo a Microsoft, inventando coisa para usar depois
Brincadeiras a parte, tem quem use esse recurso. Se existe a imagem e tem frames(quadros) dentro dela e a pessoa precisa/deseja pelo menos saber.
A Hwgui tem agora funções que devolvem até a quantidade de quadros dentro do gif. Além de mostrar, estático ou animado.
Código: Selecionar todos
2026-09-13 10:57 UTC-0300 Junior Itamar <itamarlins@gmail.com>
* source/winapi/draw.c
* source/winapi/hownbtn.prg
+ Add animated GIF support to OwnerButton. Windows OS only.
A button can now display a real animated GIF (all frames, with
their original per-frame delays), not just the first frame.
+ Add HWG_DRAWGIFFRAME() optional speed factor (8th parameter).
> 1.0 faster (2.0 = twice as fast)
< 1.0 slower (0.5 = half speed)
1.0 GIF native timing (default)
Values <= 0 fall back to 1.0.
+ Add HOwnButton:SetGifPath( cPath ) to inform the original GIF file
path when the @...OWNERBUTTON macro has already converted the BITMAP
clause to an HBitmap object.
+ Add HOwnButton:SetGifSpeed( nSpeed ) to change the animation speed
at runtime. The internal timer interval is recalculated automatically.
+ Add HOwnButton:GetGifRect() returning { x1, y1, x2, y2 } of the GIF
area in client coordinates. Used by OnGifTick() to invalidate only
the GIF region and by DrawItems() to paint at the same coordinates,
guaranteeing that both always agree.
+ Add sample samples/gifownbtn.prg
+ Add image/hwgui_64x64.gif
* Add -lgdiplus into hbmk.hbm for GDIPLUS lib.Código: Selecionar todos
/*
* demo_gif.prg
* Minimal example: HOwnButton with animated GIF using HOwnButton
* (HOwnButton must already support SetGifPath() - see hownbtn.prg)
*/
#include "hwgui.ch"
#define GIF_PATH "C:\dev\hwgui\image\hwgui_64x64.gif"
STATIC oMain, oPanel, oBtnGif
FUNCTION Main()
LOCAL oFont
PREPARE FONT oFont NAME "Segoe UI" WIDTH 0 HEIGHT -11 WEIGHT 400
INIT WINDOW oMain MAIN ;
TITLE "Animated GIF Demo" ;
AT 200, 150 SIZE 400, 220 ;
FONT oFont
// Panel to hold the button
@ 0, 0 PANEL oPanel OF oMain SIZE 400, 220
// The button with animated GIF
@ 20, 20 OWNERBUTTON oBtnGif OF oPanel ;
ON CLICK {|| hwg_MsgInfo( "Clicked!" ) } ;
SIZE 120, 120 ;
FLAT ;
TEXT "Hwgui GIF" ;
COORDINATES 0, 100, 120, 120 ;
FONT oFont ;
BITMAP GIF_PATH ;
TRANSPARENT ;
COORDINATES 0, 0, 64, 64 ;
TOOLTIP "Animated GIF button"
// The trick: SetGifPath AFTER creating the button, because the
// @...OWNERBUTTON macro converts the string path to an HBitmap
// before calling HOwnButton:New()
oBtnGif:SetGifSpeed( 1.0 ) // 0.75 25% Fine-tune downwards
oBtnGif:SetGifPath( GIF_PATH )
ACTIVATE WINDOW oMain CENTER
RETURN Nil