sk@ukc.UUCP (S.Kenyon) (03/29/85)
This is not the correct place, but this is the only news group I read. I have implemented the above and it is available to anyone who wants it. I could have just upped and sent it out on the net, but if there is no interest then that would be rather anti-social (others take note). So here is the scant documentation. For more see the referenced papers, I do not have them in machine readable format. If enough people are interested then I will put it in net.sources, otherwise I will mail it to the requesting people. Simon Kenyon PR1ME Computer, Ireland +353 1 477888 x 319 ...!mcvax!simon ...!ukc!sk I am off to the EUUG conference in Paris. I will see how many replies I have got when I get back, shall we say by the middle of April. -------------Cut here and put through sh----------------------------------- #!/bin/sh echo 'Start of jerq documentation, part 01 of 01:' echo 'x - README' sed 's/^X//' > README << '/' X X Jerq X by X Simon Kenyon X (c) 1985 X XThis is a collection of files that tries to implement the layers code Xdescribed by Rob Pike in "Graphics in overlapping bitmap layers", XACM Transactions on Graphics, 2 135 (1983). This original paper has Xbeen augmented by two others, "Hardware/Software Trade-offs for Bitmap XGraphics on the Blit", Software - Practice and Experience, Vol 15(2) X131-151 (Feb 1985) and "The Blit: a multiplexed graphics terminal", XBSTJ 63 No 8 Part 2 1607 1631 (October 1984). XI have the first two, but have only briefly read the last. X XAnyway, this code might be of use to somebody, so here it is. XThe line drawing as described in the first paper is not included as XI don't have the clipping working. In it's place is a generalised line Xdrawing algorithm taken from the 1st Smalltalk-80 book, as is the Xbitblt code. X XSend any problem, suggestions or enhancements to me and I will try Xand deal with them as and when I can, but as this is a part-time Xactivity, don't hold your breath. X XThis is in the public domain, Rob having given his permission for me Xto publish this. I have had no access whatsoever to the Blit hardware Xor software, which I'm sure is pretty obvious, so there are no licencing Xhassles in me distributing this code. As a matter of fact it was debugged Xon a Printronix 300 printer/plotter. If you use it, it would be nice if Xyou left my name in the code. X XSimon Kenyon X ...!mcvax!simon X ...!ukc!sk X XWork: Home: X XPrime Computer (Ireland) Limited XClonshaugh Industrial Estate 10 Castle Avenue XCoolock Clontarf XDublin 5 Dublin 3 XIreland Ireland X X+353 1 477888 x 319 +353 1 331497 / echo 'x - man/jerq.3x' sed 's/^X//' > man/jerq.3x << '/' X X.TH JERQ 3X 85/03/26 "PR1ME Computer" X.SH NAME Xjerq \- routines to handle "overlapping asynchronous windows" ala Rob X.SH SYNOPSIS X.nf X.B background (rect) X.B struct Rectangle rect; X.PP X.B dellayer (lp) X.B struct Layer *lp; X.PP X.B layers () X.PP X.B lbitblt (sl, rect, dl, pt, hb, f) X.B struct Layer *sl; X.B struct Rectangle rect; X.B struct Layer *dl; X.B struct Point *pt; X.B struct Bitmap *hb; X.B int f; X.PP X.B lblt (l, sb, r, hb, pt, f) X.B struct Layer *l; X.B struct Bitmap *sb; X.B struct Rectangle r; X.B struct Bitmap *hb; X.B struct Point pt; X.B int f; X.PP X.B lline (lp, p0, p1, f) X.B struct Layer *lp; X.B struct Point p0; X.B struct Point p1; X.B int f; X.PP X.B struct Layer newlayer (bp, r, hb) X.B struct Bitmap *bp; X.B struct Rectangle r; X.B struct Bitmap *hb; X.PP X.B plot (sb, r, size) X.B struct Bitmap *sb; X.B struct Rectangle r; X.B int size; X.PP X.B upfront (lp) X.B struct Layer *lp; X.fi X.SH DESCRIPTION X.I Background Xfills X.I rect Xwith the background colour. X.PP X.I Dellayer Xdeletes layer X.I lp Xfrom the display and fills it in with the background colour. X.PP X.I Layers Xinitialises the layers package, Xcreating the display bitmap and Xfilling it in with the background colour. X.PP X.I Lbitblt Xperforms a bitblt operation from the source rectangle X.I rect Xin layer X.I sl Xto the corresponding rectangle with origin X.I pt Xin the destination layer X.IR dl . XThe bitmap X.I hb Xis Xan optional halftone pattern. X.PP X.IR Lblt , Xgiven a layer X.IR l , Xa bitmap X.IR sb , Xa rectangle X.I r Xand a function code X.IR f , Xcopies the off-screen bitmap X.I sb Xto a rectangle X.I r Xwithin layer X.IR l . X.PP X.I Lline Xdraws a line from X.I p0 Xto X.I p1 Xin a layer X.IR lp , Xusing code X.IR f . X.PP X.I Newlayer Xcreates a new layer in rectangle X.I r Xof bitmap X.I bp Xand eithers fill the layer with optional halftone X.I hb Xor clears it. XIt returns a pointer to the new layer. X.PP X.IR Plot , Xgiven a bitmap X.IR sb , Xa rectangle X.I r Xand a scale factor X.I size Xcreates a plot file suitable for the Printronix. X.PP X.I Upfront Xpulls layer X.I lp Xto the front of the screen, Xso that it is obscured by no other layer. X.SH SEE ALSO Xjerq(5) X.SH AUTHOR XSimon Kenyon X.SH BUGS XIn X.I background Xthe bitmap and the background colour to fill it with Xare hard-coded into the routine. X.PP XIn X.I layers Xthe display bitmap and the background colour Xare hard-coded into the routine. X.PP XThe code in X.I lline Xis nowhere as efficient as the restartable dda Xdescribed in Rob's original paper, Xbut I was having so much hassle with the clipping in that, Xand I wanted to ship this... X.PP XIn X.I plot Xthe output is sent to X.IR stdout . / echo 'x - man/jerq.5' sed 's/^X//' > man/jerq.5 << '/' X X.TH JERQ 5 85/03/28 "PR1ME Computer" X.SH NAME Xjerq \- jerq code data structures X.SH SYNOPSIS X.B #include "jerq/h/layers.h" X.SH DESCRIPTION XHere are the definitions of the data structures that are passed in and out Xof the layers routines. X.PP X.nf Xstruct Point { X int x; /* x and y coordinates of point */ X int y; X}; X Xstruct Rectangle { X struct Point origin; /* min x,y */ X struct Point corner; /* max x,y */ X}; X Xstruct Bitmap { X unsigned short *base; /* start of data */ X int width; /* width in words */ X struct Rectangle rect; /* image rectangle */ X struct Obscured *obs; /* linked list of obscured rectangles, X for compatability with Layer */ X struct Obscured *endobs; /* end of above linked list */ X}; X Xstruct Layer { X unsigned short *base; /* start of data */ X int width; /* width in words */ X struct Rectangle rect; /* image rectangle */ X struct Obscured *obs; /* linked list of obscured rectangles */ X struct Obscured *endobs; /* end of above linked list */ X struct Layer *front; /* adjacent layer in front */ X struct Layer *back; /* adjacent layer behind */ X}; X.fi X.SH SEE ALSO Xjerq(3X) X.SH AUTHOR XSimon Kenyon X.SH BUGS X.I XEndobs Xis not stricly necessary, Xbut it made coding a lot easier. / echo 'Part 01 of jerq documentation complete.' exit -- Simon Kenyon