C++如何读取icc文件色域

2025-03-22 22:20:31
推荐回答(1个)
回答1:

HANDLE	COkMfcView::exOpenCard(HWND hWnd)
{
short typecode, iNoBoards;
HMENU hMenu;
//check ok boards sloted in PC
iNoBoards = okGetSlotBoard(NULL);
//check if pre_allocated buffer
okGetAvailBuffer(NULL, (DWORD*)&dwBufSize);
//okGetBufferSize(hBoard,NULL,&dwBufSize);//
//check if reg device driver for nt/2k/xp 
if (!okSetNTDriver(0)) { // TRUE:registered already, -1:not nt system
MessageBox("There are not yet registered device service driver!");
}
else if (okSetNTDriver(0) == -1) { //win95/98
if( !iNoBoards && (!okSetStaticVxD(0)) ) 
MessageBox("There are not yet registered vxd device driver!");
}
else {
if(dwBufSize==0) //may be not reg driver, or no board, ... 
MessageBox("There are no buffer pre-allocated !");
}
//just starting, then allocated memory for dib
if (!lpbi) 

//GlobalMemoryStatus(&Status);
//determaine how many memory will be allocated as user memory
//dwMaxMemSize=Status.dwTotalPhys-dwBufSize-32*(1<<20); //I'd keep 32M for window system
//if(dwMaxMemSize<=0)
// dwMaxMemSize=5*(1<<20); //5M
//else if( dwMaxMemSize>Status.dwAvailPhys )
// dwMaxMemSize=Status.dwAvailPhys/2;
//if( dwMaxMemSize<5*(1<<20) ) //need 5M at least for user memory
// dwMaxMemSize=max(5*(1<<20),Status.dwAvailPhys);
dwMaxMemSize = (10*(1<<20)); //10M
exAllocateDIBMemory(dwMaxMemSize);
}
//open one specified board
if (!(hBoard = okOpenBoard(&iCurrUsedNo))) //set 
{
//if( !(hBoard=okOpenImageBoard(-1)) ) //select default 
long error;
error = okGetLastError();
if (error == ERR_NOTFOUNDBOARD)
MessageBox("Not found Ok series Image Board !");
else if (error == ERR_NOTFOUNDVXDDRV)
MessageBox("Not found VxD driver for Ok series Image Board !");
else
MessageBox("Open selected board failed!");
return false;
}
exGetBitmapHeader(hBoard, SCREEN, lpbi); 
//set initial size
sampwidth = (short)lpbi->biWidth;
sampheight = (short)lpbi->biHeight;
//initailize screen
lScrnOffset = exSetToWndRectEx(hBoard, hWnd, m_Centerscreen);
InvalidateRect(NULL, FALSE);
okSetConvertParam(hBoard, CONVERT_UPRIGHT, 0); //init to normal 
m_UptoRight = TRUE;
m_UptoLeft = TRUE;
m_UptoRightCheck = FALSE;
m_UptoLeftCheck = FALSE;
okSetConvertParam(hBoard, CONVERT_MIRROR, 0);//init to normal 
m_MakeXMirror = FALSE;
m_MakeYMirror = FALSE;
//set init menu 
hMenu = ::GetMenu(hWnd);
//modelcode=okGetTypeCode(hBoard,-1); //just get model code
typecode = (short)okGetTypeCode(hBoard, NULL);
if (okSetVideoParam(hBoard, VIDEO_FRAMELINES, -1) != -1)  //support playback
{
EnableMenuItem(hMenu, 3, MF_BYPOSITION|MF_ENABLED);
if (typecode == OK_M30) //special for M30 without outlut
{
m_NormalLut = FALSE;
m_InverseLut = FALSE;
m_AbsoluteLut = FALSE;
m_AbsoluteDsa = FALSE;
}
}
else 
{
EnableMenuItem(hMenu, 3, MF_BYPOSITION|MF_GRAYED);
//EnableMenuItem(hMenu,3,MF_BYPOSITION|MF_GRAYED);
}
if (LOWORD(okSetCaptureParam(hBoard, CAPTURE_FRMRGBFORMAT, -1)) != 0xffff) 
{
m_CapToFrame = TRUE;
m_BufferToFrame = TRUE;
m_FrameToBuffer = TRUE;
m_FrameToScreen = TRUE;
}
else 
{
m_CapToFrame = FALSE;
m_BufferToFrame = FALSE;
m_FrameToBuffer = FALSE;
m_FrameToScreen = FALSE;
}
if (typecode == OK_M60)  //special for M60 with frame
{
m_CapToFrame = true;
m_BufferToFrame = true;
}
else if (typecode == OK_RGB30)  //special for RGB30 with frame
{
m_CapToFrame = false;
m_FrameToBuffer = false;
m_FrameToScreen = false;
}
if (okOpenAudio(hBoard, 1))  //support audio funcrion
{
m_CaptureAudio = true;
}
else 
{
m_CaptureAudio = false;
}
if (okOpenStream(hBoard, 1))  //support stream funcrion
{
m_CaptureMpeg2 = true;
}
else 
{
m_CaptureMpeg2 = false;
}
//reg device driver for nt/2k/xp 
if (okSetNTDriver(0))  // TRUE:registered already, -1:not nt system
{
m_Regdevdriver = false;
}
//okSaveInitParam(hBoard,2);
//okLoadInitParam(hBoard,2);
//get current mask mode 
m_Enablemask = (short)okEnableMask(hBoard, -1);
if(m_Enablemask == -1) //not support
{
b_Enablemask = false;
m_Enablemask = false;
}
else 
{
b_Enablemask = true;
exDemoMask();
}
if (okCaptureSequence(hBoard, 0, 0) == -1)
m_SeqCapToBuf = FALSE;
else
m_SeqCapToBuf = TRUE;
return hBoard;
}