[Newbies] Bitmap-Arrays to large for "contents"

Bert Freudenberg bert at freudenbergs.de
Tue Dec 22 11:38:33 UTC 2009


On 22.12.2009, at 03:17, Hans Gruber wrote:
> 
> Hi Squeak-Fans!
> 
> I am new in programming squeak an I have the following problem:
> 
> I want to integrate bitmap-arrays in my project for the images used in it. To get the elements for my bit-map array I used:
> 
> | image stream |
> image := ColorForm fromFileNamed:
> '/path/to/picture/icon.gif'.
> stream := WriteStream with: String new.
> image storeOn: stream.
> stream contents.
> 
> By inspecting contents I can copy & paste its elements to the corresponding methods for the image. The Problem now is, that some of my images generate more bitmap-code elements than "contents" can display. Do you have an Idea how may copy&paste all the elements of the Stream!? I tried Seaside WAFileLibrary and pasted the generated methods, but WAFileLibrary returns byte-arrays, which can't be interpretet within the squeak form of *Morph.
> 
> So does anybody of you have an Idea and may help me?

Your last line could become

	Clipboard clipboardText: stream contents

However, the canonical way would be to simply generate the method rather than doing it manually. Generating a method can be as simple as

	MyClass compile: 'myMethod ^42'

See, for example, MenuIcons>>importIconNamed:.

- Bert -



More information about the Beginners mailing list