TIFFReader.st
changeset 3382 cca44f2caa2d
parent 3211 6d43ccc9adc4
child 3552 ef88cdf452d1
equal deleted inserted replaced
3381:5166ef7c73b3 3382:cca44f2caa2d
  1045 "/ ' val:' print. value print. ' valArr:' print. valueArray printNewline.  
  1045 "/ ' val:' print. value print. ' valArr:' print. valueArray printNewline.  
  1046 "/
  1046 "/
  1047     'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
  1047     'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR
  1048 
  1048 
  1049     "Modified: 11.4.1997 / 01:11:17 / cg"
  1049     "Modified: 11.4.1997 / 01:11:17 / cg"
  1050 !
       
  1051 
       
  1052 decompressPackBits:nIn from:srcBytes to:dstBytes startingAt:dstOffset
       
  1053     |i b v dstOffs|
       
  1054 
       
  1055     dstOffs := dstOffset.
       
  1056     i := 1.
       
  1057 
       
  1058     [i <= nIn] whileTrue:[
       
  1059         b := srcBytes at:i.
       
  1060         i := i + 1.
       
  1061 
       
  1062         b ~~ 16rFF ifTrue:[   "/ not a NOP
       
  1063             b <= 127 ifTrue:[
       
  1064                 "/ 0..127 literal bytes
       
  1065                 dstBytes replaceFrom:dstOffs to:dstOffs+b with:srcBytes startingAt:i.
       
  1066                 i := i + b+1.
       
  1067                 dstOffs := dstOffs + b+1.
       
  1068 
       
  1069 "/                1 to:(b+1) do:[:nLit|
       
  1070 "/                    dstBytes at:dstOffs put:(srcBytes at:i).
       
  1071 "/                    i := i + 1.
       
  1072 "/                    dstOffs := dstOffs + 1
       
  1073 "/                ]
       
  1074             ] ifFalse:[                  
       
  1075                 "/ 128..254 a run        
       
  1076                 b := b - 256.
       
  1077                 b := b negated + 1.
       
  1078 
       
  1079                 v := srcBytes at:i.
       
  1080                 i := i + 1.
       
  1081 
       
  1082                 dstBytes from:dstOffs to:dstOffs+b-1 put:v.
       
  1083                 dstOffs := dstOffs+b.
       
  1084 
       
  1085 "/                1 to:b do:[:nRun |
       
  1086 "/                    dstBytes at:dstOffs put:v.
       
  1087 "/                    dstOffs := dstOffs + 1.
       
  1088 "/                ]
       
  1089             ]
       
  1090         ]
       
  1091     ].
       
  1092     ^ dstOffs - dstOffset
       
  1093 
       
  1094     "Created: / 1.12.1997 / 18:39:23 / cg"
       
  1095     "Modified: / 1.12.1997 / 18:49:58 / cg"
       
  1096 ! !
  1050 ! !
  1097 
  1051 
  1098 !TIFFReader methodsFor:'private-data reading'!
  1052 !TIFFReader methodsFor:'private-data reading'!
  1099 
  1053 
  1100 readCCITT3RLETiffImageData
  1054 readCCITT3RLETiffImageData
  1368             "/ realloc
  1322             "/ realloc
  1369             buffer := ByteArray uninitializedNew:nBytes.
  1323             buffer := ByteArray uninitializedNew:nBytes.
  1370         ].
  1324         ].
  1371         inStream nextBytes:nBytes into:buffer.
  1325         inStream nextBytes:nBytes into:buffer.
  1372 
  1326 
  1373         nDecompressedBytes := self decompressPackBits:nBytes from:buffer to:data startingAt:offset.
  1327         nDecompressedBytes := self class decompressPackBits:nBytes from:buffer to:data startingAt:offset.
  1374 
  1328 
  1375         offset := offset + nDecompressedBytes.
  1329         offset := offset + nDecompressedBytes.
  1376         row := row + rowsPerStrip
  1330         row := row + rowsPerStrip
  1377     ]
  1331     ]
  1378 
  1332 
  2353 ! !
  2307 ! !
  2354 
  2308 
  2355 !TIFFReader class methodsFor:'documentation'!
  2309 !TIFFReader class methodsFor:'documentation'!
  2356 
  2310 
  2357 version
  2311 version
  2358     ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.85 2013-08-10 11:10:37 stefan Exp $'
  2312     ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.86 2014-11-10 22:25:12 cg Exp $'
  2359 ! !
  2313 ! !
  2360 
  2314 
  2361 
  2315 
  2362 TIFFReader initialize!
  2316 TIFFReader initialize!