--- a/GIFReader.st Wed Oct 15 19:58:09 1997 +0200
+++ b/GIFReader.st Tue Oct 21 20:27:06 1997 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.2.1 on 21-oct-1997 at 5:07:17 pm' !
+
ImageReader subclass:#GIFReader
instanceVariableNames:'redMap greenMap blueMap pass xpos ypos rowByteSize remainBitCount
bufByte bufStream prefixTable suffixTable clearCode eoiCode
@@ -84,6 +86,15 @@
!GIFReader class methodsFor:'testing'!
+canRepresent:anImage
+ "return true, if anImage can be represented in my file format.
+ GIF supports depth 8 images only."
+
+ ^ anImage depth == 8
+
+ "Created: 17.10.1997 / 20:19:20 / cg"
+!
+
isValidImageFile:aFileName
"return true, if aFileName contains a GIF image"
@@ -804,27 +815,42 @@
outStream nextPut:0. "/ background (not used)
outStream nextPut:0. "/ aspect ratio
- n := 0.
- image colorMap notNil ifTrue:[
- image colorMap do:[:clr |
- |red green blue|
+ 0 to:(1 bitShift:bitsPerPixel)-1 do:[:pixel |
+ |clr red green blue|
- clr isNil ifTrue:[
- "/ unused colorMap slot
- red := green := blue := 0.
- ] ifFalse:[
- red := (clr redByte).
- green := (clr greenByte).
- blue := (clr blueByte).
- ].
- outStream
- nextPut:red; nextPut:green; nextPut:blue.
- n := n + 1.
- ]
- ].
- n+1 to:(1 bitShift:bitsPerPixel) do:[:i |
- outStream nextPut:0; nextPut:0; nextPut:0
- ].
+ clr := image colorFromValue:pixel.
+ clr isNil ifTrue:[
+ "/ unused colorMap slot
+ red := green := blue := 0.
+ ] ifFalse:[
+ red := (clr redByte).
+ green := (clr greenByte).
+ blue := (clr blueByte).
+ ].
+ outStream
+ nextPut:red; nextPut:green; nextPut:blue.
+ ].
+"/ n := 0.
+"/ image colorMap notNil ifTrue:[
+"/ image colorMap do:[:clr |
+"/ |red green blue|
+"/
+"/ clr isNil ifTrue:[
+"/ "/ unused colorMap slot
+"/ red := green := blue := 0.
+"/ ] ifFalse:[
+"/ red := (clr redByte).
+"/ green := (clr greenByte).
+"/ blue := (clr blueByte).
+"/ ].
+"/ outStream
+"/ nextPut:red; nextPut:green; nextPut:blue.
+"/ n := n + 1.
+"/ ]
+"/ ].
+"/ n+1 to:(1 bitShift:bitsPerPixel) do:[:i |
+"/ outStream nextPut:0; nextPut:0; nextPut:0
+"/ ].
outStream nextPut:ImageSeparator.
self writeShort:0. "/
self writeShort:0. "/
@@ -839,12 +865,12 @@
outStream nextPut:t1 "/ another flag
"Created: 14.10.1997 / 17:41:28 / cg"
- "Modified: 15.10.1997 / 19:54:30 / cg"
+ "Modified: 21.10.1997 / 04:52:18 / cg"
! !
!GIFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.59 1997-10-15 17:58:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.60 1997-10-21 18:26:40 cg Exp $'
! !
GIFReader initialize!