> Perhaps I should have mentioned that you need at least .Net 4 In 3.5 it's
available but does not work...

According to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP I
have Version 4 but it's worth updating to a newer version...

>
https://social.msdn.microsoft.com/Forums/en-US/be7ad7d6-972f-4a39-ae90-55660
d66c561/iccprofildaten-via-colorcontext?forum=wpfde)

Danke shön für der Microsoft Forum link -- ich sprache nicht viele deutche
aber I will try to read/translate as best I can.

------------

I used your DLLimport declaration and suggested code aber, yetz, ich bin
haben "Memory violation" problem.
Das ist meine humble C# code :

[DllImport(@lcms2Path, CallingConvention = CallingConvention.Winapi)]
        public static extern void cmsDoTransform(
        [In] IntPtr Transform,
        [In] byte[] InputBuffer,
        [Out] byte[] OutputBuffer,
        [In] UInt32 Size);

IntPtr hSource =
cmsOpenProfileFromFile("C:\\Windows\\System32\\spool\\drivers\\color\\AppleR
GB.icc", "r");
IntPtr hDestination =
cmsOpenProfileFromFile("C:\\Windows\\System32\\spool\\drivers\\color\\Coated
GRACoL2006.icc", "r");

IntPtr Transform = cmsCreateTransform(hSRGB, TYPE_BGR_8, hDestination,
TYPE_CMYK_8, INTENT_RELATIVE_COLORIMETRIC, 0);

PixelFormat inputFormat = myBitmapFrame.Format;

// copy image data to byte[]    
int stride = myBitmapFrame.PixelWidth * inputFormat.BitsPerPixel / 8;
Byte[] inputBitmapData = new Byte[stride * myBitmapFrame.PixelHeight];

myBitmapFrame.CopyPixels(inputBitmapData, stride, 0);
        
Byte[] outputBitmapData = inputBitmapData.Clone() as Byte[];

cmsDoTransform(xform, inputBitmapData, outputBitmapData,
(uint)(myBitmapFrame.PixelWidth * myBitmapFrame.PixelHeight));

----------------

The error occurs on this last line of code:

System.AccessViolationException 
Attempted to read or write protected memory. 

The error does not point to which element to cmsDoTransform that is causing
the AccessViolation?

The inputBitmapData is a pointer.
So is the outputBitmapdata.

I will continue searching for more details....

MfG / 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
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to