Sunday, December 23, 2012

lab 109 - wm/view true color

There has been a three and a half year gap in my posts to this blog. In that time I hadn't done any Limbo programming. I've used Acme as my editor everyday, but I was drifting towards using Notepad++ more often. In the past couple of months I've had the time to contemplate doing some hacking projects. I wanted to explore what I could do with Inferno for multimedia file types. This lab was the first thing I tackled in using Inferno again. I had to open up the Limbo paper to remember even some basic syntax.

It bothered me that wm/view only displayed images using the Inferno 256 color map. Charon didn't have this limitation and I thought it had something to do with their respective image libraries. They don't use the same code. I extracted Charon's img.b code out into another view tool only to realize once I'd finished that the difference was not in the handling of JPEGs or PNGs but in the remap of the raw image to an Inferno image after the image was loaded.

I changed wm/view to remap the graphic to 24bit color. Here are the results.

view-true

There are a few other files in this lab.

view.b
The modified wm/view to display JPEG and PNG in true color.
img.b
The img library extracted from charon
pics.b
A view tool similar to the Plan 9 view command. It uses the charon img.b library. It also used the rioclient, riolib, and menuhit files included in this lab to give the appearance of a Rio window. You can see it in the upper left of the screenshot. Using this you can zoom in, pan, and fit to window. The zoom now works much better with true color than with the colormap.
riolib.b
An alternative to wmlib.b for non-TK window applications
rioclient.b
Use with riolib.b for non-TK window applications
menuhit.b
Menus for non-TK windows
clock.b
A non-TK clock demonstration from Plan 9
picsar.b
Similar to pics.b but doesn't use the charon img library. Also doesn't do the remap to 24bit color.
matador.jpg
Test JPEG
test.png
Test PNG

FILES

lab 109

2 comments:

Tony said...

I am trying to run the "pics" command but nothing happens. What would be a proper command line example to use to run this command?

Caerwyn Jones said...

"pics test.png" should work, as long as all the other files are compiled, riolib.b, menuhit.b, rioclient.b. It takes a little while for the graphic to open.