HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_PixelImpl.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: PXL_Pixel.C
7  *
8  * COMMENTS:
9  * Utility class for manipulating different types of pixel data (uint8,
10  * uint16, int32, float32)
11  */
12 #ifndef PXL_PIXEL_C
13 #define PXL_PIXEL_C
14 
15 #include <limits.h>
16 #include <stdlib.h>
17 
18 #include <SYS/SYS_Types.h>
19 #include <SYS/SYS_Math.h>
20 #include <SYS/SYS_Floor.h>
21 
22 #include <UT/UT_Endian.h>
23 
24 #include "PXL_Pixel.h"
25 
26 //#ifndef LONGLONG_MAX
27 //#define LONGLONG_MAX 9223372036854775807L
28 //#endif
29 
30 //#define USE_LUT_FOR_8_16_TO_FP_CONV
31 
32 #ifdef USE_LUT_FOR_8_TO_FP_CONV
33 // Hard coded LUTs for 8bit conversion to FP.
34 static float lut8bitFP[256] =
35 {
36 0.000000, 0.003922, 0.007843, 0.011765, 0.015686, 0.019608, 0.023529, 0.027451,
37 0.031373, 0.035294, 0.039216, 0.043137, 0.047059, 0.050980, 0.054902, 0.058824,
38 0.062745, 0.066667, 0.070588, 0.074510, 0.078431, 0.082353, 0.086275, 0.090196,
39 0.094118, 0.098039, 0.101961, 0.105882, 0.109804, 0.113725, 0.117647, 0.121569,
40 0.125490, 0.129412, 0.133333, 0.137255, 0.141176, 0.145098, 0.149020, 0.152941,
41 0.156863, 0.160784, 0.164706, 0.168627, 0.172549, 0.176471, 0.180392, 0.184314,
42 0.188235, 0.192157, 0.196078, 0.200000, 0.203922, 0.207843, 0.211765, 0.215686,
43 0.219608, 0.223529, 0.227451, 0.231373, 0.235294, 0.239216, 0.243137, 0.247059,
44 0.250980, 0.254902, 0.258824, 0.262745, 0.266667, 0.270588, 0.274510, 0.278431,
45 0.282353, 0.286275, 0.290196, 0.294118, 0.298039, 0.301961, 0.305882, 0.309804,
46 0.313725, 0.317647, 0.321569, 0.325490, 0.329412, 0.333333, 0.337255, 0.341176,
47 0.345098, 0.349020, 0.352941, 0.356863, 0.360784, 0.364706, 0.368627, 0.372549,
48 0.376471, 0.380392, 0.384314, 0.388235, 0.392157, 0.396078, 0.400000, 0.403922,
49 0.407843, 0.411765, 0.415686, 0.419608, 0.423529, 0.427451, 0.431373, 0.435294,
50 0.439216, 0.443137, 0.447059, 0.450980, 0.454902, 0.458824, 0.462745, 0.466667,
51 0.470588, 0.474510, 0.478431, 0.482353, 0.486275, 0.490196, 0.494118, 0.498039,
52 0.501961, 0.505882, 0.509804, 0.513725, 0.517647, 0.521569, 0.525490, 0.529412,
53 0.533333, 0.537255, 0.541176, 0.545098, 0.549020, 0.552941, 0.556863, 0.560784,
54 0.564706, 0.568627, 0.572549, 0.576471, 0.580392, 0.584314, 0.588235, 0.592157,
55 0.596078, 0.600000, 0.603922, 0.607843, 0.611765, 0.615686, 0.619608, 0.623529,
56 0.627451, 0.631373, 0.635294, 0.639216, 0.643137, 0.647059, 0.650980, 0.654902,
57 0.658824, 0.662745, 0.666667, 0.670588, 0.674510, 0.678431, 0.682353, 0.686275,
58 0.690196, 0.694118, 0.698039, 0.701961, 0.705882, 0.709804, 0.713725, 0.717647,
59 0.721569, 0.725490, 0.729412, 0.733333, 0.737255, 0.741176, 0.745098, 0.749020,
60 0.752941, 0.756863, 0.760784, 0.764706, 0.768627, 0.772549, 0.776471, 0.780392,
61 0.784314, 0.788235, 0.792157, 0.796078, 0.800000, 0.803922, 0.807843, 0.811765,
62 0.815686, 0.819608, 0.823529, 0.827451, 0.831373, 0.835294, 0.839216, 0.843137,
63 0.847059, 0.850980, 0.854902, 0.858824, 0.862745, 0.866667, 0.870588, 0.874510,
64 0.878431, 0.882353, 0.886275, 0.890196, 0.894118, 0.898039, 0.901961, 0.905882,
65 0.909804, 0.913725, 0.917647, 0.921569, 0.925490, 0.929412, 0.933333, 0.937255,
66 0.941176, 0.945098, 0.949020, 0.952941, 0.956863, 0.960784, 0.964706, 0.968627,
67 0.972549, 0.976471, 0.980392, 0.984314, 0.988235, 0.992157, 0.996078, 1.000000
68 };
69 #endif
70 
71 
72 // Contructors.
73 template<>
74 inline
76  unsigned int white,
77  unsigned char value)
78 {
80  myType = PXL_INT8;
81  myBlack = black;
82  myWhite = white;
83  myValue = value;
84  if(myBlack != myWhite)
85  myPntScale = 1.0f / (myWhite - myBlack);
86  else myPntScale = 1.0f;
87 }
88 
89 template<>
90 inline
92  unsigned int white,
93  unsigned char value)
94 {
96  myType = PXL_INT8;
97  myBlack = black;
98  myWhite = white;
99  myValue = value;
100  myPntScale = 1.0f;
101 }
102 
103 template<>
104 inline
106 {
108  myType = PXL_INT8;
109 
110  myBlack = pix.myBlack;
111  myWhite = pix.myWhite;
112  myValue = pix.myValue;
113  if(myBlack != myWhite)
114  myPntScale = 1.0f / (myWhite - myBlack);
115  else myPntScale = 1.0f;
116 }
117 
118 
119 template<>
120 inline
122 {
124  myType = PXL_INT8;
125 
126  myBlack = pix.myBlack;
127  myWhite = pix.myWhite;
128  myValue = pix.myValue;
129  myPntScale = 1.0f;
130 }
131 
132 template<>
133 inline
135  unsigned int white,
136  unsigned short value)
137 {
139  myType = PXL_INT16;
140  myBlack = black;
141  myWhite = white;
142  myValue = value;
143  if(myBlack != myWhite)
144  myPntScale = 1.0f / (myWhite - myBlack);
145  else myPntScale = 1.0f;
146 }
147 
148 template<>
149 inline
151  unsigned int white,
152  unsigned short value)
153 {
155  myType = PXL_INT16;
156  myBlack = black;
157  myWhite = white;
158  myValue = value;
159  myPntScale = 1.0f;
160 }
161 
162 template<>
163 inline
165 {
167  myType = PXL_INT16;
168 
169  myBlack = pix.myBlack;
170  myWhite = pix.myWhite;
171  myValue = pix.myValue;
172  if(myBlack != myWhite)
173  myPntScale = 1.0f / (myWhite - myBlack);
174  else myPntScale = 1.0f;
175 }
176 
177 template<>
178 inline
180 {
182  myType = PXL_INT16;
183 
184  myBlack = pix.myBlack;
185  myWhite = pix.myWhite;
186  myValue = pix.myValue;
187  myPntScale = 1.0f;
188 }
189 
190 template<>
191 inline
193  unsigned int white,
194  unsigned int value)
195 {
197  myType = PXL_INT32;
198  myBlack = black;
199  myWhite = white;
200  myValue = value;
201  if(myBlack != myWhite)
202  myPntScale = 1.0f / (myWhite - myBlack);
203  else myPntScale = 1.0f;
204 }
205 
206 template<>
207 inline
209  unsigned int white,
210  unsigned int value)
211 {
213  myType = PXL_INT32;
214  myBlack = black;
215  myWhite = white;
216  myValue = value;
217  myPntScale = 1.0f;
218 }
219 
220 template<>
221 inline
223 {
225  myType = PXL_INT32;
226 
227  myBlack = pix.myBlack;
228  myWhite = pix.myWhite;
229  myValue = pix.myValue;
230  if(myBlack != myWhite)
231  myPntScale = 1.0f / (myWhite - myBlack);
232  else myPntScale = 1.0f;
233 }
234 
235 
236 template<>
237 inline
239 {
241  myType = PXL_INT32;
242 
243  myBlack = pix.myBlack;
244  myWhite = pix.myWhite;
245  myValue = pix.myValue;
246  myPntScale = 1.0f;
247 }
248 
249 template<>
250 inline
252  unsigned int white,
253  float value)
254 {
256  myType = PXL_FLOAT32;
257  myBlack = black;
258  myWhite = white;
259  myValue = value;
260  myPntScale = 1.0f;
261 }
262 
263 template<>
264 inline
266  unsigned int white,
267  float value)
268 {
270  myType = PXL_FLOAT32;
271  myBlack = black;
272  myWhite = white;
273  myValue = value;
274  myPntScale = 1.0f;
275 }
276 
277 template<>
278 inline
280  unsigned int,
281  fpreal16 value)
282 {
284  myType = PXL_FLOAT16;
285  myBlack = 0;
286  myWhite = 1;
287  myValue = value;
288  myPntScale = 1.0f;
289 }
290 
291 template<>
292 inline
294  unsigned int,
295  fpreal16 value)
296 {
298  myType = PXL_FLOAT16;
299  myBlack = 0;
300  myWhite = 1;
301  myValue = value;
302  myPntScale = 1.0f;
303 }
304 
305 template<>
306 inline
308 {
310  myType = PXL_FLOAT32;
311 
312  myBlack = pix.myBlack;
313  myWhite = pix.myWhite;
314  myValue = pix.myValue;
315  myPntScale = 1.0f;
316 }
317 
318 
319 template<>
320 inline
322 {
324  myType = PXL_FLOAT32;
325 
326  myBlack = pix.myBlack;
327  myWhite = pix.myWhite;
328  myValue = pix.myValue;
329  myPntScale = 1.0f;
330 }
331 
332 template<>
333 inline
335 {
337  myType = PXL_FLOAT16;
338 
339  myBlack = pix.myBlack;
340  myWhite = pix.myWhite;
341  myValue = pix.myValue;
342  myPntScale = 1.0f;
343 }
344 
345 
346 template<>
347 inline
349 {
351  myType = PXL_FLOAT16;
352 
353  myBlack = pix.myBlack;
354  myWhite = pix.myWhite;
355  myValue = pix.myValue;
356  myPntScale = 1.0f;
357 }
358 
359 template<class Type, int fast>
360 inline
361 PXL_Pixel<Type, fast>::PXL_Pixel(unsigned b, unsigned int w, Type v)
362 {
364  myBlack = b;
365  myWhite = w;
366  myValue = v;
367  if(myBlack != myWhite)
368  myPntScale = 1.0f / (myWhite - myBlack);
369  else myPntScale = 1.0f;
370 }
371 
372 template<class Type, int fast>
373 inline
375 {
377  myType = pix.myType;
378  myBlack = pix.myBlack;
379  myWhite = pix.myWhite;
380  myValue = pix.myValue;
381 
382  if(myBlack != myWhite)
383  myPntScale = 1.0f / (myWhite - myBlack);
384  else myPntScale = 1.0f;
385 }
386 
387 // format names.
388 template<>
389 inline const char * PXL_Pixel<unsigned char, 0>::formatName() const
390 { return "char:slow"; }
391 template<>
392 inline const char * PXL_Pixel<unsigned char, 1>::formatName() const
393 { return "char:fast"; }
394 template<>
395 inline const char * PXL_Pixel<unsigned short, 0>::formatName() const
396 { return "short:slow"; }
397 template<>
398 inline const char * PXL_Pixel<unsigned short, 1>::formatName() const
399 { return "short:fast"; }
400 template<>
401 inline const char * PXL_Pixel<unsigned int, 0>::formatName() const
402 { return "int:slow"; }
403 template<>
404 inline const char * PXL_Pixel<unsigned int, 1>::formatName() const
405 { return "int:fast"; }
406 template<>
407 inline const char * PXL_Pixel<float, 0>::formatName() const
408 { return "float:slow"; }
409 template<>
410 inline const char * PXL_Pixel<float, 1>::formatName() const
411 { return "float:fast"; }
412 template<>
413 inline const char * PXL_Pixel<fpreal16, 0>::formatName() const
414 { return "float16:slow"; }
415 template<>
416 inline const char * PXL_Pixel<fpreal16, 1>::formatName() const
417 { return "float16:fast"; }
418 
419 template<class Type, int fast> inline const char *
421 { return "unknown"; }
422 
423 
424 // Min/Max definitions
425 
426 template<>
427 inline unsigned char
429 {
430  return UCHAR_MAX;
431 }
432 
433 template<>
434 inline unsigned char
436 {
437  return UCHAR_MAX;
438 }
439 
440 template<>
441 inline unsigned char
443 {
444  return (unsigned char) 0;
445 }
446 
447 template<>
448 inline unsigned char
450 {
451  return (unsigned char) 0;
452 }
453 
454 template<>
455 inline unsigned short
457 {
458  return USHRT_MAX;
459 }
460 
461 template<>
462 inline unsigned short
464 {
465  return USHRT_MAX;
466 }
467 
468 template<>
469 inline unsigned short
471 {
472  return (unsigned short) 0;
473 }
474 
475 template<>
476 inline unsigned short
478 {
479  return (unsigned short) 0;
480 }
481 
482 template<>
483 inline unsigned int
485 {
486  return UINT_MAX;
487 }
488 
489 template<>
490 inline unsigned int
492 {
493  return UINT_MAX;
494 }
495 
496 template<>
497 inline unsigned int
499 {
500  return 0;
501 }
502 
503 template<>
504 inline unsigned int
506 {
507  return 0;
508 }
509 
510 template<>
511 inline float
513 {
514  return (float) 0.0F;
515 }
516 
517 template<>
518 inline float
520 {
521  return (float) 0.0F;
522 }
523 
524 template<>
525 inline float
527 {
528  return 1.0F;
529 }
530 
531 template<>
532 inline float
534 {
535  return 1.0F;
536 }
537 
538 
539 template<>
540 inline fpreal16
542 {
543  return -H_REAL16_MAX;
544 }
545 
546 template<>
547 inline fpreal16
549 {
550  return -H_REAL16_MAX;
551 }
552 
553 template<>
554 inline fpreal16
556 {
557  return H_REAL16_MAX;
558 }
559 
560 template<>
561 inline fpreal16
563 {
564  return H_REAL16_MAX;
565 }
566 
567 
568 // specific 8 bit pixel definitions.... 0-255 *****************************
569 
570 template<>
571 inline unsigned char
573 {
574  int result = (int(myValue) - myBlack) *maxValue() /(myWhite - myBlack);
575  result /= val;
576  result = result * (myWhite - myBlack) / maxValue() + myBlack;
577 
578  if(result > maxValue())
579  result = maxValue();
580  else if(result < 0)
581  result = 0;
582 
583  return result;
584 }
585 
586 template<>
587 inline unsigned char
589 {
590  return (val > 0) ? (myValue / val) : 0;
591 }
592 
593 template<>
594 inline unsigned char
596 {
597  int64 result = myValue;
598  int64 max = maxValue();
599 
600  result = (int64(myValue) - myBlack) * max / (myWhite - myBlack);
601  result *= val;
602  result = result * (myWhite - myBlack) / max + myBlack;
603 
604  if(result > max)
605  result = max;
606  else if(result < 0)
607  result = 0;
608 
609  return result;
610 }
611 
612 template<>
613 inline unsigned char
615 {
616  int64 max = maxValue();
617  int64 result = myValue * val;
618 
619  if(result > max)
620  result = max;
621  else if(result < 0)
622  result = 0;
623 
624  return result;
625 }
626 
627 template<>
628 inline unsigned char
630 {
631  int64 result;
632  int64 max = maxValue();
633  double f;
634 
635  result = (int(myValue) - myBlack) *max / (myWhite - myBlack);
636 
637  f = result * fval;
638  result = (f > 0.0) ? int64(f + 0.5) : int64(f-0.5);
639  result = result *(myWhite+myBlack) / max + myBlack;
640 
641  if(result > max)
642  result = max;
643  else if(result < 0)
644  result = 0;
645 
646  return (unsigned char) result;
647 }
648 
649 template<>
650 inline unsigned char
652 {
653  int64 result;
654  int64 max = maxValue();
655 
656  if(fval > 0.0F)
657  {
658  double f;
659 
660  result = myValue;
661  f = result * fval;
662  result = (f>0.0) ? int64(f + 0.5) : int64(f - 0.5);
663  }
664  else
665  result = 0;
666 
667  if(result > max)
668  result = max;
669  else if(result < 0)
670  result = 0;
671 
672  return (unsigned char) result;
673 }
674 
675 template<>
676 inline PXL_Pixel<unsigned char,0>::operator unsigned char () const
677 {
678  int result = (int(myValue) - myBlack) *UCHAR_MAX / (myWhite - myBlack);
679 
680  if(result > UCHAR_MAX)
681  result = UCHAR_MAX;
682  else if(result < 0)
683  result = 0;
684 
685  return (unsigned char) result;
686 }
687 
688 template<>
689 inline PXL_Pixel<unsigned char,1>::operator unsigned char () const
690 {
691  return myValue;
692 }
693 
694 template<>
695 inline PXL_Pixel<unsigned char,0>::operator unsigned short () const
696 {
697  int64 result = (((int64)myValue) - ((int64)myBlack)) *((int64)USHRT_MAX)
698  / (int64)(myWhite - myBlack);
699 
700  if(result > (int64)USHRT_MAX)
701  result = (int64)USHRT_MAX;
702  else if(result < 0)
703  result = 0;
704 
705  return (unsigned short) (result&0x0000FFFFU);
706 }
707 
708 template<>
709 inline PXL_Pixel<unsigned char,1>::operator unsigned short () const
710 {
711  unsigned short val = (((unsigned short)myValue) << 8) +
712  ((unsigned short)myValue);
713 
714  return val;
715 }
716 
717 
718 template<>
720 {
721  int64 val = (int64)((myValue) - myBlack) *
722  ((int64)UINT_MAX) / ((int64)(myWhite - myBlack));
723 
724  if(val < 0) val =0;
725  if(val > (int64) UINT_MAX) val = (int64) UINT_MAX;
726 
727  return (unsigned int) val;
728 }
729 
730 template<>
732 {
733  unsigned int result = (((unsigned int)myValue) << 24U) +
734  (((unsigned int)myValue) << 16U) +
735  (((unsigned int)myValue) << 8U) +
736  (((unsigned int)myValue));
737  return result;
738 }
739 
740 template<>
742 {
743  return float((int)(myValue - myBlack)) * myPntScale;
744 }
745 
746 template<>
748 {
749 #ifdef USE_LUT_FOR_8_TO_FP_CONV
750  return lut8bitFP[myValue];
751 #else
752  return (((int)myValue) * 3.921569e-03f);
753 #endif
754 }
755 
756 template<>
757 inline void
759 {
760  int max = maxValue();
761  int half = (max>>1);
762  int result = (v * (myWhite - myBlack) + half) / max + myBlack;
763 
764  if(result > max)
765  result = max;
766  else if(result < 0)
767  result = 0;
768 
769  myValue = (unsigned char) result;
770 }
771 
772 template<>
773 inline void
775 {
776  int max = maxValue();
777 
778  if(v > max)
779  v = max;
780 
781  myValue = (unsigned char) v;
782 }
783 
784 template<>
785 inline int
787 {
788  int range = myWhite - myBlack;
789  float max = float(int(maxValue()) - myBlack) / float(range);
790  float min = float(int(minValue()) - myBlack) / float(range);
791 
792  if(f > max)
793  f = max;
794  else if(f < min)
795  f = min;
796 
797  return (int) SYSfloorIL(range *f +myBlack +0.5F);
798 }
799 
800 template<>
801 inline int
803 {
804  if(f > 1.0F)
805  f = 1.0F;
806  else if(f < 0.0F)
807  f = 0.0F;
808 
809  return int(SYSfloorIL(maxValue() *f +0.5F));
810 }
811 
812 template<>
813 inline void
815 {
816  if(b < 0.0F) b = 0.0F;
817  if(w < 0.0F) w = 0.0F;
818  if(b > 1.0F) b = 1.0F;
819  if(w > 1.0F) w = 1.0F;
820 
821  myBlack = (unsigned int)SYSfloorIL(b * UCHAR_MAX + 0.5F);
822  myWhite = (unsigned int)SYSfloorIL(w * UCHAR_MAX + 0.5F);
823  if(myBlack != myWhite)
824  myPntScale = 1.0f / (myWhite - myBlack);
825  else
826  myPntScale = 1.0f;
827 }
828 
829 template<>
830 inline void
832 {
833  myPntScale = 1.0f; // the fast version does not use b/w points.
834 }
835 
836 
837 // 16 bit unsigned definitions (0-65535) ************************************
838 
839 template<>
840 inline unsigned short
842 {
843  int64 result = (int64(myValue) -myBlack) * USHRT_MAX / (myWhite - myBlack);
844  result /= val;
845  result = result * (myWhite - myBlack) / USHRT_MAX + myBlack;
846 
847  if(result > maxValue())
848  result = maxValue();
849  else if(result < 0)
850  result = 0;
851 
852  return (unsigned short) result;
853 }
854 
855 template<>
856 inline unsigned short
858 {
859  return (val > 0) ? (myValue / val) : 0;
860 }
861 
862 template<>
863 inline unsigned short
865 {
866  int64 result = myValue;
867  int64 max = maxValue();
868 
869  result = (int64(myValue) - myBlack) * USHRT_MAX / (myWhite - myBlack);
870  result *= val;
871  result = result * (myWhite - myBlack) / USHRT_MAX + myBlack;
872 
873  if(result > max)
874  result = max;
875  else if(result < 0)
876  result = 0;
877 
878  return result;
879 }
880 
881 template<>
882 inline unsigned short
884 {
885  int64 result = myValue * val;
886  int64 max = maxValue();
887 
888  if(result > max)
889  result = max;
890  else if(result < 0)
891  result = 0;
892 
893  return result;
894 }
895 
896 template<>
897 inline unsigned short
899 {
900  int64 result;
901  int64 max = maxValue();
902 
903  result = (int(myValue) - myBlack) *max / (myWhite - myBlack);
904  double f;
905 
906  f = result * fval;
907  result = (f > 0.0) ? int64(f + 0.5) : int64(f-0.5);
908  result = result *(myWhite+myBlack) / max + myBlack;
909 
910  if(result > max)
911  result = max;
912  else if(result < 0)
913  result = 0;
914 
915  return (unsigned short) result;
916 }
917 
918 template<>
919 inline unsigned short
921 {
922  int64 result;
923  int64 max = maxValue();
924 
925  if(fval > 0.0F)
926  {
927  double f;
928 
929  result = myValue;
930  f = result * fval;
931  result = (f>0.0) ? int64(f + 0.5) : int64(f - 0.5);
932  }
933  else
934  result = 0;
935 
936  if(result > max)
937  result = max;
938  else if(result < 0)
939  result = 0;
940 
941  return (unsigned short) result;
942 }
943 
944 template<>
945 inline PXL_Pixel<unsigned short,0>::operator unsigned char () const
946 {
947  float result = ((float)myValue-(float)myBlack) / float(myWhite-myBlack);
948 
949  if(result > 1.0f)
950  result = 1.0f;
951  else if(result < 0.0f)
952  result = 0.0f;
953 
954  return (int) SYSfloorIL(result * UCHAR_MAX);
955 }
956 
957 template<>
958 inline PXL_Pixel<unsigned short,1>::operator unsigned char () const
959 {
960  unsigned char val = (unsigned char) ((myValue >> 8)&0x00FF);
961  if(val < UCHAR_MAX && (myValue &0x0080))
962  val++;
963 
964  return val;
965 }
966 
967 template<>
968 inline PXL_Pixel<unsigned short,0>::operator unsigned short () const
969 {
970  int result = (int(myValue) - myBlack) *USHRT_MAX / (myWhite - myBlack);
971 
972  if(result > USHRT_MAX)
973  result = USHRT_MAX;
974  else if(result < 0)
975  result = 0;
976 
977  return (unsigned short) result;
978 }
979 
980 template<>
981 inline PXL_Pixel<unsigned short,1>::operator unsigned short () const
982 {
983  return myValue;
984 }
985 
986 template<>
988 {
989  float val = float(myValue - myBlack) *myPntScale;
990 
991  if(val < 0.0f) val = 0.0f;
992  else if(val > 1.0f) val = 1.0f;
993 
994  return (unsigned int) SYSfloorIL(val * UINT_MAX);
995 }
996 
997 template<>
999 {
1000  unsigned int result = (((unsigned int)myValue) << 15) +
1001  (((unsigned int)myValue) >> 1);
1002  return result;
1003 }
1004 
1005 template<>
1007 {
1008  return float((int)(myValue - myBlack)) * myPntScale;
1009 }
1010 
1011 template<>
1013 {
1014  return ((int)myValue) * 1.5259021e-5f;
1015 }
1016 
1017 template<>
1018 inline void
1020 {
1021  int max = maxValue();
1022  int half = (max>>1);
1023  int result = (v * (myWhite - myBlack) + half) / max + myBlack;
1024 
1025  if(result > max)
1026  result = max;
1027  else if(result < 0)
1028  result = 0;
1029 
1030  myValue = (unsigned short) result;
1031 }
1032 
1033 template<>
1034 inline void
1036 {
1037  int max = maxValue();
1038 
1039  if(v > max)
1040  v = max;
1041 
1042  myValue = (unsigned short) v;
1043 }
1044 
1045 
1046 template<>
1047 inline int
1049 {
1050  int range = myWhite - myBlack;
1051  float max = float(int(maxValue()) - myBlack) / float(range);
1052  float min = float(int(minValue()) - myBlack) / float(range);
1053 
1054  if(f > max)
1055  f = max;
1056  else if(f < min)
1057  f = min;
1058 
1059  return int(SYSfloorIL(range *f +myBlack +0.5F));
1060 }
1061 
1062 template<>
1063 inline int
1065 {
1066  if(f > 1.0F)
1067  f = 1.0F;
1068  else if(f < 0.0F)
1069  f = 0.0F;
1070 
1071  return int(SYSfloorIL(maxValue() *f +0.5F));
1072 }
1073 
1074 template<>
1075 inline void
1077 {
1078  if(b < 0.0F) b = 0.0F;
1079  if(w < 0.0F) w = 0.0F;
1080  if(b > 1.0F) b = 1.0F;
1081  if(w > 1.0F) w = 1.0F;
1082 
1083  myBlack = (unsigned int)SYSfloorIL(b * USHRT_MAX + 0.5F);
1084  myWhite = (unsigned int)SYSfloorIL(w * USHRT_MAX + 0.5F);
1085  if(myBlack != myWhite)
1086  myPntScale = 1.0f / (myWhite - myBlack);
1087  else
1088  myPntScale = 1.0f;
1089 }
1090 
1091 template<>
1092 inline void
1094 {
1095  myPntScale = 1.0f; // the fast version does not use b/w points.
1096 }
1097 
1098 
1099 
1100 
1101 
1102 
1103 // 32 Bit Integer (-2e9 to 2e9) **************************************
1104 
1105 
1106 template<>
1108 {
1109  return myValue;
1110 }
1111 
1112 template<>
1114 {
1115  return (float)((double(myValue) - myBlack) * myPntScale);
1116 }
1117 
1118 template<>
1120 {
1121  return myValue / double(UINT_MAX);
1122 }
1123 
1124 template<>
1125 inline unsigned int
1127 {
1128  int64 result = (int64(myValue) -myBlack)*INT_MAX / (myWhite - myBlack);
1129  result /= val;
1130  result = result * (myWhite - myBlack) / INT_MAX + myBlack;
1131 
1132  if(result > maxValue())
1133  result = maxValue();
1134  else if(result < minValue())
1135  result = minValue();
1136 
1137  return (unsigned int) result;
1138 }
1139 
1140 template<>
1141 inline unsigned int
1143 {
1144  return (val != 0) ? (myValue / val) : 0;
1145 }
1146 
1147 #define ABS(x) ((x) < 0 ? -x : x)
1148 
1149 template<>
1150 inline unsigned int
1152 {
1153  int64 result = myValue;
1154  int64 max = maxValue();
1155  int64 maxmult;
1156 
1157  result = (int64(myValue) - myBlack) * INT_MAX / (myWhite - myBlack);
1158 
1159  // prevent overflow by determining the maximum factor allowable (the nutty
1160  // expression is the max value of an int64, since I know of no way to
1161  // declare long long constants on LINUX)
1162 #if defined(WIN32) || (defined(LINUX) && !defined(INTEL_COMPILER))
1163  maxmult = ABS( ( ((~int64(0))^(int64(1)<<63)) / result ) );
1164 #else
1165  maxmult = ABS(9223372036854775807LL / result);
1166 #endif
1167 
1168  // If the result will overflow, clamp to -/+ max,
1169  // depending on the signs of the multiplicands.
1170  if(SYSabs(val) > maxmult)
1171  {
1172  if((val > 0 && result > 0) ||
1173  (val < 0 && result < 0))
1174  {
1175  result = max;
1176  }
1177  else
1178  {
1179  result = -max -1;
1180  }
1181  }
1182  else
1183  {
1184  result *= val;
1185  result = result * (myWhite - myBlack) / INT_MAX + myBlack;
1186  }
1187 
1188  if(result > max)
1189  result = max;
1190  else if(result < minValue())
1191  result = minValue();
1192 
1193  return result;
1194 }
1195 
1196 template<>
1197 inline unsigned int
1199 {
1200  int64 result = myValue * val;
1201  int64 max = maxValue();
1202 
1203  if(result > max)
1204  result = max;
1205  else if(result < minValue())
1206  result = minValue();
1207 
1208  return result;
1209 }
1210 
1211 template<>
1212 inline unsigned int
1214 {
1215  int64 result;
1216  int64 max = maxValue();
1217  double f;
1218 
1219  result = (int(myValue) - myBlack) * max / (myWhite - myBlack);
1220 
1221  f = result * fval;
1222 
1223  result = (f > 0.0) ? int64(f + 0.5) : int64(f-0.5);
1224  result = result *(myWhite+myBlack) / max + myBlack;
1225 
1226  if(result > max)
1227  result = max;
1228  else if(result < minValue())
1229  result = minValue();
1230 
1231  return (int) result;
1232 }
1233 
1234 template<>
1235 inline unsigned int
1237 {
1238  int64 result;
1239  int64 max = maxValue();
1240  double f;
1241 
1242  result = myValue;
1243  f = result * fval;
1244  result = (f>0.0) ? int64(f + 0.5) : int64(f - 0.5);
1245 
1246  if(result > max)
1247  result = max;
1248  else if(result < minValue())
1249  result = minValue();
1250 
1251  return (int) result;
1252 }
1253 
1254 template<>
1255 inline PXL_Pixel<unsigned int,0>::operator unsigned char () const
1256 {
1257  int64 result = (((int64)(myValue)) -myBlack) *UCHAR_MAX /(myWhite-myBlack);
1258 
1259  if(result > UCHAR_MAX)
1260  result = UCHAR_MAX;
1261  else if(result < 0)
1262  result = 0;
1263 
1264  return (unsigned char) result;
1265 }
1266 
1267 template<>
1268 inline PXL_Pixel<unsigned int,1>::operator unsigned char () const
1269 {
1270  unsigned int val;
1271 
1272  val = (unsigned char) ((myValue >> 24U)&0x000000FFU);
1273  if(val < UCHAR_MAX && (myValue & 0x00800000U))
1274  val++;
1275 
1276  return val;
1277 }
1278 
1279 template<>
1280 inline PXL_Pixel<unsigned int,0>::operator unsigned short () const
1281 {
1282  int64 result = (int64)((int64)myValue-(int64)myBlack) *((int64)USHRT_MAX) /
1283  ((int64)(myWhite - myBlack));
1284 
1285  if(result > (int64) USHRT_MAX)
1286  result = (int64) USHRT_MAX;
1287  else if(result < 0)
1288  result = 0;
1289 
1290  return (unsigned short) (result&0x0000FFFF);
1291 }
1292 
1293 template<>
1294 inline PXL_Pixel<unsigned int,1>::operator unsigned short () const
1295 {
1296  int val;
1297 
1298  val = (unsigned short) ((myValue >> 16U)&0x0000FFFFU);
1299  if(val < USHRT_MAX && (myValue & 0x00008000U))
1300  val++;
1301 
1302  return (unsigned short) val;
1303 }
1304 
1305 template<>
1307 {
1308  int64 result = myValue;
1309  result = (result - myBlack) *INT_MAX / (myWhite - myBlack);
1310  if(result > INT_MAX)
1311  result = INT_MAX;
1312  else if(result < INT_MIN)
1313  result = INT_MIN;
1314 
1315  return (unsigned int) result;
1316 }
1317 
1318 template<>
1319 inline void
1321 {
1322  int64 max = maxValue();
1323  int64 half = (max>>1);
1324  int64 result = (int64(v) * (myWhite - myBlack) + half) / max + myBlack;
1325 
1326  if(result > max)
1327  result = max;
1328  else if(result < minValue())
1329  result = minValue();
1330 
1331  myValue = (unsigned int) result;
1332 }
1333 
1334 template<>
1335 inline void
1337 {
1338  int64 max = maxValue();
1339 
1340  if(v > max)
1341  v = max;
1342  else if(v < minValue())
1343  v = minValue();
1344 
1345  myValue = (int) v;
1346 }
1347 
1348 template<>
1349 inline int
1351 {
1352  int range = myWhite - myBlack;
1353  float max = float(maxValue() - myBlack) / float(range);
1354  float min = float(minValue() - myBlack) / float(range);
1355 
1356  if(f > max)
1357  f = max;
1358  else if(f < min)
1359  f = min;
1360 
1361  return int(SYSfloorIL(range *f +myBlack +0.5F));
1362 }
1363 
1364 template<>
1365 inline int
1367 {
1368  if(f > 1.0F)
1369  f = 1.0F;
1370  else if(f < 0.0F)
1371  f = 0.0F;
1372 
1373  return (unsigned int)(SYSfloorIL(maxValue() *f +0.5F));
1374 }
1375 
1376 template<>
1377 inline void
1379 {
1380  if(b < 0.0F) b = 0.0F;
1381  if(w < 0.0F) w = 0.0F;
1382  if(b > 1.0F) b = 1.0F;
1383  if(w > 1.0F) w = 1.0F;
1384 
1385  myBlack = (unsigned int)SYSfloorIL(b * UINT_MAX + 0.5F);
1386  myWhite = (unsigned int)SYSfloorIL(w * UINT_MAX + 0.5F);
1387  if(myBlack != myWhite)
1388  myPntScale = 1.0f / (myWhite - myBlack);
1389  else
1390  myPntScale = 1.0f;
1391 }
1392 
1393 template<>
1394 inline void
1396 {
1397  myPntScale = 1.0f; // the fast version does not use b/w points.
1398 }
1399 
1400 
1401 
1402 // 32 bit floating point pixels *****************************************
1403 
1404 template<>
1405 inline float
1407 {
1408  return myValue + val;
1409 }
1410 
1411 template<>
1412 inline float
1414 {
1415  return myValue + val;
1416 }
1417 
1418 template<>
1419 inline float
1421 {
1422  return myValue / val;
1423 }
1424 
1425 template<>
1426 inline float
1428 {
1429  return myValue / val;
1430 }
1431 
1432 template<>
1433 inline float
1435 {
1436  return myValue * val;
1437 }
1438 
1439 template<>
1440 inline float
1442 {
1443  return myValue * val;
1444 }
1445 
1446 template<>
1447 inline float
1449 {
1450  return myValue + fval;
1451 }
1452 
1453 template<>
1454 inline float
1456 {
1457  return myValue + fval;
1458 }
1459 
1460 template<>
1461 inline float
1463 {
1464  return myValue / fval;
1465 }
1466 
1467 template<>
1468 inline float
1470 {
1471  return myValue / fval;
1472 }
1473 
1474 template<>
1475 inline float
1477 {
1478  return myValue * fval;
1479 }
1480 
1481 template<>
1482 inline float
1484 {
1485  return myValue * fval;
1486 }
1487 
1488 template<>
1489 inline float
1491 {
1492  return myValue += fval;
1493 }
1494 
1495 template<>
1496 inline float
1498 {
1499  return myValue += fval;
1500 }
1501 
1502 template<>
1503 inline PXL_Pixel<float,0>::operator unsigned char () const
1504 {
1505  unsigned char val;
1506  float f;
1507 
1508  f = myValue;
1509  if(f < 0.0F)
1510  f = 0.0F;
1511  else if(f > 1.0F)
1512  f = 1.0F;
1513 
1514  val = (unsigned char) SYSfloorIL(f * UCHAR_MAX + 0.5F);
1515 
1516  return val;
1517 }
1518 
1519 template<>
1520 inline PXL_Pixel<float,1>::operator unsigned char () const
1521 {
1522  unsigned char val;
1523  float f;
1524 
1525  f = myValue;
1526  if(f < 0.0F)
1527  f = 0.0F;
1528  else if(f > 1.0F)
1529  f = 1.0F;
1530 
1531  val = (unsigned char) SYSfloorIL(f * UCHAR_MAX + 0.5F);
1532 
1533  return val;
1534 }
1535 
1536 template<>
1537 inline PXL_Pixel<float,0>::operator unsigned short () const
1538 {
1539  unsigned short val;
1540  float f;
1541 
1542  f = myValue;
1543  if(f < 0.0F)
1544  f = 0.0F;
1545  else if(f > 1.0F)
1546  f = 1.0F;
1547 
1548  val = (unsigned short) SYSfloorIL(f * USHRT_MAX + 0.5F);
1549 
1550  return val;
1551 }
1552 
1553 template<>
1554 inline PXL_Pixel<float,1>::operator unsigned short () const
1555 {
1556  unsigned short val;
1557  float f;
1558 
1559  f = myValue;
1560  if(f < 0.0F)
1561  f = 0.0F;
1562  else if(f > 1.0F)
1563  f = 1.0F;
1564 
1565  val = (unsigned short) SYSfloorIL(f * USHRT_MAX + 0.5F);
1566 
1567  return val;
1568 }
1569 
1570 template<>
1571 inline PXL_Pixel<float,0>::operator unsigned int () const
1572 {
1573  unsigned int result;
1574  float f;
1575 
1576  f = myValue;
1577  if(f < 0.0F)
1578  f = 0.0F;
1579  else if(f > 1.0F)
1580  f = 1.0F;
1581 
1582  result = (unsigned int)SYSfloorIL(f * UINT_MAX);
1583 
1584  return result;
1585 }
1586 
1587 template<>
1588 inline PXL_Pixel<float,1>::operator unsigned int () const
1589 {
1590  unsigned int result;
1591  float f;
1592 
1593  f = myValue;
1594  if(f < 0.0F)
1595  f = 0.0F;
1596  else if(f > 1.0F)
1597  f = 1.0F;
1598 
1599  result = (unsigned int)SYSfloorIL(f * UINT_MAX);
1600 
1601  return result;
1602 }
1603 
1604 template<>
1606 {
1607  return myValue;
1608 }
1609 
1610 template<>
1612 {
1613  return myValue;
1614 }
1615 
1616 template<>
1618 {
1619  return (float)myValue;
1620 }
1621 
1622 template<>
1624 {
1625  return (float)myValue;
1626 }
1627 
1628 template<>
1629 inline float
1631 {
1632  return (myValue = (float)val);
1633 }
1634 
1635 template<>
1636 inline float
1638 {
1639  return (myValue = (float)val);
1640 }
1641 
1642 template<>
1643 inline bool
1645 {
1646  return SYSisEqual(myValue, float(val));
1647 }
1648 
1649 template<>
1650 inline bool
1652 {
1653  return SYSisEqual(myValue, float(val));
1654 }
1655 
1656 template<>
1657 inline float
1659 {
1660  return (myValue = fval);
1661 }
1662 
1663 template<>
1664 inline float
1666 {
1667  return (myValue = fval);
1668 }
1669 
1670 template<>
1671 inline bool
1673 {
1674  return SYSisEqual(myValue, fval);
1675 }
1676 
1677 template<>
1678 inline bool
1680 {
1681  return SYSisEqual(myValue, fval);
1682 }
1683 
1684 template<>
1685 inline int
1687 {
1688  return (int)f;
1689 }
1690 
1691 template<>
1692 inline int
1694 {
1695  return (int)f;
1696 }
1697 
1698 
1699 template<>
1700 inline fpreal16
1702 {
1703  return (myValue = (float)val);
1704 }
1705 
1706 template<>
1707 inline fpreal16
1709 {
1710  return (myValue = (float)val);
1711 }
1712 
1713 template<>
1714 inline bool
1716 {
1717  return SYSisEqual((float)myValue, float(val));
1718 }
1719 
1720 template<>
1721 inline bool
1723 {
1724  return SYSisEqual((float)myValue, float(val));
1725 }
1726 
1727 template<>
1728 inline fpreal16
1730 {
1731  myValue = fval;
1732  return (float) myValue;
1733 }
1734 
1735 template<>
1736 inline fpreal16
1738 {
1739  myValue = fval;
1740  return (float) myValue;
1741 }
1742 
1743 template<>
1744 inline bool
1746 {
1747  return SYSisEqual((float)myValue, fval);
1748 }
1749 
1750 template<>
1751 inline bool
1753 {
1754  return SYSisEqual((float)myValue, fval);
1755 }
1756 
1757 template<>
1758 inline int
1760 {
1761  return (int) ((float)f);
1762 }
1763 
1764 template<>
1765 inline int
1767 {
1768  return (int) ((float)f);
1769 }
1770 
1771 // Generic Definitions **************************************
1772 
1773 template<class Type, int fast> inline bool
1775  unsigned b, unsigned w) const
1776 {
1777  return myType == format && (myType == PXL_FLOAT16 ||
1778  myType == PXL_FLOAT32 ||
1779  (b == myBlack && w == myWhite));
1780 }
1781 
1782 
1783 template<class Type, int fast> inline Type
1785 {
1786  Type result = myValue;
1787  Type max = maxValue();
1788 
1789  if(val > 0)
1790  {
1791  if(val > max - myValue)
1792  result = max;
1793  else
1794  result += val;
1795  }
1796  else if(val < 0)
1797  {
1798  if(-val > myValue)
1799  result = 0;
1800  else
1801  result += val;
1802  }
1803 
1804  return result;
1805 }
1806 
1807 template<class Type, int fast> inline Type
1809 {
1810  return *this + (-val);
1811 }
1812 
1813 template<class Type, int fast> inline Type
1815 {
1816  myValue = *this + val;
1817  return myValue;
1818 }
1819 
1820 template<class Type, int fast> inline Type
1822 {
1823  myValue = *this + (-val);
1824  return myValue;
1825 }
1826 
1827 template<class Type, int fast> inline Type
1829 {
1830  myValue = *this / val;
1831  return myValue;
1832 }
1833 
1834 template<class Type, int fast> inline Type
1836 {
1837  myValue = *this * val;
1838  return myValue;
1839 }
1840 
1841 
1842 template<class Type, int fast> inline Type
1844 {
1845  return *this + getIntFromFloat(fval);
1846 }
1847 
1848 template<class Type, int fast> inline Type
1850 {
1851  return *this + (-fval);
1852 }
1853 
1854 template<class Type, int fast> inline Type
1856 {
1857  if(fval == 0.0F)
1858  return maxValue();
1859  else
1860  return *this * (1.0F/fval);
1861 }
1862 
1863 
1864 template<class Type, int fast> inline Type
1866 {
1867  int val = (int) SYSfloorIL((myWhite-myBlack) *fval +myBlack + 0.5F);
1868  return *this += val;
1869 }
1870 
1871 template<class Type, int fast> inline Type
1873 {
1874  return *this += (-fval);
1875 }
1876 
1877 template<class Type, int fast> inline Type
1879 {
1880  return myValue = (*this * fval);
1881 }
1882 
1883 template<class Type, int fast> inline Type
1885 {
1886  if(fval == 0.0F)
1887  {
1888  myValue = maxValue();
1889  return myValue;
1890  }
1891  else
1892  return *this *= (1.0F/fval);
1893 }
1894 
1895 template<>
1896 inline unsigned char
1898 {
1899  int t = (int) SYSfloorIL(fval * 255.0f +0.5F);
1900 
1901  myValue = (unsigned char) PXLclampChar(t);
1902 
1903  return myValue;
1904 }
1905 
1906 template<>
1907 inline unsigned char
1909 {
1910  float f = fval * float(myWhite - myBlack) + (float)myBlack;
1911  int t = (int) SYSfloorIL(f +0.5F);
1912 
1913  myValue = (unsigned char) PXLclampChar(t);
1914 
1915  return myValue;
1916 }
1917 
1918 template<>
1919 inline unsigned short
1921 {
1922  int t = (int) SYSfloorIL(fval * 65535.0f +0.5F);
1923 
1924  myValue = (unsigned short) PXLclampShort(t);
1925 
1926  return myValue;
1927 }
1928 
1929 template<>
1930 inline unsigned short
1932 {
1933  float f = fval * float(myWhite - myBlack) + (float)myBlack;
1934  int t = (int) SYSfloorIL(f +0.5F);
1935 
1936  myValue = PXLclampShort(t);
1937 
1938  return myValue;
1939 }
1940 
1941 template<class Type, int fast> inline Type
1943 {
1944  double f = fval * double(myWhite - myBlack) + myBlack;
1945 
1946  f = SYSfloorIL(f +0.5F);
1947 
1948  if(f < minValue())
1949  set(minValue());
1950  else if(f > maxValue())
1951  set(maxValue());
1952  else
1953  set((unsigned int) f);
1954 
1955  return myValue;
1956 }
1957 
1958 template<class Type, int fast> inline Type
1960 {
1961  if(val > maxValue())
1962  myValue = maxValue();
1963  else if(val < minValue())
1964  myValue = minValue();
1965  else
1966  myValue = val;
1967 
1968  return myValue;
1969 }
1970 
1971 template<class Type, int fast> inline Type
1973 {
1974  myValue = val;
1975  return myValue;
1976 }
1977 
1978 
1979 
1980 template<class Type, int fast> inline bool
1982 {
1983  unsigned int val = (int) SYSfloorIL(fval *(myWhite-myBlack) +myBlack +0.5F);
1984 
1985  return (*this == val);
1986 }
1987 
1988 template<class Type, int fast> inline bool
1990 {
1991  if(val > maxValue())
1992  val = maxValue();
1993 
1994  return (val == myValue) ? 1 : 0;
1995 }
1996 
1997 template<class Type, int fast> inline void
1998 PXL_Pixel<Type,fast>::setRange(unsigned int b, unsigned int w)
1999 {
2000  myWhite = w;
2001  myBlack = b;
2002 }
2003 
2004 template<class Type, int fast> inline void
2006 {
2007  // no mapping done.
2008  myValue = v;
2009 }
2010 
2011 template<class Type, int fast> void
2013 {
2014  myPntScale = 1.0f;
2015 }
2016 
2017 #endif
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
bool isSameType(PXL_DataFormat format, unsigned b, unsigned w) const
GLenum GLint * range
Definition: glcorearb.h:1925
Type operator/=(int)
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition: half.h:266
const GLdouble * v
Definition: glcorearb.h:837
GLsizei const GLfloat * value
Definition: glcorearb.h:824
#define SYSabs(a)
Definition: SYS_Math.h:1572
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define ABS(x)
**But if you need a result
Definition: thread.h:613
Type operator+(int) const
bool operator==(unsigned int) const
#define H_REAL16_MAX
Definition: fpreal16.h:271
Type operator*(int) const
GLfloat f
Definition: glcorearb.h:1926
IMATH_NAMESPACE::V2f float
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
PXL_Pixel(unsigned int black=0, unsigned int white=0, Type value=0)
Type operator-(int) const
long long int64
Definition: SYS_Types.h:116
PXL_DataFormat
Definition: PXL_Common.h:20
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLdouble t
Definition: glad.h:2397
int getIntFromFloat(float f) const
void mapValue(unsigned int val)
Type operator/(int) const
Type assign(unsigned int)
Type operator-=(int)
Type maxValue() const
const char * formatName() const
Type operator*=(int)
void setBWPoints(float b, float w)
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLuint GLfloat * val
Definition: glcorearb.h:1608
Type set(Type)
int PXLclampChar(int t)
Definition: PXL_Common.h:143
Type minValue() const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
Definition: core.h:1131
int PXLclampShort(int t)
Definition: PXL_Common.h:153
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol=SYS_FTOLERANCE)
Componentwise equality.
Definition: UT_Vector2.h:674
Type operator=(float)
void setRange(unsigned int b, unsigned int w)
fpreal32 SYSfloorIL(fpreal32 val)
Definition: SYS_Floor.h:59
PXL_API void PXLdetermineProcCaps()
Type operator+=(int)