COPASI API  4.16.103
RGTextureSpec.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layoutUI/RGTextureSpec.cpp,v $
3 // $Revision: 1.3 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/03/07 19:29:16 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #include "RGTextureSpec.h"
24 
25 #ifdef COPASI_DEBUG
26 #include <fstream>
28 
29 bool RGTextureSpec::save(const std::string& filename)
30 {
31  bool success = false;
32  std::ofstream ofs(CLocaleString::fromUtf8(filename).c_str());
33 
34  if (ofs.good())
35  {
36  /**
37  * RGB header
38  char header[18]={0,0,2,0,0,0,
39  0,0,0,0,0,0,
40  (char)this->textureWidth,(char)(((unsigned int)this->textureWidth) >> 8),
41  (char)this->textureHeight,(char)(((unsigned int)this->textureHeight) >> 8),
42  24,32
43  };
44  */
45  // grayscale header
46  char header[18] = {0, 0, 3, 0, 0, 0,
47  0, 0, 0, 0, 0, 0,
48  (char)this->textureWidth, (char)(((unsigned int)this->textureWidth) >> 8),
49  (char)this->textureHeight, (char)(((unsigned int)this->textureHeight) >> 8),
50  8, 32
51  };
52 
53  ofs.write(header, 18);
54  ofs.write((char*)this->textureData, this->textureWidth * this->textureHeight);
55  ofs.close();
56  success = true;
57  }
58 
59  return success;
60 }
61 #endif // COPASI_DEBUG
GLubyte * textureData
Definition: RGTextureSpec.h:35
double textureHeight
Definition: RGTextureSpec.h:32
static CLocaleString fromUtf8(const std::string &utf8)