24-bit RGB pixel. More...
#include <SimdPixel.hpp>
Public Member Functions | |
| Rgb24 (const uint8_t &gray=uint8_t(0)) | |
| Rgb24 (const uint8_t &r, const uint8_t &g, const uint8_t &b) | |
| Rgb24 (const Bgra32 &p) | |
| Rgb24 (const Bgr24 &p) | |
| Rgb24 (const Rgba32 &p) | |
| Rgb24 (const Rgb24 &p) | |
Static Public Member Functions | |
| template<template< class > class A> | |
| static const Rgb24 & | At (const View< A > &view, ptrdiff_t col, ptrdiff_t row) |
| template<template< class > class A> | |
| static Rgb24 & | At (View< A > &view, ptrdiff_t col, ptrdiff_t row) |
Data Fields | |
| uint8_t | red |
| Red channel. First byte of a View::Rgb24 pixel. | |
| uint8_t | green |
| Green channel. Second byte of a View::Rgb24 pixel. | |
| uint8_t | blue |
| Blue channel. Third byte of a View::Rgb24 pixel. Rgb24(255, 0, 0) is red. | |
Detailed Description
24-bit RGB pixel.
Stores red, green, blue as three consecutive bytes. This is the element type of a View::Rgb24 image. Argument order is red, green, blue, which is the reverse of Bgr24. TestRandom::GetColor uses that difference: for an Rgb24 canvas it calls Rgb24(r, g, b) where the caller passed (b, g, r), so the painted color matches a Bgr24 canvas. Pass Rgb24 to DrawRectangle, Font::Draw and FillPixel only when the canvas format is View::Rgb24.
Constructor & Destructor Documentation
◆ Rgb24() [1/6]
| SIMD_INLINE Rgb24 | ( | const uint8_t & | gray = uint8_t(0) | ) |
Creates a 24-bit RGB pixel with the same value in every channel.
Rgb24() is black. The value is written to red, green and blue.
- Parameters
-
[in] gray - initial value for red, green and blue. It is equal to 0 by default.
◆ Rgb24() [2/6]
| SIMD_INLINE Rgb24 | ( | const uint8_t & | r, |
| const uint8_t & | g, | ||
| const uint8_t & | b | ||
| ) |
Creates a 24-bit RGB pixel from red, green and blue.
Argument order is red, green, blue. TestRandom builds the blue, green and red labels with Rgb24(r, g, b) after receiving the channels as (b, g, r). A BGR color Bgr24(b, g, r) is the same color as Rgb24(r, g, b).
- 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.
◆ Rgb24() [3/6]
Creates a 24-bit RGB pixel from a 32-bit BGRA pixel.
Copies red, green and blue by name, so the color is kept and the byte order becomes red, green, blue. Alpha is omitted.
- Parameters
-
[in] p - a 32-bit BGRA pixel.
◆ Rgb24() [4/6]
Creates a 24-bit RGB pixel from a 24-bit BGR pixel.
Copies red, green and blue by name, so the color is kept and the byte order becomes red, green, blue.
- Parameters
-
[in] p - a 24-bit BGR pixel.
◆ Rgb24() [5/6]
Creates a 24-bit RGB pixel from a 32-bit RGBA pixel.
Copies red, green and blue. Alpha is omitted.
- Parameters
-
[in] p - a 32-bit RGBA pixel.
◆ Rgb24() [6/6]
Creates a copy of a 24-bit RGB pixel.
- Parameters
-
[in] p - a 24-bit RGB pixel.
Member Function Documentation
◆ At() [1/2]
|
static |
Gets a constant reference to the RGB pixel at (col, row).
Requires view.format == View::Rgb24 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::Rgb24>(x, y).
- Parameters
-
[in] view - an image view of 24-bit RGB 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 RGB pixel at (col, row).
Requires view.format == View::Rgb24 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 24-bit RGB pixel format. [in] col - x-coordinate of the pixel. [in] row - y-coordinate of the pixel.
- Returns
- a reference to the pixel.