'From Squeak3.5 of ''11 April 2003'' [latest update: #5180] on 11 May 2003 at 6:36:19 pm'! "Change Set: KCP-0064-PictReaderClass Date: 11 May 2003 Author: stephane ducasse Remove from system dictionary the methods gifReaderClass , ImageReaderClass, and JPEGReaderClass. Fixe the few senders"! !Form class methodsFor: 'instance creation' stamp: 'sd 5/11/2003 15:41'! fromBinaryStream: aBinaryStream "Read a Form or ColorForm from given file, using the first byte of the file to guess its format. Currently handles: GIF, uncompressed BMP, and both old and new DisplayObject writeOn: formats, JPEG, and PCX. Return nil if the file could not be read or was of an unrecognized format." | firstByte classOrNil | aBinaryStream binary. firstByte _ aBinaryStream next. firstByte = 1 ifTrue: [ "old Squeakform format" ^ self new readFromOldFormat: aBinaryStream]. firstByte = 2 ifTrue: [ "new Squeak form format" ^ self new readFrom: aBinaryStream]. "Try for JPG, GIF, or PCX..." "Note: The following call closes the stream." classOrNil := Smalltalk at: #ImageReader ifAbsent: [nil]. classOrNil isNil ifTrue: [self error: 'Image Reader is not available' . ^ self] ifFalse: [ ^ classOrNil formFromStream: aBinaryStream ] ! ! !HTTPSocket class methodsFor: 'get the page' stamp: 'sd 5/11/2003 15:51'! httpGif: url "Fetch the given URL, parse it using the GIF reader, and return the resulting Form." "HTTPSocket httpShowGif: 'www.altavista.digital.com/av/pix/default/av-adv.gif'" | doc ggg classOrNil | doc _ self httpGet: url accept: 'image/gif'. doc class == String ifTrue: [ self inform: 'The server with that GIF is not responding'. ^ ColorForm extent: 20@20 depth: 8]. doc binary; reset. classOrNil := Smalltalk at: #GIFReadWriter ifAbsent: [nil]. classOrNil isNil ifTrue: [self inform: 'no gif reader.'. ^self]. (ggg _ classOrNil new) setStream: doc. ^ ggg nextImage. ! ! !HTTPSocket class methodsFor: 'get the page' stamp: 'sd 5/11/2003 15:43'! httpJpeg: url "Fetch the given URL, parse it using the JPEG reader, and return the resulting Form." | doc ggg classOrNil | doc _ self httpGet: url. doc binary; reset. classOrNil := Smalltalk at: #JPEGReadWriter ifAbsent: [nil]. classOrNil ifTrue: [self error: 'The JPEG reader is not available' . ^self]. (ggg _ classOrNil new) setStream: doc. ^ ggg nextImage. ! ! !SystemDictionary methodsFor: 'deprecated' stamp: 'sd 5/11/2003 18:35'! gifReaderClass "YOU SHOULD NOT USE THIS METHOD ANYMORE" ^ self deprecated: [self gifReaderClass] explanation: 'there is no replacement for this method'! ! !SystemDictionary methodsFor: 'deprecated' stamp: 'sd 5/11/2003 14:30'! gifReaderClassDeprecated "YOU SHOULD NOT CALL THIS METHOD ANYMORE" "Answer, if present, a class to handle the importing of GIF files from disk. If none, return nil. 9/18/96 sw" | aClass | ^ ((aClass _ self at: #GIFReadWriter ifAbsent: [nil]) isKindOf: Class) ifTrue: [aClass] ifFalse: [nil]! ! !SystemDictionary methodsFor: 'deprecated' stamp: 'sd 5/11/2003 18:35'! imageReaderClass "YOU SHOULD NOT USE THIS METHOD ANYMORE" ^ self deprecated: [self imageReaderClassDeprecated] explanation: 'there is no replacement for this method'! ! !SystemDictionary methodsFor: 'deprecated' stamp: 'sd 5/11/2003 15:38'! imageReaderClassDeprecated "Answer, if present, a class to handle the importing of various graphic image files from disk. If none, return nil. tao 10/26/97" | aClass | ^ ((aClass _ self at: #ImageReadWriter ifAbsent: [nil]) isKindOf: Class) ifTrue: [aClass] ifFalse: [nil]! ! !SystemDictionary methodsFor: 'deprecated' stamp: 'sd 5/11/2003 18:35'! jpegReaderClass "YOU SHOULD NOT USE THIS METHOD ANYMORE" ^ self deprecated: [self jpegReaderClassDeprecated] explanation: 'there is no replacement for this method'! ! !SystemDictionary methodsFor: 'deprecated' stamp: 'sd 5/11/2003 15:38'! jpegReaderClassDeprecated "Answer, if present, a class to handle the importing of JPEG files from disk. If none, return nil. 9/18/96 sw" | aClass | ^ ((aClass _ self at: #JPEGReadWriter ifAbsent: [nil]) isKindOf: Class) ifTrue: [aClass] ifFalse: [nil]! !