[Pharo-project] [update 2.0] #20414
20414 ----- Issue 7008: clean unsent messages in StringHolder Hierarchy http://code.google.com/p/pharo/issues/detail?id=7008 Issue 7009: clean up CharacterScanner a little http://code.google.com/p/pharo/issues/detail?id=7009 Issue 7015: Form>>#fromBinaryStream: dependent on ImageReadWriter http://code.google.com/p/pharo/issues/detail?id=7015 Diff information: http://ss3.gemstone.com/ss/Pharo20/Tools-MarcusDenker.988.diff http://ss3.gemstone.com/ss/Pharo20/Text-MarcusDenker.38.diff http://ss3.gemstone.com/ss/Pharo20/Graphics-Display Objects-MarcusDenker.96.diff -- Marcus Denker -- http://marcusdenker.de
Pavel why not moving this class on the ImageWriter package because - I do not like this Smalltalk globals at: ifPresent: especially when there is no default. - This method does not make sense without the ImageReadWriter Form classSide>>fromBinaryStream: (in category 'instance creation') -----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 | 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." + Smalltalk globals at: #ImageReadWriter ifPresent: [:imageReadWriter | + ^ imageReadWriter formFromStream: aBinaryStream]
Hi Stef, because this method can be called from Form class >> #fromFileNamed: and can work in case you use native binary Form representation. Any idea how to solve it in more cleaner way? Cheers, -- Pavel On Wed, Nov 21, 2012 at 2:50 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Pavel
why not moving this class on the ImageWriter package because - I do not like this Smalltalk globals at: ifPresent: especially when there is no default.
- This method does not make sense without the ImageReadWriter
Form classSide>>fromBinaryStream: (in category 'instance creation') -----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 | 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." + Smalltalk globals at: #ImageReadWriter ifPresent: [:imageReadWriter | + ^ imageReadWriter formFromStream: aBinaryStream]
Hi Stef,
because this method can be called from Form class >> #fromFileNamed: and can work in case you use native binary Form representation.
I would move fromFileNamed: too Stef
Any idea how to solve it in more cleaner way?
Cheers, -- Pavel
On Wed, Nov 21, 2012 at 2:50 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Pavel
why not moving this class on the ImageWriter package because - I do not like this Smalltalk globals at: ifPresent: especially when there is no default.
- This method does not make sense without the ImageReadWriter
Form classSide>>fromBinaryStream: (in category 'instance creation') -----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 | 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." + Smalltalk globals at: #ImageReadWriter ifPresent: [:imageReadWriter | + ^ imageReadWriter formFromStream: aBinaryStream]
I'll prepare a slice -- Pavel On Wed, Nov 21, 2012 at 4:13 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Hi Stef,
because this method can be called from Form class >> #fromFileNamed: and can work in case you use native binary Form representation.
I would move fromFileNamed: too
Stef
Any idea how to solve it in more cleaner way?
Cheers, -- Pavel
On Wed, Nov 21, 2012 at 2:50 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Pavel
why not moving this class on the ImageWriter package because - I do not like this Smalltalk globals at: ifPresent: especially when there is no default.
- This method does not make sense without the ImageReadWriter
Form classSide>>fromBinaryStream: (in category 'instance creation') -----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 | 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." + Smalltalk globals at: #ImageReadWriter ifPresent: [:imageReadWriter | + ^ imageReadWriter formFromStream: aBinaryStream]
http://code.google.com/p/pharo/issues/detail?id=7036 -- Pavel On Wed, Nov 21, 2012 at 8:40 PM, Pavel Krivanek <pavel.krivanek@gmail.com> wrote:
I'll prepare a slice
-- Pavel
On Wed, Nov 21, 2012 at 4:13 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Hi Stef,
because this method can be called from Form class >> #fromFileNamed: and can work in case you use native binary Form representation.
I would move fromFileNamed: too
Stef
Any idea how to solve it in more cleaner way?
Cheers, -- Pavel
On Wed, Nov 21, 2012 at 2:50 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Pavel
why not moving this class on the ImageWriter package because - I do not like this Smalltalk globals at: ifPresent: especially when there is no default.
- This method does not make sense without the ImageReadWriter
Form classSide>>fromBinaryStream: (in category 'instance creation') -----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 | 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." + Smalltalk globals at: #ImageReadWriter ifPresent: [:imageReadWriter | + ^ imageReadWriter formFromStream: aBinaryStream]
participants (3)
-
Marcus Denker -
Pavel Krivanek -
Stéphane Ducasse