Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
agg::gray32 Struct Reference

#include <src/agg/agg_color_gray.h>

Public Types

typedef float value_type
 
typedef double calc_type
 
typedef double long_type
 
typedef gray32 self_type
 

Public Member Functions

 gray32 ()
 
 gray32 (value_type v_, value_type a_=1)
 
 gray32 (const self_type &c, value_type a_)
 
 gray32 (const rgba &c)
 
 gray32 (const rgba8 &c)
 
 gray32 (const srgba8 &c)
 
 gray32 (const rgba16 &c)
 
 gray32 (const rgba32 &c)
 
 gray32 (const gray8 &c)
 
 gray32 (const sgray8 &c)
 
 gray32 (const gray16 &c)
 
 operator rgba () const
 
 operator gray8 () const
 
 operator sgray8 () const
 
 operator gray16 () const
 
 operator rgba8 () const
 
 operator srgba8 () const
 
 operator rgba16 () const
 
 operator rgba32 () const
 
AGG_INLINE bool is_transparent () const
 
AGG_INLINE bool is_opaque () const
 
self_typeclear ()
 
self_typetransparent ()
 
self_typeopacity (double a_)
 
double opacity () const
 
self_typepremultiply ()
 
self_typedemultiply ()
 
self_type gradient (self_type c, double k) const
 

Static Public Member Functions

static value_type luminance (double r, double g, double b)
 
static value_type luminance (const rgba &c)
 
static value_type luminance (const rgba32 &c)
 
static value_type luminance (const rgba8 &c)
 
static value_type luminance (const rgba16 &c)
 
static AGG_INLINE double to_double (value_type a)
 
static AGG_INLINE value_type from_double (double a)
 
static AGG_INLINE value_type empty_value ()
 
static AGG_INLINE value_type full_value ()
 
static AGG_INLINE value_type invert (value_type x)
 
static AGG_INLINE value_type multiply (value_type a, value_type b)
 
static AGG_INLINE value_type demultiply (value_type a, value_type b)
 
template<typename T >
static AGG_INLINEdownscale (T a)
 
template<typename T >
static AGG_INLINEdownshift (T a, unsigned n)
 
static AGG_INLINE value_type mult_cover (value_type a, cover_type b)
 
static AGG_INLINE cover_type scale_cover (cover_type a, value_type b)
 
static AGG_INLINE value_type prelerp (value_type p, value_type q, value_type a)
 
static AGG_INLINE value_type lerp (value_type p, value_type q, value_type a)
 
static self_type no_color ()
 

Public Attributes

value_type v
 
value_type a
 

Detailed Description

Member Typedef Documentation

◆ calc_type

typedef double agg::gray32::calc_type

◆ long_type

typedef double agg::gray32::long_type

◆ self_type

◆ value_type

typedef float agg::gray32::value_type

Constructor & Destructor Documentation

◆ gray32() [1/11]

agg::gray32::gray32 ( )
inline
783{}

◆ gray32() [2/11]

agg::gray32::gray32 ( value_type  v_,
value_type  a_ = 1 
)
inlineexplicit
786 :
787 v(v_), a(a_) {}
value_type v
Definition agg_color_gray.h:753
value_type a
Definition agg_color_gray.h:754

◆ gray32() [3/11]

agg::gray32::gray32 ( const self_type c,
value_type  a_ 
)
inline
790 :
791 v(c.v), a(a_) {}

◆ gray32() [4/11]

agg::gray32::gray32 ( const rgba c)
inline
794 :
795 v(luminance(c)),
796 a(value_type(c.a)) {}
float value_type
Definition agg_color_gray.h:748
static value_type luminance(double r, double g, double b)
Definition agg_color_gray.h:757

◆ gray32() [5/11]

agg::gray32::gray32 ( const rgba8 c)
inline
799 :
800 v(luminance(c)),
801 a(value_type(c.a / 255.0)) {}

◆ gray32() [6/11]

agg::gray32::gray32 ( const srgba8 c)
inline
804 :
805 v(luminance(rgba32(c))),
806 a(value_type(c.a / 255.0)) {}

◆ gray32() [7/11]

agg::gray32::gray32 ( const rgba16 c)
inline
809 :
810 v(luminance(c)),
811 a(value_type(c.a / 65535.0)) {}

◆ gray32() [8/11]

agg::gray32::gray32 ( const rgba32 c)
inline
814 :
815 v(luminance(c)),
816 a(value_type(c.a)) {}

◆ gray32() [9/11]

agg::gray32::gray32 ( const gray8 c)
inline
819 :
820 v(value_type(c.v / 255.0)),
821 a(value_type(c.a / 255.0)) {}

◆ gray32() [10/11]

agg::gray32::gray32 ( const sgray8 c)
inline
824 :
825 v(sRGB_conv<value_type>::rgb_from_sRGB(c.v)),
826 a(sRGB_conv<value_type>::alpha_from_sRGB(c.a)) {}

◆ gray32() [11/11]

agg::gray32::gray32 ( const gray16 c)
inline
829 :
830 v(value_type(c.v / 65535.0)),
831 a(value_type(c.a / 65535.0)) {}

Member Function Documentation

◆ clear()

self_type & agg::gray32::clear ( )
inline
987 {
988 v = a = 0;
989 return *this;
990 }

References a, and v.

◆ demultiply() [1/2]

self_type & agg::gray32::demultiply ( )
inline
1025 {
1026 if (a < 0) v = 0;
1027 else if (a < 1) v /= a;
1028 return *this;
1029 }

References a, and v.

◆ demultiply() [2/2]

static AGG_INLINE value_type agg::gray32::demultiply ( value_type  a,
value_type  b 
)
inlinestatic
937 {
938 return (b == 0) ? 0 : value_type(a / b);
939 }

References a.

◆ downscale()

template<typename T >
static AGG_INLINE T agg::gray32::downscale ( a)
inlinestatic
944 {
945 return a;
946 }

References a.

◆ downshift()

template<typename T >
static AGG_INLINE T agg::gray32::downshift ( a,
unsigned  n 
)
inlinestatic
951 {
952 return n > 0 ? a / (1 << n) : a;
953 }

References a.

◆ empty_value()

static AGG_INLINE value_type agg::gray32::empty_value ( )
inlinestatic
901 {
902 return 0;
903 }

◆ from_double()

static AGG_INLINE value_type agg::gray32::from_double ( double  a)
inlinestatic
895 {
896 return value_type(a);
897 }

References a.

◆ full_value()

static AGG_INLINE value_type agg::gray32::full_value ( )
inlinestatic
907 {
908 return 1;
909 }

◆ gradient()

self_type agg::gray32::gradient ( self_type  c,
double  k 
) const
inline
1033 {
1034 return self_type(
1035 value_type(v + (c.v - v) * k),
1036 value_type(a + (c.a - a) * k));
1037 }
gray32 self_type
Definition agg_color_gray.h:751

References a, and v.

◆ invert()

static AGG_INLINE value_type agg::gray32::invert ( value_type  x)
inlinestatic
925 {
926 return 1 - x;
927 }
TCoord< P > x(const P &p)
Definition geometry_traits.hpp:297

◆ is_opaque()

AGG_INLINE bool agg::gray32::is_opaque ( ) const
inline
919 {
920 return a >= 1;
921 }

References a.

◆ is_transparent()

AGG_INLINE bool agg::gray32::is_transparent ( ) const
inline
913 {
914 return a <= 0;
915 }

References a.

◆ lerp()

static AGG_INLINE value_type agg::gray32::lerp ( value_type  p,
value_type  q,
value_type  a 
)
inlinestatic
977 {
978 // The form "p + a * (q - p)" avoids a multiplication, but may produce an
979 // inaccurate result. For example, "p + (q - p)" may not be exactly equal
980 // to q. Therefore, stick to the basic expression, which at least produces
981 // the correct result at either extreme.
982 return (1 - a) * p + a * q;
983 }

References a.

◆ luminance() [1/5]

static value_type agg::gray32::luminance ( const rgba c)
inlinestatic
763 {
764 return luminance(c.r, c.g, c.b);
765 }

References luminance().

+ Here is the call graph for this function:

◆ luminance() [2/5]

static value_type agg::gray32::luminance ( const rgba16 c)
inlinestatic
778 {
779 return luminance(c.r / 65535.0, c.g / 65535.0, c.g / 65535.0);
780 }

References luminance().

+ Here is the call graph for this function:

◆ luminance() [3/5]

static value_type agg::gray32::luminance ( const rgba32 c)
inlinestatic
768 {
769 return luminance(c.r, c.g, c.b);
770 }

References luminance().

+ Here is the call graph for this function:

◆ luminance() [4/5]

static value_type agg::gray32::luminance ( const rgba8 c)
inlinestatic
773 {
774 return luminance(c.r / 255.0, c.g / 255.0, c.g / 255.0);
775 }

References luminance().

+ Here is the call graph for this function:

◆ luminance() [5/5]

static value_type agg::gray32::luminance ( double  r,
double  g,
double  b 
)
inlinestatic
758 {
759 return value_type(0.2126 * r + 0.7152 * g + 0.0722 * b);
760 }

Referenced by luminance(), luminance(), luminance(), and luminance().

+ Here is the caller graph for this function:

◆ mult_cover()

static AGG_INLINE value_type agg::gray32::mult_cover ( value_type  a,
cover_type  b 
)
inlinestatic
957 {
958 return value_type(a * b / cover_mask);
959 }
@ cover_mask
Definition agg_basics.h:242

References a, and agg::cover_mask.

◆ multiply()

static AGG_INLINE value_type agg::gray32::multiply ( value_type  a,
value_type  b 
)
inlinestatic
931 {
932 return value_type(a * b);
933 }

References a.

◆ no_color()

static self_type agg::gray32::no_color ( )
inlinestatic
1040{ return self_type(0,0); }

◆ opacity() [1/2]

double agg::gray32::opacity ( ) const
inline
1010 {
1011 return a;
1012 }

References a.

◆ opacity() [2/2]

self_type & agg::gray32::opacity ( double  a_)
inline
1001 {
1002 if (a_ < 0) a = 0;
1003 else if (a_ > 1) a = 1;
1004 else a = value_type(a_);
1005 return *this;
1006 }

References a.

◆ operator gray16()

agg::gray32::operator gray16 ( ) const
inline
856 {
857 return gray16(uround(v * 65535.0), uround(a * 65535.0));
858 }
AGG_INLINE int uround(double v)
Definition agg_basics.h:192

References a, agg::uround(), and v.

+ Here is the call graph for this function:

◆ operator gray8()

agg::gray32::operator gray8 ( ) const
inline
841 {
842 return gray8(uround(v * 255.0), uround(a * 255.0));
843 }
gray8T< linear > gray8
Definition agg_color_gray.h:414

References a, agg::uround(), and v.

+ Here is the call graph for this function:

◆ operator rgba()

agg::gray32::operator rgba ( ) const
inline
835 {
836 return rgba(v, v, v, a);
837 }

References a, and v.

◆ operator rgba16()

agg::gray32::operator rgba16 ( ) const
inline
876 {
877 rgba16::value_type y = uround(v * 65535.0);
878 return rgba16(y, y, y, uround(a * 65535.0));
879 }
const Scalar & y
Definition MathFunctions.h:552
int16u value_type
Definition agg_color_rgba.h:664

References a, agg::uround(), and v.

+ Here is the call graph for this function:

◆ operator rgba32()

agg::gray32::operator rgba32 ( ) const
inline
883 {
884 return rgba32(v, v, v, a);
885 }

References a, and v.

◆ operator rgba8()

agg::gray32::operator rgba8 ( ) const
inline
862 {
863 rgba8::value_type y = uround(v * 255.0);
864 return rgba8(y, y, y, uround(a * 255.0));
865 }
rgba8T< linear > rgba8
Definition agg_color_rgba.h:623
int8u value_type
Definition agg_color_rgba.h:248

References a, agg::uround(), and v.

+ Here is the call graph for this function:

◆ operator sgray8()

agg::gray32::operator sgray8 ( ) const
inline
847 {
848 // Return (non-premultiplied) sRGB values.
849 return sgray8(
850 sRGB_conv<value_type>::rgb_to_sRGB(v),
851 sRGB_conv<value_type>::alpha_to_sRGB(a));
852 }
gray8T< sRGB > sgray8
Definition agg_color_gray.h:415

References a, and v.

◆ operator srgba8()

agg::gray32::operator srgba8 ( ) const
inline
869 {
870 srgba8::value_type y = sRGB_conv<value_type>::rgb_to_sRGB(v);
871 return srgba8(y, y, y, sRGB_conv<value_type>::alpha_to_sRGB(a));
872 }
rgba8T< sRGB > srgba8
Definition agg_color_rgba.h:624

References a, and v.

◆ prelerp()

static AGG_INLINE value_type agg::gray32::prelerp ( value_type  p,
value_type  q,
value_type  a 
)
inlinestatic
970 {
971 return (1 - a) * p + q; // more accurate than "p + q - p * a"
972 }

References a.

◆ premultiply()

self_type & agg::gray32::premultiply ( )
inline
1017 {
1018 if (a < 0) v = 0;
1019 else if(a < 1) v *= a;
1020 return *this;
1021 }

References a, and v.

◆ scale_cover()

static AGG_INLINE cover_type agg::gray32::scale_cover ( cover_type  a,
value_type  b 
)
inlinestatic
963 {
964 return cover_type(uround(a * b));
965 }
unsigned char cover_type
Definition agg_basics.h:237

References a, and agg::uround().

+ Here is the call graph for this function:

◆ to_double()

static AGG_INLINE double agg::gray32::to_double ( value_type  a)
inlinestatic
889 {
890 return a;
891 }

References a.

◆ transparent()

self_type & agg::gray32::transparent ( )
inline
994 {
995 a = 0;
996 return *this;
997 }

References a.

Member Data Documentation

◆ a

◆ v


The documentation for this struct was generated from the following file: