Displaying GIF, PNG and JPG images

Chris Double chris at double.co.nz
Mon Jul 27 10:30:16 UTC 2009


On Mon, Jul 27, 2009 at 9:35 PM, Chris Double<chris at 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.
-- 
http://www.bluishcoder.co.nz



More information about the Self-interest mailing list