Rick Engebretson wrote:
Here is a draft of a draw routine. It is intended to set up linked lists for draw primitives such as circles and squares. While not a working draft, it compiles and runs the little test. And the logic is readable in Pascal.
I don't know what your design goals are, but allocating a linked list node for each pixel is a bit of overhead. It may be fine for some applications, but maximum speed probably isn't one of them. (At least it's an interesting contrast to the numerous postings in c.l.p.b -- at least some years ago when I read it -- with hand-written assembler putpixel routines ;-).
TYPE pPixel = ^TPixel; TPixel = Record x, y, color : longint; end; { TPixel }
pListElement = ^PixelListElement; { The List Handle } PixelListElement = Record ListIndex : longint; Pixel : TPixel; NextPixel : pListElement; end;
BTW, why LongInt? This it 64 bit on most targets. For the coordinates surely 32 or even 16 bit are sufficient, i.e. plain `Integer' should do. For the colors you may need 32 bits, so `Integer' may be too small on a few 16 bit platforms, but you may want to use a separate type (e.g. `TColor') as e.g. GRX does which could be declared as `Integer attribute (Size = 32)' or so. Anyway, I suggest to avoid the overhead of extra-large integers (which can be considerable) unless really needed. Perhaps your application is entirely time-uncritical, but for graphics applications that's not always so. Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8