I am still having difficulty with calling cmsDoTransform with
variable-length arrays of bytes.
I always get MemoryAccessViolations errors.
Today's preliminary testing suggest I would have better luck using fixed
size arrays.
What will happen if I break down my bitmap image in fixed size chunks?
Suppose image size = 104 bytes
Suppose I chose Fixed array size = 64 bytes
My new C# pinvoke function signature would look like this :
[DllImport(@lcms2Path, CallingConvention = CallingConvention.Winapi)]
static extern void cmsDoTransform(
IntPtr xform,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 64), In]
byte[] inputColors,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 64), Out]
byte[] outputColors,
uint Size);
Then, I will iterate cmsDoTransform 2x with 64 bytes each.
Upon return, it will be up to my code to throw away the remainder 2 x 64 =
128 - 104 -> 24 bytes.
I guess I will have to pad these extra 24 bytes with 00.
But, would this work?
At least, this approach has the merit of avoiding MemoryAccessViolations.
Best / Roger
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Lcms-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lcms-user