Reading and writing to a image in memory!?
Posted: Wed May 11, 2005 8:09 am
Hi.
Cant find any usefull info about peek's and poke's with memory access adressing images(bitmaps).
Here's my 'problem'
Im going to use a dll that does some color correction with colorprofiles
(littleCMS), It cant use the whole image, it whants only partial information about the bitmap(pixel,scanline or 'block')
api info says this:
So.. how can I adress the image in blocks/chunks/lines?
with gdi/gdi+? or with peek's ?
api for cmsDoTransform says:
-------------------------------------------------------------
_________________________________________________________________________________
void cmsDoTransform(cmsHTRANSFORM hTransform,
LPVOID InputBuffer,
LPVOID OutputBuffer, unsigned int Size);
_________________________________________________________________________________
This function translates bitmaps according of transform. Format
of buffers is described by InputFormat and OutputFormat
parameters in function cmsCreateTransform() or
cmsCreateProofingTransform()
Parameters:
hTransform: A handle to a transform describing the translation.
InputBuffer: A pointer to a input bitmap
OutputBuffer: A pointer to a output bitmap.
Size: the number of PIXELS to be transformed.
Comments:
Windows, stores the bitmaps in a particular way... for speed
purposes, does align the scanlines to doubleword boundaries, so
a bitmap has in windows always a size multiple of 4. This is
ok, since no matter if you waste a couple of bytes, but if you
call cmsDoTransform() and passes it WHOLE image, lcms doesn't
know nothing about this extra padding bytes. So, it assumes
that you are passing a block of BGR triplets with no alignment
at all. This result in a strange looking "lines" in obtained
bitmap.
The solution most evident is to convert scanline by scanline
instead of whole image. This is as easy as to add a for() loop,
and the time penalty is so low that is impossible to detect.
--------------------------------------------------------------------------------
Thanks!
And it would be nice if someone could guide me into
peek poke pointer @ * ? jungle
Thanks again!
ZuedTheSwede
Cant find any usefull info about peek's and poke's with memory access adressing images(bitmaps).
Here's my 'problem'
Im going to use a dll that does some color correction with colorprofiles
(littleCMS), It cant use the whole image, it whants only partial information about the bitmap(pixel,scanline or 'block')
api info says this:
Code: Select all
/*
here a loop for translating your image.
*/
/*
for (i=0; i < AllScanlinesTilesOrWatseverBlocksYouUse; i++)
{
cmsDoTransform(hTransform, YourInputBuffer,
YourOutputBuffer,
YourBuffersSizeInPixels);
}
*/
with gdi/gdi+? or with peek's ?
api for cmsDoTransform says:
-------------------------------------------------------------
_________________________________________________________________________________
void cmsDoTransform(cmsHTRANSFORM hTransform,
LPVOID InputBuffer,
LPVOID OutputBuffer, unsigned int Size);
_________________________________________________________________________________
This function translates bitmaps according of transform. Format
of buffers is described by InputFormat and OutputFormat
parameters in function cmsCreateTransform() or
cmsCreateProofingTransform()
Parameters:
hTransform: A handle to a transform describing the translation.
InputBuffer: A pointer to a input bitmap
OutputBuffer: A pointer to a output bitmap.
Size: the number of PIXELS to be transformed.
Comments:
Windows, stores the bitmaps in a particular way... for speed
purposes, does align the scanlines to doubleword boundaries, so
a bitmap has in windows always a size multiple of 4. This is
ok, since no matter if you waste a couple of bytes, but if you
call cmsDoTransform() and passes it WHOLE image, lcms doesn't
know nothing about this extra padding bytes. So, it assumes
that you are passing a block of BGR triplets with no alignment
at all. This result in a strange looking "lines" in obtained
bitmap.
The solution most evident is to convert scanline by scanline
instead of whole image. This is as easy as to add a for() loop,
and the time penalty is so low that is impossible to detect.
--------------------------------------------------------------------------------
Thanks!
And it would be nice if someone could guide me into
peek poke pointer @ * ? jungle

Thanks again!
ZuedTheSwede