On Thu, 21 Apr 2011, Marco van de Voort wrote:
In our previous episode, [email protected] said:
* Create a TFPCustomImage descendant that is limited to the bit depth you need.
* Do not use palette.
* Implement GetPixel and SetPixel so they convert from 64-bit from/to the depth
you used
* Implement a GetScanLine/SetScanLine specific to your bit depth.
You can now load/save the image very fast using the GetScanLine/SetScanLine,
and all other FPIMage operations will work equally well.
This will not accelerate reading/writing at all. When writing (or any other
form of streaming), there will still be a procedure call per pixel and
conversion to/from 64-bit.
Obviously not if you use the standard reader classes.
But if the data is available as scanlines: definitely.
That was the implicit assumption.
There is no generic way to solve this problem, because you'd need a matrix
covering all possible storage memory formats and all possible disk storage
formats.
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.
Michael.
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal