[fpc-pascal] FPImage and GetDataLineStart

Michael Van Canneyt michael at freepascal.org
Thu Apr 21 23:42:20 CEST 2011

On Thu, 21 Apr 2011, Marco van de Voort wrote:

> In our previous episode, Michael Van Canneyt said:
>>>> The best we can do is create a memory class with some pre-defined memory storages,
>>>> with appropriate getscanline/setscanline routines and make sure the reader classes
>>>> can
>>>> a) detect them
>>>> b) make use of them if they find one matching the file storage format.
>>>> c) fall back on the current mechanism if no fitting format is found.
>>>> If well-chosen, this approach should cover most cases.
>>> Something like that yes. Still duplication for the various formats though.
>> I don't see where the duplication comes in.
> It allows to address multiple points in the imagesize vs reader/writer class
> matrix (that you described) in one source.
>> There may be duplication in your classes (I don't know, but I suspect it is
>> delegation classes I think there is no need for duplication...
> Basically I use delegation for the slow case, where you operate on the base
> type.
> However when implemented using generics you can also directly use the
> specialized type, and have fairly quick direct access.

You don't need generics for that. Any form of an array of bytes will do, 
since that's what it amounts to in the end anyway.

>> The thing will be to parametrize the needed storage formats, and then implement
>> the reader support for them.
> How will you implement reader support for many memory layouts?

I am not that definite in my design. But I'm willing to listen to ideas.
(barring the ones relying on the use of generics)


More information about the fpc-pascal mailing list