1131 . |
1131 . |
1132 self primitiveFailed |
1132 self primitiveFailed |
1133 ! |
1133 ! |
1134 |
1134 |
1135 loadBMP1to8Width:width height:height from:aStream into:aByteArray |
1135 loadBMP1to8Width:width height:height from:aStream into:aByteArray |
|
1136 "load bmp-1 bit per pixel imagedata. A helper for BMP image reader. |
|
1137 Calls primitive c function for speed" |
|
1138 |
1136 |f| |
1139 |f| |
1137 |
1140 |
1138 aStream isExternalStream ifFalse:[^ false]. |
1141 aStream isExternalStream ifFalse:[^ false]. |
1139 f := aStream filePointer. |
1142 f := aStream filePointer. |
1140 f isNil ifTrue:[^ false]. |
1143 f isNil ifTrue:[^ false]. |
1141 %{ |
1144 %{ |
1142 if (! (__bothSmallInteger(width, height) |
1145 if (! (__bothSmallInteger(width, height) |
1143 && __isByteArray(aByteArray))) { |
1146 && __isByteArray(aByteArray))) { |
1144 RETURN (false); |
1147 RETURN (false); |
1145 } |
1148 } |
1146 if (loadBMP1to8(__intVal(width), __intVal(height), |
1149 if (loadBMP1to8(__intVal(width), __intVal(height), |
1147 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1150 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1148 RETURN (true); |
1151 RETURN (true); |
1149 } |
1152 } |
1150 RETURN (false); |
1153 RETURN (false); |
1151 %} |
1154 %} |
|
1155 |
|
1156 "Modified: 22.4.1996 / 19:14:32 / cg" |
1152 ! |
1157 ! |
1153 |
1158 |
1154 loadBMP2to8Width:width height:height from:aStream into:aByteArray |
1159 loadBMP2to8Width:width height:height from:aStream into:aByteArray |
|
1160 "load bmp-2 bit per pixel imagedata. A helper for BMP image reader. |
|
1161 Calls primitive c function for speed" |
|
1162 |
1155 |f| |
1163 |f| |
1156 |
1164 |
1157 aStream isExternalStream ifFalse:[^ false]. |
1165 aStream isExternalStream ifFalse:[^ false]. |
1158 f := aStream filePointer. |
1166 f := aStream filePointer. |
1159 f isNil ifTrue:[^ false]. |
1167 f isNil ifTrue:[^ false]. |
1160 %{ |
1168 %{ |
1161 if (! (__bothSmallInteger(width, height) |
1169 if (! (__bothSmallInteger(width, height) |
1162 && __isByteArray(aByteArray))) { |
1170 && __isByteArray(aByteArray))) { |
1163 RETURN (false); |
1171 RETURN (false); |
1164 } |
1172 } |
1165 if (loadBMP2to8(__intVal(width), __intVal(height), |
1173 if (loadBMP2to8(__intVal(width), __intVal(height), |
1166 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1174 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1167 RETURN (true); |
1175 RETURN (true); |
1168 } |
1176 } |
1169 RETURN (false); |
1177 RETURN (false); |
1170 %} |
1178 %} |
|
1179 |
|
1180 "Modified: 22.4.1996 / 19:14:40 / cg" |
1171 ! |
1181 ! |
1172 |
1182 |
1173 loadBMP4to8Width:width height:height compression:compression from:aStream into:aByteArray |
1183 loadBMP4to8Width:width height:height compression:compression from:aStream into:aByteArray |
|
1184 "load bmp-4 bit per pixel imagedata. A helper for BMP image reader. |
|
1185 Calls primitive c function for speed" |
|
1186 |
1174 |f| |
1187 |f| |
1175 |
1188 |
1176 aStream isExternalStream ifFalse:[^ false]. |
1189 aStream isExternalStream ifFalse:[^ false]. |
1177 f := aStream filePointer. |
1190 f := aStream filePointer. |
1178 f isNil ifTrue:[^ false]. |
1191 f isNil ifTrue:[^ false]. |
1179 %{ |
1192 %{ |
1180 if (! (__bothSmallInteger(width, height) |
1193 if (! (__bothSmallInteger(width, height) |
1181 && __isSmallInteger(compression) |
1194 && __isSmallInteger(compression) |
1182 && __isByteArray(aByteArray))) { |
1195 && __isByteArray(aByteArray))) { |
1183 RETURN (false); |
1196 RETURN (false); |
1184 } |
1197 } |
1185 if (loadBMP4to8(__intVal(width), __intVal(height), __intVal(compression), |
1198 if (loadBMP4to8(__intVal(width), __intVal(height), __intVal(compression), |
1186 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1199 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1187 RETURN (true); |
1200 RETURN (true); |
1188 } |
1201 } |
1189 RETURN (false); |
1202 RETURN (false); |
1190 %} |
1203 %} |
|
1204 |
|
1205 "Modified: 22.4.1996 / 19:14:46 / cg" |
1191 ! |
1206 ! |
1192 |
1207 |
1193 loadBMP8Width:width height:height compression:compression from:aStream into:aByteArray |
1208 loadBMP8Width:width height:height compression:compression from:aStream into:aByteArray |
1194 |f| |
1209 "load bmp-8 bit per pixel imagedata. A helper for BMP image reader. |
|
1210 Calls primitive c function for speed" |
|
1211 |
|
1212 |f| |
1195 |
1213 |
1196 aStream isExternalStream ifFalse:[^ false]. |
1214 aStream isExternalStream ifFalse:[^ false]. |
1197 f := aStream filePointer. |
1215 f := aStream filePointer. |
1198 f isNil ifTrue:[^ false]. |
1216 f isNil ifTrue:[^ false]. |
1199 %{ |
1217 %{ |
1200 if (! (__bothSmallInteger(width, height) |
1218 if (! (__bothSmallInteger(width, height) |
1201 && __isSmallInteger(compression) |
1219 && __isSmallInteger(compression) |
1202 && __isByteArray(aByteArray))) { |
1220 && __isByteArray(aByteArray))) { |
1203 RETURN (false); |
1221 RETURN (false); |
1204 } |
1222 } |
1205 if (loadBMP8(__intVal(width), __intVal(height), __intVal(compression), |
1223 if (loadBMP8(__intVal(width), __intVal(height), __intVal(compression), |
1206 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1224 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) { |
1207 RETURN (true); |
1225 RETURN (true); |
1208 } |
1226 } |
1209 RETURN (false); |
1227 RETURN (false); |
1210 %} |
1228 %} |
|
1229 |
|
1230 "Modified: 22.4.1996 / 19:14:54 / cg" |
1211 ! ! |
1231 ! ! |
1212 |
1232 |
1213 !ImageReader class methodsFor:'i/o support'! |
1233 !ImageReader class methodsFor:'i/o support'! |
1214 |
1234 |
1215 streamReadingFile:aFilename |
1235 streamReadingFile:aFilename |