Hello! I'm porting code from Cincom Smalltalk to Pharo. It's a web application so I've got several WAComponent instances and one component which inherits from WAFileLibrary that renders images.
In the original code ( the one that runned in VW) i had the following instance method in the component that inherits from WAFileLibrary:
logoJpg ^ByteArray asPackagedString: '?=#?8@@PR$YIQ @A@ D@X@A @@C?8P))QW!)Y @@RT$*@@ @@@@G@AHA@0@......etc etc' But now when i run it in Pharo the debbugger doesn't recognize #asPackagedString: message.
Does anyone know which method should I use in order to render that image? Thanks in advance! Mercy beaucoup! Emilia
|
On 12.11.2012 14:54, Emilia wrote:
fromPackedString: uses a (proprietary?) format to store a bytearray in source code, there are no method for reading the string as is in Pharo directly. The equivalent in Pharo would probably be something like: ^Base64MimeConverter mimeDecodeToBytes: 'myImageInAStringThatsSafeToStoreInSource' readStream contents (See ThemeIcons use of xxxContents methods for an example) To convert, you'd have to serialize your images to disk first (leaving you with .jpg files), then read them in and convert (f.ex. using a Base64MimeConverter) to an appropriate format for storing image bytes as methods in Pharo. Cheers, Henry |
In reply to this post by Emilia
On 12 Nov 2012, at 14:54, Emilia <[hidden email]> wrote: > Hello! I'm porting code from Cincom Smalltalk to Pharo. It's a web application so I've got several WAComponent instances and one component which inherits from WAFileLibrary that renders images. > In the original code ( the one that runned in VW) i had the following instance method in the component that inherits from WAFileLibrary: > > logoJpg > ^ByteArray asPackagedString: '?=#?8@@PR$YIQ @A@ D@X@A @@C?8P))QW!)Y @@RT$*@@ @@@@G@AHA@0@......etc etc' > > But now when i run it in Pharo the debbugger doesn't recognize #asPackagedString: message. > > Does anyone know which method should I use in order to render that image? > > Thanks in advance! > Mercy beaucoup! > > Emilia You could try to port ByteArray class>.#asPackagedString: from (VW?) to Pharo Smalltalk. It can't be that hard - is there a spec for this format ? -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill |
On 12.11.2012 18:08, Sven Van Caekenberghe wrote:
> On 12 Nov 2012, at 14:54, Emilia <[hidden email]> wrote: > >> Hello! I'm porting code from Cincom Smalltalk to Pharo. It's a web application so I've got several WAComponent instances and one component which inherits from WAFileLibrary that renders images. >> In the original code ( the one that runned in VW) i had the following instance method in the component that inherits from WAFileLibrary: >> >> logoJpg >> ^ByteArray asPackagedString: '?=#?8@@PR$YIQ @A@ D@X@A @@C?8P))QW!)Y @@RT$*@@ @@@@G@AHA@0@......etc etc' >> >> But now when i run it in Pharo the debbugger doesn't recognize #asPackagedString: message. >> >> Does anyone know which method should I use in order to render that image? >> >> Thanks in advance! >> Mercy beaucoup! >> >> Emilia > You could try to port ByteArray class>.#asPackagedString: from (VW?) to Pharo Smalltalk. It can't be that hard - is there a spec for this format ? > Available to port without copyright issues though? I doubt it. Cheers, Henry |
In reply to this post by Sven Van Caekenberghe-2
Thank you guys, i'll see what I can do :)
2012/11/12 Sven Van Caekenberghe <[hidden email]>
|
any progress or clues?
I have a similar problem. I'm dealing with a legacy code that takes a huge string and builds an executable file. I tried the solution with Base64MimeConverter, but it doesn't seem to convert the entire string. |
Free forum by Nabble | Edit this page |