[squeak-dev] Form asSomethingOrOther

Damien Cassou damien.cassou at gmail.com
Thu Aug 27 06:04:48 UTC 2009


On Thu, Aug 27, 2009 at 7:22 AM, Ronald Spengler<ron.spengler at gmail.com> wrote:
> Foo>>someIcon
>     ^ #( ... ) asForm
> What's the best way to do this?

To convert the picture to a byte array:

 This code needs a Seaside utility class to install the PNG file as a
ByteArray. Edit the generated code afterwards so that it runs without
Seaside installed (just remove the cache hack) or without the
NewCompiler (change to an array literal and send asByteArray)
	| data code |
	data := FileStream
		fileNamed: 'sqflogo.png'
		do: [:f | f binary contentsOfEntireFile].
	code := SeasidePlatformSupport asMethodReturningByteArray: data
named: #sqfLogoPng.
	SeasidePlatformSupport
		compile: code
		into: DEVImageCreator class
		classified: 'private - generated'


-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry



More information about the Squeak-dev mailing list