FLIReader.st
author Claus Gittinger <cg@exept.de>
Tue, 24 Jun 1997 15:40:35 +0200
changeset 620 6a4214e29c86
parent 615 1f5b783f9c08
child 621 7df3678991c1
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
514
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     1
"
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     3
              All Rights Reserved
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     4
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     5
 This software is furnished under a license and may be used
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     6
 only in accordance with the terms of that license and with the
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     8
 be provided or otherwise made available to, or used by, any
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
     9
 other person.  No title to or ownership of the software is
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    10
 hereby transferred.
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    11
"
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    12
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    13
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
ImageReader subclass:#FLIReader
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
    15
	instanceVariableNames:'nframes frameBuffer frameBufferSize imageBuffer redPalette
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
		greenPalette bluePalette flags frameDelay'
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:'FLI_FILE_MAGIC FLC_FILE_MAGIC FLI_FRAME_MAGIC FILE_HEAD_SIZE
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
		FRAME_HEAD_SIZE CHUNK_HEAD_SIZE FLI_256_COLOR FLI_DELTA FLI_COLOR
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
		FLI_LC FLI_BLACK FLI_BRUN FLI_COPY FLI_MINI MAXCOLORS'
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Graphics-Images-Support'
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!FLIReader class methodsFor:'documentation'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
514
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    26
copyright
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    27
"
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    28
 COPYRIGHT (c) 1997 by eXept Software AG
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    29
              All Rights Reserved
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    30
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    31
 This software is furnished under a license and may be used
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    32
 only in accordance with the terms of that license and with the
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    34
 be provided or otherwise made available to, or used by, any
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    35
 other person.  No title to or ownership of the software is
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    36
 hereby transferred.
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    37
"
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    38
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    39
!
6b18ed409057 copyright
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    40
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    Read frames from a FLI/FLC file.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    this is a very first attempt in reading FLI files;
615
1f5b783f9c08 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
    46
    (a first experiment in reading that fileFormat)
1f5b783f9c08 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
    47
1f5b783f9c08 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
    48
    Its very experimental, preliminary and will certainly change.
1f5b783f9c08 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 557
diff changeset
    49
    (will introduce a new class hierarchy based upon some MovieReader ...).
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    When used like an imageReader, #fromFile: will return
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    the very first frame.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
511
a71875ab0bf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
    54
    Warning: right now, the complete movie is read and huge
a71875ab0bf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
    55
    amounts of memoru are allocated. The interface will be changed
a71875ab0bf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
    56
    to allow stream operation ...
a71875ab0bf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
    57
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    [author:]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        Claus Gittinger
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    [see also:]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
        ImageReader
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
examples
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    |reader film view tNext|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    reader := FLIReader readFile:'/usr/local/FLI/jeffmild.fli'.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    reader isNil ifTrue:[^ nil].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    film := reader images.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    view := StandardSystemView extent:(film first extent).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    view openAndWait.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    tNext := Time millisecondClockValue + (reader frameDelay).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    film do:[:frame |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
        frame displayOn:view x:0 y:0.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
        (Delay untilMilliseconds:tNext) wait.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
        tNext := tNext + (reader frameDelay).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    ].
552
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    82
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    83
    |reader film view tNext|
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    84
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    85
    FLIReader fromFile:('/cdrom/video/fli/dh_hai.fli').
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    86
    reader := FLIReader readFile:'/cdrom/video/fli/dh_hai.fli'.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    87
    reader isNil ifTrue:[^ nil].
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    88
    film := reader images.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    89
    view := StandardSystemView extent:(film first extent).
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    90
    view openAndWait.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    91
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    92
    tNext := Time millisecondClockValue + (reader frameDelay).
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    93
    film do:[:frame |
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    94
        frame displayOn:view x:0 y:0.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    95
        (Delay untilMilliseconds:tNext) wait.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    96
        tNext := tNext + (reader frameDelay).
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    97
    ].
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    98
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    99
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   100
    |reader film view tNext|
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   101
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   102
    reader := FLIReader readFile:'/cdrom/video/fli/wedding.fli'.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   103
    reader isNil ifTrue:[^ nil].
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   104
    film := reader images.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   105
    view := StandardSystemView extent:(film first extent).
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   106
    view openAndWait.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   107
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   108
    tNext := Time millisecondClockValue + (reader frameDelay).
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   109
    film do:[:frame |
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   110
        frame displayOn:view x:0 y:0.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   111
        (Delay untilMilliseconds:tNext) wait.
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   112
        tNext := tNext + (reader frameDelay).
18b8aa74622d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
   113
    ].
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
!FLIReader class methodsFor:'class initialization'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
initialize
557
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   120
    "install myself in the Image classes fileFormat table
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   121
     for the `.fli' and '.flc' extensions."
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   122
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   123
"/    Image addReader:self suffix:'fli'.
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   124
"/    Image addReader:self suffix:'flc'.
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   125
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   126
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    FLI_FILE_MAGIC := 16rAF11.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    FLC_FILE_MAGIC := 16rAF12.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    FLI_FRAME_MAGIC := 16rF1FA.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    FILE_HEAD_SIZE := 128.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    FRAME_HEAD_SIZE := 16.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    CHUNK_HEAD_SIZE := 6.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    FLI_256_COLOR := 4.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    FLI_DELTA := 7.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    FLI_COLOR := 11.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    FLI_LC  := 12.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    FLI_BLACK := 13.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    FLI_BRUN := 15.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    FLI_COPY := 16.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    FLI_MINI := 18.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    MAXCOLORS := 256.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
     FLIReader initialize
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
557
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   151
    "Modified: 21.4.1997 / 21:16:48 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
!FLIReader class methodsFor:'testing'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
isValidImageFile:aFileName
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "return true, if aFileName contains an FLI/FLC-movie"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    |header n inStream len type|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    inStream := self streamReadingFile:aFileName.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    inStream isNil ifTrue:[^ false].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    header := ByteArray new:FILE_HEAD_SIZE.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    n := inStream nextBytes:FILE_HEAD_SIZE into:header.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    inStream close.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    n ~~ FILE_HEAD_SIZE ifTrue:[^ false].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    len := header doubleWordAt:(1+0).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    type := header wordAt:(1+4).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    type ~~ FLI_FILE_MAGIC ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
        type ~~ FLC_FILE_MAGIC ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
            ^ false
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
        ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    ^ true
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
     FLIReader isValidImageFile:'bitmaps/magtape.xpm'    
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
     FLIReader isValidImageFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    "Modified: 4.4.1997 / 22:30:19 / cg"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
!FLIReader methodsFor:'accessing'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
frameDelay
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    "return the value of the instance variable 'frameDelay' (automatically generated)"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    ^ frameDelay
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
    "Created: 4.4.1997 / 21:59:02 / cg"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
images
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    "return a collection of all images as represented by myself"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    |images image depth|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    depth := self bitsPerPixel.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    images := OrderedCollection new.
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   205
    imageSequence do:[:aFrame |
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
        image := (Image implementorForDepth:depth) new.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
        image 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
            width:width 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
            height:height
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
            photometric:photometric
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
            samplesPerPixel:samplesPerPixel
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
            bitsPerSample:bitsPerSample
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
            colorMap:colorMap
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
            bits:aFrame
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
            mask:mask.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
        images add:image.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    ^ images
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    "Created: 4.4.1997 / 21:44:44 / cg"
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   221
    "Modified: 24.6.1997 / 15:31:14 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
!FLIReader methodsFor:'processing chunks'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
brunChunkAt:chunkOffs
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    |offs lineIdx nextLineIdx packets sz|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   229
"/    'brunChunkAt' infoPrintCR.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    imageBuffer := ByteArray uninitializedNew:(width*height).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    offs := chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    lineIdx := 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    1 to:height do:[:y |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
        nextLineIdx := lineIdx + width.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
        packets := frameBuffer byteAt:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
        1 to:packets do:[:p |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
            sz := frameBuffer signedByteAt:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
            sz > 0 ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
                data := frameBuffer at:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
                imageBuffer from:lineIdx to:(lineIdx+sz-1) put:data.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
            ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
                sz == 0 ifTrue:[    
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
                    self halt:'error in brun chunk'.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
                    ^ self.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
                ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
                sz := sz negated.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
                imageBuffer replaceFrom:lineIdx to:(lineIdx+sz-1) 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
                            with:frameBuffer startingAt:offs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
                offs := offs + sz.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
            ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
            lineIdx := lineIdx + sz.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
        ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
        lineIdx := nextLineIdx
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   260
    imageSequence add:imageBuffer.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
     FLIReader imagesFromFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   266
    "Modified: 24.6.1997 / 15:31:22 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
color256ChunkAt:chunkOffs
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   270
"/    'color256Chunk' infoPrintCR.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    self colorChunkAt:chunkOffs shift:0
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   273
    "Modified: 4.4.1997 / 22:45:42 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
color64ChunkAt:chunkOffs
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   277
"/    'color64Chunk' infoPrintCR.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    self colorChunkAt:chunkOffs shift:2
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   280
    "Modified: 4.4.1997 / 22:45:45 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
colorChunkAt:chunkOffs shift:colorShift
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
    |b0 b1 packets offs ic skip change red green blue|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   286
"/    '  colorChunk' infoPrintCR.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    offs := chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    packets := frameBuffer wordAt:offs. offs := offs + 2.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
    ic := 0.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
    1 to:packets do:[:i |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
        skip := frameBuffer byteAt:offs. offs := offs + 1.   
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
        ic := ic + skip.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
        ic := ic \\ MAXCOLORS.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
        change := frameBuffer byteAt:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
        change == 0 ifTrue:[change := 256].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
        
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
        1 to:change do:[:n |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
            red := frameBuffer at:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
            green := frameBuffer at:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
            blue := frameBuffer at:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
            red := red bitShift:colorShift.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
            green := green bitShift:colorShift.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
            blue := blue bitShift:colorShift.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
"/ red print. ' ' print. green print. ' ' print. blue printCR.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
            redPalette at:(ic + 1) put:red.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
            greenPalette at:(ic + 1) put:green.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
            bluePalette at:(ic + 1) put:blue.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
            ic := ic + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
        ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
     FLIReader fromFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   319
    "Modified: 4.4.1997 / 22:45:49 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
deltaChunkAt:chunkOffs
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   323
"/    'deltaChunkAt' infoPrintCR.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
557
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   325
    Image badImageFormatQuerySignal raiseErrorString:'FLIReader [error]: delta chunks not yet implemented'
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   326
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   327
    "Modified: 21.4.1997 / 21:15:05 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
lcChunkAt:chunkOffs
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    |jnext lines lineCnt offs lineIdx packets idx skip sz|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   333
"/    'lcChunkAt' infoPrintCR.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
    imageBuffer := imageBuffer copyFrom:1 to:(width*height).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
    offs := chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    jnext := frameBuffer wordAt:offs. offs := offs + 2.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
    lines := frameBuffer wordAt:offs. offs := offs + 2.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
    lineCnt := 0.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
    lineIdx := 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
    0 to:height-1 do:[:row |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
        lineCnt >= lines ifTrue:[
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   346
            imageSequence add:imageBuffer.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
            ^ self
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
        ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
        row < jnext ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
            packets := frameBuffer byteAt:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
            lineCnt := lineCnt + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
            idx := lineIdx.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
            1 to:packets do:[:p |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
                skip := frameBuffer byteAt:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
                idx := idx + skip.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
                sz := frameBuffer signedByteAt:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
                sz > 0 ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
                    imageBuffer replaceFrom:idx to:(idx+sz-1) 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
                                with:frameBuffer startingAt:offs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
                    offs := offs + sz.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
                ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
                    sz < 0 ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
                        sz := sz negated.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
                        data := frameBuffer at:offs. offs := offs + 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
                        imageBuffer from:idx to:(idx+sz-1) put:data.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
                    ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
                ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
                idx := idx + sz.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
            ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
        ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
        lineIdx := lineIdx + width
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
    ].
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   374
    imageSequence add:imageBuffer.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   376
    "Modified: 24.6.1997 / 15:31:25 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
processChunks:nchunks size:dataLen
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
    "process chunks in a frame"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
    |len type offs chunkOffs|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
    offs := 1+0.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
    1 to:nchunks do:[:chunkIndex |
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
        len := frameBuffer doubleWordAt:(offs+0).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
        type := frameBuffer wordAt:(offs+4).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
        chunkOffs := offs + CHUNK_HEAD_SIZE.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
        type == FLI_COLOR ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
            self color64ChunkAt:chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
        ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
            type == FLI_256_COLOR ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
                self color256ChunkAt:chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
            ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
                type == FLI_DELTA ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
                    self deltaChunkAt:chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
                ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
                    type == FLI_LC ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
                        self lcChunkAt:chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
                    ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
                        type == FLI_BRUN ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
                            self brunChunkAt:chunkOffs.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
                        ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
                            'FLI [info]: unknown chunk type: ' infoPrint.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
                            type hexPrintString infoPrintCR.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
                            ^ false.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
                        ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
                    ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
                ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
            ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
        ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
        offs := offs + len
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
     FLIReader fromFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
    "Created: 3.4.1997 / 22:28:11 / cg"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
    "Modified: 3.4.1997 / 22:52:38 / cg"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
!FLIReader methodsFor:'reading from stream'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
fromStream:aStream
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   427
    "read a FLI-movie from aStream."
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
    inStream := aStream.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
    (self getHeader) ifFalse:[^ nil].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
557
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   433
    Image badImageFormatQuerySignal handle:[:ex |
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   434
        ex errorString infoPrintCR.
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   435
        ^ nil
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   436
    ] do:[
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   437
        1 to:nframes do:[:frameIndex |
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   438
            self getFrame
4eb806135e3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 552
diff changeset
   439
        ]
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
    "/ return the first frame as image
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
    colorMap := Colormap 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
                    redVector:redPalette 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
                    greenVector:greenPalette 
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
                    blueVector:bluePalette.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
    photometric := #palette.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
    samplesPerPixel := 1.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
    bitsPerSample := #(8).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
     FLIReader fromFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   457
    "Modified: 24.6.1997 / 15:32:20 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
getFrame
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
    "get a single frame"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
    |header n len type dataLen nchunks|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
    header := ByteArray new:FRAME_HEAD_SIZE.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
    n := inStream nextBytes:FRAME_HEAD_SIZE into:header.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
    n ~~ FRAME_HEAD_SIZE ifTrue:[^ false].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
    len := header doubleWordAt:(1+0).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
    type := header wordAt:(1+4).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
    type ~~ FLI_FRAME_MAGIC ifTrue:[^ false].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    dataLen := len - FRAME_HEAD_SIZE.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
    dataLen > frameBufferSize ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
        frameBuffer := ByteArray uninitializedNew:dataLen.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
        frameBufferSize := dataLen.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
    n := inStream nextBytes:dataLen into:frameBuffer.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
    n ~~ dataLen ifTrue:[^ false].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
    nchunks := header wordAt:(1+6).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
    nchunks == 0 ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
        "/ mhmh - a timing frame; should add a dummy frame
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
        ^ self.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
    ].     
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
    ^ self processChunks:nchunks size:dataLen.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
     FLIReader fromFile:'bitmaps/magtape.xpm'    
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
     FLIReader fromFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
    "Created: 3.4.1997 / 22:15:19 / cg"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    "Modified: 4.4.1997 / 22:18:21 / cg"
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
getHeader
512
e1f0a68c218d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   500
    "read the header; return true, if its valid"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    |header n len type speed|
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
    header := ByteArray new:FILE_HEAD_SIZE.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
    n := inStream nextBytes:FILE_HEAD_SIZE into:header.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
    n ~~ FILE_HEAD_SIZE ifTrue:[^ false].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
    len := header doubleWordAt:(1+0).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
    type := header wordAt:(1+4).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
    type ~~ FLI_FILE_MAGIC ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
        type ~~ FLC_FILE_MAGIC ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
            ^ false
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
        ]
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
    nframes := header wordAt:(1+6).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
    width := header wordAt:(1+8).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    height := header wordAt:(1+10).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
    dimensionCallBack notNil ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
        dimensionCallBack value
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
    flags := header wordAt:(1+14).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
    speed := header wordAt:(1+16).
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    speed <= 0 ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
        speed := 1
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
    "/ FLI uses 1/70th of a second;
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
    "/ FLC measures the frameDelay in milliseconds
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
    type == FLI_FILE_MAGIC ifTrue:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
        frameDelay := 1000 * speed // 70
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
    ] ifFalse:[
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
        frameDelay := speed
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
    ].
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    frameBufferSize := width * height.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
    frameBuffer := ByteArray uninitializedNew:frameBufferSize.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    redPalette := ByteArray new:256.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
    greenPalette := ByteArray new:256.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
    bluePalette := ByteArray new:256.
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   544
    imageSequence := OrderedCollection new:nframes.
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
    ^ true
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
     FLIReader fromFile:'bitmaps/magtape.xpm'    
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
     FLIReader fromFile:'/usr/local/FLI/jeffmild.fli'      
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
    "
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
    "Created: 3.4.1997 / 22:09:12 / cg"
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   554
    "Modified: 24.6.1997 / 15:31:39 / cg"
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
!FLIReader class methodsFor:'documentation'!
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
version
620
6a4214e29c86 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
   560
    ^ '$Header: /cvs/stx/stx/libview2/FLIReader.st,v 1.8 1997-06-24 13:40:35 cg Exp $'
510
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
! !
f328479994ab intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
FLIReader initialize!