iRoCS Toolbox  1.1.0
Blitz2Ddraw.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2008 Alexandra Teynor
4  *
5  * Image Analysis Lab, University of Freiburg, Germany
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  **************************************************************************/
22 
23 /**********************************************************
24  *
25  * Blitz2Ddraw
26  * Basic drawing routines in blitz arrays
27  *
28  * author: Alex Teynor (teynor@informatik.uni-freiburg.de)
29  * Dec. 2008
30  *
31  *********************************************************/
32 
33 #ifndef _BLITZ2DDRAW
34 #define _BLITZ2DDRAW
35 
36 #ifdef HAVE_CONFIG_H
37 #include <config.hh>
38 #endif
39 
40 // Blitz arrays
41 #include <blitz/array.h>
42 
43 
45 class Blitz2Ddraw {
46 
47 public:
48 
49 
50 /*======================================================================*/
59 /*======================================================================*/
60 
61 template <typename T>
62 static void setPixel(blitz::Array<T,3>& image,
63  int y, int x,
64  const blitz::TinyVector<T,3>& color);
65 
66 
67 /*======================================================================*/
78 /*======================================================================*/
79 
80 template <typename T>
81 static void setPixel(blitz::Array<T,2>& image,
82  int y, int x,
83  const T& color);
84 
85 /*======================================================================*/
99 /*======================================================================*/
100 
101 template<typename Type>
102 static void drawLine(blitz::Array<Type,3> & image,
103  int y0, int x0, int y1, int x1,
104  const blitz::TinyVector<Type,3>& color);
105 
106 
107 /*======================================================================*/
123 /*======================================================================*/
124 
125 template<typename Type>
126 static void drawLine(blitz::Array<Type,2> & image,
127  int y0, int x0, int y1, int x1,
128  const Type& color);
129 
130 /*======================================================================*/
140 /*======================================================================*/
141 
142 
143 template<typename Type>
144 static void drawCircle(blitz::Array<Type,3>& image,
145  int yCenter, int xCenter, int radius,
146  const blitz::TinyVector<Type,3>& color);
147 
148 /*======================================================================*/
160 /*======================================================================*/
161 
162 template<typename Type>
163 static void drawCircle(blitz::Array<Type,2>& image,
164  int yCenter, int xCenter, int radius,
165  const Type& color);
166 
167 
168 
169 /*======================================================================*/
181 /*======================================================================*/
182 
183 template<typename Type>
184 static void drawRect(blitz::Array<Type,3> & image,
185  int y0, int x0, int y1, int x1,
186  const blitz::TinyVector<Type,3>& color);
187 
188 
189 
190 /*======================================================================*/
204 /*======================================================================*/
205 
206 template<typename Type>
207 static void drawRect(blitz::Array<Type,2> & image,
208  int y0, int x0, int y1, int x1,
209  const Type& color);
210 
211 
212 
213 private:
214 
215 /*======================================================================*/
219 /*======================================================================*/
220 
221 template<typename Type>
222 static void circlePoints(blitz::Array<Type,2>& image,
223  int cy, int cx, int y, int x,
224  const Type& color);
225 
226 template<typename Type>
227 static void circlePoints(blitz::Array<Type,3>& image,
228  int cy, int cx, int y, int x,
229  const blitz::TinyVector<Type,3>& color);
230 
231 
232 
233 
234 
235 
236 };
237 
238 #include "Blitz2Ddraw.icc"
239 
240 
241 #endif
242 
static void drawRect(blitz::Array< Type, 3 > &image, int y0, int x0, int y1, int x1, const blitz::TinyVector< Type, 3 > &color)
Draw a rectangle into an blitz array the upper right corner and the lower left corner must be given...
static void setPixel(blitz::Array< T, 3 > &image, int y, int x, const blitz::TinyVector< T, 3 > &color)
Sets a single pixel in a image.
static void drawCircle(blitz::Array< Type, 3 > &image, int yCenter, int xCenter, int radius, const blitz::TinyVector< Type, 3 > &color)
Draw a simple, non-aliased circle.
static void drawLine(blitz::Array< Type, 3 > &image, int y0, int x0, int y1, int x1, const blitz::TinyVector< Type, 3 > &color)
Draw a simple, non-aliased line.
Basic drawing routines for blitz arrays.
Definition: Blitz2Ddraw.hh:45