[fpc-devel] graph module
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Mar 9 16:08:35 CET 2007
On 9 mrt 2007, at 15:59, Evgeniy Ivanov wrote:
>> I personally wouldn't necessarily wait for PTCPas based
>> implementation -
>> if Daniel wants to use the driver system, it should be enough to
>> agree on
>> the driver interface, anything else can be done completely
>> independently.
>
> As far as I've understood Daniel is working only on driver system,
> isn't it? He doesn't touch such things like line and circle for
> example (It should be based on PutPixel as I thing) but he is
> implementing only the things that using back-end libs (like
> PTCPas), in my example such thing is PutPixel. Am I right?
The graph unit is pretty generic in this respect. You indeed only
need to implement putpixel, getpixel, graphics mode detection,
setting a graphic mode, setting and getting colour palette entries
for indexed modes, and closing down the graphic system again. But
it's perfectly possible to also intercept line, elipse, rectangle etc
and to implement them directly in the "driver".
> I will do it using driver system with pleasure, but you've written
> that it is only your own opinion.
It's the way the whole graphics unit is designed to work. Note that
"driver" is just used in the figurative sense here. In practice, you
simply write your code and set some procedure variables inside the
graph unit so it calls your code.
> I agree that the most part must be in pascal, but I think that such
> things like SDL initialization, loading images need to be
> implemented in C (if use native SDL headers). From my point of
> view usage of C parts is less dangerous then usage converters and
> other wrappers stuff.
If you write your code in C, then you need to write Pascal headers
for your code. In the end, you will always have to convert some headers.
> I have no experience with JEDI_SDL, but the last release was 2
> years ago... And it's only the headers, so it uses "native" SDL
> libraries.
That's true, and it's the case for most libraries out there.
Converting all libraries from C to Pascal rather than the headers
would be a huge and never-ending duplication of effort. There's
nothing wrong with using Pascal interfaces for libraries which are
written in another language.
Jonas
More information about the fpc-devel
mailing list