Main MRPT website > C++ reference for MRPT 1.9.9
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include <mrpt/gui.h>
11 #include <iostream>
12 
13 using namespace mrpt;
14 using namespace mrpt::gui;
15 using namespace mrpt::img;
16 using namespace std;
17 
18 // ------------------------------------------------------
19 // TestFonts
20 // ------------------------------------------------------
21 void TestFonts()
22 {
23  CImage img(400, 300);
24 
25  img.filledRectangle(0, 0, 400, 300, TColor(0x50, 0x50, 0x50));
26 
27  int y = 10;
28  img.selectTextFont("5x7");
29  img.textOut(10, y, "Hello World! with font \"5x7\"", TColor::white());
30  y += 20;
31 
32  img.selectTextFont("6x13");
33  img.textOut(10, y, "Hello World! with font \"6x13\"", TColor::white());
34  y += 20;
35 
36  img.selectTextFont("6x13B");
37  img.textOut(10, y, "Hello World! with font \"6x13B\"", TColor::white());
38  y += 20;
39 
40  img.selectTextFont("6x13O");
41  img.textOut(10, y, "Hello World! with font \"6x13O\"", TColor::white());
42  y += 20;
43 
44  img.selectTextFont("9x15");
45  img.textOut(10, y, "Hello World! with font \"9x15\"", TColor::white());
46  y += 20;
47 
48  img.selectTextFont("9x15B");
49  img.textOut(10, y, "Hello World! with font \"9x15B\"", TColor::white());
50  y += 20;
51 
52  img.selectTextFont("18x18ja");
53  img.textOut(10, y, "MRPTのフォントは易しいです!", TColor::white());
54  y += 20;
55 
56  img.selectTextFont("10x20");
57  img.textOut(10, y, "Hello World! with font \"10x20\"", TColor::white());
58  y += 20;
59 
60  CDisplayWindow win1("MRPT - Demo of text fonts render");
61  win1.setPos(10, 10);
62  win1.showImage(img);
63 
64  cout << "Push a key in the console or in the window to continue...";
65  win1.waitForKey();
66  cout << "Done" << endl;
67 }
68 
69 // ------------------------------------------------------
70 // MAIN
71 // ------------------------------------------------------
72 int main()
73 {
74  try
75  {
76  TestFonts();
77  return 0;
78  }
79  catch (std::exception& e)
80  {
81  std::cout << "MRPT exception caught: " << e.what() << std::endl;
82  return -1;
83  }
84  catch (...)
85  {
86  printf("Untyped exception!!");
87  return -1;
88  }
89 }
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
mrpt::img
Definition: CCanvas.h:17
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:22
mrpt::gui::CDisplayWindow
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Definition: CDisplayWindow.h:30
TestFonts
void TestFonts()
Definition: vision_stereo_rectify/test.cpp:21
mrpt::gui
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:16
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
img
GLint GLvoid * img
Definition: glext.h:3763
gui.h
y
GLenum GLint GLint y
Definition: glext.h:3538



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at mié 12 jul 2023 10:03:34 CEST