OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRgbImage.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 //
7 //*************************************************************************
8 // $Id: ossimRgbImage.h 15766 2009-10-20 12:37:09Z gpotts $
9 #ifndef ossimRgbImage_HEADER
10 #define ossimRgbImage_HEADER
11 
12 #include <vector>
13 
15 #include <ossim/base/ossimIpt.h>
17 
19 {
20 public:
21  ossimRgbImage();
22 
28  ossimRgbImage(ossimRefPtr<ossimImageData>& currentImageData);
29 
30 
34  virtual void createNewGrey(ossim_int32 width, ossim_int32 height);
35 
39  virtual void createNewTrueColor(ossim_int32 width, ossim_int32 height);
40 
46  virtual void initialize();
47 
57  inline void slowPlotPixel(ossim_int32 x,
58  ossim_int32 y,
59  ossim_uint8 r,
60  ossim_uint8 g,
61  ossim_uint8 b);
62 
66  inline void fastPlotPixel(ossim_int32 x,
67  ossim_int32 y,
68  ossim_uint8 r,
69  ossim_uint8 g,
70  ossim_uint8 b);
71 
77  void setThickness(ossim_int32 thickness);
78 
80  ossim_int32 getThickness() const;
81 
94  void setCurrentImageData(ossimRefPtr<ossimImageData>& imageData);
98  ossimRefPtr<ossimImageData> getImageData();
99 
104  void drawFilledPolygon(const std::vector<ossimDpt>& p);
109  void drawFilledPolygon(const std::vector<ossimIpt>& p);
110 
111 
115  void drawFilledPolygon(ossimDpt *p,
116  int n);
120  void drawFilledPolygon(ossimIpt *p,
121  int n);
122 
132  void drawArc(double cx,
133  double cy,
134  double w,
135  double h,
136  double s,
137  double e);
138 
148  void drawArc(int cx,
149  int cy,
150  int w,
151  int h,
152  int s,
153  int e);
154 
159  void drawFilledEllipse(int cx,
160  int cy,
161  int sminor,
162  int smajor,
163  double rot);
164 
169  void drawEllipse(int cx,
170  int cy,
171  int sminor,
172  int smajor,
173  double rot,
174  bool drawAxes = false);
175 
180  void drawFilledArc(double cx,
181  double cy,
182  double w,
183  double h,
184  double s,
185  double e);
186 
191  void drawFilledArc(int cx,
192  int cy,
193  int w,
194  int h,
195  int s,
196  int e);
197 
198  void drawPolygon(const std::vector<ossimDpt>& p);
199  void drawPolygon(const std::vector<ossimIpt>& p);
200 
206  void drawPolygon(ossimDpt *p,
207  int n);
208 
214  void drawPolygon(ossimIpt *p,
215  int n);
216 
222  void drawLine(double x1,
223  double y1,
224  double x2,
225  double y2);
226 
232  void drawLine(int x1,
233  int y1,
234  int x2,
235  int y2);
236 
242  void drawLine(const ossimIpt& start,
243  const ossimIpt& end);
249  void drawLine(const ossimDpt& start,
250  const ossimDpt& end);
251 
252 
256  void drawRectangle(double x1,
257  double y1,
258  double x2,
259  double y2);
260 
264  void drawRectangle(int x1,
265  int y1,
266  int x2,
267  int y2);
268 
273  void drawFilledRectangle(double x1,
274  double y1,
275  double x2,
276  double y2);
277 
282  void drawFilledRectangle(int x1,
283  int y1,
284  int x2,
285  int y2);
286 
291  void fill();
292 
293  void setDrawColor(ossim_uint8 r = 255,
294  ossim_uint8 g = 255,
295  ossim_uint8 b = 255);
296 
297  void getDrawColor(ossim_uint8& rCurr,
298  ossim_uint8& gCurr,
299  ossim_uint8& bCurr);
309 // inline void translateToOrigin(ossim_int32& x, ossim_int32& y);
310 
320 // inline void translateToOrigin(ossimDpt& pt);
321  const ossimRefPtr<ossimImageData> getImageData()const;
322 
323 protected:
324  virtual ~ossimRgbImage();
325 
332 
340 
344  ossim_uint8* theBands[3];
345 
351 
357 
362 
363 
368 
373 
378 };
379 
381  ossim_int32 y,
382  ossim_uint8 r,
383  ossim_uint8 g,
384  ossim_uint8 b)
385 {
386  if((x > -1) && (x < theWidth) &&
387  (y > -1) && (y < theHeight))
388  {
389  theBands[0][theOffsets[y]+x] = r;
390  theBands[1][theOffsets[y]+x] = g;
391  theBands[2][theOffsets[y]+x] = b;
392  }
393 }
394 
396  ossim_int32 y,
397  ossim_uint8 r,
398  ossim_uint8 g,
399  ossim_uint8 b)
400 {
401  theBands[0][theOffsets[y]+x] = r;
402  theBands[1][theOffsets[y]+x] = g;
403  theBands[2][theOffsets[y]+x] = b;
404 }
405 
406 #endif
ossim_uint32 x
ossim_uint8 theGreen
The green component of the color used in drawing the shapes.
ossim_uint32 y
ossimReferenced allows for shared object ref counting if the reference count ever gets to 0 or less i...
ossim_int32 theThickness
Holds the draw thickness.
ossim_int32 theWidth
This is here so we don&#39;t have to call theWidth and theHeight of the ossimImageData.
ossim_int32 theHeight
This is here so we don&#39;t have to call theWidth and theHeight of the ossimImageData.
ossimRefPtr< ossimImageData > theImageData
This object operates on the ossimImageData.
void slowPlotPixel(ossim_int32 x, ossim_int32 y, ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
This will plot a pixel and will do inside outside compares.
os2<< "> n<< " > nendobj n
ossim_uint8 * theBands[3]
This is a fast access to the start of each band.
ossim_uint8 theRed
The red component of the color used in drawing the shapes.
#define OSSIM_DLL
ossim_uint8 theBlue
The blue component of the color used in drawing the shapes.
ossim_int32 * theOffsets
This will hold precomputed offsets to the start of each row.
void fastPlotPixel(ossim_int32 x, ossim_int32 y, ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
same thing as slowPlotPixel but without the inside outside compare
unsigned char ossim_uint8
int ossim_int32