[Pharo-project] Render images - Porting from Cincom VW to Pharo
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:
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
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
On 12 Nov 2012, at 14:54, Emilia <maemco4@gmail.com> 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 <maemco4@gmail.com> 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 ?
The spec/how it works is well described in comments, believe it or not ;) Available to port without copyright issues though? I doubt it. Cheers, Henry
Thank you guys, i'll see what I can do :) 2012/11/12 Sven Van Caekenberghe <sven@stfx.eu>
On 12 Nov 2012, at 14:54, Emilia <maemco4@gmail.com> 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
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. -- View this message in context: http://forum.world.st/Render-images-Porting-from-Cincom-VW-to-Pharo-tp465483... Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (4)
-
Emilia -
Gustavo Jansen -
Henrik Sperre Johansen -
Sven Van Caekenberghe