gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiw to use graphics in gforth?


From: Anton Ertl
Subject: Re: Hiw to use graphics in gforth?
Date: Sun, 22 May 2022 10:13:20 +0200

On Fri, May 20, 2022 at 07:11:31PM +0200, paul.ortais@aida-sea.com wrote:
> 
> Hello Anton, Joe,
> 
> I wasn't the initiator of this request, but it directly relates to a concern
> of mine.
> Though I can live with just at-xy and and scarce polices, the lack of
> graphics words in Gforth, and the reluctance to provide them in general in
> Forth, has something extremely bizarre that I concluded is a part of an
> "elite" club wanting to remain tiny.

Not at all, more a reflection that this topic has a bewildering
multitude of incompatible and aften complex APIs in the world outside
Forth, so what should our (one) graphics API target?

By contrast, text I/O has pretty much one API on the C level, even
though what's behind that can be quite diverse (display on a serial
terminal, the console, a local terminal emulator window (with lots of
terminal emulators available), through ssh on a remote terminal
emulator, on a local terminal emulator with a display on a remote X
server, an emacs terminal buffer, etc.), so it's relatively easy to
support.

> Anton, in your answer to Joe,  I can hardly figure what "open a pipe" means
> in reality for me,

https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Pipes.html

And I just rediscovered an example of how to use that for graphics:

http://www.complang.tuwien.ac.at/forth/programs/ps-example.fs

> or "through the C interface" etc.

For Gfoth 0.7:
https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/C-Interface.html

It's slightly different in the current development version:
https://gforth.org/manual/C-Interface.html

Then you look at the C graphics API you want to use, and call the C
functions through the C interface.

> Reading this I imagined that if only there is a single (Forth) word, for a
> given OS ok, to draw a pixel where I need it with graphic attributes, That
> would be cataclysmic in the Forth world. Like:
> : Pix. ( RGB i j --)
>   ????????
> ;
> Then many would be in heaven.

When I posted about ps-example.fs in 2010, there was not much
reaction; maybe once you are in heaven, there is no desire to post.:-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]