--- a/ImageRdr.st Mon Jun 23 16:13:26 1997 +0200
+++ b/ImageRdr.st Tue Jun 24 15:29:26 1997 +0200
@@ -13,7 +13,7 @@
Object subclass:#ImageReader
instanceVariableNames:'width height data byteOrder inStream outStream photometric
samplesPerPixel bitsPerSample colorMap mask maskPixel
- dimensionCallBack'
+ dimensionCallBack imageSequence'
classVariableNames:'ReverseBits'
poolDictionaries:''
category:'Graphics-Images-Support'
@@ -1543,9 +1543,10 @@
!
hasMultipleImages
- ^ false
+ ^ self numberOfImages > 1
"Created: 4.4.1997 / 21:37:06 / cg"
+ "Modified: 21.6.1997 / 18:34:24 / cg"
!
height
@@ -1557,10 +1558,15 @@
!
image
- "return the image as represented by myself"
+ "return the image as represented by myself;
+ If my file contained multiple images, return the first one."
|image depth|
+ self hasMultipleImages ifTrue:[
+ ^ self images first
+ ].
+
depth := self bitsPerPixel.
image := (Image implementorForDepth:depth) new.
image depth:depth.
@@ -1575,13 +1581,15 @@
mask:mask.
^ image
- "Modified: 24.4.1997 / 14:28:04 / cg"
+ "Modified: 21.6.1997 / 18:32:27 / cg"
!
images
"return a collection of all images as represented by myself.
For compatibility with single-image formats, return a collection
- containing my single image here."
+ containing my single image here.
+ This must be redefined in readers for formats which support multiple
+ images in a single file."
|img|
@@ -1591,7 +1599,7 @@
].
^ Array with:img
- "Modified: 4.4.1997 / 22:02:22 / cg"
+ "Modified: 21.6.1997 / 18:35:52 / cg"
!
mask
@@ -1603,6 +1611,17 @@
"Created: 20.6.1996 / 17:08:29 / cg"
!
+numberOfImages
+ "return the number of images as read.
+ By default (here), I hold a single image;
+ however, some fileFormats allow for multiple images"
+
+ ^ 1
+
+ "Created: 21.6.1997 / 18:33:45 / cg"
+ "Modified: 21.6.1997 / 18:35:19 / cg"
+!
+
photometric
"return the photometric interpretation of the image data"
@@ -1816,5 +1835,5 @@
!ImageReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/ImageRdr.st,v 1.48 1997-04-24 16:09:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/ImageRdr.st,v 1.49 1997-06-24 13:29:26 cg Exp $'
! !
--- a/ImageReader.st Mon Jun 23 16:13:26 1997 +0200
+++ b/ImageReader.st Tue Jun 24 15:29:26 1997 +0200
@@ -13,7 +13,7 @@
Object subclass:#ImageReader
instanceVariableNames:'width height data byteOrder inStream outStream photometric
samplesPerPixel bitsPerSample colorMap mask maskPixel
- dimensionCallBack'
+ dimensionCallBack imageSequence'
classVariableNames:'ReverseBits'
poolDictionaries:''
category:'Graphics-Images-Support'
@@ -1543,9 +1543,10 @@
!
hasMultipleImages
- ^ false
+ ^ self numberOfImages > 1
"Created: 4.4.1997 / 21:37:06 / cg"
+ "Modified: 21.6.1997 / 18:34:24 / cg"
!
height
@@ -1557,10 +1558,15 @@
!
image
- "return the image as represented by myself"
+ "return the image as represented by myself;
+ If my file contained multiple images, return the first one."
|image depth|
+ self hasMultipleImages ifTrue:[
+ ^ self images first
+ ].
+
depth := self bitsPerPixel.
image := (Image implementorForDepth:depth) new.
image depth:depth.
@@ -1575,13 +1581,15 @@
mask:mask.
^ image
- "Modified: 24.4.1997 / 14:28:04 / cg"
+ "Modified: 21.6.1997 / 18:32:27 / cg"
!
images
"return a collection of all images as represented by myself.
For compatibility with single-image formats, return a collection
- containing my single image here."
+ containing my single image here.
+ This must be redefined in readers for formats which support multiple
+ images in a single file."
|img|
@@ -1591,7 +1599,7 @@
].
^ Array with:img
- "Modified: 4.4.1997 / 22:02:22 / cg"
+ "Modified: 21.6.1997 / 18:35:52 / cg"
!
mask
@@ -1603,6 +1611,17 @@
"Created: 20.6.1996 / 17:08:29 / cg"
!
+numberOfImages
+ "return the number of images as read.
+ By default (here), I hold a single image;
+ however, some fileFormats allow for multiple images"
+
+ ^ 1
+
+ "Created: 21.6.1997 / 18:33:45 / cg"
+ "Modified: 21.6.1997 / 18:35:19 / cg"
+!
+
photometric
"return the photometric interpretation of the image data"
@@ -1816,5 +1835,5 @@
!ImageReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.48 1997-04-24 16:09:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.49 1997-06-24 13:29:26 cg Exp $'
! !