32-bit RGBA pixel. More...
#include <SimdPixel.hpp>
Public Member Functions | |
| Rgba32 (const uint8_t &gray=uint8_t(0), const uint8_t &a=uint8_t(255)) | |
| Rgba32 (const uint8_t &r, const uint8_t &g, const uint8_t &b, const uint8_t &a=uint8_t(255)) | |
| Rgba32 (const Bgra32 &p) | |
| Rgba32 (const Bgr24 &p, const uint8_t &a=uint8_t(255)) | |
| Rgba32 (const Rgb24 &p, const uint8_t &a=uint8_t(255)) | |
| Rgba32 (const Rgba32 &p) | |
Static Public Member Functions | |
| template<template< class > class A> | |
| static const Rgba32 & | At (const View< A > &view, ptrdiff_t col, ptrdiff_t row) |
| template<template< class > class A> | |
| static Rgba32 & | At (View< A > &view, ptrdiff_t col, ptrdiff_t row) |
Data Fields | |
| uint8_t | red |
| Red channel. First byte of a View::Rgba32 pixel. | |
| uint8_t | green |
| Green channel. Second byte of a View::Rgba32 pixel. | |
| uint8_t | blue |
| Blue channel. Third byte of a View::Rgba32 pixel. Rgba32(255, 0, 0) is opaque red. | |
| uint8_t | alpha |
| Alpha channel. Fourth byte of a View::Rgba32 pixel. 255 is opaque. | |
Detailed Description
32-bit RGBA pixel.
Stores red, green, blue, alpha as four consecutive bytes. This is the element type of a View::Rgba32 image. Argument order is red, green, blue, alpha, which is the reverse of the color channels of Bgra32. TestRandom::GetColor calls Rgba32(r, g, b) and leaves alpha at 255, so an RGBA canvas receives the same color as a BGRA canvas built with Bgra32(b, g, r). Pass Rgba32 to drawing and FillPixel only when the canvas format is View::Rgba32.
Constructor & Destructor Documentation
◆ Rgba32() [1/6]
| SIMD_INLINE Rgba32 | ( | const uint8_t & | gray = uint8_t(0), |
| const uint8_t & | a = uint8_t(255) |
||
| ) |
Creates a 32-bit RGBA pixel with equal red, green and blue.
Rgba32() is opaque black. gray is written to red, green and blue. Alpha is independent and defaults to 255.
- Parameters
-
[in] gray - initial value for red, green and blue. It is equal to 0 by default. [in] a - initial value for alpha. It is equal to 255 by default.
◆ Rgba32() [2/6]
| SIMD_INLINE Rgba32 | ( | const uint8_t & | r, |
| const uint8_t & | g, | ||
| const uint8_t & | b, | ||
| const uint8_t & | a = uint8_t(255) |
||
| ) |
Creates a 32-bit RGBA pixel from red, green, blue and alpha.
Argument order is red, green, blue, alpha. TestRandom passes Rgba32(r, g, b) when the source triple was (b, g, r).
- Parameters
-
[in] r - initial value for the red channel. [in] g - initial value for the green channel. [in] b - initial value for the blue channel. [in] a - initial value for the alpha channel. It is equal to 255 by default.
◆ Rgba32() [3/6]
Creates a 32-bit RGBA pixel from a 32-bit BGRA pixel.
Copies red, green, blue and alpha by name, so the color and alpha are kept and the byte order becomes red, green, blue, alpha.
- Parameters
-
[in] p - a 32-bit BGRA pixel.
◆ Rgba32() [4/6]
Creates a 32-bit RGBA pixel from a 24-bit BGR pixel.
Copies red, green and blue by name. Alpha is 255 unless another value is passed.
- Parameters
-
[in] p - a 24-bit BGR pixel. [in] a - initial value for the alpha channel. It is equal to 255 by default.
◆ Rgba32() [5/6]
Creates a 32-bit RGBA pixel from a 24-bit RGB pixel.
Copies red, green and blue. Alpha is 255 unless another value is passed.
- Parameters
-
[in] p - a 24-bit RGB pixel. [in] a - initial value for the alpha channel. It is equal to 255 by default.
◆ Rgba32() [6/6]
Creates a copy of a 32-bit RGBA pixel.
- Parameters
-
[in] p - a 32-bit RGBA pixel.
Member Function Documentation
◆ At() [1/2]
|
static |
Gets a constant reference to the RGBA pixel at (col, row).
Requires view.format == View::Rgba32 and then returns Simd::At. col is the x coordinate and row is the y coordinate; both must lie inside the view. Typical code uses view.At<Pixel::Rgba32>(x, y).
- Parameters
-
[in] view - an image view of 32-bit RGBA pixel format. [in] col - x-coordinate of the pixel. [in] row - y-coordinate of the pixel.
- Returns
- a constant reference to the pixel.
◆ At() [2/2]
|
static |
Gets a reference to the RGBA pixel at (col, row).
Requires view.format == View::Rgba32 and then returns Simd::At. col is the x coordinate and row is the y coordinate; both must lie inside the view.
- Parameters
-
[in] view - an image view of 32-bit RGBA pixel format. [in] col - x-coordinate of the pixel. [in] row - y-coordinate of the pixel.
- Returns
- a reference to the pixel.