Hi,
I'm an inexperienced C++ programmer with some background in CM / Digital
Imaging..
Unfortunately, I'm having a problem getting Little cms to work properly
using Cbuilder 6.0.
This is what I did to 'enable LCMS' on my system (please tell me if I
screwed up!):
I opened the project group LCMS109.BPG from the BCB4 folder and did a Build
All.
I used the resulting lcmsdll.dll and lcms109.lib in my own project (I added
the lcms109.lib to my project and put the lcmsdll.dll file in my project
directory).
Furthermore (of course) I included lcms.h in my header file.
In principle I could now use the functionality of lcms in my own program.
BUT, a nasty error crept in, just have a look at my code:
{
/* 1: open image */
Graphics::TBitmap *mybitmap=new Graphics::TBitmap();
Graphics::TBitmap *newbitmap=new Graphics::TBitmap();
if (!opdlgMain->Execute()) exit; //PictureOpenDialog
mybitmap->LoadFromFile(opdlgMain->FileName); //bmp file in this example
newbitmap->Assign(mybitmap);
/* 2: profile stuff related to lcms */
cmsHPROFILE hInProfile, hOutProfile;
cmsHTRANSFORM hTransform;
hInProfile = cmsOpenProfileFromFile("Dimage 7i CWB c4b1.icm", "r");
//ERROR OCCURS HERE!!!
hOutProfile = cmsOpenProfileFromFile("sRGB Color Space Profile.icm", "r");
hTransform =
cmsCreateTransform(hInProfile,TYPE_BGR_8,hOutProfile,TYPE_BGR_8,
INTENT_RELATIVE_COLORIMETRIC, 0);
/* 3: actual colour transform */
for (int y=0;y<mybitmap->Height;y++) {
unsigned char* ptr=(unsigned char*)mybitmap->ScanLine[y];
unsigned char* nwptr=(unsigned char*)newbitmap->ScanLine[y];
cmsDoTransform(hTransform, ptr,nwptr,mybitmap->Width);
}
/* 4: cleanup */
cmsCloseProfile(hInProfile);
cmsCloseProfile(hOutProfile);
cmsDeleteTransform(hTransform);
delete mybitmap;
delete newbitmap;
}
When this code is executed an error message occurs at 2: hInProfile =
cmsOpenProfileFromFile...
'Access violation at address xxxxxxxx in module cc3260mt.dll'
So there seems to be some memory conflict here.
--> Now, when the code is shuffled, that is part 1 (open image) is swapped
with part 2 (profile stuff) the code executes fine -once-.
When I want to execute the code the 2nd time, the same error message happens
at the same point.
And now the weirdest part:
When the pictureopendialog ( if (!opdlgMain->Execute()) exit; ) is replaced
by:
opdlgMain->FileName="my filename.bmp";
the code runs flawlessly, any number of times.
So there actually seems to be a conflict involving lcms and
pictureopendialog. When the opendialog is skipped, the problems are gone.
Please could anyone shed some light on this matter?
Thanks and have a nice day,
Auke Nauta
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Lcms-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/lcms-user