Image Capture

Hi ,
The image capture functionality in the importExport sample is not working. it is only giving a bitmap image with background color. can any one help?

David Egan's picture

can you post your code so we can see what you are doing here. we have a windows app that is working for .bmp OK , I just tested it now so I can look for the source and compare to what you are doing. It is awhile though since this was coded.

Saneesh Kumar's picture

Sorry David for the late reply...

I am using the same code explained in the open cascade importExport Sample

LPCTSTR filter;
#ifdef WNT
filter = _T("BMP Files (*.BMP)|*.bmp|GIF Files (*.GIF)|*.gif|XWD Files (*.XWD)|*.xwd|PS Files (*.PS)|*.ps|EMF Files (*.EMF)|*.emf||");
#else
filter = _T("BMP Files (*.BMP)|*.bmp|GIF Files (*.GIF)|*.gif|XWD Files (*.XWD)|*.xwd|PS Files (*.PS)|*.ps||");
#endif //WNT
CFileDialog dlg(FALSE,_T("*.BMP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
filter,
NULL );

if (dlg.DoModal() == IDOK)
{
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
CString filename = dlg.GetPathName();
char* theFile = new char[filename.GetLength()+1];
_tcscpy(theFile,filename);
CString ext = dlg.GetFileExt();
if (ext == "ps" || ext == "emf")
{
Graphic3d_ExportFormat exFormat;
if (ext == "ps") exFormat = Graphic3d_EF_PostScript;
else exFormat = Graphic3d_EF_EnhMetaFile;
myView->View()->Export( theFile, exFormat );
return;
}
Handle(Aspect_Window) anAspectWindow = myView->Window();
Handle(WNT_Window) aWNTWindow = Handle(WNT_Window)::DownCast(anAspectWindow);
if (ext == "bmp") aWNTWindow->SetOutputFormat ( WNT_TOI_BMP );
if (ext == "gif") aWNTWindow->SetOutputFormat ( WNT_TOI_GIF );
if (ext == "xwd") aWNTWindow->SetOutputFormat ( WNT_TOI_XWD );
aWNTWindow->Dump ((Standard_CString)(LPCTSTR)filename);
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}

this is the code given there.

it is only giving a blank image

Attached two images "Required.png" is the required image and "UsingCode.bmp" is what i am getting
thanx for the help
saneesh

Attachments: