ANNOUNCE - graphics package

Joe Armstrong joe@REDACTED
Mon Jan 12 16:35:42 CET 2004


On Mon, 12 Jan 2004, Vlad Dumitrescu wrote:

> > To add support for (say) a rendering  extension one could make a new
> > protocol conversion module and write:
> >
> > xDo(Display, render:eSomeProtocolMessage(.....))
> >
> > etc.
> 
> Oh, yes! :-)
> 
> The replies are a little more tricky (i.e. one has to know which module to ask
> to decode the data) but not much, and what I was thinking was to have the
> extensions in mind so that it will be easy to add them after the core
> functionality runs smoothly.

This is also easy :-)

Primitives end up by calling either req or call like this:


ePutImage(Draw, GC, Width, Ht, X, Y, Pad, Depth, Data) ->
    req(72, 2, <<Draw:32,GC:32,Width:16,Ht:16,X:16,Y:16,Pad:8,Depth:8,
		0:16,Data/binary>>).

PutImage has no reply


eQueryFont(Id) ->
    call(47, <<Id:32>>, eQueryFont).
		        **********

Query font has a reply. Here eQueryFont is the name of the parser to
be called when the command returns

Then when later the command returns this code gets called: ...

pReply1(eQueryFont, <<_:64,
		     MinBounds:12/binary,       % note the units of binary
						% are inbytes
		     _:32,
		     MaxBounds:12/binary,
		     _:32,
		     MinByte2:16,
		     MaxByte2:16,
		     DefaultChar:16,
		     NFontProps:16,
		     DrawDirection:8,
		     MinByte1:8,
		     MaxByte1:8,
		     AllCharsExist:8,
		     FontAscent:?INT16, 
		     FontDescent:?INT16,
		     NCharInfos:32,
	...



> Just to check if I didn't miss this one: the image functionality isn't complete,
> is it?

No. I have included the code to read and display a Jpeg - but I removed it
from the examples when I found that it didn't work on all machines.
You can try it if you like

The example only works if you have "true color" (I think its called this)

The code works if you have a modern graphics card but fails if you have to
map the colors. I have written the code for this but
still get weird colors on my machine at work.

/Joe



> 
> /Vlad
> 




More information about the erlang-questions mailing list