32-bit BGRA pixel. More...
#include <SimdPixel.hpp>
Public Member Functions | |
| Bgra32 (const uint8_t &gray=uint8_t(0), const uint8_t &a=uint8_t(255)) | |
| Bgra32 (const uint8_t &b, const uint8_t &g, const uint8_t &r, const uint8_t &a=uint8_t(255)) | |
| Bgra32 (const Bgr24 &p, const uint8_t &a=uint8_t(255)) | |
| Bgra32 (const Rgb24 &p, const uint8_t &a=uint8_t(255)) | |
| Bgra32 (const Rgba32 &p) | |
| Bgra32 (const Bgra32 &p) | |
Static Public Member Functions | |
| template<template< class > class A> | |
| static const Bgra32 & | At (const View< A > &view, ptrdiff_t col, ptrdiff_t row) |
| template<template< class > class A> | |
| static Bgra32 & | At (View< A > &view, ptrdiff_t col, ptrdiff_t row) |
Data Fields | |
| uint8_t | blue |
| Blue channel. First byte of a View::Bgra32 pixel. | |
| uint8_t | green |
| Green channel. Second byte of a View::Bgra32 pixel. | |
| uint8_t | red |
| Red channel. Third byte of a View::Bgra32 pixel. Bgra32(0, 0, 255) is opaque red. | |
| uint8_t | alpha |
| Alpha channel. Fourth byte of a View::Bgra32 pixel. 255 is opaque. | |
Detailed Description
32-bit BGRA pixel.
Stores blue, green, red, alpha as four consecutive bytes. This is the element type of a View::Bgra32 image and the color type of the Font example and TestFont. FillPixel, Font::Draw and the drawing functions write these four bytes when the canvas pixel size is 4. The byte order matches Simd::FillBgra. TestRandom::GetColor calls Bgra32(b, g, r) and leaves alpha at 255.
Constructor & Destructor Documentation
◆ Bgra32() [1/6]
| SIMD_INLINE Bgra32 | ( | const uint8_t & | gray = uint8_t(0), |
| const uint8_t & | a = uint8_t(255) |
||
| ) |
Creates a 32-bit BGRA pixel with equal blue, green and red.
Bgra32() is opaque black. The Font example fills a canvas with FillPixel(image, Bgra32(128, 128, 0)): blue = 128, green = 128, red = 0 and alpha = 255.
- Parameters
-
[in] gray - initial value for blue, green and red. It is equal to 0 by default. [in] a - initial value for alpha. It is equal to 255 by default.
◆ Bgra32() [2/6]
| SIMD_INLINE Bgra32 | ( | const uint8_t & | b, |
| const uint8_t & | g, | ||
| const uint8_t & | r, | ||
| const uint8_t & | a = uint8_t(255) |
||
| ) |
Creates a 32-bit BGRA pixel from blue, green, red and alpha.
Argument order is blue, green, red, alpha. The Font example draws red text with Bgra32(0, 0, 255), white text with Bgra32(255, 255, 255) and cyan text with Bgra32(255, 255, 0). The font test fills each row with Bgra32(255, x, y), so blue is 255, green follows the column and red follows the row. The transform test assigns view.At<Pixel::Bgra32>(x, y) = Pixel::Bgra32(x, y, red, alpha).
- Parameters
-
[in] b - initial value for the blue channel. [in] g - initial value for the green channel. [in] r - initial value for the red channel. [in] a - initial value for the alpha channel. It is equal to 255 by default.
◆ Bgra32() [3/6]
Creates a 32-bit BGRA pixel from a 24-bit BGR pixel.
Copies blue, green and red. 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.
◆ Bgra32() [4/6]
Creates a 32-bit BGRA pixel from a 24-bit RGB pixel.
Copies blue, green and red by name, so the color is kept and the byte order becomes blue, green, red, alpha.
- Parameters
-
[in] p - a 24-bit RGB pixel. [in] a - initial value for the alpha channel. It is equal to 255 by default.
◆ Bgra32() [5/6]
Creates a 32-bit BGRA pixel from a 32-bit RGBA pixel.
Copies blue, green, red and alpha by name.
- Parameters
-
[in] p - a 32-bit RGBA pixel.
◆ Bgra32() [6/6]
Creates a copy of a 32-bit BGRA pixel.
- Parameters
-
[in] p - a 32-bit BGRA pixel.
Member Function Documentation
◆ At() [1/2]
|
static |
Gets a constant reference to the BGRA pixel at (col, row).
Requires view.format == View::Bgra32 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::Bgra32>(x, y) or View::Row<Pixel::Bgra32>.
- Parameters
-
[in] view - an image view of 32-bit BGRA 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 BGRA pixel at (col, row).
Requires view.format == View::Bgra32 and then returns Simd::At. col is the x coordinate and row is the y coordinate; both must lie inside the view. The transform test assigns view.At<Pixel::Bgra32>(x, y) = Pixel::Bgra32(x, y, red, alpha).
- Parameters
-
[in] view - an image view of 32-bit BGRA pixel format. [in] col - x-coordinate of the pixel. [in] row - y-coordinate of the pixel.
- Returns
- a reference to the pixel.