NCBI C++ ToolKit
image_grabber.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: image_grabber.cpp 44930 2020-04-21 17:07:30Z evgeniev $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Bob Falk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 #include <corelib/ncbistd.hpp>
35 
38 #include <gui/opengl/glresmgr.hpp>
39 
40 #include <corelib/ncbifile.hpp>
41 
43 
44 #include <gui/opengl/gltexture.hpp>
45 #include <gui/opengl/glutils.hpp>
47 
48 #include <util/image/image.hpp>
49 #include <util/image/image_io.hpp>
50 #include <gui/utils/vect2.hpp>
51 
54 
55 
57 
63  eAbort
64 };
65 
66 
68 : m_GuidesEnabled(false)
69 , m_GuideWidthX(0)
70 , m_GuideWidthY(0)
71 , m_TileAspectRatio(-1.0f)
72 , m_ImageAspectRatio(-1.0f)
73 , m_DisableGouraudShaded(false)
74 {
76 }
77 
79 {
80  if (m_SavedRender)
82 }
83 
85  const std::string& base_name,
86  const std::string& img_format)
87 {
88  m_Directory = dir;
89  m_BaseImageName = base_name;
90  m_ImageFormat = img_format;
91 }
92 
95 {
96  if (progress != NULL)
97  progress->SetGLContext();
98 
99  if (!glewIsSupported("GL_EXT_framebuffer_object")) {
100  _TRACE("Opengl: Feature not available");
101  return eOpenGLError;
102  }
103 
104  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
105 
106  CGLFrameBuffer tile_buffer(tex_size);
107  tile_buffer.CreateFrameBuffer();
108  if (!tile_buffer.IsValid())
109  return eOpenGLError;
110 
111  CImage img(tex_size, tex_size, 4);
113 
114  if (!m_BaseImageName.empty()) {
115  CImageIO::EType img_type = CImageIO::GetTypeFromFileName( "Whatever."+
116  m_ImageFormat );
117 
118  tile_buffer.MakeCurrent(true);
119  if (tile_buffer.CheckFBOError())
120  return eOpenGLError;
121 
122  GLint alignment;
123  glGetIntegerv(GL_PACK_ALIGNMENT, &alignment);
124  glPixelStorei(GL_PACK_ALIGNMENT, 1);
125 
126  x_BeginCaptures(tex_size);
127 
128  for (int y=0; y<m_ImagePartitions.Y()+1; ++y) {
129  for (int x=0; x<m_ImagePartitions.X()+1; ++x) {
130  glDisable(GL_TEXTURE_2D);
131 
132  // Call subclass to generate subimage
133  CVect2<size_t> capture_size;
135  CVect2<int>(x,y),
136  capture_size);
137 
138  std::string img_name = x_GetImageName(x, y);
139 
140  if (m_GuidesEnabled) {
141  x_RenderGuides(capture_size,
142  img_name,
143  x_GetImageName(x, y+1),
144  x_GetImageName(x+1, y),
145  x_GetImageName(x, y-1),
146  x_GetImageName(x-1, y));
147  }
148 
149  img_name = CDir::ConcatPath(m_Directory, img_name);
150 
151  // Make sure image size is correct. Probably all tiles will be
152  // the same size, but this code will work either way.
153  if (img.GetWidth() != capture_size.X() ||
154  img.GetHeight() != capture_size.Y() ) {
155  img.Init(capture_size.X(), capture_size.Y(), 4);
156  }
157 
158  glReadPixels(0, 0, (GLsizei)capture_size.X(), (GLsizei)capture_size.Y(),
159  GL_RGBA, GL_UNSIGNED_BYTE, img.SetData());
160  img.Flip();
161 
162  //Write image to file
163  bool success = CImageIO::WriteImage(img, img_name, img_type);
164 
165  // Call progress object to indicate that that the current image
166  // has been saved
167  if (!success) {
168  x_EndCaptures();
169  return eFileError;
170  }
171  else if (progress != NULL) {
172  // Bind standard (window) framebuffer
173  tile_buffer.MakeCurrent(false);
174 
175  // Update progress info
176  progress->ImageSaved(x, y);
177 
178  // Re-bind texture buffer we are using for image output
179  tile_buffer.MakeCurrent(true);
180  }
181  }
182  }
183 
184  // Restore standard (window) framebuffer and pixel store
185  glPixelStorei(GL_PACK_ALIGNMENT, alignment);
186  tile_buffer.MakeCurrent(false);
187  }
188 
189  x_EndCaptures();
190 
191  return eSuccess;
192 }
193 
196  CVect2<int> img_idx,
198 {
199  if (p != NULL)
200  p->SetGLContext();
201 
202  if (!glewIsSupported("GL_EXT_framebuffer_object")) {
203  _TRACE("Opengl: Feature not available");
204  return eOpenGLError;
205  }
206 
207  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
208 
209  CGLFrameBuffer tile_buffer(tex_size);
210  tile_buffer.CreateFrameBuffer();
211  if (!tile_buffer.IsValid())
212  return eOpenGLError;
213 
214  CRef<CImage> img(new CImage(tex_size, tex_size, 3));
215 
216  tile_buffer.MakeCurrent(true);
217 
218  GLint alignment;
219  glGetIntegerv(GL_PACK_ALIGNMENT, &alignment);
220  glPixelStorei(GL_PACK_ALIGNMENT, 1);
221 
222  x_BeginCaptures(tex_size);
223 
224  glDisable(GL_TEXTURE_2D);
225 
226  // Call subclass to generate subimage
227  CVect2<size_t> capture_size;
228  x_CaptureImage(m_ImagePartitions, img_idx, capture_size);
229 
230  string img_name = x_GetImageName(img_idx.X(), img_idx.Y());
231 
232  if (m_GuidesEnabled) {
233  x_RenderGuides(capture_size,
234  img_name,
235  x_GetImageName(img_idx.X(), img_idx.Y()+1),
236  x_GetImageName(img_idx.X()+1, img_idx.Y()),
237  x_GetImageName(img_idx.X(), img_idx.Y()-1),
238  x_GetImageName(img_idx.X()-1, img_idx.Y()));
239  }
240 
241  // Make sure image size is correct. Probably all tiles will be
242  // the same size, but this code will work either way.
243  if (img->GetWidth() != capture_size.X() ||
244  img->GetHeight() != capture_size.Y() ) {
245  img->Init(capture_size.X(), capture_size.Y(), 3);
246  }
247 
248  glReadPixels(0, 0, (GLsizei)capture_size.X(), (GLsizei)capture_size.Y(),
249  GL_RGB, GL_UNSIGNED_BYTE, img->SetData());
250 
251  // Call progress object to indicate that that the current image
252  // has been saved
253  if (p != NULL) {
254  // Bind standard (window) framebuffer
255  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
256  glDrawBuffer(GL_BACK);
257  glReadBuffer(GL_BACK);
258 
259  // Display preview image in widget
260  p->SetPreviewSubImage(img);
261  }
262 
263  // Restore standard (window) framebuffer and pixel store
264  glPixelStorei(GL_PACK_ALIGNMENT, alignment);
265 
266  x_EndCaptures();
267 
268  return eSuccess;
269 }
270 
271 
274  int ref_img_width, int ref_img_height,
276 {
277  if (p == NULL)
278  return eError;
279 
280  p->SetGLContext();
281 
282  if (!glewIsSupported("GL_EXT_framebuffer_object")) {
283  _TRACE("Opengl: Feature not available");
284  return eOpenGLError;
285  }
286 
287  // We have the size of a display area for the tiled image on the
288  // preview widget. Use this size to find the next larger (square)
289  // texture size
290  int size = std::max(ref_img_width,
291  ref_img_height);
292  int ref_image_size = 64;
293  while (ref_image_size < size)
294  ref_image_size *= 2;
295 
296  CGLFrameBuffer result_buffer(ref_image_size);
297  result_buffer.CreateFrameBuffer();
298 
299  CGlTexture *result_texture = new CGlTexture(result_buffer.GetTexture(), ref_image_size, ref_image_size);
300  result_buffer.ReleaseTexture();
301 
302  result_buffer.MakeCurrent(true);
303  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
304 
305  int target_tile_width, target_tile_height;
306  vector<IImageGrabberProgress::CTileOrigin> tile_positions;
307  tile_positions = p->GetTileLocations(target_tile_width, target_tile_height);
308 
309  // Compute scale factors between the display area size and the
310  // texture size. These are used for scaling the tiles whose
311  // sizes we get from the preview widget.
312  float tiled_width = (m_ImagePartitions.X()+1)*target_tile_width;
313  float tiled_height = (m_ImagePartitions.Y()+1)*target_tile_height;
314  float tile_scale_x = ((float)ref_image_size)/(float)tiled_width;
315  float tile_scale_y = ((float)ref_image_size)/(float)tiled_height;
316 
317  CGLFrameBuffer tile_buffer(tex_size);
318  tile_buffer.SetTextureFiltering(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR);
319  tile_buffer.SetTextureWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
320  tile_buffer.CreateFrameBuffer();
321  tile_buffer.MakeCurrent(false);
322  if (!tile_buffer.IsValid())
323  return eOpenGLError;
324 
325  // This renderes to the screen with the updated image, so make sure
326  // default frame buffer is active.
327  p->SetReferenceImage(result_texture);
328 
329  x_BeginCaptures(tex_size);
330 
331  size_t tile_idx = 0;
332 
333  for (int y=0; y<m_ImagePartitions.Y()+1; ++y) {
334  for (int x=0; x<m_ImagePartitions.X()+1; ++x) {
335  glDisable(GL_TEXTURE_2D);
336 
337  // Re-bind texture buffer we are using for image output
338  tile_buffer.MakeCurrent(true);
339  if (tile_buffer.CheckFBOError())
340  return eOpenGLError;
341 
342  // Call subclass to generate subimage
343  CVect2<size_t> capture_size;
345  CVect2<int>(x,y),
346  capture_size);
347  tile_buffer.GenerateMipMaps();
348 
349  if (m_GuidesEnabled) {
350  x_RenderGuides(capture_size,
351  x_GetImageName(x, y),
352  x_GetImageName(x, y+1),
353  x_GetImageName(x+1, y),
354  x_GetImageName(x, y-1),
355  x_GetImageName(x-1, y));
356  }
357 
358  IImageGrabberProgress::CTileOrigin tile_pos = tile_positions[tile_idx];
359  ++tile_idx;
360 
361  // Draw into the buffer using the positions for drawing the tiles, but
362  // scale those to the image size (the images we draw will tile the entire
363  // texture map, (ref_image_size, ref_image_size) with appropriate scaling.
364  int originx = tile_pos.m_TileIndex.X()*target_tile_width*tile_scale_x;
365  int originy = (m_ImagePartitions.Y() - tile_pos.m_TileIndex.Y()) *
366  target_tile_height*tile_scale_y;
367 
368  result_buffer.MakeCurrent(true);
369 
370  // Viewport for just region of the texture for this tile. Enlarge by 1 to
371  // avoid dropped pixels.
372  glViewport(originx, originy,
373  (int)((float)target_tile_width)*tile_scale_x + 1,
374  (int)((float)target_tile_height)*tile_scale_y + 1);
375  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
376 
377  glMatrixMode(GL_MODELVIEW);
378  glPushMatrix();
379  glLoadIdentity();
380 
381  glMatrixMode(GL_PROJECTION);
382  glPushMatrix();
383  glLoadIdentity();
384  gluOrtho2D(0.0, 1.0, 0.0, 1.0);
385 
386  glEnable(GL_TEXTURE_2D);
387  glBindTexture(GL_TEXTURE_2D, tile_buffer.GetTexture());
388 
389  float capture_ratiox = ((float)capture_size.X())/(float)tex_size;
390  float capture_ratioy = ((float)capture_size.Y())/(float)tex_size;
391 
392  glBegin(GL_QUADS);
393  glTexCoord2f(0.0f, 0.0f);
394  glVertex3f(0.0f, 0.0f, 0.0f);
395 
396  glTexCoord2f(capture_ratiox, 0.0f);
397  glVertex3f(1.0f, 0.0f, 0.0f);
398 
399  glTexCoord2f(capture_ratiox, capture_ratioy);
400  glVertex3f(1.0f, 1.0f, 0.0f);
401 
402  glTexCoord2f(0.0f, capture_ratioy);
403  glVertex3f(0.0f, 1.0f, 0.0f);
404  glEnd();
405 
406  // Refresh preview widget incrementally (as edget tile is rendered).
407  // Bind standard (window) framebuffer before refreshing, since the
408  // refresh draw requires OpenGL drawing to the window.
409  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
410  glDrawBuffer(GL_BACK);
411  glReadBuffer(GL_BACK);
412  p->ImageSaved(-1, -1);
413 
414  glPopMatrix();
415 
416  glMatrixMode(GL_PROJECTION);
417  glPopMatrix();
418  }
419 
420  }
421 
422  // Restore standard (window) framebuffer and pixel store
423  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
424  glDrawBuffer(GL_BACK);
425  glReadBuffer(GL_BACK);
426 
427  x_EndCaptures();
428 
429  return eSuccess;
430 }
431 
432 
433 
435 {
436  // If tile index is out of bounds return blank
437  if (y < 0 ||
438  x < 0 ||
439  y > m_ImagePartitions.Y() ||
440  x > m_ImagePartitions.X()) {
441  return "";
442  }
443 
444  std::string img_name = m_BaseImageName;
445 
447  // Add sequential one-based tile (x,y) coords to image name
448  if (m_ImagePartitions.Y() > 0) {
449  // the y index will count from 0 starting at the top.
450  img_name += NStr::IntToString(y + 1);
451  if (m_ImagePartitions.X() > 0)
452  img_name += "_";
453  }
454  if (m_ImagePartitions.X() > 0)
455  img_name += NStr::IntToString(x+1);
456  }
457  else {
458  // Add sequential (one-based) counter to name
459  img_name += NStr::IntToString(x + y*(m_ImagePartitions.X()+1) + 1);
460  }
461 
462  img_name += "." + m_ImageFormat;
463 
464  return img_name;
465 }
466 
467 
469  const std::string& image_name,
470  std::string image_bottom,
471  std::string image_right,
472  std::string image_top,
473  std::string image_left)
474 {
475  glViewport(0, 0, (GLsizei)capture_size.X(), (GLsizei)capture_size.Y());
476  glMatrixMode(GL_PROJECTION);
477  glPushMatrix();
478  glLoadIdentity();
479  glOrtho(0.0, (double)capture_size.X(),
480  0.0, (double)capture_size.Y(),
481  -1.0, 1.0);
482 
483  glMatrixMode(GL_MODELVIEW);
484  glPushMatrix();
485  glLoadIdentity();
486 
487  glColor3f(0.7f, 0.7f, 0.7f);
488  glLineWidth(1.0f);
489  glEnable(GL_LINE_STIPPLE);
490  glLineStipple(8, (short)0x0307);
491 
492  // Draw borders around image, with gap of 2 pixels between border and
493  // actual image. Subtracting 1 extra rom top and right is due to 0-based
494  // counting.
495  glBegin(GL_LINE_LOOP);
496  glVertex2f(m_GuideWidthX-5,
497  m_GuideWidthY-5);
498  glVertex2f(capture_size.X()-m_GuideWidthX + 6.0,
499  m_GuideWidthY-2);
500  glVertex2f(capture_size.X()-m_GuideWidthX + 6.0,
501  capture_size.Y()-m_GuideWidthY + 6.0);
502  glVertex2f(m_GuideWidthX-2,
503  capture_size.Y()-m_GuideWidthY + 6.0);
504  glEnd();
505 
506  glDisable(GL_LINE_STIPPLE);
507 
508  /*
509  * Write names of adjacent images (if any) inside the guide margins
510  */
511 
512  // pick a font for the file names of the adjacent images. Default to 10,
513  // and work down from there if needed.
514  CGlTextureFont img_name_font;
516 
517  unsigned int font_height = (unsigned int)std::min(10, std::min(m_GuideWidthX, m_GuideWidthY)-8);
518  font_height = std::max(font_height, (unsigned int)8);
519  img_name_font.SetFontSize(font_height);
520 
521  glColor3f(1.0f, 0.0f, 0.0f);
522 
523  img_name_font.BeginText();
524  // Draw the image name in the upper right-hand corner.
525  if (image_name != "") {
526  int text_width = (int)img_name_font.TextWidth(image_name.c_str());
527  img_name_font.WriteText(((int)capture_size.X()) - (text_width + m_GuideWidthX),
528  ((int)capture_size.Y()) - (font_height+2),
529  image_name.c_str());
530  }
531 
532  glColor3f(0.25f, 0.25f, 0.25f);
533 
534  // Draw the name of the adjacent images (if any) in the appropriate margin
535  // on each side of the image.
536  if (image_bottom != "") {
537  //image_bottom += "v";
538  int text_width = (int)img_name_font.TextWidth(image_bottom.c_str());
539  img_name_font.WriteText(((int)capture_size.X())/2-text_width/2,
540  4,
541  image_bottom.c_str());
542  }
543 
544  if (image_top != "") {
545  //image_top += "^";
546  int text_width = (int)img_name_font.TextWidth(image_top.c_str());
547  img_name_font.WriteText(((int)capture_size.X())/2-text_width/2,
548  ((int)capture_size.Y())-(font_height+2),
549  image_top.c_str());
550  }
551 
552  if (image_right != "") {
553  //image_right += ">";
554  int text_width = (int)img_name_font.TextWidth(image_right.c_str());
555  img_name_font.WriteText(((int)capture_size.X()) - 4,
556  ((int)capture_size.Y())/2-text_width/2,
557  image_right.c_str(), 90.0f);
558  }
559 
560  if (image_left != "") {
561  //image_left += "<";
562  int text_width = (int)img_name_font.TextWidth(image_left.c_str());
563  img_name_font.WriteText(font_height + 2,
564  ((int)capture_size.Y())/2-text_width/2,
565  image_left.c_str(), 90.0f);
566  }
567  img_name_font.EndText();
568 
569  glMatrixMode(GL_MODELVIEW);
570  glPopMatrix();
571 
572  glMatrixMode(GL_PROJECTION);
573  glPopMatrix();
574 }
575 
577 {
578  switch(format) {
579  case CPrintOptions::ePdf:
580  return new CPdfGrabber(pane);
581  case CPrintOptions::eSvg:
582  return new CSVGGrabber(pane);
583  default:
584  NCBI_THROW(CException, eUnknown, "Unsupported image format");
585  }
586 }
587 
589 
CGLFrameBuffer.
virtual void ReleaseTexture()
Releases ownership of texture so it isn't deleted with framebuffer.
void SetTextureWrap(GLint wraps, GLint wrapt)
Set texture paramters, if needed. Call before calling CreateFrameBuffer.
GLuint GetTexture()
void MakeCurrent(bool b)
Makes this framebuffer the current rendering target if b==true, and if b==false, makes the rendering ...
virtual void GenerateMipMaps()
Generates mipmaps for the texture rendering target.
static bool CheckFBOError()
Returns true and writes error message if framebuffer is invalid.
virtual void SetTextureFiltering(GLint min_filter, GLint mag_filter)
Set texture filtering parameters (default: GL_LINEAR)
virtual bool IsValid()
Returns true if framebuffer was created successfully.
virtual void CreateFrameBuffer()
Create, set and validate framebuffer.
static IImageGrabber * CreateImageGrabber(EOutputFormat format, IVectorGraphicsRenderer &pane)
static bool WriteImage(const CImage &image, CNcbiOstream &ostr, EType type, ECompress compress=eCompress_Default)
Definition: image_io.cpp:287
static EType GetTypeFromFileName(const string &file)
Definition: image_io.cpp:144
CImage –.
Definition: Image.hpp:66
size_t GetWidth(void) const
Definition: image.hpp:98
void Flip(void)
Definition: image.cpp:275
void Init(size_t width, size_t height, size_t depth)
Definition: image.cpp:62
size_t GetHeight(void) const
Definition: image.hpp:99
unsigned char * SetData(void)
Definition: image.cpp:92
virtual void ImageSaved(int, int)
virtual void SetGLContext()
virtual void SetPreviewSubImage(CRef< CImage >)
Set an image to be displayed in the center of the widget.
virtual void SetReferenceImage(CGlTexture *refimg)
Return texture so that the preview image can be updated.
virtual vector< CTileOrigin > GetTileLocations(int &w, int &h)
Get locations (origin and size) of individual image tiles.
std::string m_BaseImageName
Image name without its appended number (e.g. img for img1, img2...)
virtual ~IImageGrabber()
std::string x_GetImageName(int x, int y)
Return image filename for a tile index based on the numbering scheme.
eCaptureResult PreviewImages(int tex_size, int ref_img_width, int ref_img_height, IImageGrabberProgress *p=NULL)
Grab images to update the on-screen image to approximate final output.
virtual eCaptureResult GrabImages(int tex_size, IImageGrabberProgress *p=NULL)
Grab the requested images.
std::string m_Directory
Target directory for saved images.
std::string m_ImageFormat
Image output format (e.g. jpeg, png...)
void x_RenderGuides(CVect2< size_t > capture_size, const std::string &image_name, std::string image_bottom, std::string image_right, std::string image_top, std::string image_left)
Render guides around image edge (cut marks + adjacent image names)
eImageNumberingFormat m_NumberingFormat
Numbering format, such as sequential or tiled (x and y)
virtual void x_EndCaptures()
Called after last image captured.
bool m_GuidesEnabled
If true, printing guides (like where to cut paper) will be added to image edges.
int m_GuideWidthX
If we are making space for printing guides (margins) on the sides, those margins may have different s...
virtual void x_BeginCaptures(int)
Called before first image captured.
virtual eCaptureResult x_CaptureImage(CVect2< int > partitions, CVect2< int > index, CVect2< size_t > &capture_size)
Must be subclassed to capture an individual image.
CVect2< int > m_ImagePartitions
Number of partitions (tilings) in x and 1.
CIRef< IRender > m_SavedRender
eCaptureResult GrabImage(int tex_size, CVect2< int > img_idx, IImageGrabberProgress *p=NULL)
Grab a single image for preview purposes.
void SetOutputInfo(const std::string &dir, const std::string &base_name, const std::string &img_format)
Set file output information.
Interface class for the pdf renderer.
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define false
Definition: bool.h:36
EGlDiagMode
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
#define _TRACE(message)
Definition: ncbidbg.hpp:122
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
Definition: ncbifile.cpp:776
T & X()
Definition: vect2.hpp:107
T & Y()
Definition: vect2.hpp:109
static CGlResMgr & Instance()
Definition: glresmgr.cpp:59
CIRef< IRender > GetCurrentRenderer()
Returns current renderer, or NULL.
Definition: glresmgr.hpp:98
void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0) const
Write text at specified model coords.
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
void BeginText() const
WriteText interface The WriteText functions produce the same results as TextOut but they are more eff...
static bool CheckGlError()
Check if there are any OpenGL errors.
Definition: glutils.cpp:166
void SetCurrentRenderer(CIRef< IRender > rm)
Set current renderer (rm must already be in m_Renderers)
Definition: glresmgr.cpp:281
void EndText() const
Pops matrices and attributes after writing text.
virtual TModelUnit TextWidth(const char *text) const
Compute and return font metrics.
void SetFontSize(unsigned int size)
Set/get font size in points.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
@ eIgnore
@ eLogPost
@ eThrow
@ eUndefined
@ eAbort
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
T max(T x_, T y_)
T min(T x_, T y_)
static Format format
Definition: njn_ioutil.cpp:53
Modified on Wed Apr 17 13:09:47 2024 by modify_doxy.py rev. 669887