ImageSegment

Noury Bouraqadi bouraqadi at ensm-douai.fr
Tue Nov 7 23:40:54 UTC 2006


Hi,

I'm trying to serialize morphs. A simple use of ReferenceStream seem  
not satisfactory cause some morphs may store blocks (e.g. a textmorph  
can refer to a block as crAction). So, I started looking at image  
segments. It worked fine for me when exporting segments to files.  
But, I encountered some issues when serializing into memory.
I first used RWBinaryOrTextStream as following:
-----------
morph := RectangleMorph new.
morph addMorph: (SimpleButtonMorph newWithLabel: 'My Button').
morph extent: 100 at 50.
morph position: 200 at 200.
segment := ImageSegment new.
segment copyFromRoots: (Array with: morph) sizeHint: 500000.
stream := RWBinaryOrTextStream on: (String new: 1000000).
stream fileOutClass: nil andObject: segment.
stream reset.
(stream fileInObjectAndCode) install arrayOfRoots first openInWorld.
stream close
---------
but, I got the following error 'Improper store into indexable  
object'. I don't understand exactly why. Tough I switched to  
MultiByteBinaryOrTextStream. It works, but it's about 4 times slower  
compared to file usage !

Any hints?

Thanks,
Noury
------------------------------------------------------------------
Dr. Noury Bouraqadi - Enseignant/Chercheur
ARMINES - Ecole des Mines de Douai - Dept. I.A.
http://csl.ensm-douai.fr/noury

European Smalltalk Users Group Board
http://www.esug.org

Squeak: a Free Smalltalk
http://www.squeak.org
------------------------------------------------------------------






More information about the Squeak-dev mailing list