34 #ifndef CARTOBASE_TYPE_RGBA_DEF_H
35 #define CARTOBASE_TYPE_RGBA_DEF_H
42 #ifdef CARTO_DEBUG_RGB
64 #ifdef CARTO_DEBUG_RGB
65 std::cout <<
"RGBA:: Constructor( RGBA )" << std::endl;
72 #ifdef CARTO_DEBUG_RGB
73 std::cout <<
"RGBA:: Constructor( RGB )" << std::endl;
85 #ifdef CARTO_DEBUG_RGB
86 std::cout <<
"RGBA:: Constructor( VV<4> )" << std::endl;
92 const uint8_t &b,
const uint8_t &a )
94 #ifdef CARTO_DEBUG_RGB
95 std::cout <<
"RGBA:: Constructor( r,g,b,a )" << std::endl;
106 #ifdef CARTO_DEBUG_RGB
107 std::cout <<
"RGBA:: Destructor" << std::endl;
116 #ifdef CARTO_DEBUG_RGB
117 std::cout <<
"RGBA:: operator = ( RGBA )" << std::endl;
129 #ifdef CARTO_DEBUG_RGB
130 std::cout <<
"RGBA:: operator = ( RGB )" << std::endl;
142 #ifdef CARTO_DEBUG_RGB
143 std::cout <<
"RGBA:: operator = ( uint8_t )" << std::endl;
157 #ifdef CARTO_DEBUG_RGB
158 std::cout <<
"RGBA:: operator += ( RGBA )" << std::endl;
160 if( other.
alpha() == 0 ) {
169 }
else if(
alpha() == 0 ) {
188 #ifdef CARTO_DEBUG_RGB
189 std::cout <<
"RGBA:: operator += ( RGB )" << std::endl;
207 #ifdef CARTO_DEBUG_RGB
208 std::cout <<
"RGBA:: operator -= ( RGBA )" << std::endl;
210 if( other.
alpha() == 0 ) {
219 }
else if(
alpha() == 0 ) {
236 #ifdef CARTO_DEBUG_RGB
237 std::cout <<
"RGBA:: operator -= ( RGB )" << std::endl;
254 #ifdef CARTO_DEBUG_RGB
255 std::cout <<
"RGBA:: operator += ( uint8_t )" << std::endl;
273 #ifdef CARTO_DEBUG_RGB
274 std::cout <<
"RGBA:: operator -= ( uint8_t )" << std::endl;
292 #ifdef CARTO_DEBUG_RGB
293 std::cout <<
"RGBA:: operator *= ( uint8_t )" << std::endl;
295 red() *=
static_cast<uint8_t
>( value );
296 green() *=
static_cast<uint8_t
>( value );
297 blue() *=
static_cast<uint8_t
>( value );
304 #ifdef CARTO_DEBUG_RGB
305 std::cout <<
"RGBA:: operator *= ( uint16_t )" << std::endl;
307 red() *=
static_cast<uint8_t
>( value );
308 green() *=
static_cast<uint8_t
>( value );
309 blue() *=
static_cast<uint8_t
>( value );
316 #ifdef CARTO_DEBUG_RGB
317 std::cout <<
"RGBA:: operator *= ( uint32_t )" << std::endl;
319 red() *=
static_cast<uint8_t
>( value );
320 green() *=
static_cast<uint8_t
>( value );
321 blue() *=
static_cast<uint8_t
>( value );
328 #ifdef CARTO_DEBUG_RGB
329 std::cout <<
"RGBA:: operator *= ( uint64_t )" << std::endl;
331 red() *=
static_cast<uint8_t
>( value );
332 green() *=
static_cast<uint8_t
>( value );
333 blue() *=
static_cast<uint8_t
>( value );
340 #ifdef CARTO_DEBUG_RGB
341 std::cout <<
"RGBA:: operator *= ( float )" << std::endl;
344 red() =
static_cast<uint8_t
>(
red() * value );
345 green() =
static_cast<uint8_t
>(
green() * value );
346 blue() =
static_cast<uint8_t
>(
blue() * value );
353 #ifdef CARTO_DEBUG_RGB
354 std::cout <<
"RGBA:: operator *= ( double )" << std::endl;
357 red() =
static_cast<uint8_t
>(
red() * value );
358 green() =
static_cast<uint8_t
>(
green() * value );
359 blue() =
static_cast<uint8_t
>(
blue() * value );
366 #ifdef CARTO_DEBUG_RGB
367 std::cout <<
"RGBA:: operator /= ( uint8_t )" << std::endl;
370 red() /=
static_cast<uint8_t
>( value );
371 green() /=
static_cast<uint8_t
>( value );
372 blue() /=
static_cast<uint8_t
>( value );
379 #ifdef CARTO_DEBUG_RGB
380 std::cout <<
"RGBA:: operator /= ( uint16_t )" << std::endl;
383 red() /=
static_cast<uint8_t
>( value );
384 green() /=
static_cast<uint8_t
>( value );
385 blue() /=
static_cast<uint8_t
>( value );
392 #ifdef CARTO_DEBUG_RGB
393 std::cout <<
"RGBA:: operator /= ( uint32_t )" << std::endl;
396 red() /=
static_cast<uint8_t
>( value );
397 green() /=
static_cast<uint8_t
>( value );
398 blue() /=
static_cast<uint8_t
>( value );
405 #ifdef CARTO_DEBUG_RGB
406 std::cout <<
"RGBA:: operator /= ( uint64_t )" << std::endl;
409 red() /=
static_cast<uint8_t
>( value );
410 green() /=
static_cast<uint8_t
>( value );
411 blue() /=
static_cast<uint8_t
>( value );
418 #ifdef CARTO_DEBUG_RGB
419 std::cout <<
"RGBA:: operator /= ( float )" << std::endl;
423 red() =
static_cast<uint8_t
>(
red() / value );
424 green() =
static_cast<uint8_t
>(
green() / value );
425 blue() =
static_cast<uint8_t
>(
blue() / value );
432 #ifdef CARTO_DEBUG_RGB
433 std::cout <<
"RGBA:: operator /= ( double )" << std::endl;
437 red() =
static_cast<uint8_t
>(
red() / value );
438 green() =
static_cast<uint8_t
>(
green() / value );
439 blue() =
static_cast<uint8_t
>(
blue() / value );
448 #ifdef CARTO_DEBUG_RGB
449 std::cout <<
"RGBA:: RGBA + RGBA" << std::endl;
458 #ifdef CARTO_DEBUG_RGB
459 std::cout <<
"RGBA:: RGBA + uint8_t" << std::endl;
468 #ifdef CARTO_DEBUG_RGB
469 std::cout <<
"RGBA:: RGBA + uint16_t" << std::endl;
478 #ifdef CARTO_DEBUG_RGB
479 std::cout <<
"RGBA:: RGBA + uint32_t" << std::endl;
488 #ifdef CARTO_DEBUG_RGB
489 std::cout <<
"RGBA:: RGBA + uint64_t" << std::endl;
498 #ifdef CARTO_DEBUG_RGB
499 std::cout <<
"RGBA:: RGBA + float" << std::endl;
502 return result +=
static_cast<uint8_t
>(bb);
508 #ifdef CARTO_DEBUG_RGB
509 std::cout <<
"RGBA:: RGBA + double" << std::endl;
512 return result +=
static_cast<uint8_t
>(bb);
518 #ifdef CARTO_DEBUG_RGB
519 std::cout <<
"RGBA:: uint8_t + RGBA" << std::endl;
528 #ifdef CARTO_DEBUG_RGB
529 std::cout <<
"RGBA:: uint16_t + RGBA" << std::endl;
538 #ifdef CARTO_DEBUG_RGB
539 std::cout <<
"RGBA:: uint32_t + RGBA" << std::endl;
548 #ifdef CARTO_DEBUG_RGB
549 std::cout <<
"RGBA:: uint64_t + RGBA" << std::endl;
558 #ifdef CARTO_DEBUG_RGB
559 std::cout <<
"RGBA:: float + RGBA" << std::endl;
561 VoxelRGBA result(
static_cast<uint8_t
>(aa) );
568 #ifdef CARTO_DEBUG_RGB
569 std::cout <<
"RGBA:: double + RGBA" << std::endl;
571 VoxelRGBA result(
static_cast<uint8_t
>(aa) );
578 #ifdef CARTO_DEBUG_RGB
579 std::cout <<
"RGBA:: RGBA - RGBA" << std::endl;
588 #ifdef CARTO_DEBUG_RGB
589 std::cout <<
"RGBA:: RGBA - uint8_t" << std::endl;
598 #ifdef CARTO_DEBUG_RGB
599 std::cout <<
"RGBA:: RGBA - uint16_t" << std::endl;
608 #ifdef CARTO_DEBUG_RGB
609 std::cout <<
"RGBA:: RGBA - uint32_t" << std::endl;
618 #ifdef CARTO_DEBUG_RGB
619 std::cout <<
"RGBA:: RGBA - uint64_t" << std::endl;
628 #ifdef CARTO_DEBUG_RGB
629 std::cout <<
"RGBA:: RGBA - float" << std::endl;
632 return result -=
static_cast<uint8_t
>(bb);
638 #ifdef CARTO_DEBUG_RGB
639 std::cout <<
"RGBA:: RGBA - double" << std::endl;
642 return result -=
static_cast<uint8_t
>(bb);
648 #ifdef CARTO_DEBUG_RGB
649 std::cout <<
"RGBA:: uint8_t - RGBA" << std::endl;
658 #ifdef CARTO_DEBUG_RGB
659 std::cout <<
"RGBA:: uint16_t - RGBA" << std::endl;
668 #ifdef CARTO_DEBUG_RGB
669 std::cout <<
"RGBA:: uint32_t - RGBA" << std::endl;
678 #ifdef CARTO_DEBUG_RGB
679 std::cout <<
"RGBA:: uint64_t - RGBA" << std::endl;
688 #ifdef CARTO_DEBUG_RGB
689 std::cout <<
"RGBA:: float - RGBA" << std::endl;
691 VoxelRGBA result(
static_cast<uint8_t
>(aa) );
698 #ifdef CARTO_DEBUG_RGB
699 std::cout <<
"RGBA:: double - RGBA" << std::endl;
701 VoxelRGBA result(
static_cast<uint8_t
>(aa) );
708 #ifdef CARTO_DEBUG_RGB
709 std::cout <<
"RGBA:: RGBA * uint8_t" << std::endl;
718 #ifdef CARTO_DEBUG_RGB
719 std::cout <<
"RGBA:: RGBA * uint16_t" << std::endl;
728 #ifdef CARTO_DEBUG_RGB
729 std::cout <<
"RGBA:: RGBA * uint32_t" << std::endl;
738 #ifdef CARTO_DEBUG_RGB
739 std::cout <<
"RGBA:: RGBA * uint64_t" << std::endl;
748 #ifdef CARTO_DEBUG_RGB
749 std::cout <<
"RGBA:: RGBA * float" << std::endl;
758 #ifdef CARTO_DEBUG_RGB
759 std::cout <<
"RGBA:: RGBA * double" << std::endl;
768 #ifdef CARTO_DEBUG_RGB
769 std::cout <<
"RGBA:: uint8_t * RGBA" << std::endl;
778 #ifdef CARTO_DEBUG_RGB
779 std::cout <<
"RGBA:: uint16_t * RGBA" << std::endl;
788 #ifdef CARTO_DEBUG_RGB
789 std::cout <<
"RGBA:: uint32_t * RGBA" << std::endl;
798 #ifdef CARTO_DEBUG_RGB
799 std::cout <<
"RGBA:: uint64_t * RGBA" << std::endl;
808 #ifdef CARTO_DEBUG_RGB
809 std::cout <<
"RGBA:: float * RGBA" << std::endl;
818 #ifdef CARTO_DEBUG_RGB
819 std::cout <<
"RGBA:: double * RGBA" << std::endl;
828 #ifdef CARTO_DEBUG_RGB
829 std::cout <<
"RGBA:: RGBA / uint8_t" << std::endl;
838 #ifdef CARTO_DEBUG_RGB
839 std::cout <<
"RGBA:: RGBA / uint16_t" << std::endl;
848 #ifdef CARTO_DEBUG_RGB
849 std::cout <<
"RGBA:: RGBA / uint32_t" << std::endl;
858 #ifdef CARTO_DEBUG_RGB
859 std::cout <<
"RGBA:: RGBA / uint64_t" << std::endl;
868 #ifdef CARTO_DEBUG_RGB
869 std::cout <<
"RGBA:: RGBA / float" << std::endl;
878 #ifdef CARTO_DEBUG_RGB
879 std::cout <<
"RGBA:: RGBA / double" << std::endl;
890 #ifdef CARTO_DEBUG_RGB
891 std::cout <<
"RGBA:: operator *= ( long )" << std::endl;
893 red() *=
static_cast<uint8_t
>( value );
894 green() *=
static_cast<uint8_t
>( value );
895 blue() *=
static_cast<uint8_t
>( value );
902 #ifdef CARTO_DEBUG_RGB
903 std::cout <<
"RGBA:: operator /= ( long )" << std::endl;
906 red() /=
static_cast<uint8_t
>( value );
907 green() /=
static_cast<uint8_t
>( value );
908 blue() /=
static_cast<uint8_t
>( value );
915 #ifdef CARTO_DEBUG_RGB
916 std::cout <<
"RGBA:: RGBA * long" << std::endl;
925 #ifdef CARTO_DEBUG_RGB
926 std::cout <<
"RGBA:: long * RGBA" << std::endl;
935 #ifdef CARTO_DEBUG_RGB
936 std::cout <<
"RGBA:: RGBA / long" << std::endl;
VoxelRGBA & operator*=(const uint8_t &value)
const uint8_t & green() const
const uint8_t & blue() const
VoxelRGBA & operator+=(const VoxelRGBA &other)
VoxelRGBA & operator/=(const uint8_t &value)
const uint8_t & alpha() const
VoxelRGBA & operator=(const VoxelRGBA &other)
VoxelRGBA & operator-=(const VoxelRGBA &other)
const uint8_t & red() const
VoxelRGBA(const VoxelRGBA &other)
const uint8_t & red() const
const uint8_t & blue() const
const uint8_t & green() const
Base class for any multichannel data (RGB, RGBA, HSV, ...)
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
VoxelRGB operator+(const VoxelRGB &aa, const VoxelRGB &bb)
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)