webBrowser spawns an external program to convert GIF and JPG images to Sun raster format before displaying them. I couldn't find the programs it spawns to install on Linux so I converted the code to use 'convert' from Image Magick. Using this you can display PNG, GIF and JPG images from an imageMorph. With a copied imageMorph as the receiver:
setImage: ui2Image copyFromPNGFile: '/path/to/foo.png'
Unfortunately this doesn't yet work from the web browser to display images in web pages on Linux due to a crash in an X11 routine. I'll look into that.
I put a patch with these changes in the 'webbrowser' branch of git://github.com/doublec/self.git if anyone wants to use it.
Chris.
On Mon, Jul 27, 2009 at 9:35 PM, Chris Doublechris@double.co.nz wrote:
Unfortunately this doesn't yet work from the web browser to display images in web pages on Linux due to a crash in an X11 routine. I'll look into that.
It looks like this is a bug in the 'colorsFor:' method of 'traits ui2Image'. That method does:
(colorQuantizing && [paintMgr policy != paintMgr quantizingColors]) ifTrue: ...
But for displays greater than 8 bit the paintMgr is an unmappedPaintManager which doesn't have a policy or quantizingColors slot, I changed the code to do:
(colorQuantizing && [paintMgr areColorsMapped && [paintMgr policy != paintMgr quantizingColors]]) ifTrue: ...
'areColorsMapped' is implemented to return false in unmappedPaintManager and true in mappedPaintManager.
With this change images display in the web browser. Patch in webbrowser branch of: git://github.com/doublec/self.git
You can browse the patch change here:
http://github.com/doublec/self/tree/webbrowser
The web browser doesn't handle modern HTML very well so I put a simple test case with in image at: http://www.bluishcoder.co.nz/self/imagetest.html
This can be viewed with the following evaluated in a shell (with an image that has the web browser code loaded):
'http://www.bluishcoder.co.nz/self/imagetest.html' asURL getPageForUser
Chris.
self-interest@lists.selflanguage.org