Gamp v0.0.7-54-gccdc599
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::render::pixel::PixelFormats Class Reference

Basic pixel formats. More...

#include <PixelFormat.hpp>

Collaboration diagram for gamp::render::pixel::PixelFormats:

Static Public Member Functions

static void convert (const ComponentMap &cmap, const PixelFormat dstComp, uint8_t *dstBitStream, const PixelFormat &srcComp, const uint8_t *srcBitStream)
 
static GenericPixelRect convert (const PixelRectangle &src, const PixelFormat &destFmt, uint32_t ddestStride, bool isGLOriented)
 
static void convert (const PixelRectangle &src, PixelRectangle &dst)
 
static void convert (const Point2u32 &size, const uint8_t *src_pixels, const PixelFormat &src_fmt, bool src_glOriented, uint32_t src_lineStride, uint8_t *dst_pixels, const PixelFormat &dst_fmt, bool dst_glOriented, uint32_t dst_lineStride)
 
static uint32_t convertU32 (const PixelFormat &dst_fmt, const PixelFormat &src_fmt, const uint8_t *src)
 
static uint32_t convertU32 (const PixelFormat &dst_fmt, const PixelFormat &src_fmt, uint32_t src_pixel)
 
static const PixelFormatreverse (const PixelFormat &fmt) noexcept
 Returns the PixelFormat with reversed components of fmt.
 
static uint32_t toU32 (const PixelFormat &dst_fmt, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 

Static Public Attributes

static constexpr PixelFormat ABGR1555
 Stride is 16 bits, 16 bits per pixel, 4 discrete components.
 
static constexpr PixelFormat ABGR8888 = PixelFormat(4, { CType::A, CType::B, CType::G, CType::R }, 8, 32)
 Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
 
static constexpr PixelFormat ARGB8888 = PixelFormat(4, { CType::A, CType::R, CType::G, CType::B }, 8, 32)
 Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
 
static constexpr PixelFormat BGR565
 Stride is 16 bits, 16 bits per pixel, 3 discrete components.
 
static constexpr PixelFormat BGR888 = PixelFormat(3, { CType::B, CType::G, CType::R }, 8, 24)
 Stride is 24 bits, 24 bits per pixel, 3 uniform components of of 8 bits.
 
static constexpr PixelFormat BGRA8888 = PixelFormat(4, { CType::B, CType::G, CType::R, CType::A }, 8, 32)
 Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
 
static constexpr PixelFormat BGRx8888 = PixelFormat(3, { CType::B, CType::G, CType::R }, 8, 32)
 Stride is 32 bits, 24 bits per pixel, 3 uniform components of 8 bits.
 
static constexpr std::array< const PixelFormat *, 11 > formats
 
static constexpr PixelFormat LUMINANCE = PixelFormat(1, { CType::Y }, 8, 8)
 Stride is 8 bits, 8 bits per pixel, 1 component of 8 bits.
 
static constexpr PixelFormat RGB565
 Stride is 16 bits, 16 bits per pixel, 3 discrete components.
 
static constexpr PixelFormat RGB888 = PixelFormat(3, { CType::R, CType::G, CType::B }, 8, 24)
 Stride 24 bits, 24 bits per pixel, 3 uniform components of 8 bits.
 
static constexpr PixelFormat RGBA5551
 Stride is 16 bits, 16 bits per pixel, 4 discrete components.
 
static constexpr PixelFormat RGBA8888 = PixelFormat(4, { CType::R, CType::G, CType::B, CType::A }, 8, 32)
 Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
 
static constexpr PixelFormat RGBx8888 = PixelFormat(3, { CType::R, CType::G, CType::B }, 8, 32)
 Stride is 32 bits, 24 bits per pixel, 3 uniform components of 8 bits.
 

Detailed Description

Basic pixel formats.

Notation follows OpenGL notation, i.e. name consist of all it's component names followed by their bit size.

Order of component names is from lowest-bit to highest-bit.

In case component-size is 1 byte (e.g. OpenGL data-type GL_UNSIGNED_BYTE), component names are ordered from lowest-byte to highest-byte. Note that OpenGL applies special interpretation if data-type is e.g. GL_UNSIGNED_8_8_8_8_REV or GL_UNSIGNED_8_8_8_8_REV.

PixelFormat can be converted to OpenGL GLPixelAttributes via

 GLPixelAttributes glpa = GLPixelAttributes.convert(PixelFormat pixFmt, GLProfile glp);

See OpenGL Specification 4.3 - February 14, 2013, Core Profile, Section 8.4.4 Transfer of Pixel Rectangles, p. 161-174.

Definition at line 458 of file PixelFormat.hpp.

Member Function Documentation

◆ reverse()

static const PixelFormat & gamp::render::pixel::PixelFormats::reverse ( const PixelFormat & fmt)
inlinestaticnoexcept

Returns the PixelFormat with reversed components of fmt.

If no reversed PixelFormat is available, returns fmt.

Definition at line 753 of file PixelFormat.hpp.

◆ toU32()

static uint32_t gamp::render::pixel::PixelFormats::toU32 ( const PixelFormat & dst_fmt,
uint8_t r,
uint8_t g,
uint8_t b,
uint8_t a )
inlinestatic

Definition at line 779 of file PixelFormat.hpp.

Here is the caller graph for this function:

◆ convertU32() [1/2]

static uint32_t gamp::render::pixel::PixelFormats::convertU32 ( const PixelFormat & dst_fmt,
const PixelFormat & src_fmt,
const uint8_t * src )
inlinestatic

Definition at line 800 of file PixelFormat.hpp.

◆ convertU32() [2/2]

static uint32_t gamp::render::pixel::PixelFormats::convertU32 ( const PixelFormat & dst_fmt,
const PixelFormat & src_fmt,
uint32_t src_pixel )
inlinestatic

Definition at line 844 of file PixelFormat.hpp.

◆ convert() [1/4]

static GenericPixelRect gamp::render::pixel::PixelFormats::convert ( const PixelRectangle & src,
const PixelFormat & destFmt,
uint32_t ddestStride,
bool isGLOriented )
inlinestatic

Definition at line 887 of file PixelFormat.hpp.

Here is the caller graph for this function:

◆ convert() [2/4]

static void gamp::render::pixel::PixelFormats::convert ( const PixelRectangle & src,
PixelRectangle & dst )
inlinestatic
Parameters
srcsource PixelRectangle
dstdestination PixelRectangle

Definition at line 907 of file PixelFormat.hpp.

◆ convert() [3/4]

static void gamp::render::pixel::PixelFormats::convert ( const Point2u32 & size,
const uint8_t * src_pixels,
const PixelFormat & src_fmt,
bool src_glOriented,
uint32_t src_lineStride,
uint8_t * dst_pixels,
const PixelFormat & dst_fmt,
bool dst_glOriented,
uint32_t dst_lineStride )
inlinestatic
Parameters
widthwidth of the to be converted pixel rectangle
heightheight of the to be converted pixel rectangle
src_bbByteBuffer source
src_fmtsource PixelFormat
src_glOrientedif true, the source memory is laid out in OpenGL's coordinate system, origin at bottom left, otherwise origin at top left.
src_lineStrideline stride in byte-size for source, i.e. byte count from one line to the next. Must be >= src_fmt.comp.bytesPerPixel() * width or zero for default stride.
dst_bbByteBuffer sink
dst_fmtdestination PixelFormat
dst_glOrientedif true, the source memory is laid out in OpenGL's coordinate system, origin at bottom left, otherwise origin at top left.
dst_lineStrideline stride in byte-size for destination, i.e. byte count from one line to the next. Must be >= dst_fmt.comp.bytesPerPixel() * width or zero for default stride.
Exceptions
IllegalStateException
IllegalArgumentExceptionif src_lineStride or dst_lineStride is invalid

Definition at line 935 of file PixelFormat.hpp.

◆ convert() [4/4]

static void gamp::render::pixel::PixelFormats::convert ( const ComponentMap & cmap,
const PixelFormat dstComp,
uint8_t * dstBitStream,
const PixelFormat & srcComp,
const uint8_t * srcBitStream )
inlinestatic

Definition at line 1013 of file PixelFormat.hpp.

Member Data Documentation

◆ LUMINANCE

PixelFormat gamp::render::pixel::PixelFormats::LUMINANCE = PixelFormat(1, { CType::Y }, 8, 8)
staticconstexpr

Stride is 8 bits, 8 bits per pixel, 1 component of 8 bits.

Compatible with:

  • OpenGL: data-format GL_ALPHA (< GL3), GL_RED (>= GL3), data-type GL_UNSIGNED_BYTE
  • AWT: none

Definition at line 469 of file PixelFormat.hpp.

◆ RGB565

PixelFormat gamp::render::pixel::PixelFormats::RGB565
staticconstexpr
Initial value:
{ 0x1F, 0x3F, 0x1F },
{ 0, 5, 5+6 },
16 )
Packed pixel composition, i.e.
@ G
Green component.
Definition PixelUtil.hpp:44

Stride is 16 bits, 16 bits per pixel, 3 discrete components.

The discrete components are interleaved in the order Low to High:

  1. R: 0x1F << 0
  2. G: 0x3F << 5
  3. B: 0x1F << 11

Compatible with:

  • OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_SHORT_5_6_5_REV
  • AWT: None

Definition at line 490 of file PixelFormat.hpp.

◆ BGR565

PixelFormat gamp::render::pixel::PixelFormats::BGR565
staticconstexpr
Initial value:
{ 0x1F, 0x3F, 0x1F },
{ 0, 5, 5+6 },
16 )

Stride is 16 bits, 16 bits per pixel, 3 discrete components.

The discrete components are interleaved in the order Low to High:

  1. B: 0x1F << 0
  2. G: 0x3F << 5
  3. R: 0x1F << 11

Compatible with:

  • OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_SHORT_5_6_5
  • AWT: None

Definition at line 514 of file PixelFormat.hpp.

◆ RGBA5551

PixelFormat gamp::render::pixel::PixelFormats::RGBA5551
staticconstexpr
Initial value:
{ 0x1F, 0x1F, 0x1F, 0x01 },
{ 0, 5, 5+5, 5+5+5 },
16 )
@ A
Alpha component.
Definition PixelUtil.hpp:48

Stride is 16 bits, 16 bits per pixel, 4 discrete components.

The discrete components are interleaved in the order Low to High:

  1. R: 0x1F << 0
  2. G: 0x1F << 5
  3. B: 0x1F << 10
  4. A: 0x01 << 15

Compatible with:

  • OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_SHORT_1_5_5_5_REV
  • AWT: None

Definition at line 539 of file PixelFormat.hpp.

◆ ABGR1555

PixelFormat gamp::render::pixel::PixelFormats::ABGR1555
staticconstexpr
Initial value:
{ 0x01, 0x1F, 0x1F, 0x1F },
{ 0, 1, 1+5, 1+5+5 },
16 )

Stride is 16 bits, 16 bits per pixel, 4 discrete components.

The discrete components are interleaved in the order Low to High:

  1. A: 0x01 << 0
  2. B: 0x1F << 1
  3. G: 0x1F << 6
  4. R: 0x1F << 11

Compatible with:

  • OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_SHORT_5_5_5_1
  • AWT: None

Definition at line 564 of file PixelFormat.hpp.

◆ RGB888

PixelFormat gamp::render::pixel::PixelFormats::RGB888 = PixelFormat(3, { CType::R, CType::G, CType::B }, 8, 24)
staticconstexpr

Stride 24 bits, 24 bits per pixel, 3 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. R: 0xFF << 0
  2. G: 0xFF << 8
  3. B: 0xFF << 16

Compatible with:

  • OpenGL: data-format GL_RGB, data-type GL_UNSIGNED_BYTE
  • AWT: None

Definition at line 588 of file PixelFormat.hpp.

◆ BGR888

PixelFormat gamp::render::pixel::PixelFormats::BGR888 = PixelFormat(3, { CType::B, CType::G, CType::R }, 8, 24)
staticconstexpr

Stride is 24 bits, 24 bits per pixel, 3 uniform components of of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. B: 0xFF << 0
  2. G: 0xFF << 8
  3. R: 0xFF << 16

Compatible with:

  • OpenGL: data-format GL_BGR (>= GL2), data-type GL_UNSIGNED_BYTE
  • AWT: TYPE_3BYTE_BGR

Definition at line 609 of file PixelFormat.hpp.

◆ RGBx8888

PixelFormat gamp::render::pixel::PixelFormats::RGBx8888 = PixelFormat(3, { CType::R, CType::G, CType::B }, 8, 32)
staticconstexpr

Stride is 32 bits, 24 bits per pixel, 3 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. R: 0xFF << 0
  2. G: 0xFF << 8
  3. B: 0xFF << 16

Compatible with:

  • OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_BYTE, with alpha discarded!
  • AWT: TYPE_INT_BGR

Definition at line 630 of file PixelFormat.hpp.

◆ BGRx8888

PixelFormat gamp::render::pixel::PixelFormats::BGRx8888 = PixelFormat(3, { CType::B, CType::G, CType::R }, 8, 32)
staticconstexpr

Stride is 32 bits, 24 bits per pixel, 3 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. B: 0xFF << 0
  2. G: 0xFF << 8
  3. R: 0xFF << 16

Compatible with:

  • OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_BYTE - with alpha discarded!
  • AWT: TYPE_INT_RGB

Definition at line 651 of file PixelFormat.hpp.

◆ RGBA8888

PixelFormat gamp::render::pixel::PixelFormats::RGBA8888 = PixelFormat(4, { CType::R, CType::G, CType::B, CType::A }, 8, 32)
staticconstexpr

Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. R: 0xFF << 0
  2. G: 0xFF << 8
  3. B: 0xFF << 16
  4. A: 0xFF << 24

Compatible with:

  • OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_BYTE
  • AWT: None
  • PointerIcon: OSX (NSBitmapImageRep)
  • Window Icon: OSX (NSBitmapImageRep)
  • PNGJ: Scanlines

Definition at line 676 of file PixelFormat.hpp.

◆ ABGR8888

PixelFormat gamp::render::pixel::PixelFormats::ABGR8888 = PixelFormat(4, { CType::A, CType::B, CType::G, CType::R }, 8, 32)
staticconstexpr

Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. A: 0xFF << 0
  2. B: 0xFF << 8
  3. G: 0xFF << 16
  4. R: 0xFF << 24

Compatible with:

  • OpenGL: data-format GL_RGBA, data-type GL_UNSIGNED_INT_8_8_8_8
  • AWT: TYPE_4BYTE_ABGR

Definition at line 698 of file PixelFormat.hpp.

◆ ARGB8888

PixelFormat gamp::render::pixel::PixelFormats::ARGB8888 = PixelFormat(4, { CType::A, CType::R, CType::G, CType::B }, 8, 32)
staticconstexpr

Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. A: 0xFF << 0
  2. R: 0xFF << 8
  3. G: 0xFF << 16
  4. B: 0xFF << 24

Compatible with:

  • OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_INT_8_8_8_8
  • AWT: None

Definition at line 720 of file PixelFormat.hpp.

◆ BGRA8888

PixelFormat gamp::render::pixel::PixelFormats::BGRA8888 = PixelFormat(4, { CType::B, CType::G, CType::R, CType::A }, 8, 32)
staticconstexpr

Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.

The uniform components are interleaved in the order Low to High:

  1. B: 0xFF << 0
  2. G: 0xFF << 8
  3. R: 0xFF << 16
  4. A: 0xFF << 24

Compatible with:

  • OpenGL: data-format GL_BGRA, data-type GL_UNSIGNED_BYTE
  • AWT: TYPE_INT_ARGB
  • PointerIcon: X11 (XCURSOR), Win32, AWT
  • Window Icon: X11, Win32

Definition at line 744 of file PixelFormat.hpp.

◆ formats

std::array<const PixelFormat*, 11> gamp::render::pixel::PixelFormats::formats
staticconstexpr
Initial value:
static constexpr PixelFormat BGR565
Stride is 16 bits, 16 bits per pixel, 3 discrete components.
static constexpr PixelFormat BGR888
Stride is 24 bits, 24 bits per pixel, 3 uniform components of of 8 bits.
static constexpr PixelFormat RGB888
Stride 24 bits, 24 bits per pixel, 3 uniform components of 8 bits.
static constexpr PixelFormat LUMINANCE
Stride is 8 bits, 8 bits per pixel, 1 component of 8 bits.
static constexpr PixelFormat RGB565
Stride is 16 bits, 16 bits per pixel, 3 discrete components.
static constexpr PixelFormat RGBA8888
Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
static constexpr PixelFormat ARGB8888
Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
static constexpr PixelFormat RGBA5551
Stride is 16 bits, 16 bits per pixel, 4 discrete components.
static constexpr PixelFormat ABGR1555
Stride is 16 bits, 16 bits per pixel, 4 discrete components.
static constexpr PixelFormat BGRA8888
Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.
static constexpr PixelFormat ABGR8888
Stride is 32 bits, 32 bits per pixel, 4 uniform components of 8 bits.

Definition at line 746 of file PixelFormat.hpp.


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