/usr/include/ossim/imaging/ossimRgbImage.h is in libossim-dev 1.8.16-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts
//
//*************************************************************************
// $Id: ossimRgbImage.h 15766 2009-10-20 12:37:09Z gpotts $
#ifndef ossimRgbImage_HEADER
#define ossimRgbImage_HEADER
#include <vector>
#include <ossim/base/ossimReferenced.h>
#include <ossim/base/ossimIpt.h>
#include <ossim/imaging/ossimImageData.h>
class OSSIM_DLL ossimRgbImage : public ossimReferenced
{
public:
ossimRgbImage();
/**
* @param currentImageData The tile to annotate or draw to.
* @note This can be any number of bands; however, will only draw
* to up to 3.
*/
ossimRgbImage(ossimRefPtr<ossimImageData>& currentImageData);
/**
* Will construct a new single band image data object.
*/
virtual void createNewGrey(ossim_int32 width, ossim_int32 height);
/**
* Will construct a new 3 band rgb data object.
*/
virtual void createNewTrueColor(ossim_int32 width, ossim_int32 height);
/**
* Will initilize any pre-computations that are needed.
* Example: setting up the origin for adjustments and
* setting up the offsets.
*/
virtual void initialize();
/**
* This will plot a pixel and will do inside outside compares.
* This assumes the pixel has already been put into a relative
* 0,0 to the upper left corner of the image data.
*
* example: if the upperleft corner or origin of the image was
* 34, 55 then it assumes that the points passed in are
* already relative to that corner not absolute.
*/
inline void slowPlotPixel(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
*/
inline void fastPlotPixel(ossim_int32 x,
ossim_int32 y,
ossim_uint8 r,
ossim_uint8 g,
ossim_uint8 b);
/**
* All the drawing algorithms have thickness. So you can draw a line
* that has thickness of 3 pixels if you want. Note: the thickness is in
* pixels
*/
void setThickness(ossim_int32 thickness);
/** @return The thickness. */
ossim_int32 getThickness() const;
/**
* Allows you to change the image data that this RgbImage object
* operates on. You can specify if the image owns the data or not.
* if it doesn't own the data then it will not destroy it when the
* data is changed to a different data object or if this object
* is deleted.
*
* @param imageData The tile to annotate or draw to.
*
* @note This can be any number of bands; however, will only draw
* to up to 3.
*/
void setCurrentImageData(ossimRefPtr<ossimImageData>& imageData);
/**
* Will return the image data.
*/
ossimRefPtr<ossimImageData> getImageData();
/**
* We will cut and paste the code from
* drawFilledPolygon(ossimIpt *p, int n).
*/
void drawFilledPolygon(const std::vector<ossimDpt>& p);
/**
* We will cut and paste the code from
* drawFilledPolygon(ossimIpt *p, int n).
*/
void drawFilledPolygon(const std::vector<ossimIpt>& p);
/**
* This will draw a polygon and fill it with the specified color.
*/
void drawFilledPolygon(ossimDpt *p,
int n);
/**
* This will draw a polygon and fill it with the specified color.
*/
void drawFilledPolygon(ossimIpt *p,
int n);
/**
* will draw an arc. The cx and cy specifies the center point in image
* space. The parameters w, h are the width and height of the arc.
* The s and e are the starting and ending angles. So if I want to
* draw a complete circle at point 45, 45 with width 10 and height 23 then
* we set the angles s =0 and e = 360:
* drawArc(45, 45, 10, 23, 0, 360).
*
*/
void drawArc(double cx,
double cy,
double w,
double h,
double s,
double e);
/**
* will draw an arc. The cx and cy specifies the center point in image
* space. The parameters w, h are the width and height of the arc.
* The s and e are the starting and ending angles. So if I want to
* draw a complete circle at point 45, 45 with width 10 and height 23 then
* we set the angles s =0 and e = 360:
* drawArc(45, 45, 10, 23, 0, 360).
*
*/
void drawArc(int cx,
int cy,
int w,
int h,
int s,
int e);
/**
* Draws a filled ellipse. Rot is the major axis rotation from up.
* rot (rotaition) is in radians.
*/
void drawFilledEllipse(int cx,
int cy,
int sminor,
int smajor,
double rot);
/**
* Draws an ellipse. Rot is the major axis rotation from up.
* rot (rotation is in radians).
*/
void drawEllipse(int cx,
int cy,
int sminor,
int smajor,
double rot,
bool drawAxes = false);
/**
* This will draw a filled arc. See drawArc for documentation of
* parameters.
*/
void drawFilledArc(double cx,
double cy,
double w,
double h,
double s,
double e);
/**
* This will draw a filled arc. See drawArc for documentation of
* parameters.
*/
void drawFilledArc(int cx,
int cy,
int w,
int h,
int s,
int e);
void drawPolygon(const std::vector<ossimDpt>& p);
void drawPolygon(const std::vector<ossimIpt>& p);
/**
* Draws a polygon. The first argument is an array of points. The second
* argument is the number of points and the rest are the rgb color values.
* theColor used is set by the setDrawColor.
*/
void drawPolygon(ossimDpt *p,
int n);
/**
* Draws a polygon. The first argument is an array of points. The second
* argument is the number of points and the rest are the rgb color values.
* theColor used is set by the setDrawColor.
*/
void drawPolygon(ossimIpt *p,
int n);
/**
* About all the draw routines will call draw line. it takes a start and
* an end point and a color value.
* theColor used is set by the setDrawColor.
*/
void drawLine(double x1,
double y1,
double x2,
double y2);
/**
* About all the draw routines will call draw line. it takes a start and
* an end point and a color value.
* theColor used is set by the setDrawColor.
*/
void drawLine(int x1,
int y1,
int x2,
int y2);
/**
* About all the draw routines will call draw line. it takes a start and
* an end point and a color value.
* theColor used is set by the setDrawColor.
*/
void drawLine(const ossimIpt& start,
const ossimIpt& end);
/**
* About all the draw routines will call draw line. it takes a start and
* an end point and a color value.
* theColor used is set by the setDrawColor.
*/
void drawLine(const ossimDpt& start,
const ossimDpt& end);
/**
* Will draw a rectangle. The color used is set by setDrawColor.
*/
void drawRectangle(double x1,
double y1,
double x2,
double y2);
/**
* Will draw a rectangle. The color used is set by setDrawColor.
*/
void drawRectangle(int x1,
int y1,
int x2,
int y2);
/**
* Will draw a filled rectangle with the current draw color.
* Use setDrawColor to set it.
*/
void drawFilledRectangle(double x1,
double y1,
double x2,
double y2);
/**
* Will draw a filled rectangle with the current draw color.
* Use setDrawColor to set it.
*/
void drawFilledRectangle(int x1,
int y1,
int x2,
int y2);
/**
* Will fill the entire data object with the specified color set in
* setDrawColor.
*/
void fill();
void setDrawColor(ossim_uint8 r = 255,
ossim_uint8 g = 255,
ossim_uint8 b = 255);
void getDrawColor(ossim_uint8& rCurr,
ossim_uint8& gCurr,
ossim_uint8& bCurr);
/**
* Will take the point passed in and translate
* to a 0,0.
* Example:
* Let's say that we have origin 45,34 for the
* image's upper left corner. then a call to this
* method will translate the point passed in
* x-45, y-34
*/
// inline void translateToOrigin(ossim_int32& x, ossim_int32& y);
/**
* Will take the point passed in and translate
* to a 0,0.
* Example:
* Let's say that we have origin 45,34 for the
* image's upper left corner. then a call to this
* method will translate the point passed in
* x-45, y-34
*/
// inline void translateToOrigin(ossimDpt& pt);
const ossimRefPtr<ossimImageData> getImageData()const;
protected:
virtual ~ossimRgbImage();
/**
* This object operates on the ossimImageData. Note the
* ossimImageData is a band separate so the bands follow sequentially:
* all the reds followed by all the blues followed by all greens
*/
ossimRefPtr<ossimImageData> theImageData;
/**
* This will hold precomputed offsets to the
* start of each row. This will get rid of a multiplication
* per access. Since we will be accessing on a per pixel basis
* this will be needed.
*/
ossim_int32* theOffsets;
/**
* This is a fast access to the start of each band.
*/
ossim_uint8* theBands[3];
/**
* This is here so we don't have to call theWidth and theHeight
* of the ossimImageData.
*/
ossim_int32 theWidth;
/**
* This is here so we don't have to call theWidth and theHeight
* of the ossimImageData.
*/
ossim_int32 theHeight;
/**
* Holds the draw thickness.
*/
ossim_int32 theThickness;
/**
* The red component of the color used in drawing the shapes
*/
ossim_uint8 theRed;
/**
* The green component of the color used in drawing the shapes
*/
ossim_uint8 theGreen;
/**
* The blue component of the color used in drawing the shapes
*/
ossim_uint8 theBlue;
};
inline void ossimRgbImage::slowPlotPixel(ossim_int32 x,
ossim_int32 y,
ossim_uint8 r,
ossim_uint8 g,
ossim_uint8 b)
{
if((x > -1) && (x < theWidth) &&
(y > -1) && (y < theHeight))
{
theBands[0][theOffsets[y]+x] = r;
theBands[1][theOffsets[y]+x] = g;
theBands[2][theOffsets[y]+x] = b;
}
}
inline void ossimRgbImage::fastPlotPixel(ossim_int32 x,
ossim_int32 y,
ossim_uint8 r,
ossim_uint8 g,
ossim_uint8 b)
{
theBands[0][theOffsets[y]+x] = r;
theBands[1][theOffsets[y]+x] = g;
theBands[2][theOffsets[y]+x] = b;
}
#endif
|