Get the App
SLTechnology News&Howtos  ›  Servers  › 

AGG lesson 5 RGB Color definition

Shulou Source: shulou.com Published: 2022-06-02 05:47:01 10月03日 Update

Mixers exist to accommodate different pixel formats for different platforms and different needs. There are three types of mixers: agg::rgba, agg:: rgba8, and agg:: rgba16, which are used to specify colors, rgba is stored as double per channel, rgba8 is unsigned char, and rgba16 is int or long int; mixers function like RGB and COLORREF macros in the Win32API.

Special note for agg::rgba: Although each component is stored using double type, in fact, the value interval is [0,1], and the value of each component of agg::rgba8 is [0,255]

header #include "agg_pixfmt_rgba.h"

type definition

struct rgba8; //Yes, you are not mistaken, it is a structure, not a class…

elementary member function

rgba8(unsigned r, unsigned g, unsigned b,unsigned a)

No need to explain it, maximum 255;

clear(), no_color()

All four channels are cleared, that is, they become colorless.

transparent()

alpha cleared, transparent;

opacity()

Returns transparency, represented by double;

gradient(agg::rgba8 &c, double k)

Color gradient, that is, the color changes from the original color gradually to c, the rate of change is k;

add(agg::rgba8 &c, unsinged cover)

Color Overlay, superimposing a color c with transparency of cover/255;

member variables

r, g, b, a are unsigned integers;

Tags: Colors differences mixers mixers components members types transparency channels overlay maximum that is actions pixels functions intervals rates of change variables actually Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei macOS Docker Shulou Tech Info