diff -r b8f2855bf510 -r 864ca2cd4e71 IrisRGBReader.st --- a/IrisRGBReader.st Wed Nov 19 16:33:55 2003 +0100 +++ b/IrisRGBReader.st Wed Nov 19 16:38:53 2003 +0100 @@ -97,59 +97,7 @@ "Modified: 14.4.1997 / 16:51:58 / cg" ! ! -!IrisRGBReader methodsFor:'reading'! - -fromStream:aStream - "read a Portable bitmap file format as of Jeff Poskanzers Portable Bitmap Package. - supported are IRIS_RGB, PGB and PNM files." - - | magic type dim isRLE bpp| - - inStream := aStream. - inStream binary. - - magic := inStream nextShortMSB:true. - magic ~~ 8r0732 ifTrue:[ - ^ self fileFormatError:'bad magic number'. - ]. - - type := inStream nextShortMSB:true. - dim := inStream nextShortMSB:true. - width := inStream nextShortMSB:true. - height := inStream nextShortMSB:true. - bytesPerPixel := inStream nextShortMSB:true. - - isRLE := (type bitAnd:16rFF00) == 16r0100. - bpp := type bitAnd:16r00FF. - bpp ~~ 1 ifTrue:[ - ^ self fileFormatError:'only 1byte/pixel channel supported'. - ]. - bytesPerPixel ~~ 3 ifTrue:[ - ^ self fileFormatError:'can only read 3-channel images'. - ]. - - self reportDimension. - - isRLE ifTrue:[ - self readRLEData - ] ifFalse:[ - ^ self fileFormatError:'currently, only RLE encoding supported'. - "/ self readVerbatimData - ]. - - photometric := #rgb. - samplesPerPixel := 3. - bitsPerSample := #(8 8 8). - - " - IrisRGBReader fromFile:'/home2/cg/capture.rgb' - " - - "Created: / 14.4.1997 / 15:38:51 / cg" - "Modified: / 1.4.1998 / 14:28:51 / cg" -! ! - -!IrisRGBReader methodsFor:'reading-private'! +!IrisRGBReader methodsFor:'private-reading'! readRLEData "read RLE compressed data" @@ -211,6 +159,58 @@ "Modified: 23.4.1997 / 18:59:11 / cg" ! ! +!IrisRGBReader methodsFor:'reading'! + +fromStream:aStream + "read a Portable bitmap file format as of Jeff Poskanzers Portable Bitmap Package. + supported are IRIS_RGB, PGB and PNM files." + + | magic type dim isRLE bpp| + + inStream := aStream. + inStream binary. + + magic := inStream nextShortMSB:true. + magic ~~ 8r0732 ifTrue:[ + ^ self fileFormatError:'bad magic number'. + ]. + + type := inStream nextShortMSB:true. + dim := inStream nextShortMSB:true. + width := inStream nextShortMSB:true. + height := inStream nextShortMSB:true. + bytesPerPixel := inStream nextShortMSB:true. + + isRLE := (type bitAnd:16rFF00) == 16r0100. + bpp := type bitAnd:16r00FF. + bpp ~~ 1 ifTrue:[ + ^ self fileFormatError:'only 1byte/pixel channel supported'. + ]. + bytesPerPixel ~~ 3 ifTrue:[ + ^ self fileFormatError:'can only read 3-channel images'. + ]. + + self reportDimension. + + isRLE ifTrue:[ + self readRLEData + ] ifFalse:[ + ^ self fileFormatError:'currently, only RLE encoding supported'. + "/ self readVerbatimData + ]. + + photometric := #rgb. + samplesPerPixel := 3. + bitsPerSample := #(8 8 8). + + " + IrisRGBReader fromFile:'/home2/cg/capture.rgb' + " + + "Created: / 14.4.1997 / 15:38:51 / cg" + "Modified: / 1.4.1998 / 14:28:51 / cg" +! ! + !IrisRGBReader methodsFor:'testing '! canRepresent:anImage @@ -233,7 +233,7 @@ !IrisRGBReader class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview2/IrisRGBReader.st,v 1.11 2003-11-19 15:27:22 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview2/IrisRGBReader.st,v 1.12 2003-11-19 15:38:49 cg Exp $' ! ! IrisRGBReader initialize!