rudi wrote: ↑Wed Mar 22, 2023 5:35 am
Jaymos wrote: ↑Tue Mar 21, 2023 8:14 pm
pauli wrote: ↑Tue Mar 21, 2023 7:32 am
If someone volunteered to implement more, I'm sure they'd be considered for inclusion.
Otherwise, they'll have to wait for one of the team to build up sufficient motivation to design and implement them.
True. In addition:
There is no spec for commands to draw. The closest to a spec was this list I dreamt up at some point. A good start would be a spec of how this is to be done, and not a haphazard addition of commands like LINE and CIRCLE or what not.
Consider this and either replace it or enhance it.
viewtopic.php?f=2&t=2216&p=25356&hilit=Graphics#p25356
I would be happy to provide some C snippets, containing code that renders a
LINE,
RECT and
ELLIPSE.
I also assume, that in the source to C43, there is some sort of fast
setpixel function?
All three functions should take two 2D integer points as parameters, p0 and p1.
LINE will draw a line between p0 and p1.
RECT will draw a rectangle, where p0 and p1 are diagonally opposite corners (no requirements to which is left/right/upper/lower, the code detects this)
ELLIPSE will draw an ellipse with bounding rect p0 and p1, same specs as for
RECT.
For all three functions, p0 and p1 are allowed to lie outside the screen rect and will be clipped automatically. Thus allowing for drawing figures, that only partially lies on the screen.
Another thing, I am writing a program, that uses AGRAPH to draw objects on the screen and they may sometimes partially overlap.
It would be convenient, if it was possible to set the raster-operation, ROP, for AGRAPH. Could be inspired from
MS BitBlt function. To allow overlapping, the MERGECOPY ROP would be needed.
SRCCOPY : (default) copies pixels
MERGECOPY : merges pixels (OR)
Any additions to the set of commands need to go through scrutiny in terms of name choice, parameter usage, parameter sequence, etc. If originating here; scrutiny on a thread like this one would be ok. After that, internal discussion on Gitlab will continue.
Having said that, to me, my take on the commands could take the form:
LINE from (Z,T) to (X,Y)
RECT with corners (Z,T) and (X,Y) are ok. These two internal commands exist already and only wrappers are needed. This does not allow for a rectangle on an incline. Maybe register A = the angle offset anti-clockwise.
ELLIPSE bounded by a rectangle seems to be limited as the ellipse should have an inclination. Maybe like RECT, with additional parameter A = angle of the bounding rectangle. So the ellipse has the same spec as a rectangle.
POLY can have the same spec as
ELLIPSE, with an additional parameter B = number of points (codes) (note the points fit inside the rectangle). So a equilateral 10x3 triangle would be
POLY (0,0) (10,10) 0 3 and a 10x10 square would be
POLY (0,0) (10,10) 0 4
ELLIPSE may be a bit long - depending on the exact pixel length, it might not fix into a softkey.
COMPLEX currently is the longest one and does fit in marginally. If it does not fit, 2nd choice might be
ELLIPS which should fit.
Referring to the link I gave above and the response from dlachieze, I still find the creative expansion of AGRAPH interesting and I like the flag idea for defining to fill a shape, an arc spec, and other elements.
I think though that standard commands above can co-exist with an expanded AGRAPH.
This is my take on taking the proposed commands from rudi further. Welcome to further comment or change for proposal.
In terms of new snippets offered, there are already existing internal functions plotrect, plotline and plotline2 (in plotstat.c). New snippets will be needed using the existing ones where applicable.