OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRgbImage.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 // Description:
7 //
8 //
9 // Credits:
10 // Much of the implementation within this file was taken from gd
11 // We can use it but we need to give credit to the people who wrote
12 // the algorithms.
13 //
14 // COPYRIGHT STATEMENT FOLLOWS THIS LINE
15 
16 // Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
17 // by Cold Spring Harbor Laboratory. Funded under Grant P41-RR02188 by
18 // the National Institutes of Health.
19 
20 // Portions copyright 1996, 1997, 1998, 1999, 2000, 2001 by
21 // Boutell.Com, Inc.
22 
23 // Portions relating to GD2 format copyright 1999, 2000 Philip Warner.
24 
25 // Portions relating to PNG copyright 1999, 2000 Greg Roelofs.
26 
27 // Portions relating to libttf copyright 1999, 2000 John Ellson
28 // (ellson@lucent.com).
29 
30 // Portions relating to JPEG and to color quantization copyright 2000,
31 // Doug Becker and copyright (C) 1994-1998, Thomas G. Lane. This
32 // software is based in part on the work of the Independent JPEG
33 // Group. See the file README-JPEG.TXT for more information.
34 
35 // Portions relating to WBMP copyright 2000 Maurice Szmurlo and Johan
36 // Van den Brande.
37 
38 // _Permission has been granted to copy, distribute and modify gd in
39 // any context without fee, including a commercial application,
40 // provided that this notice is present in user-accessible supporting
41 // documentation._
42 
43 // This does not affect your ownership of the derived work itself, and
44 // the intent is to assure proper credit for the authors of gd, not to
45 // interfere with your productive use of gd. If you have questions,
46 // ask. "Derived works" includes all programs that utilize the
47 // library. Credit must be given in user-accessible documentation.
48 
49 // _This software is provided "AS IS."_ The copyright holders disclaim
50 // all warranties, either express or implied, including but not
51 // limited to implied warranties of merchantability and fitness for a
52 // particular purpose, with respect to this code and accompanying
53 // documentation.
54 
55 // Although their code does not appear in gd 2.0.1, the authors wish
56 // to thank David Koblas, David Rowley, and Hutchison Avenue Software
57 // Corporation for their prior contributions.
58 
59 // END OF COPYRIGHT STATEMENT
60 //*************************************************************************
61 // $Id: ossimRgbImage.cpp 21184 2012-06-29 15:13:09Z dburken $
62 
63 #include <cstdlib>
64 #include <cmath>
66 #include <ossim/base/ossimCommon.h>
67 
68 // this should be in another file. This is from gd's gdtable.c file and has
69 // precomputations for sine and cosine. It looks like they multiply the cos and
70 // sign by 1024 and store the rounded int.
71 static const int gdCosT[] =
72 {
73  1024,
74  1023,
75  1023,
76  1022,
77  1021,
78  1020,
79  1018,
80  1016,
81  1014,
82  1011,
83  1008,
84  1005,
85  1001,
86  997,
87  993,
88  989,
89  984,
90  979,
91  973,
92  968,
93  962,
94  955,
95  949,
96  942,
97  935,
98  928,
99  920,
100  912,
101  904,
102  895,
103  886,
104  877,
105  868,
106  858,
107  848,
108  838,
109  828,
110  817,
111  806,
112  795,
113  784,
114  772,
115  760,
116  748,
117  736,
118  724,
119  711,
120  698,
121  685,
122  671,
123  658,
124  644,
125  630,
126  616,
127  601,
128  587,
129  572,
130  557,
131  542,
132  527,
133  512,
134  496,
135  480,
136  464,
137  448,
138  432,
139  416,
140  400,
141  383,
142  366,
143  350,
144  333,
145  316,
146  299,
147  282,
148  265,
149  247,
150  230,
151  212,
152  195,
153  177,
154  160,
155  142,
156  124,
157  107,
158  89,
159  71,
160  53,
161  35,
162  17,
163  0,
164  -17,
165  -35,
166  -53,
167  -71,
168  -89,
169  -107,
170  -124,
171  -142,
172  -160,
173  -177,
174  -195,
175  -212,
176  -230,
177  -247,
178  -265,
179  -282,
180  -299,
181  -316,
182  -333,
183  -350,
184  -366,
185  -383,
186  -400,
187  -416,
188  -432,
189  -448,
190  -464,
191  -480,
192  -496,
193  -512,
194  -527,
195  -542,
196  -557,
197  -572,
198  -587,
199  -601,
200  -616,
201  -630,
202  -644,
203  -658,
204  -671,
205  -685,
206  -698,
207  -711,
208  -724,
209  -736,
210  -748,
211  -760,
212  -772,
213  -784,
214  -795,
215  -806,
216  -817,
217  -828,
218  -838,
219  -848,
220  -858,
221  -868,
222  -877,
223  -886,
224  -895,
225  -904,
226  -912,
227  -920,
228  -928,
229  -935,
230  -942,
231  -949,
232  -955,
233  -962,
234  -968,
235  -973,
236  -979,
237  -984,
238  -989,
239  -993,
240  -997,
241  -1001,
242  -1005,
243  -1008,
244  -1011,
245  -1014,
246  -1016,
247  -1018,
248  -1020,
249  -1021,
250  -1022,
251  -1023,
252  -1023,
253  -1024,
254  -1023,
255  -1023,
256  -1022,
257  -1021,
258  -1020,
259  -1018,
260  -1016,
261  -1014,
262  -1011,
263  -1008,
264  -1005,
265  -1001,
266  -997,
267  -993,
268  -989,
269  -984,
270  -979,
271  -973,
272  -968,
273  -962,
274  -955,
275  -949,
276  -942,
277  -935,
278  -928,
279  -920,
280  -912,
281  -904,
282  -895,
283  -886,
284  -877,
285  -868,
286  -858,
287  -848,
288  -838,
289  -828,
290  -817,
291  -806,
292  -795,
293  -784,
294  -772,
295  -760,
296  -748,
297  -736,
298  -724,
299  -711,
300  -698,
301  -685,
302  -671,
303  -658,
304  -644,
305  -630,
306  -616,
307  -601,
308  -587,
309  -572,
310  -557,
311  -542,
312  -527,
313  -512,
314  -496,
315  -480,
316  -464,
317  -448,
318  -432,
319  -416,
320  -400,
321  -383,
322  -366,
323  -350,
324  -333,
325  -316,
326  -299,
327  -282,
328  -265,
329  -247,
330  -230,
331  -212,
332  -195,
333  -177,
334  -160,
335  -142,
336  -124,
337  -107,
338  -89,
339  -71,
340  -53,
341  -35,
342  -17,
343  0,
344  17,
345  35,
346  53,
347  71,
348  89,
349  107,
350  124,
351  142,
352  160,
353  177,
354  195,
355  212,
356  230,
357  247,
358  265,
359  282,
360  299,
361  316,
362  333,
363  350,
364  366,
365  383,
366  400,
367  416,
368  432,
369  448,
370  464,
371  480,
372  496,
373  512,
374  527,
375  542,
376  557,
377  572,
378  587,
379  601,
380  616,
381  630,
382  644,
383  658,
384  671,
385  685,
386  698,
387  711,
388  724,
389  736,
390  748,
391  760,
392  772,
393  784,
394  795,
395  806,
396  817,
397  828,
398  838,
399  848,
400  858,
401  868,
402  877,
403  886,
404  895,
405  904,
406  912,
407  920,
408  928,
409  935,
410  942,
411  949,
412  955,
413  962,
414  968,
415  973,
416  979,
417  984,
418  989,
419  993,
420  997,
421  1001,
422  1005,
423  1008,
424  1011,
425  1014,
426  1016,
427  1018,
428  1020,
429  1021,
430  1022,
431  1023,
432  1023
433 };
434 
435 static const int gdSinT[] =
436 {
437  0,
438  17,
439  35,
440  53,
441  71,
442  89,
443  107,
444  124,
445  142,
446  160,
447  177,
448  195,
449  212,
450  230,
451  247,
452  265,
453  282,
454  299,
455  316,
456  333,
457  350,
458  366,
459  383,
460  400,
461  416,
462  432,
463  448,
464  464,
465  480,
466  496,
467  512,
468  527,
469  542,
470  557,
471  572,
472  587,
473  601,
474  616,
475  630,
476  644,
477  658,
478  671,
479  685,
480  698,
481  711,
482  724,
483  736,
484  748,
485  760,
486  772,
487  784,
488  795,
489  806,
490  817,
491  828,
492  838,
493  848,
494  858,
495  868,
496  877,
497  886,
498  895,
499  904,
500  912,
501  920,
502  928,
503  935,
504  942,
505  949,
506  955,
507  962,
508  968,
509  973,
510  979,
511  984,
512  989,
513  993,
514  997,
515  1001,
516  1005,
517  1008,
518  1011,
519  1014,
520  1016,
521  1018,
522  1020,
523  1021,
524  1022,
525  1023,
526  1023,
527  1024,
528  1023,
529  1023,
530  1022,
531  1021,
532  1020,
533  1018,
534  1016,
535  1014,
536  1011,
537  1008,
538  1005,
539  1001,
540  997,
541  993,
542  989,
543  984,
544  979,
545  973,
546  968,
547  962,
548  955,
549  949,
550  942,
551  935,
552  928,
553  920,
554  912,
555  904,
556  895,
557  886,
558  877,
559  868,
560  858,
561  848,
562  838,
563  828,
564  817,
565  806,
566  795,
567  784,
568  772,
569  760,
570  748,
571  736,
572  724,
573  711,
574  698,
575  685,
576  671,
577  658,
578  644,
579  630,
580  616,
581  601,
582  587,
583  572,
584  557,
585  542,
586  527,
587  512,
588  496,
589  480,
590  464,
591  448,
592  432,
593  416,
594  400,
595  383,
596  366,
597  350,
598  333,
599  316,
600  299,
601  282,
602  265,
603  247,
604  230,
605  212,
606  195,
607  177,
608  160,
609  142,
610  124,
611  107,
612  89,
613  71,
614  53,
615  35,
616  17,
617  0,
618  -17,
619  -35,
620  -53,
621  -71,
622  -89,
623  -107,
624  -124,
625  -142,
626  -160,
627  -177,
628  -195,
629  -212,
630  -230,
631  -247,
632  -265,
633  -282,
634  -299,
635  -316,
636  -333,
637  -350,
638  -366,
639  -383,
640  -400,
641  -416,
642  -432,
643  -448,
644  -464,
645  -480,
646  -496,
647  -512,
648  -527,
649  -542,
650  -557,
651  -572,
652  -587,
653  -601,
654  -616,
655  -630,
656  -644,
657  -658,
658  -671,
659  -685,
660  -698,
661  -711,
662  -724,
663  -736,
664  -748,
665  -760,
666  -772,
667  -784,
668  -795,
669  -806,
670  -817,
671  -828,
672  -838,
673  -848,
674  -858,
675  -868,
676  -877,
677  -886,
678  -895,
679  -904,
680  -912,
681  -920,
682  -928,
683  -935,
684  -942,
685  -949,
686  -955,
687  -962,
688  -968,
689  -973,
690  -979,
691  -984,
692  -989,
693  -993,
694  -997,
695  -1001,
696  -1005,
697  -1008,
698  -1011,
699  -1014,
700  -1016,
701  -1018,
702  -1020,
703  -1021,
704  -1022,
705  -1023,
706  -1023,
707  -1024,
708  -1023,
709  -1023,
710  -1022,
711  -1021,
712  -1020,
713  -1018,
714  -1016,
715  -1014,
716  -1011,
717  -1008,
718  -1005,
719  -1001,
720  -997,
721  -993,
722  -989,
723  -984,
724  -979,
725  -973,
726  -968,
727  -962,
728  -955,
729  -949,
730  -942,
731  -935,
732  -928,
733  -920,
734  -912,
735  -904,
736  -895,
737  -886,
738  -877,
739  -868,
740  -858,
741  -848,
742  -838,
743  -828,
744  -817,
745  -806,
746  -795,
747  -784,
748  -772,
749  -760,
750  -748,
751  -736,
752  -724,
753  -711,
754  -698,
755  -685,
756  -671,
757  -658,
758  -644,
759  -630,
760  -616,
761  -601,
762  -587,
763  -572,
764  -557,
765  -542,
766  -527,
767  -512,
768  -496,
769  -480,
770  -464,
771  -448,
772  -432,
773  -416,
774  -400,
775  -383,
776  -366,
777  -350,
778  -333,
779  -316,
780  -299,
781  -282,
782  -265,
783  -247,
784  -230,
785  -212,
786  -195,
787  -177,
788  -160,
789  -142,
790  -124,
791  -107,
792  -89,
793  -71,
794  -53,
795  -35,
796  -17
797 };
798 
800  : ossimReferenced(),
801  theImageData(0),
802  theOffsets(0),
803  theThickness(1),
804  theRed(255),
805  theGreen(255),
806  theBlue(255)
807 {
808 }
809 
811  : ossimReferenced(),
812  theImageData(0),
813  theOffsets(0),
814  theThickness(1),
815  theRed(255),
816  theGreen(255),
817  theBlue(255)
818 {
819  setCurrentImageData(currentImageData);
820 }
821 
822 
824 {
825  if(theOffsets)
826  {
827  delete [] theOffsets;
828  theOffsets = 0;
829  }
830 }
831 
833 {
834  return theImageData;
835 }
836 
838 {
840  OSSIM_UCHAR,
841  1,
842  width,
843  height);
845 
847 
848 }
849 
851 {
853  OSSIM_UCHAR,
854  3,
855  width,
856  height);
858 }
859 
861 {
862  if(!theImageData)
863  {
864  return;
865  }
866  if(theOffsets)
867  {
868  delete [] theOffsets;
869  theOffsets = 0;
870  }
873 
875  for(ossim_int32 row = 0; row < theHeight; ++row)
876  {
877  theOffsets[row] = row*theWidth;
878  }
879 
880  // make it work for 1, 2, or 3 band data.
881  // we assume the fourth band is for the alpha channel
882  if(theImageData->getNumberOfBands() >= 3)
883  { // point each band to r, g, b.
884  theBands[0] = static_cast<ossim_uint8*>(theImageData->getBuf(0));
885  theBands[1] = static_cast<ossim_uint8*>(theImageData->getBuf(1));
886  theBands[2] = static_cast<ossim_uint8*>(theImageData->getBuf(2));
887  }
888  else if(theImageData->getNumberOfBands() == 2)
889  {//point r and g to the same place
890  theBands[0] = static_cast<ossim_uint8*>(theImageData->getBuf(0));
891  theBands[1] = static_cast<ossim_uint8*>(theImageData->getBuf(0));
892  theBands[2] = static_cast<ossim_uint8*>(theImageData->getBuf(1));
893  }
894  else if(theImageData->getNumberOfBands() == 1)
895  {// point all band s to the first band
896  theBands[0] = static_cast<ossim_uint8*>(theImageData->getBuf(0));
897  theBands[1] = static_cast<ossim_uint8*>(theImageData->getBuf(0));
898  theBands[2] = static_cast<ossim_uint8*>(theImageData->getBuf(0));
899  }
900 }
901 
903 {
904  if(imageData.valid())
905  {
906  if((imageData->getScalarType() == OSSIM_UCHAR)&&
907  (imageData->getDataObjectStatus()!=OSSIM_NULL))
908  {
909  theImageData = imageData;
910  initialize();
911  }
912  }
913 }
914 
916 {
917  return theImageData;
918 }
919 
920 
922  int n)
923 {
924  if(!theImageData)
925  {
926  return;
927  }
928  int i;
929  int lx, ly;
930 
931  if (!n)
932  {
933  return;
934  }
935  lx = p->x;
936  ly = p->y;
937  drawLine (lx, ly, p[n - 1].x, p[n - 1].y);
938 
939  for (i = 1; (i < n); i++)
940  {
941  p++;
942  drawLine (lx, ly, p->x, p->y);
943  lx = p->x;
944  ly = p->y;
945  }
946 }
947 
949  int n)
950 {
951  if(!theImageData)
952  {
953  return;
954  }
955  int i;
956  double lx, ly;
957 
958  if (!n)
959  {
960  return;
961  }
962  lx = p->x;
963  ly = p->y;
964  drawLine (lx, ly, p[n - 1].x, p[n - 1].y);
965 
966  for (i = 1; (i < n); i++)
967  {
968  p++;
969  drawLine (lx, ly, p->x, p->y);
970  lx = p->x;
971  ly = p->y;
972  }
973 }
974 
975 void ossimRgbImage::drawPolygon(const std::vector<ossimIpt> &p)
976 {
977  if(!theImageData)
978  {
979  return;
980  }
981  int n = (int)p.size();
982 
983  int i;
984  int lx, ly;
985 
986  if (!n)
987  {
988  return;
989  }
990  lx = p[0].x;
991  ly = p[0].y;
992  drawLine (lx, ly, p[n - 1].x, p[n - 1].y);
993 
994  for (i = 1; (i < n); i++)
995  {
996  drawLine (lx, ly, p[i].x, p[i].y);
997  lx = p[i].x;
998  ly = p[i].y;
999  }
1000 }
1001 
1002 void ossimRgbImage::drawPolygon(const std::vector<ossimDpt> &p)
1003 {
1004  if(!theImageData)
1005  {
1006  return;
1007  }
1008  int n = (int)p.size();
1009 
1010  int i;
1011  double lx, ly;
1012 
1013  if (!n)
1014  {
1015  return;
1016  }
1017  lx = p[0].x;
1018  ly = p[0].y;
1019  drawLine (lx, ly, p[n - 1].x, p[n - 1].y);
1020 
1021  for (i = 1; (i < n); i++)
1022  {
1023  drawLine (lx, ly, p[i].x, p[i].y);
1024  lx = p[i].x;
1025  ly = p[i].y;
1026  }
1027 }
1028 
1029 inline int gdCompareInt (const void *a, const void *b)
1030 {
1031  return (*(const int *) a) - (*(const int *) b);
1032 }
1033 
1035  double cy,
1036  double w,
1037  double h,
1038  double s,
1039  double e)
1040 {
1041 // drawFilledArc((int)ossim::round<int>(cx), // center x
1042 // (int)ossim::round<int>(cy), // center y
1043 // (int)ossim::round<int>(w), // width
1044 // (int)ossim::round<int>(h), // height
1045 // (int)ossim::round<int>(s), // start angle
1046 // (int)ossim::round<int>(e)); // end angle
1047  drawFilledArc((int)(cx), // center x
1048  (int)(cy), // center y
1049  (int)(w), // width
1050  (int)(h), // height
1051  (int)(s), // start angle
1052  (int)(e)); // end angle
1053 }
1054 
1056  int cy,
1057  int w,
1058  int h,
1059  int s,
1060  int e)
1061 {
1062  if(!theImageData)
1063  {
1064  return;
1065  }
1066  ossimIpt pts[3];
1067  int i;
1068  int lx = 0, ly = 0;
1069  // int fx, fy;
1070  int w2, h2;
1071  w2 = w / 2;
1072  h2 = h / 2;
1073  while (e < s)
1074  {
1075  e += 360;
1076  }
1077  for (i = s; (i <= e); i++)
1078  {
1079  int x, y;
1080  x = ((ossim_int32) gdCosT[i % 360] * (ossim_int32) w2 / 1024) + cx;
1081  y = ((ossim_int32) gdSinT[i % 360] * (ossim_int32) h2 / 1024) + cy;
1082  if (i != s)
1083  {
1084  /* This is expensive! */
1085  pts[0].x = lx;
1086  pts[0].y = ly;
1087  pts[1].x = x;
1088  pts[1].y = y;
1089  pts[2].x = cx;
1090  pts[2].y = cy;
1091  drawFilledPolygon (pts, 3);
1092  }
1093  // else
1094  // {
1095  // fx = x;
1096  // fy = y;
1097  // }
1098  lx = x;
1099  ly = y;
1100  }
1101 }
1102 
1104  int cy,
1105  int w,
1106  int h,
1107  int s,
1108  int e)
1109 {
1110  if(!theImageData)
1111  {
1112  return;
1113  }
1114  int i;
1115  int lx = 0, ly = 0;
1116  // int fx, fy;
1117  int w2, h2;
1118  w2 = w / 2;
1119  h2 = h / 2;
1120  while (e < s)
1121  {
1122  e += 360;
1123  }
1124  for (i = s; (i <= e); i++)
1125  {
1126  int x, y;
1127  x = ((ossim_int32) gdCosT[i % 360] * (ossim_int32) w2 / 1024) + cx;
1128  y = ((ossim_int32) gdSinT[i % 360] * (ossim_int32) h2 / 1024) + cy;
1129  if (i != s)
1130  {
1131  drawLine (lx, ly, x, y);
1132  }
1133  // else
1134  // {
1135  // fx = x;
1136  // fy = y;
1137  // }
1138  lx = x;
1139  ly = y;
1140  }
1141 }
1142 
1144  int cy,
1145  int axisMinor,
1146  int axisMajor,
1147  double rot)
1148 {
1149  if(!theImageData)
1150  {
1151  return;
1152  }
1153 
1154  int lx = 0;
1155  int ly = 0;
1156  int w2 = axisMinor/2;
1157  int h2 = axisMajor/2;
1158  ossimIpt pts[3];
1159 
1160  float sinRot = sin(rot);
1161  float cosRot = cos(rot);
1162 
1163  for (int i = 0; i <= 360; ++i)
1164  {
1165  int x = ((ossim_int32) gdCosT[i % 360] * (ossim_int32) w2 / 1024);
1166  int y = ((ossim_int32) gdSinT[i % 360] * (ossim_int32) h2 / 1024);
1167 
1168  int rx = (ossim_int32)((float)x*cosRot - (float)y*sinRot + cx);
1169  int ry = (ossim_int32)((float)y*cosRot + (float)x*sinRot + cy);
1170 
1171  if (i != 0)
1172  {
1173  /* This is expensive! */
1174  pts[0].x = lx;
1175  pts[0].y = ly;
1176  pts[1].x = rx;
1177  pts[1].y = ry;
1178  pts[2].x = cx;
1179  pts[2].y = cy;
1180 
1181  drawFilledPolygon (pts, 3);
1182  }
1183  lx = rx;
1184  ly = ry;
1185  }
1186 }
1187 
1189  int cy,
1190  int axisMinor,
1191  int axisMajor,
1192  double rot,
1193  bool drawAxes)
1194 {
1195  if(!theImageData)
1196  {
1197  return;
1198  }
1199 
1200  // Range check rotation.
1201  if ( (rot < -TWO_PI) || (rot > TWO_PI) )
1202  {
1203  rot = 0.0; // throw exception or continue???
1204  }
1205 
1206  int lx = 0;
1207  int ly = 0;
1208  int w2 = axisMinor/2;
1209  int h2 = axisMajor/2;
1210 
1211  float sinRot = sin(rot);
1212  float cosRot = cos(rot);
1213 
1214  int xMaj[2];
1215  int yMaj[2];
1216  int xMin[2];
1217  int yMin[2];
1218  xMin[0] = 0;
1219  xMin[1] = 0;
1220  yMin[0] = 0;
1221  yMin[1] = 0;
1222  xMaj[0] = 0;
1223  xMaj[1] = 0;
1224  yMaj[0] = 0;
1225  yMaj[1] = 0;
1226 
1227  for (int i = 0; i <= 360; i++)
1228  {
1229  // Compute current coordinates
1230  int x = ((ossim_int32) gdCosT[i % 360] * (ossim_int32) w2 / 1024);
1231  int y = ((ossim_int32) gdSinT[i % 360] * (ossim_int32) h2 / 1024);
1232 
1233  // Rotate through orientation angle
1234  int rx = (ossim_int32)((float)x*cosRot - (float)y*sinRot + cx);
1235  int ry = (ossim_int32)((float)y*cosRot + (float)x*sinRot + cy);
1236 
1237  // Draw the 1-degree segment
1238  if (i != 0)
1239  {
1240  drawLine (lx, ly, rx, ry);
1241  }
1242  lx = rx;
1243  ly = ry;
1244 
1245  if (drawAxes)
1246  {
1247  // Save axes end-points
1248  switch (i)
1249  {
1250  case 0:
1251  xMin[0] = rx;
1252  yMin[0] = ry;
1253  break;
1254  case 90:
1255  xMaj[0] = rx;
1256  yMaj[0] = ry;
1257  break;
1258  case 180:
1259  xMin[1] = rx;
1260  yMin[1] = ry;
1261  break;
1262  case 270:
1263  xMaj[1] = rx;
1264  yMaj[1] = ry;
1265  break;
1266  default:
1267  break;
1268  }
1269  }
1270  }
1271 
1272  // Draw axes if selected
1273  if (drawAxes)
1274  {
1275  ossim_uint8 rCurr;
1276  ossim_uint8 gCurr;
1277  ossim_uint8 bCurr;
1278  getDrawColor(rCurr, gCurr, bCurr);
1279 
1280  ossim_int32 thickCurr = theThickness;
1281 
1282  ossim_uint8 mask = 0xff;
1283 
1284  // Draw the minor axis first so it is on the bottom.
1285  drawLine (xMin[0], yMin[0], xMin[1], yMin[1]);
1286 
1287  //set major axis to thicker yellow
1288  setDrawColor((rCurr^mask),(gCurr^mask),(bCurr^mask));
1289  // setDrawColor(255,255,1);
1290  theThickness += 1;
1291  drawLine (xMaj[0], yMaj[0], xMaj[1], yMaj[1]);
1292  theThickness = thickCurr;
1293  setDrawColor(rCurr,gCurr,bCurr); //set back
1294  }
1295 }
1296 
1298  int n)
1299 {
1300  if(!theImageData)
1301  {
1302  return;
1303  }
1304  int i;
1305  int y;
1306  int miny, maxy;
1307  int minx, maxx;
1308  int x1, y1;
1309  int x2, y2;
1310  int ind1, ind2;
1311  int ints;
1312  int *polyInts = 0;
1313 
1314  if(!n)
1315  {
1316  return;
1317  }
1318  polyInts = new int[n];
1319 
1320  miny = p[0].y;
1321  maxy = p[0].y;
1322  minx = p[0].x;
1323  maxx = p[0].x;
1324  for (i = 1; (i < n); i++)
1325  {
1326  miny = std::min((int)p[i].y, miny);
1327  minx = std::min((int)p[i].x, minx);
1328  maxy = std::max((int)p[i].y, maxy);
1329  maxx = std::max((int)p[i].x, maxx);
1330  }
1331  /* Fix in 1.3: count a vertex only once */
1332  for (y = miny; (y <= maxy); y++)
1333  {
1334  ints = 0;
1335  for (i = 0; (i < n); i++)
1336  {
1337  if (!i)
1338  {
1339  ind1 = n - 1;
1340  ind2 = 0;
1341  }
1342  else
1343  {
1344  ind1 = i - 1;
1345  ind2 = i;
1346  }
1347  y1 = p[ind1].y;
1348  y2 = p[ind2].y;
1349  if (y1 < y2)
1350  {
1351  x1 = p[ind1].x;
1352  x2 = p[ind2].x;
1353  }
1354  else if (y1 > y2)
1355  {
1356  y2 = p[ind1].y;
1357  y1 = p[ind2].y;
1358  x2 = p[ind1].x;
1359  x1 = p[ind2].x;
1360  }
1361  else
1362  {
1363  continue;
1364  }
1365  if ((y >= y1) && (y < y2))
1366  {
1367  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1368  }
1369  else if ((y == maxy) && (y > y1) && (y <= y2))
1370  {
1371  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1372  }
1373  }
1374  qsort (polyInts, ints, sizeof (int), gdCompareInt);
1375 
1376  if(ints)
1377  {
1378  for (i = 0; (i < (ints)); i += 2)
1379  {
1380  drawLine (polyInts[i], y,
1381  polyInts[i + 1], y);
1382  }
1383  }
1384  else
1385  {
1386  if((miny == maxy) && (minx==maxx))
1387  {
1388  drawLine((int)p[0].x, (int)p[0].y, (int)p[0].x, (int)p[0].y);
1389  }
1390  }
1391  }
1392 
1393  if (polyInts) delete [] polyInts;
1394 }
1395 
1397  int n)
1398 {
1399  if(!theImageData)
1400  {
1401  return;
1402  }
1403  int i;
1404  int y;
1405  int miny, maxy;
1406  int x1, y1;
1407  int x2, y2;
1408  int ind1, ind2;
1409  int ints;
1410  int *polyInts = 0;
1411 
1412  if(!n)
1413  {
1414  return;
1415  }
1416  polyInts = new int[n];
1417 
1418 // miny = ossim::round<int>(p[0].y);
1419 // maxy = ossim::round<int>(p[0].y);
1420  miny = (int)(p[0].y);
1421  maxy = (int)(p[0].y);
1422  for (i = 1; (i < n); i++)
1423  {
1424 // int testPy = ossim::round<int>(p[i].y);
1425  int testPy = (int)(p[i].y);
1426  if (testPy < miny)
1427  {
1428  miny = testPy;
1429  }
1430  if (testPy > maxy)
1431  {
1432  maxy = testPy;
1433  }
1434  }
1435  /* Fix in 1.3: count a vertex only once */
1436  for (y = miny; (y <= maxy); y++)
1437  {
1438  ints = 0;
1439  for (i = 0; (i < n); i++)
1440  {
1441  if (!i)
1442  {
1443  ind1 = n - 1;
1444  ind2 = 0;
1445  }
1446  else
1447  {
1448  ind1 = i - 1;
1449  ind2 = i;
1450  }
1451 // y1 = ossim::round<int>(p[ind1].y);
1452 // y2 = ossim::round<int>(p[ind2].y);
1453  y1 = (int)(p[ind1].y);
1454  y2 = (int)(p[ind2].y);
1455  if (y1 < y2)
1456  {
1457  x1 = ossim::round<int>(p[ind1].x);
1458  x2 = ossim::round<int>(p[ind2].x);
1459  }
1460  else if (y1 > y2)
1461  {
1462 // y2 = ossim::round<int>(p[ind1].y);
1463 // y1 = ossim::round<int>(p[ind2].y);
1464 // x2 = ossim::round<int>(p[ind1].x);
1465 // x1 = ossim::round<int>(p[ind2].x);
1466  y2 = (int)(p[ind1].y);
1467  y1 = (int)(p[ind2].y);
1468  x2 = (int)(p[ind1].x);
1469  x1 = (int)(p[ind2].x);
1470  }
1471  else
1472  {
1473  continue;
1474  }
1475  if ((y >= y1) && (y < y2))
1476  {
1477  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1478  }
1479  else if ((y == maxy) && (y > y1) && (y <= y2))
1480  {
1481  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1482  }
1483  }
1484  qsort (polyInts, ints, sizeof (int), gdCompareInt);
1485 
1486  for (i = 0; (i < (ints)); i += 2)
1487  {
1488  drawLine (polyInts[i], y,
1489  polyInts[i + 1], y);
1490  }
1491  }
1492 
1493  if (polyInts) delete [] polyInts;
1494 }
1495 
1496 void ossimRgbImage::drawFilledPolygon(const std::vector<ossimIpt> &p)
1497 {
1498  if(!theImageData)
1499  {
1500  return;
1501  }
1502  int n = (int)p.size();
1503  int i;
1504  int y;
1505  int miny, maxy;
1506  int x1, y1;
1507  int x2, y2;
1508  int ind1, ind2;
1509  int ints;
1510  int *polyInts = 0;
1511 
1512  if(!n)
1513  {
1514  return;
1515  }
1516  polyInts = new int[n];
1517 
1518  miny = p[0].y;
1519  maxy = p[0].y;
1520  for (i = 1; (i < n); i++)
1521  {
1522  if (p[i].y < miny)
1523  {
1524  miny = p[i].y;
1525  }
1526  if (p[i].y > maxy)
1527  {
1528  maxy = p[i].y;
1529  }
1530  }
1531  /* Fix in 1.3: count a vertex only once */
1532  for (y = miny; (y <= maxy); y++)
1533  {
1534  ints = 0;
1535  for (i = 0; (i < n); i++)
1536  {
1537  if (!i)
1538  {
1539  ind1 = n - 1;
1540  ind2 = 0;
1541  }
1542  else
1543  {
1544  ind1 = i - 1;
1545  ind2 = i;
1546  }
1547  y1 = p[ind1].y;
1548  y2 = p[ind2].y;
1549  if (y1 < y2)
1550  {
1551  x1 = p[ind1].x;
1552  x2 = p[ind2].x;
1553  }
1554  else if (y1 > y2)
1555  {
1556  y2 = p[ind1].y;
1557  y1 = p[ind2].y;
1558  x2 = p[ind1].x;
1559  x1 = p[ind2].x;
1560  }
1561  else
1562  {
1563  continue;
1564  }
1565  if ((y >= y1) && (y < y2))
1566  {
1567  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1568  }
1569  else if ((y == maxy) && (y > y1) && (y <= y2))
1570  {
1571  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1572  }
1573  }
1574  qsort (polyInts, ints, sizeof (int), gdCompareInt);
1575 
1576  for (i = 0; (i < (ints)); i += 2)
1577  {
1578  drawLine (polyInts[i], y,
1579  polyInts[i + 1], y);
1580  }
1581  }
1582 
1583  if (polyInts) delete [] polyInts;
1584 }
1585 
1586 void ossimRgbImage::drawFilledPolygon(const std::vector<ossimDpt> &p)
1587 {
1588  if(!theImageData)
1589  {
1590  return;
1591  }
1592  int n = (int)p.size();
1593  int i;
1594  int y;
1595  int miny, maxy;
1596  int x1, y1;
1597  int x2, y2;
1598  int ind1, ind2;
1599  int ints;
1600  int *polyInts = 0;
1601 
1602  if(!n)
1603  {
1604  return;
1605  }
1606  polyInts = new int[n];
1607 
1608  miny = (int)p[0].y;//ossim::round<int>(p[0].y);
1609  maxy = (int)p[0].y;//ossim::round<int>(p[0].y);
1610  for (i = 1; (i < n); i++)
1611  {
1612  int testPy = (int)p[i].y;//ossim::round<int>(p[i].y);
1613  if (testPy < miny)
1614  {
1615  miny = testPy;
1616  }
1617  if (testPy > maxy)
1618  {
1619  maxy = testPy;
1620  }
1621  }
1622  /* Fix in 1.3: count a vertex only once */
1623  for (y = miny; (y <= maxy); y++)
1624  {
1625  ints = 0;
1626  for (i = 0; (i < n); i++)
1627  {
1628  if (!i)
1629  {
1630  ind1 = n - 1;
1631  ind2 = 0;
1632  }
1633  else
1634  {
1635  ind1 = i - 1;
1636  ind2 = i;
1637  }
1638 // y1 = ossim::round<int>(p[ind1].y);
1639 // y2 = ossim::round<int>(p[ind2].y);
1640  y1 = (int)(p[ind1].y);
1641  y2 = (int)(p[ind2].y);
1642  if (y1 < y2)
1643  {
1644 // x1 = ossim::round<int>(p[ind1].x);
1645 // x2 = ossim::round<int>(p[ind2].x);
1646  x1 = (int)(p[ind1].x);
1647  x2 = (int)(p[ind2].x);
1648  }
1649  else if (y1 > y2)
1650  {
1651 // y2 = ossim::round<int>(p[ind1].y);
1652 // y1 = ossim::round<int>(p[ind2].y);
1653 // x2 = ossim::round<int>(p[ind1].x);
1654 // x1 = ossim::round<int>(p[ind2].x);
1655  y2 = (int)(p[ind1].y);
1656  y1 = (int)(p[ind2].y);
1657  x2 = (int)(p[ind1].x);
1658  x1 = (int)(p[ind2].x);
1659  }
1660  else
1661  {
1662  continue;
1663  }
1664  if ((y >= y1) && (y < y2))
1665  {
1666  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1667  }
1668  else if ((y == maxy) && (y > y1) && (y <= y2))
1669  {
1670  polyInts[ints++] = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
1671  }
1672  }
1673  qsort (polyInts, ints, sizeof (int), gdCompareInt);
1674 
1675  for (i = 0; (i < (ints)); i += 2)
1676  {
1677  drawLine (polyInts[i], y,
1678  polyInts[i + 1], y);
1679  }
1680  }
1681 
1682  if (polyInts) delete [] polyInts;
1683 }
1684 
1686  const ossimIpt& end)
1687 {
1688  drawLine((int)start.x,
1689  (int)start.y,
1690  (int)end.x,
1691  (int)end.y);
1692 
1693 }
1694 
1696  const ossimDpt& end)
1697 {
1698 // drawLine((int)ossim::round<int>(start.x),
1699 // (int)ossim::round<int>(start.y),
1700 // (int)ossim::round<int>(end.x),
1701 // (int)ossim::round<int>(end.y));
1702 
1703  drawLine((int)(start.x),
1704  (int)(start.y),
1705  (int)(end.x),
1706  (int)(end.y));
1707 
1708 }
1709 
1711  double y1,
1712  double x2,
1713  double y2)
1714 {
1715 // drawLine((int)ossim::round<int>(x1),
1716 // (int)ossim::round<int>(y1),
1717 // (int)ossim::round<int>(x2),
1718 // (int)ossim::round<int>(y2));
1719  drawLine((int)(x1),
1720  (int)(y1),
1721  (int)(x2),
1722  (int)(y2));
1723 
1724 }
1726  int y1,
1727  int x2,
1728  int y2)
1729 {
1730  if(!theImageData)
1731  {
1732  return;
1733  }
1734 
1735  // we need to shift x and y relative to the image data
1736  // origin. That way we are doing the algorithm relative to
1737  // the 0,0
1738  //
1739  ossimIpt origin = ossimDpt(theImageData->getOrigin());
1740  x1 += (-origin.x);
1741  y1 += (-origin.y);
1742  x2 += (-origin.x);
1743  y2 += (-origin.y);
1744 
1745 // ossimDpt start(x1, y1);
1746 // ossimDpt end(x2,y2);
1747 // ossimDrect bounds(0,0,theWidth-1, theHeight-1);
1748 
1749 // if(bounds.clip(start, end)) return;
1750 
1751 // x1 = (int)start.x;
1752 // y1 = (int)start.y;
1753 // x2 = (int)end.x;
1754 // y2 = (int)end.y;
1755 
1756  int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;
1757  int wid;
1758  int w, wstart;
1759  int thick = theThickness;
1760 
1761  dx = abs (x2 - x1);
1762  dy = abs (y2 - y1);
1763  if (dy <= dx)
1764  {
1765  /* More-or-less horizontal. use wid for vertical stroke */
1766  /* Doug Claar: watch out for NaN in atan2 (2.0.5) */
1767  if ((dx == 0) && (dy == 0))
1768  {
1769  wid = 1;
1770  }
1771  else
1772  {
1773  /* 2.0.12: Michael Schwartz: divide rather than multiply;
1774  TBB: but watch out for /0! */
1775  double ac = cos (atan2 ((double)dy, (double)dx));
1776  if (ac != 0)
1777  {
1778  wid = ossim::round<int>(thick / ac);
1779  }
1780  else
1781  {
1782  wid = 1;
1783  }
1784  if (wid == 0)
1785  {
1786  wid = 1;
1787  }
1788  }
1789  d = 2 * dy - dx;
1790  incr1 = 2 * dy;
1791  incr2 = 2 * (dy - dx);
1792  if (x1 > x2)
1793  {
1794  x = x2;
1795  y = y2;
1796  ydirflag = (-1);
1797  xend = x1;
1798  }
1799  else
1800  {
1801  x = x1;
1802  y = y1;
1803  ydirflag = 1;
1804  xend = x2;
1805  }
1806 
1807  /* Set up line thickness */
1808  wstart = y - wid / 2;
1809  for (w = wstart; w < wstart + wid; w++)
1811 
1812  if (((y2 - y1) * ydirflag) > 0)
1813  {
1814  while (x < xend)
1815  {
1816  x++;
1817  if (d < 0)
1818  {
1819  d += incr1;
1820  }
1821  else
1822  {
1823  y++;
1824  d += incr2;
1825  }
1826  wstart = y - wid / 2;
1827  for (w = wstart; w < wstart + wid; w++)
1829  }
1830  }
1831  else
1832  {
1833  while (x < xend)
1834  {
1835  x++;
1836  if (d < 0)
1837  {
1838  d += incr1;
1839  }
1840  else
1841  {
1842  y--;
1843  d += incr2;
1844  }
1845  wstart = y - wid / 2;
1846  for (w = wstart; w < wstart + wid; w++)
1848  }
1849  }
1850  }
1851  else
1852  {
1853  /* More-or-less vertical. use wid for horizontal stroke */
1854  /* 2.0.12: Michael Schwartz: divide rather than multiply;
1855  TBB: but watch out for /0! */
1856  double as = sin (atan2 ((double)dy, (double)dx));
1857  if (as != 0)
1858  {
1859  wid = ossim::round<int>(thick / as);
1860  }
1861  else
1862  {
1863  wid = 1;
1864  }
1865  if (wid == 0)
1866  wid = 1;
1867 
1868  d = 2 * dx - dy;
1869  incr1 = 2 * dx;
1870  incr2 = 2 * (dx - dy);
1871  if (y1 > y2)
1872  {
1873  y = y2;
1874  x = x2;
1875  yend = y1;
1876  xdirflag = (-1);
1877  }
1878  else
1879  {
1880  y = y1;
1881  x = x1;
1882  yend = y2;
1883  xdirflag = 1;
1884  }
1885 
1886  /* Set up line thickness */
1887  wstart = x - wid / 2;
1888  for (w = wstart; w < wstart + wid; w++)
1890 
1891  if (((x2 - x1) * xdirflag) > 0)
1892  {
1893  while (y < yend)
1894  {
1895  y++;
1896  if (d < 0)
1897  {
1898  d += incr1;
1899  }
1900  else
1901  {
1902  x++;
1903  d += incr2;
1904  }
1905  wstart = x - wid / 2;
1906  for (w = wstart; w < wstart + wid; w++)
1908  }
1909  }
1910  else
1911  {
1912  while (y < yend)
1913  {
1914  y++;
1915  if (d < 0)
1916  {
1917  d += incr1;
1918  }
1919  else
1920  {
1921  x--;
1922  d += incr2;
1923  }
1924  wstart = x - wid / 2;
1925  for (w = wstart; w < wstart + wid; w++)
1927  }
1928  }
1929  }
1930 }
1932  double y1,
1933  double x2,
1934  double y2)
1935 {
1936 // drawRectangle(ossim::round<int>(x1),
1937 // ossim::round<int>(y1),
1938 // ossim::round<int>(x2),
1939 // ossim::round<int>(y2));
1940  drawRectangle((int)(x1),
1941  (int)(y1),
1942  (int)(x2),
1943  (int)(y2));
1944 }
1945 
1947  int y1,
1948  int x2,
1949  int y2)
1950 {
1951  if(x1 > x2)
1952  {
1953  swap(x1, x2);
1954  }
1955  if(y1 > y2)
1956  {
1957  swap(y1, y2);
1958  }
1959  int x1h = x1,
1960  x1v = x1,
1961  y1h = y1,
1962  y1v = y1,
1963  x2h = x2,
1964  x2v = x2,
1965  y2h = y2,
1966  y2v = y2;
1967 
1968  int thick = theThickness;
1969 
1970 
1971  if (thick > 1)
1972  {
1973  int half = thick / 2;
1974  int half1 = thick - half;
1975 
1976  if (y1 < y2)
1977  {
1978  y1v = y1h - half;
1979  y2v = y2h + half1 - 1;
1980  }
1981  else
1982  {
1983  y1v = y1h + half1 - 1;
1984  y2v = y2h - half;
1985  }
1986  }
1987 
1988  drawLine (x1h, y1h, x2h, y1h);
1989  drawLine (x1h, y2h, x2h, y2h);
1990  drawLine (x1v, y1v, x1v, y2v);
1991  drawLine (x2v, y1v, x2v, y2v);
1992 }
1993 
1994 
1996  double y1,
1997  double x2,
1998  double y2)
1999 {
2000 // drawFilledRectangle((int)ossim::round<int>(x1),
2001 // (int)ossim::round<int>(y1),
2002 // (int)ossim::round<int>(x2),
2003 // (int)ossim::round<int>(y2));
2004  drawFilledRectangle((int)(x1),
2005  (int)(y1),
2006  (int)(x2),
2007  (int)(y2));
2008 }
2009 
2011  int y1,
2012  int x2,
2013  int y2)
2014 {
2015  int x, y;
2016 
2017  if(x1 > x2)
2018  {
2019  swap(x1, x2);
2020  }
2021  if(y1 > y2)
2022  {
2023  swap(y1, y2);
2024  }
2025  for (y = y1; (y <= y2); y++)
2026  {
2027  for (x = x1; (x <= x2); x++)
2028  {
2030  }
2031  }
2032 }
2033 
2035 {
2036  if(!theImageData)
2037  {
2038  return;
2039  }
2040  ossim_int32 width = theWidth;
2041  ossim_int32 height = theHeight;
2042 
2043  for(ossim_int32 row = 0; row < height; ++row)
2044  {
2045  for(ossim_int32 col = 0; col < width; ++col)
2046  {
2047  fastPlotPixel(col, row,
2048  theRed, theGreen, theBlue);
2049  }
2050  }
2051 }
2052 
2054  ossim_uint8 g,
2055  ossim_uint8 b)
2056 {
2057  theRed = r;
2058  theGreen = g;
2059  theBlue = b;
2060 }
2061 
2063  ossim_uint8& gCurr,
2064  ossim_uint8& bCurr)
2065 {
2066  rCurr = theRed;
2067  gCurr = theGreen;
2068  bCurr = theBlue;
2069 }
2070 
2072 {
2073  theThickness = thickness;
2074 }
2075 
2077 {
2078  return theThickness;
2079 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
ossim_int32 getThickness() const
ossim_uint8 theGreen
The green component of the color used in drawing the shapes.
void drawPolygon(const std::vector< ossimDpt > &p)
virtual ossim_uint32 getNumberOfBands() const
void fill()
Will fill the entire data object with the specified color set in setDrawColor.
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
ossimReferenced allows for shared object ref counting if the reference count ever gets to 0 or less i...
double y
Definition: ossimDpt.h:165
virtual void createNewGrey(ossim_int32 width, ossim_int32 height)
Will construct a new single band image data object.
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
void setThickness(ossim_int32 thickness)
All the drawing algorithms have thickness.
#define abs(a)
Definition: auxiliary.h:74
void drawRectangle(double x1, double y1, double x2, double y2)
Will draw a rectangle.
ossim_int32 theThickness
Holds the draw thickness.
void drawEllipse(int cx, int cy, int sminor, int smajor, double rot, bool drawAxes=false)
Draws an ellipse.
virtual void initialize()
Initialize the data buffer.
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 > getImageData()
Will return the image data.
ossimRefPtr< ossimImageData > theImageData
This object operates on the ossimImageData.
virtual void createNewTrueColor(ossim_int32 width, ossim_int32 height)
Will construct a new 3 band rgb data object.
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
void drawArc(double cx, double cy, double w, double h, double s, double e)
will draw an arc.
ossim_uint8 * theBands[3]
This is a fast access to the start of each band.
void drawLine(double x1, double y1, double x2, double y2)
About all the draw routines will call draw line.
ossim_uint8 theRed
The red component of the color used in drawing the shapes.
virtual ossimScalarType getScalarType() const
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)
void drawFilledPolygon(const std::vector< ossimDpt > &p)
We will cut and paste the code from drawFilledPolygon(ossimIpt *p, int n).
int gdCompareInt(const void *a, const void *b)
#define max(a, b)
Definition: auxiliary.h:76
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_uint8 theBlue
The blue component of the color used in drawing the shapes.
double x
Definition: ossimDpt.h:164
#define TWO_PI
void drawFilledEllipse(int cx, int cy, int sminor, int smajor, double rot)
Draws a filled ellipse.
virtual ~ossimRgbImage()
ossim_int32 x
Definition: ossimIpt.h:141
ossim_int32 * theOffsets
This will hold precomputed offsets to the start of each row.
void drawFilledRectangle(double x1, double y1, double x2, double y2)
Will draw a filled rectangle with the current draw color.
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
void setCurrentImageData(ossimRefPtr< ossimImageData > &imageData)
Allows you to change the image data that this RgbImage object operates on.
void drawFilledArc(double cx, double cy, double w, double h, double s, double e)
This will draw a filled arc.
virtual void initialize()
Will initilize any pre-computations that are needed.
virtual const ossimIpt & getOrigin() const
unsigned char ossim_uint8
8 bit unsigned iteger
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32