mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 03:49:56 +00:00
GIFPlay cleanup 1
This commit is contained in:
parent
ce2d98fb3e
commit
3867088da3
12 changed files with 84 additions and 73 deletions
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
***By Zom-B*** ([QB64-PE Wiki](https://qb64phoenix.com/qb64wiki/index.php/GIF_Images))
|
***By Zom-B*** ([QB64-PE Wiki](https://qb64phoenix.com/qb64wiki/index.php/GIF_Images))
|
||||||
|
|
||||||
*Adapted for use with InForm's PictureBox controls by @FellippeHeitor*
|
***Adapted for use with InForm's PictureBox controls by @FellippeHeitor***
|
||||||
|
|
||||||
*Refactored and enhanced by a740g to use include guards, conditional compiles and cleaner API*
|
***Fixed, refactored and enhanced by @a740g***
|
||||||
|
|
||||||
## Usage instructions
|
## Usage instructions
|
||||||
|
|
||||||
|
@ -74,3 +74,9 @@ FUNCTION GIF_GetWidth~% (ID AS LONG)
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns the width of the GIF in pixels.
|
Returns the width of the GIF in pixels.
|
||||||
|
|
||||||
|
```vb
|
||||||
|
SUB GIF_HideOverlay (ID AS LONG)
|
||||||
|
```
|
||||||
|
|
||||||
|
Hides the **GIF** overlay image when the GIF is not playing or paused.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
'
|
'
|
||||||
' Adapted for use with InForm's PictureBox controls by @FellippeHeitor
|
' Adapted for use with InForm's PictureBox controls by @FellippeHeitor
|
||||||
'
|
'
|
||||||
' Refactored and enhanced by a740g to use include guards, conditional compiles and cleaner API
|
' Fixed, refactored and enhanced by @a740g
|
||||||
|
|
||||||
$IF GIFPLAY_BAS = UNDEFINED THEN
|
$IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
$LET GIFPLAY_BAS = TRUE
|
$LET GIFPLAY_BAS = TRUE
|
||||||
|
@ -29,13 +29,13 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
GifOverlay = __GIF_LoadOverlayImage
|
GifOverlay = __GIF_LoadOverlayImage
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF __GIFData(i).IsPlaying OR __GIFData(i).LastFrameServed = 0 THEN
|
IF __GIFData(i).isPlaying OR __GIFData(i).lastFrameServed = 0 THEN
|
||||||
IF __GIFData(i).LastFrameUpdate > 0 AND TIMER - __GIFData(i).LastFrameUpdate < __GIFData(i).LastFrameDelay THEN
|
IF __GIFData(i).lastFrameUpdate > 0 AND TIMER - __GIFData(i).lastFrameUpdate < __GIFData(i).lastFrameDelay THEN
|
||||||
'Wait for the GIF's frame delay
|
'Wait for the GIF's frame delay
|
||||||
ELSE
|
ELSE
|
||||||
__GIFData(i).Frame = __GIFData(i).Frame + 1
|
__GIFData(i).frame = __GIFData(i).frame + 1
|
||||||
__GIFData(i).LastFrameServed = __GIFData(i).Frame
|
__GIFData(i).lastFrameServed = __GIFData(i).frame
|
||||||
__GIFData(i).LastFrameUpdate = TIMER
|
__GIFData(i).lastFrameUpdate = TIMER
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
newFrame = __GIF_GetFrame(i)
|
newFrame = __GIF_GetFrame(i)
|
||||||
IF newFrame THEN _PUTIMAGE , newFrame
|
IF newFrame THEN _PUTIMAGE , newFrame
|
||||||
IF __GIFData(i).IsPlaying = FALSE AND __GIFData(i).HideOverlay = FALSE AND __GIFData(i).totalFrames > 1 THEN
|
IF __GIFData(i).isPlaying = FALSE AND __GIFData(i).hideOverlay = FALSE AND __GIFData(i).totalFrames > 1 THEN
|
||||||
_PUTIMAGE (_WIDTH / 2 - _WIDTH(GifOverlay) / 2, _HEIGHT / 2 - _HEIGHT(GifOverlay) / 2), GifOverlay
|
_PUTIMAGE (_WIDTH / 2 - _WIDTH(GifOverlay) / 2, _HEIGHT / 2 - _HEIGHT(GifOverlay) / 2), GifOverlay
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
GIF_IsPlaying = __GIFData(i).IsPlaying
|
GIF_IsPlaying = __GIFData(i).isPlaying
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
GIF_GetWidth = __GIFData(i).width
|
GIF_GetWidth = __GIFData(i).W
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
GIF_GetHeight = __GIFData(i).height
|
GIF_GetHeight = __GIFData(i).H
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
__GIFData(i).HideOverlay = TRUE
|
__GIFData(i).hideOverlay = TRUE
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
__GIFData(i).IsPlaying = TRUE
|
__GIFData(i).isPlaying = TRUE
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
__GIFData(i).IsPlaying = FALSE
|
__GIFData(i).isPlaying = FALSE
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,8 +122,8 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
DIM i AS LONG: i = __GIF_GetIndex(ID)
|
||||||
|
|
||||||
__GIFData(i).IsPlaying = FALSE
|
__GIFData(i).isPlaying = FALSE
|
||||||
__GIFData(i).Frame = 1
|
__GIFData(i).frame = 1
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,8 +155,8 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
OPEN filename$ FOR BINARY AS __GIFData(Index).file
|
OPEN filename$ FOR BINARY AS __GIFData(Index).file
|
||||||
|
|
||||||
GET __GIFData(Index).file, , __GIFData(Index).sigver
|
GET __GIFData(Index).file, , __GIFData(Index).sigver
|
||||||
GET __GIFData(Index).file, , __GIFData(Index).width
|
GET __GIFData(Index).file, , __GIFData(Index).W
|
||||||
GET __GIFData(Index).file, , __GIFData(Index).height
|
GET __GIFData(Index).file, , __GIFData(Index).H
|
||||||
GET __GIFData(Index).file, , byte~%%
|
GET __GIFData(Index).file, , byte~%%
|
||||||
__GIFData(Index).bpp = (byte~%% AND 7) + 1
|
__GIFData(Index).bpp = (byte~%% AND 7) + 1
|
||||||
__GIFData(Index).sortFlag = (byte~%% AND 8) > 0
|
__GIFData(Index).sortFlag = (byte~%% AND 8) > 0
|
||||||
|
@ -179,7 +179,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
palette$ = SPACE$(3 * __GIFData(Index).numColors)
|
palette$ = SPACE$(3 * __GIFData(Index).numColors)
|
||||||
GET __GIFData(Index).file, , palette$
|
GET __GIFData(Index).file, , palette$
|
||||||
__GIFData(Index).palette = palette$
|
__GIFData(Index).pal = palette$
|
||||||
DO
|
DO
|
||||||
GET __GIFData(Index).file, , byte~%%
|
GET __GIFData(Index).file, , byte~%%
|
||||||
SELECT CASE byte~%%
|
SELECT CASE byte~%%
|
||||||
|
@ -198,10 +198,10 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
__GIFFrameData(__TotalGIFFrames).ID = ID
|
__GIFFrameData(__TotalGIFFrames).ID = ID
|
||||||
__GIFFrameData(__TotalGIFFrames).thisFrame = __GIFData(Index).totalFrames
|
__GIFFrameData(__TotalGIFFrames).thisFrame = __GIFData(Index).totalFrames
|
||||||
|
|
||||||
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).left
|
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).L
|
||||||
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).top
|
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).T
|
||||||
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).width
|
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).W
|
||||||
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).height
|
GET __GIFData(Index).file, , __GIFFrameData(__TotalGIFFrames).H
|
||||||
GET __GIFData(Index).file, , byte~%%
|
GET __GIFData(Index).file, , byte~%%
|
||||||
__GIFFrameData(__TotalGIFFrames).localColorTableFlag = (byte~%% AND 128) > 0
|
__GIFFrameData(__TotalGIFFrames).localColorTableFlag = (byte~%% AND 128) > 0
|
||||||
__GIFFrameData(__TotalGIFFrames).interlacedFlag = (byte~%% AND 64) > 0
|
__GIFFrameData(__TotalGIFFrames).interlacedFlag = (byte~%% AND 64) > 0
|
||||||
|
@ -252,7 +252,7 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
|
|
||||||
REDIM _PRESERVE __GIFFrameData(0 TO __TotalGIFFrames) AS __GIFFrameDataType
|
REDIM _PRESERVE __GIFFrameData(0 TO __TotalGIFFrames) AS __GIFFrameDataType
|
||||||
|
|
||||||
__GIFData(Index).IsPlaying = FALSE
|
__GIFData(Index).isPlaying = FALSE
|
||||||
GIF_Open = TRUE
|
GIF_Open = TRUE
|
||||||
EXIT FUNCTION
|
EXIT FUNCTION
|
||||||
|
|
||||||
|
@ -324,27 +324,27 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
DIM img&, actualFrame&
|
DIM img&, actualFrame&
|
||||||
DIM prevDest AS LONG
|
DIM prevDest AS LONG
|
||||||
|
|
||||||
IF __GIFData(Index).Frame > __GIFData(Index).totalFrames THEN
|
IF __GIFData(Index).frame > __GIFData(Index).totalFrames THEN
|
||||||
__GIFData(Index).Frame = 1
|
__GIFData(Index).frame = 1
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
FOR i = 1 TO UBOUND(__GIFFrameData)
|
FOR i = 1 TO UBOUND(__GIFFrameData)
|
||||||
IF __GIFFrameData(i).ID = __GIFData(Index).ID AND __GIFFrameData(i).thisFrame = __GIFData(Index).Frame THEN
|
IF __GIFFrameData(i).ID = __GIFData(Index).ID AND __GIFFrameData(i).thisFrame = __GIFData(Index).frame THEN
|
||||||
frame = i
|
frame = i
|
||||||
EXIT FOR
|
EXIT FOR
|
||||||
ELSEIF __GIFFrameData(i).ID = __GIFData(Index).ID AND __GIFFrameData(i).thisFrame < __GIFData(Index).Frame THEN
|
ELSEIF __GIFFrameData(i).ID = __GIFData(Index).ID AND __GIFFrameData(i).thisFrame < __GIFData(Index).frame THEN
|
||||||
previousFrame = i
|
previousFrame = i
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
__GIFData(Index).LastFrameDelay = __GIFFrameData(frame).delay - (__GIFFrameData(frame).delay / 10)
|
__GIFData(Index).lastFrameDelay = __GIFFrameData(frame).delay - (__GIFFrameData(frame).delay / 10)
|
||||||
|
|
||||||
IF __GIFFrameData(frame).addr > 0 THEN
|
IF __GIFFrameData(frame).addr > 0 THEN
|
||||||
prevDest = _DEST
|
prevDest = _DEST
|
||||||
w = __GIFFrameData(frame).width
|
w = __GIFFrameData(frame).W
|
||||||
h = __GIFFrameData(frame).height
|
h = __GIFFrameData(frame).H
|
||||||
img& = _NEWIMAGE(w, h, 256)
|
img& = _NEWIMAGE(w, h, 256)
|
||||||
actualFrame& = _NEWIMAGE(__GIFData(Index).width, __GIFData(Index).height, 256)
|
actualFrame& = _NEWIMAGE(__GIFData(Index).W, __GIFData(Index).H, 256)
|
||||||
|
|
||||||
_DEST img&
|
_DEST img&
|
||||||
__GIF_DecodeFrame __GIFData(Index), __GIFFrameData(frame)
|
__GIF_DecodeFrame __GIFData(Index), __GIFFrameData(frame)
|
||||||
|
@ -354,11 +354,11 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
_COPYPALETTE img&
|
_COPYPALETTE img&
|
||||||
ELSE
|
ELSE
|
||||||
FOR i = 0 TO __GIFData(Index).numColors - 1
|
FOR i = 0 TO __GIFData(Index).numColors - 1
|
||||||
_PALETTECOLOR i, _RGB32(ASC(__GIFData(Index).palette, i * 3 + 1), ASC(__GIFData(Index).palette, i * 3 + 2), ASC(__GIFData(Index).palette, i * 3 + 3))
|
_PALETTECOLOR i, _RGB32(ASC(__GIFData(Index).pal, i * 3 + 1), ASC(__GIFData(Index).pal, i * 3 + 2), ASC(__GIFData(Index).pal, i * 3 + 3))
|
||||||
NEXT
|
NEXT
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF __GIFData(Index).Frame > 1 THEN
|
IF __GIFData(Index).frame > 1 THEN
|
||||||
SELECT CASE __GIFFrameData(previousFrame).disposalMethod
|
SELECT CASE __GIFFrameData(previousFrame).disposalMethod
|
||||||
CASE 0, 1
|
CASE 0, 1
|
||||||
_PUTIMAGE , __GIFFrameData(previousFrame).addr
|
_PUTIMAGE , __GIFFrameData(previousFrame).addr
|
||||||
|
@ -373,12 +373,12 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
IF __GIFFrameData(frame).transparentFlag THEN
|
IF __GIFFrameData(frame).transparentFlag THEN
|
||||||
_CLEARCOLOR __GIFFrameData(frame).transColor, img&
|
_CLEARCOLOR __GIFFrameData(frame).transColor, img&
|
||||||
END IF
|
END IF
|
||||||
_PUTIMAGE (__GIFFrameData(frame).left, __GIFFrameData(frame).top), img&
|
_PUTIMAGE (__GIFFrameData(frame).L, __GIFFrameData(frame).T), img&
|
||||||
_FREEIMAGE img&
|
_FREEIMAGE img&
|
||||||
|
|
||||||
__GIFFrameData(frame).addr = actualFrame&
|
__GIFFrameData(frame).addr = actualFrame&
|
||||||
__GIFData(Index).LoadedFrames = __GIFData(Index).LoadedFrames + 1
|
__GIFData(Index).loadedFrames = __GIFData(Index).loadedFrames + 1
|
||||||
__GIFData(Index).GifLoadComplete = (__GIFData(Index).LoadedFrames = __GIFData(Index).totalFrames)
|
__GIFData(Index).isLoadComplete = (__GIFData(Index).loadedFrames = __GIFData(Index).totalFrames)
|
||||||
_DEST prevDest
|
_DEST prevDest
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -477,11 +477,11 @@ $IF GIFPLAY_BAS = UNDEFINED THEN
|
||||||
FOR i = stackPointer - 1 TO 0 STEP -1
|
FOR i = stackPointer - 1 TO 0 STEP -1
|
||||||
PSET (x, y), colorStack(i)
|
PSET (x, y), colorStack(i)
|
||||||
x = x + 1
|
x = x + 1
|
||||||
IF x = __GIfFRAMEDATA.width THEN
|
IF x = __GIfFRAMEDATA.W THEN
|
||||||
x = 0
|
x = 0
|
||||||
IF __GIfFRAMEDATA.interlacedFlag THEN
|
IF __GIfFRAMEDATA.interlacedFlag THEN
|
||||||
y = y + interlacedStep
|
y = y + interlacedStep
|
||||||
IF y >= __GIfFRAMEDATA.height THEN
|
IF y >= __GIfFRAMEDATA.H THEN
|
||||||
SELECT CASE interlacedPass
|
SELECT CASE interlacedPass
|
||||||
CASE 0: interlacedPass = 1: y = 4
|
CASE 0: interlacedPass = 1: y = 4
|
||||||
CASE 1: interlacedPass = 2: y = 2
|
CASE 1: interlacedPass = 2: y = 2
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
'
|
'
|
||||||
' Adapted for use with InForm's PictureBox controls by @FellippeHeitor
|
' Adapted for use with InForm's PictureBox controls by @FellippeHeitor
|
||||||
'
|
'
|
||||||
' Refactored and enhanced by a740g to use include guards, conditional compiles and cleaner API
|
' Fixed, refactored and enhanced by @a740g
|
||||||
|
|
||||||
$IF GIFPLAY_BI = UNDEFINED THEN
|
$IF GIFPLAY_BI = UNDEFINED THEN
|
||||||
$LET GIFPLAY_BI = TRUE
|
$LET GIFPLAY_BI = TRUE
|
||||||
|
@ -22,8 +22,8 @@ $IF GIFPLAY_BI = UNDEFINED THEN
|
||||||
ID AS LONG
|
ID AS LONG
|
||||||
file AS INTEGER
|
file AS INTEGER
|
||||||
sigver AS STRING * 6
|
sigver AS STRING * 6
|
||||||
width AS _UNSIGNED INTEGER
|
W AS _UNSIGNED INTEGER ' width
|
||||||
height AS _UNSIGNED INTEGER
|
H AS _UNSIGNED INTEGER ' height
|
||||||
bpp AS _UNSIGNED _BYTE
|
bpp AS _UNSIGNED _BYTE
|
||||||
sortFlag AS _BYTE ' Unused
|
sortFlag AS _BYTE ' Unused
|
||||||
colorRes AS _UNSIGNED _BYTE
|
colorRes AS _UNSIGNED _BYTE
|
||||||
|
@ -31,27 +31,27 @@ $IF GIFPLAY_BI = UNDEFINED THEN
|
||||||
bgColor AS _UNSIGNED _BYTE
|
bgColor AS _UNSIGNED _BYTE
|
||||||
aspect AS SINGLE ' Unused
|
aspect AS SINGLE ' Unused
|
||||||
numColors AS _UNSIGNED INTEGER
|
numColors AS _UNSIGNED INTEGER
|
||||||
palette AS STRING * 768
|
pal AS STRING * 768 ' global palette
|
||||||
firstFrame AS LONG
|
firstFrame AS LONG
|
||||||
totalFrames AS _UNSIGNED LONG
|
totalFrames AS _UNSIGNED LONG
|
||||||
IsPlaying AS _BYTE
|
isPlaying AS _BYTE
|
||||||
Frame AS LONG
|
frame AS LONG
|
||||||
LoadedFrames AS LONG
|
loadedFrames AS LONG
|
||||||
GifLoadComplete AS _BYTE
|
isLoadComplete AS _BYTE
|
||||||
LastFrameServed AS LONG
|
lastFrameServed AS LONG
|
||||||
LastFrameUpdate AS SINGLE
|
lastFrameUpdate AS SINGLE
|
||||||
LastFrameDelay AS SINGLE
|
lastFrameDelay AS SINGLE
|
||||||
HideOverlay AS _BYTE
|
hideOverlay AS _BYTE
|
||||||
END TYPE
|
END TYPE
|
||||||
|
|
||||||
TYPE __GIFFrameDataType
|
TYPE __GIFFrameDataType
|
||||||
ID AS LONG
|
ID AS LONG
|
||||||
thisFrame AS LONG
|
thisFrame AS LONG
|
||||||
addr AS LONG
|
addr AS LONG
|
||||||
left AS _UNSIGNED INTEGER
|
L AS _UNSIGNED INTEGER ' left
|
||||||
top AS _UNSIGNED INTEGER
|
T AS _UNSIGNED INTEGER ' top
|
||||||
width AS _UNSIGNED INTEGER
|
W AS _UNSIGNED INTEGER ' width
|
||||||
height AS _UNSIGNED INTEGER
|
H AS _UNSIGNED INTEGER ' height
|
||||||
localColorTableFlag AS _BYTE
|
localColorTableFlag AS _BYTE
|
||||||
interlacedFlag AS _BYTE
|
interlacedFlag AS _BYTE
|
||||||
sortFlag AS _BYTE ' Unused
|
sortFlag AS _BYTE ' Unused
|
||||||
|
|
|
@ -72,15 +72,15 @@ $IF MESSAGEBOX_BAS = UNDEFINED THEN
|
||||||
DIM __caption AS STRING: __caption = caption
|
DIM __caption AS STRING: __caption = caption
|
||||||
|
|
||||||
$IF INFORM_BI = DEFINED THEN
|
$IF INFORM_BI = DEFINED THEN
|
||||||
IF __UI_CurrentTitle <> "" THEN
|
IF LEN(__UI_CurrentTitle) > 0 THEN
|
||||||
__caption = __UI_CurrentTitle
|
__caption = __UI_CurrentTitle
|
||||||
ELSEIF _TITLE$ <> "" THEN
|
ELSEIF LEN(_TITLE$) > 0 THEN
|
||||||
__caption = _TITLE$
|
__caption = _TITLE$
|
||||||
ELSE
|
ELSE
|
||||||
__caption = COMMAND$(0)
|
__caption = COMMAND$(0)
|
||||||
END IF
|
END IF
|
||||||
$ELSE
|
$ELSE
|
||||||
IF _TITLE$ <> "" THEN
|
IF LEN(_TITLE$) > 0 THEN
|
||||||
__caption = _TITLE$
|
__caption = _TITLE$
|
||||||
ELSE
|
ELSE
|
||||||
__caption = COMMAND$(0)
|
__caption = COMMAND$(0)
|
||||||
|
|
|
@ -39,21 +39,26 @@ SUB __UI_Click (id AS LONG)
|
||||||
CASE gifplaySample
|
CASE gifplaySample
|
||||||
|
|
||||||
CASE LoadBT
|
CASE LoadBT
|
||||||
'file 'globe.gif' comes from:
|
DIM fileName AS STRING: fileName = _OPENFILEDIALOG$(Caption(gifplaySample), , "*.gif|*.GIF|*.Gif", "GIF Files")
|
||||||
'https://en.wikipedia.org/wiki/GIF#/media/File:Rotating_earth_(large).gif
|
|
||||||
IF GIF_Open(PictureBox1, "globe.gif") THEN
|
IF LEN(fileName) > 0 THEN
|
||||||
Control(PlayBT).Disabled = False
|
GIF_Close PictureBox1 ' close any previously opened GIF
|
||||||
IF GIF_GetTotalFrames(PictureBox1) > 1 THEN
|
|
||||||
Caption(PlayBT) = "Play"
|
IF GIF_Open(PictureBox1, fileName) THEN
|
||||||
|
|
||||||
|
Control(PlayBT).Disabled = False
|
||||||
|
|
||||||
|
IF GIF_GetTotalFrames(PictureBox1) > 1 THEN
|
||||||
|
Caption(PlayBT) = "Play"
|
||||||
|
ELSE
|
||||||
|
Control(PlayBT).Disabled = True
|
||||||
|
END IF
|
||||||
ELSE
|
ELSE
|
||||||
Caption(PlayBT) = "Static gif"
|
|
||||||
Control(PlayBT).Disabled = True
|
Control(PlayBT).Disabled = True
|
||||||
|
MessageBox fileName + " failed to load!", "", MsgBox_Exclamation
|
||||||
END IF
|
END IF
|
||||||
Caption(LoadBT) = "globe.gif loaded"
|
|
||||||
Control(LoadBT).Disabled = True
|
|
||||||
ELSE
|
|
||||||
MessageBox "File 'globe.gif' could not be found.", "", MsgBox_Exclamation
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
CASE PlayBT
|
CASE PlayBT
|
||||||
IF GIF_IsPlaying(PictureBox1) THEN
|
IF GIF_IsPlaying(PictureBox1) THEN
|
||||||
GIF_Pause PictureBox1
|
GIF_Pause PictureBox1
|
||||||
|
@ -62,6 +67,7 @@ SUB __UI_Click (id AS LONG)
|
||||||
GIF_Play PictureBox1
|
GIF_Play PictureBox1
|
||||||
Caption(PlayBT) = "Pause"
|
Caption(PlayBT) = "Pause"
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
CASE PictureBox1
|
CASE PictureBox1
|
||||||
GIF_HideOverlay PictureBox1
|
GIF_HideOverlay PictureBox1
|
||||||
END SELECT
|
END SELECT
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
': Fellippe Heitor, 2016-2023 - fellippe@qb64.org - @fellippeheitor
|
': Fellippe Heitor, 2016-2023 - fellippe@qb64.org - @fellippeheitor
|
||||||
': https://github.com/FellippeHeitor/InForm
|
': https://github.com/FellippeHeitor/InForm
|
||||||
'-----------------------------------------------------------
|
'-----------------------------------------------------------
|
||||||
|
|
||||||
SUB __UI_LoadForm
|
SUB __UI_LoadForm
|
||||||
|
|
||||||
DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG
|
DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG
|
||||||
|
@ -24,13 +23,13 @@ SUB __UI_LoadForm
|
||||||
|
|
||||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "LoadBT", 123, 23, 36, 247, 0)
|
__UI_NewID = __UI_NewControl(__UI_Type_Button, "LoadBT", 123, 23, 36, 247, 0)
|
||||||
__UI_RegisterResult = 0
|
__UI_RegisterResult = 0
|
||||||
SetCaption __UI_NewID, "Load globe.gif"
|
SetCaption __UI_NewID, "&Load"
|
||||||
Control(__UI_NewID).HasBorder = False
|
Control(__UI_NewID).HasBorder = False
|
||||||
Control(__UI_NewID).CanHaveFocus = True
|
Control(__UI_NewID).CanHaveFocus = True
|
||||||
|
|
||||||
__UI_NewID = __UI_NewControl(__UI_Type_Button, "PlayBT", 80, 23, 186, 247, 0)
|
__UI_NewID = __UI_NewControl(__UI_Type_Button, "PlayBT", 80, 23, 186, 247, 0)
|
||||||
__UI_RegisterResult = 0
|
__UI_RegisterResult = 0
|
||||||
SetCaption __UI_NewID, "Play"
|
SetCaption __UI_NewID, "&Play"
|
||||||
Control(__UI_NewID).HasBorder = False
|
Control(__UI_NewID).HasBorder = False
|
||||||
Control(__UI_NewID).CanHaveFocus = True
|
Control(__UI_NewID).CanHaveFocus = True
|
||||||
|
|
||||||
|
|
BIN
examples/GIFPlaySample/Newtons_cradle_animation_book_2.gif
Normal file
BIN
examples/GIFPlaySample/Newtons_cradle_animation_book_2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
examples/GIFPlaySample/Rotating_earth_(large).gif
Normal file
BIN
examples/GIFPlaySample/Rotating_earth_(large).gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 978 KiB |
BIN
examples/GIFPlaySample/SmallFullColourGIF.gif
Normal file
BIN
examples/GIFPlaySample/SmallFullColourGIF.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
BIN
examples/GIFPlaySample/Sunflower_as_gif_websafe.gif
Normal file
BIN
examples/GIFPlaySample/Sunflower_as_gif_websafe.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 MiB |
Loading…
Reference in a new issue