FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DRAWING

Display GIF and JPGEG files


I'm too lazy to write my own code, so I just use QT 3 to do it:
CLEAR LOCAL MODE
LOCAL FN openGraphicFile(graphicSize,graphicPos):'    play this movie
for us
  DIM paramBlock$
  DIM fsSpec;0,fsVRefNum,fsParID&,63 fsName$:'   standard file spec
record
  DIM boxT%,boxL%,boxB%,boxR%
  '
  fsName$ =FILES$(1,"",,fsVRefNum):'         get a QuickTime
movie
  '
  pBlk& = @paramBlock$        'pBlock for file spec
  & pBlk& + _ioNamePtr  ,@fsName$     'file name to pBlock
  % pBlk& + _ioVRefNum  ,fsVRefNum%     'vol ref num to pBlock
  % pBlk& + _ioFDirIndex,0        'flag pBlk to use name & vRef
  OSErr = FN GETCATINFO(pBlk&)     'get info on movie file
  fsParID& = [pBlk& + _ioFLParID]     'parent ID is what we needed
  '
  Movie&=_False
  OSErr=FN OPENMOVIEFILE(fsSpec,MovieResRefNum,_FSRdPerm):'    checking
  LONG IF OSErr=_noErr
  OSErr=FN
NEWMOVIEFROMFILE(Movie&,MovieResRefNum,resID,resName$,1,dataRefChgd)
  LONG IF OSErr=_noErr
  '
  CALL GETMOVIEBOX(Movie&,boxT%)    'get rect for movie
  CALL OFFSETRECT(boxT%,-boxL%,-boxT%)  'offset to zero (Z will center)
  '
  SELECT graphicSize:'        see which size we use by default
    CASE 1:'                   full size
    maxGraphicSize=2000
    CASE 2
    maxGraphicSize=72
    CASE 3
    maxGraphicSize=108
    CASE 4
    maxGraphicSize=144
    CASE 5
    maxGraphicSize=216
    CASE 6
    maxGraphicSize=288
  END SELECT
  theRight=WINDOW(_width)
  theBottom=WINDOW(_height)
  '
  movieWidth=boxR%-boxL%:'        this is the width of the movie
  movieHeight=boxB%-boxT%:'        get the height of the movie
  LONG IF movieWidth>maxGraphicSize:'          too wide?
    boxR%=maxGraphicSize:'          reset the right side
  END IF
  LONG IF movieHeight>maxGraphicSize:' oversize?
    boxB%=maxGraphicSize:' crop it
  END IF
  '
  SELECT graphicPos
    CASE 1:'                    top left
    boxT%=33
    boxB%=boxB%+boxT%:'               top down
    boxL%=97:'              left most position
    boxR%=boxR%+boxL%:'           new right position
    CASE 2:'                   top right
    boxT%=33
    boxB%=boxB%+boxT%:'               top down
    boxL%=theRight-boxR%:'     move the left over to right hand side
    boxR%=theRight:'       and this is the new right hand side
    CASE 3:'                  bottom right
    boxT%=theBottom-boxB%:'      set the new top of the box to use
    boxB%=theBottom:'        this is the new bottom we can use
    boxL%=theRight-boxR%:'     move the left over to right hand side
    boxR%=theRight:'       and this is the new right hand side
    CASE 4:'                   bottom left
    boxT%=theBottom-boxB%:'      set the new top of the box to use
    boxB%=theBottom:'        this is the new bottom we can use
    boxL%=97:'              left most position
    boxR%=boxR%+boxL%:'           new right position
  END SELECT
  '
  CALL SETMOVIEBOX(Movie&,boxT%)    'say this is our rect
  CALL GETGWORLD(CGrafPtr&,CurDev&)
  CALL SETMOVIEGWORLD(Movie&,CGrafPtr&,0)'tell QT to use this grafport
  '
  OSErr=FN CLOSEMOVIEFILE(MovieResRefNum):'     close the movie file now
  CALL GOTOBEGINNINGOFMOVIE(Movie&):' rewind
  CALL STARTMOVIE(Movie&):' roll 'em
  END IF
  XELSE
  BEEP
  PRINT "Error :";OSErr
  INPUT "We're going to stop processing right now ";a$:END
  END IF END FN=Movie& ' LOCAL FN CloseMovie
  LONG IF Movie&
  CALL DISPOSEMOVIE(Movie&):' then get rid of the movie for us
  Movie&=0:'           make the handle a null
  END IF END FN

    Movie&=FN openGraphicFile(graphicSize,graphicPos):' open the graphic

To keep it displayed, in the null event loops just do this :

    LONG IF Movie&          '   Movie Playing?
    CALL MOVIESTASK(Movie&,33)   'handle it every 33 millScnds
    END IF

My subroutine above scales the movies so they don't come in at full size (I
use them as thumbnails). So some adjustment will be required but the
routines (snipped from another project) will work and they are pretty
generic.

Last item is to check for QT :

CLEAR LOCAL MODE
LOCAL FN checkQT
  temp&=FN GESTALT(_"qtim"):'           gets the long int about QT
  temp&=FN HIWORD(temp&):'         get the version number of this QT
  qtVer$=HEX$(temp&):'          get the version number in a HEX$
  qtVer$=LEFT$(qtVer$,2)+"."+RIGHT$(qtVer$,2):'       make XX.XX version
  IF LEFT$(qtVer$,1)="0" THEN qtVer$=RIGHT$(qtVer$,LEN(qtVer$)-1):
  '  purge leading 0
  IF RIGHT$(qtVer$,1)="0" THEN qtVer$=LEFT$(qtVer$,LEN(qtVer$)-1):
  ' purge trailing 0
  'PRINT "QuickTime Version : ";qtVer$:
  ' let the user know what the version is
  qtVal!=VAL(qtVer$):
  '   figure out what version of QT this is in floating point
  LONG IF qtVal!<3.0:'     version before we had the midi manager and stuff?
  canPlay=_False
  XELSE
  canPlay=_True
  END IF
END FN=canPlay
'
LOCAL FN initQT
  LONG IF FN ENTERMOVIES:'     err-couldn't init package
  state=_False
  XELSE
  state=_True
  END IF
END FN=state

  hasQT=FN checkQT:'           see if we have 2.5 or newer
  LONG IF hasQT:'           if this is true we cnn process
  canViewQT=FN initQT:'          did we init the package
  END IF
Mel Patrick