VTK
vtkOpenGLContextDevice2DPrivate.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLContextDevice2DPrivate.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
32 #ifndef vtkOpenGLContextDevice2DPrivate_h
33 #define vtkOpenGLContextDevice2DPrivate_h
34 
36 
37 #include "vtkColor.h"
38 #include "vtkTextProperty.h"
39 #include "vtkFreeTypeTools.h"
40 #include "vtkStdString.h"
41 #include "vtkUnicodeString.h"
42 
43 #include <algorithm>
44 #include <list>
45 #include <utility>
46 
47 // .NAME vtkTextureImageCache - store vtkTexture and vtkImageData identified by
48 // a unique key.
49 // .SECTION Description
50 // Creating and initializing a texture can be time consuming,
51 // vtkTextureImageCache offers the ability to reuse them as much as possible.
52 template <class Key>
54 {
55 public:
56  struct CacheData
57  {
60  // Dimensions of the text. Used for generating texture coords when the image
61  // dimensions are scaled to a power of two.
62  int TextWidth;
63  int TextHeight;
64  };
65 
67 
68  struct CacheElement: public std::pair<Key, CacheData>
69  {
70  // Default constructor
72  : std::pair<Key, CacheData>(Key(), CacheData()){}
73  // Construct a partial CacheElement with no CacheData
74  // This can be used for temporary CacheElement used to search a given
75  // key into the cache list.
76  CacheElement(const Key& key)
77  : std::pair<Key, CacheData>(key, CacheData()){}
78  // Standard constructor of CacheElement
79  CacheElement(const Key& key, const CacheData& cacheData)
80  : std::pair<Key, CacheData>(key, cacheData){}
81  // Operator tuned to be used when searching into the cache list using
82  // std::find()
83  bool operator==(const CacheElement& other)const
84  {
85  // Here we cheat and make the comparison only on the key, this allows
86  // us to use std::find() to search for a given key.
87  return this->first == other.first;
88  }
89  };
91 
93 
96  {
97  this->MaxSize = 50;
98  }
100 
102 
104  bool IsKeyInCache(const Key& key)const
105  {
106  return std::find(this->Cache.begin(), this->Cache.end(), key) != this->Cache.end();
107  }
109 
114  CacheData& GetCacheData(const Key& key);
115 
117 
120  {
121  typename std::list<CacheElement >::iterator it;
122  for (it = this->Cache.begin(); it != this->Cache.end(); ++it)
123  {
124  it->second.Texture->ReleaseGraphicsResources(window);
125  }
126  }
128 
129 protected:
131 
133  CacheData& AddCacheData(const Key& key, const CacheData& cacheData)
134  {
135  assert(!this->IsKeyInCache(key));
136  if (this->Cache.size() >= this->MaxSize)
137  {
138  this->Cache.pop_back();
139  }
140  this->Cache.push_front(CacheElement(key, cacheData));
141  return this->Cache.begin()->second;
142  }
144 
146  std::list<CacheElement > Cache;
148 
149  size_t MaxSize;
150 };
152 
153 template<class Key>
155 ::GetCacheData(const Key& key)
156 {
157  typename std::list<CacheElement>::iterator it =
158  std::find(this->Cache.begin(), this->Cache.end(), CacheElement(key));
159  if (it != this->Cache.end())
160  {
161  return it->second;
162  }
163  CacheData cacheData;
164  cacheData.ImageData = vtkSmartPointer<vtkImageData>::New();
165  cacheData.Texture = vtkSmartPointer<vtkTexture>::New();
166  cacheData.Texture->SetInputData(cacheData.ImageData);
167  cacheData.TextWidth = 0;
168  cacheData.TextHeight = 0;
169  return this->AddCacheData(key, cacheData);
170 }
171 
172 // .NAME TextPropertyKey - unique key for a vtkTextProperty and text
173 // .SECTION Description
174 // Uniquely describe a pair of vtkTextProperty and text.
175 template <class StringType>
176 struct TextPropertyKey
177 {
179 
180  static unsigned int GetIdFromTextProperty(vtkTextProperty* textProperty)
181  {
182  size_t id;
184  // Truncation on 64-bit machines! The id is a pointer.
185  return static_cast<unsigned int>(id);
186  }
188 
190 
191  TextPropertyKey(vtkTextProperty* textProperty, const StringType& text,
192  int dpi)
193  {
194  this->TextPropertyId = GetIdFromTextProperty(textProperty);
195  this->FontSize = textProperty->GetFontSize();
196  double color[3];
197  textProperty->GetColor(color);
198  this->Color.Set(static_cast<unsigned char>(color[0] * 255),
199  static_cast<unsigned char>(color[1] * 255),
200  static_cast<unsigned char>(color[2] * 255),
201  static_cast<unsigned char>(textProperty->GetOpacity() * 255));
202  this->Text = text;
203  this->DPI = dpi;
204  }
206 
208 
210  bool operator==(const TextPropertyKey& other)const
211  {
212  return this->TextPropertyId == other.TextPropertyId &&
213  this->FontSize == other.FontSize &&
214  this->Text == other.Text &&
215  this->Color[0] == other.Color[0] &&
216  this->Color[1] == other.Color[1] &&
217  this->Color[2] == other.Color[2] &&
218  this->Color[3] == other.Color[3] &&
219  this->DPI == other.DPI;
220  }
222 
223  unsigned short FontSize;
225  // States in the function not to use more than 32 bits - int works fine here.
226  unsigned int TextPropertyId;
227  StringType Text;
228  int DPI;
229 };
230 
233 
235 {
236 public:
238  {
239  this->Texture = NULL;
242  this->SpriteTexture = NULL;
243  this->SavedDepthTest = GL_TRUE;
244  this->SavedAlphaTest = GL_TRUE;
245  this->SavedStencilTest = GL_TRUE;
246  this->SavedBlend = GL_TRUE;
247  this->SavedDrawBuffer = 0;
248  this->SavedClearColor[0] = this->SavedClearColor[1] =
249  this->SavedClearColor[2] =
250  this->SavedClearColor[3] = 0.0f;
251  this->TextCounter = 0;
252  this->GLExtensionsLoaded = true;
253  this->GLSL = true;
254  this->PowerOfTwoTextures = false;
255  }
256 
258  {
259  if (this->Texture)
260  {
261  this->Texture->Delete();
262  this->Texture = NULL;
263  }
264  if (this->SpriteTexture)
265  {
266  this->SpriteTexture->Delete();
267  this->SpriteTexture = NULL;
268  }
269  }
270 
271  void SaveGLState(bool colorBuffer = false)
272  {
273  this->SavedDepthTest = glIsEnabled(GL_DEPTH_TEST);
274 
275  if (colorBuffer)
276  {
277  this->SavedAlphaTest = glIsEnabled(GL_ALPHA_TEST);
278  this->SavedStencilTest = glIsEnabled(GL_STENCIL_TEST);
279  this->SavedBlend = glIsEnabled(GL_BLEND);
280  glGetFloatv(GL_COLOR_CLEAR_VALUE, this->SavedClearColor);
281  glGetIntegerv(GL_DRAW_BUFFER, &this->SavedDrawBuffer);
282  }
283  }
284 
285  void RestoreGLState(bool colorBuffer = false)
286  {
287  this->SetGLCapability(GL_DEPTH_TEST, this->SavedDepthTest);
288 
289  if (colorBuffer)
290  {
291  this->SetGLCapability(GL_ALPHA_TEST, this->SavedAlphaTest);
292  this->SetGLCapability(GL_STENCIL_TEST, this->SavedStencilTest);
293  this->SetGLCapability(GL_BLEND, this->SavedBlend);
294 
295  if(this->SavedDrawBuffer != GL_BACK_LEFT)
296  {
297  glDrawBuffer(this->SavedDrawBuffer);
298  }
299 
300  int i = 0;
301  bool colorDiffer = false;
302  while(!colorDiffer && i < 4)
303  {
304  colorDiffer=this->SavedClearColor[i++] != 0.0;
305  }
306  if(colorDiffer)
307  {
308  glClearColor(this->SavedClearColor[0],
309  this->SavedClearColor[1],
310  this->SavedClearColor[2],
311  this->SavedClearColor[3]);
312  }
313  }
314  }
315 
316  void SetGLCapability(GLenum capability, GLboolean state)
317  {
318  if (state)
319  {
320  glEnable(capability);
321  }
322  else
323  {
324  glDisable(capability);
325  }
326  }
327 
328  float* TexCoords(float* f, int n)
329  {
330  float* texCoord = new float[2*n];
331  float minX = f[0]; float minY = f[1];
332  float maxX = f[0]; float maxY = f[1];
333  float* fptr = f;
334  for(int i = 0; i < n; ++i)
335  {
336  minX = fptr[0] < minX ? fptr[0] : minX;
337  maxX = fptr[0] > maxX ? fptr[0] : maxX;
338  minY = fptr[1] < minY ? fptr[1] : minY;
339  maxY = fptr[1] > maxY ? fptr[1] : maxY;
340  fptr+=2;
341  }
342  fptr = f;
344  {
345  double* textureBounds = this->Texture->GetInput()->GetBounds();
346  float rangeX = (textureBounds[1] - textureBounds[0]) ?
347  textureBounds[1] - textureBounds[0] : 1.;
348  float rangeY = (textureBounds[3] - textureBounds[2]) ?
349  textureBounds[3] - textureBounds[2] : 1.;
350  for (int i = 0; i < n; ++i)
351  {
352  texCoord[i*2] = (fptr[0]-minX) / rangeX;
353  texCoord[i*2+1] = (fptr[1]-minY) / rangeY;
354  fptr+=2;
355  }
356  }
357  else // this->TextureProperties & vtkContextDevice2D::Stretch
358  {
359  float rangeX = (maxX - minX)? maxX - minX : 1.f;
360  float rangeY = (maxY - minY)? maxY - minY : 1.f;
361  for (int i = 0; i < n; ++i)
362  {
363  texCoord[i*2] = (fptr[0]-minX)/rangeX;
364  texCoord[i*2+1] = (fptr[1]-minY)/rangeY;
365  fptr+=2;
366  }
367  }
368  return texCoord;
369  }
370 
372  {
373  vtkVector2i pow2(1, 1);
374  for (int i = 0; i < 2; ++i)
375  {
376  while (pow2[i] < size[i])
377  {
378  pow2[i] *= 2;
379  }
380  }
381  return pow2;
382  }
383 
385  {
386  if (image->GetScalarType() != VTK_UNSIGNED_CHAR)
387  {
388  cout << "Error = not an unsigned char..." << endl;
389  return 0;
390  }
391  int bytesPerPixel = image->GetNumberOfScalarComponents();
392  int size[3];
393  image->GetDimensions(size);
394  vtkVector2i newImg = this->FindPowerOfTwo(vtkVector2i(size[0], size[1]));
395 
396  for (int i = 0; i < 2; ++i)
397  {
398  texCoords[i] = size[i] / float(newImg[i]);
399  }
400 
401  unsigned char *dataPtr =
402  new unsigned char[newImg[0] * newImg[1] * bytesPerPixel];
403  unsigned char *origPtr =
404  static_cast<unsigned char*>(image->GetScalarPointer());
405 
406  for (int i = 0; i < newImg[0]; ++i)
407  {
408  for (int j = 0; j < newImg[1]; ++j)
409  {
410  for (int k = 0; k < bytesPerPixel; ++k)
411  {
412  if (i < size[0] && j < size[1])
413  {
414  dataPtr[i * bytesPerPixel + j * newImg[0] * bytesPerPixel + k] =
415  origPtr[i * bytesPerPixel + j * size[0] * bytesPerPixel + k];
416  }
417  else
418  {
419  dataPtr[i * bytesPerPixel + j * newImg[0] * bytesPerPixel + k] =
420  k == 3 ? 0 : 255;
421  }
422  }
423  }
424  }
425 
426  GLuint tmpIndex(0);
427  GLint glFormat = bytesPerPixel == 3 ? GL_RGB : GL_RGBA;
428  GLint glInternalFormat = bytesPerPixel == 3 ? GL_RGB8 : GL_RGBA8;
429 
430  glGenTextures(1, &tmpIndex);
431  glBindTexture(GL_TEXTURE_2D, tmpIndex);
432 
433  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
434  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
435  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
436  GL_CLAMP_TO_EDGE );
437  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
438  GL_CLAMP_TO_EDGE );
439 
440  glTexImage2D(GL_TEXTURE_2D, 0 , glInternalFormat,
441  newImg[0], newImg[1], 0, glFormat,
442  GL_UNSIGNED_BYTE, static_cast<const GLvoid *>(dataPtr));
443  delete [] dataPtr;
444  return tmpIndex;
445  }
446 
448  {
449  if (image->GetScalarType() != VTK_UNSIGNED_CHAR)
450  {
451  cout << "Error = not an unsigned char..." << endl;
452  return 0;
453  }
454  int bytesPerPixel = image->GetNumberOfScalarComponents();
455  int size[3];
456  image->GetDimensions(size);
457 
458  unsigned char *dataPtr =
459  static_cast<unsigned char*>(image->GetScalarPointer());
460  GLuint tmpIndex(0);
461  GLint glFormat = bytesPerPixel == 3 ? GL_RGB : GL_RGBA;
462  GLint glInternalFormat = bytesPerPixel == 3 ? GL_RGB8 : GL_RGBA8;
463 
464  glGenTextures(1, &tmpIndex);
465  glBindTexture(GL_TEXTURE_2D, tmpIndex);
466 
467  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
468  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
469  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
470  GL_CLAMP_TO_EDGE );
471  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
472  GL_CLAMP_TO_EDGE );
473 
474  glTexImage2D(GL_TEXTURE_2D, 0 , glInternalFormat,
475  size[0], size[1], 0, glFormat,
476  GL_UNSIGNED_BYTE, static_cast<const GLvoid *>(dataPtr));
477  return tmpIndex;
478  }
479 
481  unsigned int TextureProperties;
483  // Store the previous GL state so that we can restore it when complete
489  GLfloat SavedClearColor[4];
490 
491  int TextCounter;
494  bool GLExtensionsLoaded;
495  bool GLSL;
496  bool PowerOfTwoTextures;
497 
499 
503 };
505 
506 #endif // VTKOPENGLCONTEXTDEVICE2DPRIVATE_H
507 // VTK-HeaderTest-Exclude: vtkOpenGLContextDevice2DPrivate.h
vtkOpenGLContextDevice2D::Private
Definition: vtkOpenGLContextDevice2DPrivate.h:235
vtkStdString.h
vtkOpenGLContextDevice2D::Private::TexCoords
float * TexCoords(float *f, int n)
Definition: vtkOpenGLContextDevice2DPrivate.h:328
vtkgl::id
GLuint id
Definition: vtkgl.h:11834
vtkTextureImageCache::CacheData::TextWidth
int TextWidth
Definition: vtkOpenGLContextDevice2DPrivate.h:62
vtkTextureImageCache::CacheData::Texture
vtkSmartPointer< vtkTexture > Texture
Definition: vtkOpenGLContextDevice2DPrivate.h:59
vtkTextureImageCache::GetCacheData
CacheData & GetCacheData(const Key &key)
vtkTextureImageCache::CacheData::TextHeight
int TextHeight
Definition: vtkOpenGLContextDevice2DPrivate.h:63
vtkOpenGLContextDevice2D::Private::Dim
vtkVector2i Dim
Definition: vtkOpenGLContextDevice2DPrivate.h:516
vtkContextDevice2D::Repeat
@ Repeat
Definition: vtkContextDevice2D.h:215
vtkOpenGLContextDevice2D::Private::GLSL
bool GLSL
Definition: vtkOpenGLContextDevice2DPrivate.h:521
vtkgl::GLenum
typedef GLenum(APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target)
vtkOpenGLContextDevice2D::Private::SavedBlend
GLboolean SavedBlend
Definition: vtkOpenGLContextDevice2DPrivate.h:511
vtkOpenGLContextDevice2D.h
vtkX3D::key
@ key
Definition: vtkX3D.h:257
vtkUnicodeString.h
vtkTextureImageCache::CacheElement::CacheElement
CacheElement(const Key &key)
Definition: vtkOpenGLContextDevice2DPrivate.h:76
TextPropertyKey::GetIdFromTextProperty
static unsigned int GetIdFromTextProperty(vtkTextProperty *textProperty)
Definition: vtkOpenGLContextDevice2DPrivate.h:180
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkOpenGLContextDevice2D::Private::TextCounter
int TextCounter
Definition: vtkOpenGLContextDevice2DPrivate.h:515
vtkOpenGLContextDevice2D::Private::SaveGLState
void SaveGLState(bool colorBuffer=false)
Definition: vtkOpenGLContextDevice2DPrivate.h:271
vtkTextureImageCache::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *window)
Definition: vtkOpenGLContextDevice2DPrivate.h:119
vtkSmartPointer< vtkImageData >
vtkTextureImageCache::CacheElement::CacheElement
CacheElement(const Key &key, const CacheData &cacheData)
Definition: vtkOpenGLContextDevice2DPrivate.h:79
vtkTextProperty::GetColor
virtual double * GetColor()
TextPropertyKey::Text
StringType Text
Definition: vtkOpenGLContextDevice2DPrivate.h:227
vtkOpenGLContextDevice2D::Private::PowerOfTwoTextures
bool PowerOfTwoTextures
Definition: vtkOpenGLContextDevice2DPrivate.h:522
vtkObjectBase::Delete
virtual void Delete()
vtkTextureImageCache::Cache
std::list< CacheElement > Cache
Definition: vtkOpenGLContextDevice2DPrivate.h:146
vtkOpenGLContextDevice2D::Private::Offset
vtkVector2i Offset
Definition: vtkOpenGLContextDevice2DPrivate.h:517
vtkTextureImageCache::CacheElement
Definition: vtkOpenGLContextDevice2DPrivate.h:69
vtkOpenGLContextDevice2D::Private::TextureFromImage
GLuint TextureFromImage(vtkImageData *image, vtkVector2f &texCoords)
Definition: vtkOpenGLContextDevice2DPrivate.h:384
vtkTextProperty.h
UTF8TextPropertyKey
TextPropertyKey< vtkStdString > UTF8TextPropertyKey
Definition: vtkOpenGLContextDevice2DPrivate.h:231
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkTextureImageCache::CacheElement::CacheElement
CacheElement()
Definition: vtkOpenGLContextDevice2DPrivate.h:71
vtkTextProperty::GetFontSize
virtual int GetFontSize()
vtkTextureImageCache::CacheElement::operator==
bool operator==(const CacheElement &other) const
Definition: vtkOpenGLContextDevice2DPrivate.h:83
float
float
Definition: vtkVectorOperators.h:162
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:70
vtkFreeTypeTools::MapTextPropertyToId
void MapTextPropertyToId(vtkTextProperty *tprop, size_t *tprop_cache_id)
TextPropertyKey::TextPropertyId
unsigned int TextPropertyId
Definition: vtkOpenGLContextDevice2DPrivate.h:226
vtkOpenGLContextDevice2D::Private::SavedAlphaTest
GLboolean SavedAlphaTest
Definition: vtkOpenGLContextDevice2DPrivate.h:509
vtkOpenGLContextDevice2D::Private::Texture
vtkTexture * Texture
Definition: vtkOpenGLContextDevice2DPrivate.h:503
vtkOpenGLContextDevice2D::Private::SavedClearColor
GLfloat SavedClearColor[4]
Definition: vtkOpenGLContextDevice2DPrivate.h:513
vtkTextureImageCache::CacheData
Definition: vtkOpenGLContextDevice2DPrivate.h:57
TextPropertyKey::Color
vtkColor4ub Color
Definition: vtkOpenGLContextDevice2DPrivate.h:224
TextPropertyKey::FontSize
unsigned short FontSize
Definition: vtkOpenGLContextDevice2DPrivate.h:223
vtkColor.h
vtkTextureImageCache::vtkTextureImageCache
vtkTextureImageCache()
Definition: vtkOpenGLContextDevice2DPrivate.h:95
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkOpenGLContextDevice2D::Private::SavedDepthTest
GLboolean SavedDepthTest
Definition: vtkOpenGLContextDevice2DPrivate.h:508
vtkOpenGLContextDevice2D::Private::SavedDrawBuffer
GLint SavedDrawBuffer
Definition: vtkOpenGLContextDevice2DPrivate.h:512
vtkSmartPointer::New
static vtkSmartPointer< T > New()
Definition: vtkSmartPointer.h:126
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
vtkgl::GLuint
typedef GLuint(APIENTRYP PFNGLCREATEPROGRAMPROC)(void)
vtkgl::first
const GLint * first
Definition: vtkgl.h:11686
vtkColor4::Set
void Set(const T &red, const T &green, const T &blue)
Definition: vtkColor.h:114
vtkgl::color
GLuint color
Definition: vtkgl.h:12351
vtkTextureImageCache::MaxSize
size_t MaxSize
Definition: vtkOpenGLContextDevice2DPrivate.h:149
vtkgl::f
GLclampf f
Definition: vtkgl.h:14181
vtkgl::GLint
typedef GLint(APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program
vtkOpenGLContextDevice2D::Private::Private
Private()
Definition: vtkOpenGLContextDevice2DPrivate.h:237
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkOpenGLContextDevice2D::Private::GLExtensionsLoaded
bool GLExtensionsLoaded
Definition: vtkOpenGLContextDevice2DPrivate.h:518
vtkOpenGLContextDevice2D::Private::~Private
~Private()
Definition: vtkOpenGLContextDevice2DPrivate.h:257
vtkOpenGLContextDevice2D::Private::SavedStencilTest
GLboolean SavedStencilTest
Definition: vtkOpenGLContextDevice2DPrivate.h:510
vtkOpenGLContextDevice2D::Private::RestoreGLState
void RestoreGLState(bool colorBuffer=false)
Definition: vtkOpenGLContextDevice2DPrivate.h:285
vtkTexture::GetInput
vtkImageData * GetInput()
vtkContextDevice2D::Linear
@ Linear
Definition: vtkContextDevice2D.h:213
vtkFreeTypeTools.h
vtkgl::GLboolean
typedef GLboolean(APIENTRYP PFNGLISQUERYPROC)(GLuint id)
vtkOpenGLContextDevice2D::Private::TextureProperties
unsigned int TextureProperties
Definition: vtkOpenGLContextDevice2DPrivate.h:504
TextPropertyKey::DPI
int DPI
Definition: vtkOpenGLContextDevice2DPrivate.h:228
vtkOpenGLContextDevice2D::Private::SetGLCapability
void SetGLCapability(GLenum capability, GLboolean state)
Definition: vtkOpenGLContextDevice2DPrivate.h:321
vtkTextureImageCache::GetCacheData
CacheData & GetCacheData(const Key &key)
Definition: vtkOpenGLContextDevice2DPrivate.h:155
vtkColor4ub
Definition: vtkColor.h:209
vtkOpenGLContextDevice2D::Private::TextTextureCache
vtkTextureImageCache< UTF16TextPropertyKey > TextTextureCache
Definition: vtkOpenGLContextDevice2DPrivate.h:527
vtkTextureImageCache::IsKeyInCache
bool IsKeyInCache(const Key &key) const
Definition: vtkOpenGLContextDevice2DPrivate.h:104
vtkDataSet::GetBounds
double * GetBounds()
vtkOpenGLContextDevice2D::Private::SpriteTexture
vtkTexture * SpriteTexture
Definition: vtkOpenGLContextDevice2DPrivate.h:505
vtkTextureImageCache
Definition: vtkOpenGLContextDevice2DPrivate.h:54
TextPropertyKey::TextPropertyKey
TextPropertyKey(vtkTextProperty *textProperty, const StringType &text, int dpi)
Definition: vtkOpenGLContextDevice2DPrivate.h:191
vtkVector2i
Definition: vtkVector.h:266
vtkOpenGLContextDevice2D::Private::TextureFromImage
GLuint TextureFromImage(vtkImageData *image)
Definition: vtkOpenGLContextDevice2DPrivate.h:447
UTF16TextPropertyKey
TextPropertyKey< vtkUnicodeString > UTF16TextPropertyKey
Definition: vtkOpenGLContextDevice2DPrivate.h:232
vtkFreeTypeTools::GetInstance
static vtkFreeTypeTools * GetInstance()
vtkTextProperty::GetOpacity
virtual double GetOpacity()
vtkTextureImageCache::CacheData::ImageData
vtkSmartPointer< vtkImageData > ImageData
Definition: vtkOpenGLContextDevice2DPrivate.h:58
vtkOpenGLContextDevice2D::Private::MathTextTextureCache
vtkTextureImageCache< UTF8TextPropertyKey > MathTextTextureCache
Definition: vtkOpenGLContextDevice2DPrivate.h:528
vtkVector2f
Definition: vtkVector.h:277
vtkgl::image
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: vtkgl.h:11341
TextPropertyKey
Definition: vtkOpenGLContextDevice2DPrivate.h:177
vtkContextDevice2D::Stretch
@ Stretch
Definition: vtkContextDevice2D.h:214
TextPropertyKey::operator==
bool operator==(const TextPropertyKey &other) const
Definition: vtkOpenGLContextDevice2DPrivate.h:210
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843
vtkOpenGLContextDevice2D::Private::FindPowerOfTwo
vtkVector2i FindPowerOfTwo(const vtkVector2i &size)
Definition: vtkOpenGLContextDevice2DPrivate.h:371
vtkTextureImageCache::AddCacheData
CacheData & AddCacheData(const Key &key, const CacheData &cacheData)
Definition: vtkOpenGLContextDevice2DPrivate.h:133