Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DrawTextWx.hh
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003-2009 (see file CONTACT for details)
4  Vision N GmbH
5  Schauenburgerstr. 116
6  24118 Kiel
7 
8  BIAS is free software; you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation; either version 2.1 of the License, or
11  (at your option) any later version.
12 
13  BIAS is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with BIAS; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/
21 #ifndef __DrawTextWx_hh__
22 #define __DrawTextWx_hh__
23 
24 #include "bias_config.h"
25 #include <Base/Image/ColourRGB.hh>
26 
27 #include <string>
28 
29 #define DTWX_OK 0
30 #define DTWX_OUT_OF_IMAGE 1
31 #define DTWX_INVALID_ARGUMENT -2
32 #define DTWX_WX_ERROR -3
33 
34 namespace BIAS {
35 
36  template <class T> class Image;
37  template <class T> class ColourRGB;
38 
39  /** @class DrawTextWx
40  @brief Writing a text in an bias image usig a wx device context
41  This class uses wxDC and thus it can only be used in wx GUI applications.
42  !! It does not work for console applications !!!
43  @author woelk 09/2009 (c) www.vision-n.de */
44  template <class StorageType>
45  class BIASGui_EXPORT DrawTextWx
46  {
47  public:
48  enum EVerticalAlign { V_ALIGN_TOP, V_ALIGN_CENTER, V_ALIGN_BOTTOM };
49 
50  enum EHorizontalAlign { H_ALIGN_LEFT, H_ALIGN_CENTER, H_ALIGN_RIGHT };
51 
52  DrawTextWx() {};
53 
55 
56  /** @brief returns size of the bounding box of the text */
57  static int GetTextExtend(const std::string &text,
58  unsigned &width, unsigned &height,
59  const unsigned point_size = 8);
60 
61  /** @brief write text in an image
62  !!! Can only be used in wx-GUI applications which implement wxApp !!! */
63  static int Text(Image<StorageType> &im, const std::string &text,
64  const unsigned &pos_x, const unsigned &pos_y,
65  const ColourRGB<StorageType> &foreground_color = COLOR_WHITE,
66  const ColourRGB<StorageType> &background_color = COLOR_BLACK,
67  const unsigned point_size = 8,
68  const enum EVerticalAlign vertical_align = V_ALIGN_TOP,
69  const enum EHorizontalAlign horizontal_align = H_ALIGN_LEFT);
70 
71  }; // class
72 
73 
74 } // namespace
75 
76 #endif // __DrawTextWx_hh__
interface class used to ease handover in function calls
Definition: ColourRGB.hh:34
class BIASImageBase_EXPORT Image
Definition: ImageBase.hh:91
The image template class for specific storage types.
Definition: Image.hh:78
Writing a text in an bias image usig a wx device context This class uses wxDC and thus it can only be...
Definition: DrawTextWx.hh:45