[Oberon] Module Display: ReplPatternC (with clipping)?
Till Oliver Knoll
till.oliver.knoll at gmail.com
Thu Feb 28 08:06:59 CET 2019
Am 27.02.19 um 16:12 schrieb Tomas Kral:
> On Tue, 26 Feb 2019 20:42:46 +0100
> Jörg Straube <joerg.straube at iaeth.ch> wrote:
>
>> no higher module with clipping functionality yet
>
> My simple graph primitives, also lack, among other things, the
> clipping.
>
> Looking at PO2013 `Curves.Mod', I can see
>
> PROCEDURE Dot(f: GraphicFrames.Frame; col, x, y: INTEGER);
> BEGIN
> IF (x >= f.X) & (x+7 < f.X1) & (y >= f.Y) & (x+7 < f.Y1) THEN
> Display.Dot(col, x, y, Display.replace)
> END
> END Dot
Ah, that's interesting: comparing the above Curves.Mod from "Project
Oberon 2013" (the revised Oberon operating system based on the "original
Oberon" V4, or so I understand) with the previous Curves.Mod from OberonV4:
https://raw.githubusercontent.com/Spirit-of-Oberon/ProjectOberonV4/master/Curves.Mod
As can easily been seen the V4 version uses the "clip operations" from
the V4 Display.Mod, specifically the Display.DotC. E.g. the circle
drawing code in Curves.Mod (V4):
PROCEDURE circle(f: GraphicFrames.Frame; col: INTEGER; x0, y0, r:
LONGINT);
VAR x, y, u: LONGINT;
BEGIN u := 1 - r; x := r; y := 0;
WHILE y <= x DO
Display.DotC(f, col, SHORT(x0+x), SHORT(y0+y), 0);
[etc.]
Now that those "raster operations with clipping" are gone in Display.Mod
2013, the new Curves.Mod 2013 has its own "Dot with clipping" procedure,
additionally taking the Frame as input (as to determine the clipping
region). As shown in the previous reply.
All this supports my initial suspicion that the omission of the
"clipping operations" in Display.Mod are very deliberate and a concious
design decision done by Niklaus Wirth, most likely based on additional
input given by Paul Reed, in the spirit of "keep it as simple as
possible, but not simpler":
"I gratefully acknowledge the valuable contributions of Paul
Reed. He designed the interfaces to various devices, such as
the PS-2 and SPI, including the SD-card, acting as disk store.
He suggested many improvements and simplifications."
[https://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.System.pdf -
Preface to the 2013 edition]
And so the Curves.Mod was exactly that "higher level module" which is
(mostly) to be used by "application code", in order to draw clipped
points, lines, circles etc. - this is also illustrated by the "ordering"
of the modules here:
https://www.inf.ethz.ch/personal/wirth/ProjectOberon/index.html
When we take it that the "lowest modules" are described first (and are
hence "on top" of that page) then it becomes clear that Display.Mod is a
"lower module" than GraphicFrames.Mod, and the fact that the original V4
Display.Mod knew about the higher level concept of "frames" (which is
now, PO2013, "exclusively" implemented in the "higher module"
GraphicFrames.Mod) probably nagged Niklaus Wirth all over those years
(that's a personal assumption, of course ;)).
In short: so yes, the PO2013 is definitively simpler, and clipping is
"up to application code" (when not using the provided draw procedures in
Curves.Mod).
By the way: the reason our "GigaDraw" (exercise) did use "replicate
pattern" to draw (only horizontal and vertical) lines was because we
used a "grey" (dotted) and "black" pattern, to differentiate between
selected (dotted) lines and non-selected (fully black) lines. I guess
that was a given for the exercise at the time...
Cheers, Oliver
More information about the Oberon
mailing list