Integration of OCCT 6.5.0 from SVN
[occt.git] / src / ImageUtility / ImageUtility_XWD.cxx
CommitLineData
7fd59977 1#include <Image_Image.hxx>
2#include <AlienImage_XAlienImage.hxx>
3#include <OSD_Process.hxx>
4#include <OSD_File.hxx>
5#include <ImageUtility_XWD.ixx>
6
7ImageUtility_XWD::ImageUtility_XWD()
8
9{ myXAlienImage = NULL ;
10 myImage = NULL ;
11}
12
13Handle(Image_Image) ImageUtility_XWD::Image() const
14{ return myImage ; }
15
16Handle(AlienImage_XAlienImage) ImageUtility_XWD::XAlienImage() const
17{ return myXAlienImage; }
18
19Standard_Boolean ImageUtility_XWD::XWD( const Standard_CString xwdOptions )
20
21{ Standard_Boolean RetStatus ;
22
23 OSD_File File = OSD_File::BuildTemporary() ;
24
25 TCollection_AsciiString s, Name ;
26 OSD_Path Path ;
27 OSD_Process Process ;
28
29 File.Path( Path ) ;
30
31 Path.SystemName( Name, OSD_Default ) ;
32
33#ifdef TRACE
34 cout << "BuildTemporaryFile :" << Name << endl << flush ;
35#endif
36
37 s = TCollection_AsciiString("xwd ")
38 + TCollection_AsciiString(xwdOptions)
39 + TCollection_AsciiString(" -out ")
40 + Name ;
41
42 Process.Spawn( s ) ;
43
44 myXAlienImage = new AlienImage_XAlienImage() ;
45
46 if (( RetStatus = myXAlienImage->Read( File ) )) {
47 myImage = myXAlienImage->ToImage() ;
48 }
49 else {
50 myImage = NULL ;
51 myXAlienImage = NULL ;
52 }
53
54 return RetStatus ;
55}
56