| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csPackRGBA Struct Reference
[Graphics]

RGBA data packing. More...

`#include <csgfx/packrgb.h>`

List of all members.

## Static Public Member Functions
static csRGBpixel * | CopyUnpackRGBAtoRGBpixel (const uint8 *rgba, size_t numPixels)
| Unpack a RGBA byte array into an array of csRGBpixel.
static void | csDiscardUnpackedRGBpixel (const csRGBpixel *pixels)
| Frees memory possibly allocated by UnpackRGBAtoRGBpixel().
static void | DiscardPackedRGBA (const uint8 *rgba)
| Frees memory possibly allocated by PackRGBpixelToRGBA().
static bool | IsRGBpixelSane ()
static const uint8 * | PackRGBpixelToRGBA (const csRGBpixel *pixels, size_t numPixels)
| Pack an array of csRGBpixel into a RGBA byte array.
static void | PackRGBpixelToRGBA (uint8 *buf, const csRGBpixel *pixels, size_t numPixels)
| Pack an array of csRGBpixel into a RGBA byte array.
static csRGBcolor * | UnpackRGBAtoRGBcolor (const uint8 *rgba, size_t numPixels)
| Unpack a RGBA byte array into an array of csRGBcolor.
static const csRGBpixel * | UnpackRGBAtoRGBpixel (const uint8 *rgba, size_t numPixels)
| Unpack a RGBA byte array into an array of csRGBpixel.
static void | UnpackRGBAtoRGBpixel (csRGBpixel *buf, const uint8 *rgba, size_t numPixels)
| Unpack a RGBA byte array into an array of csRGBpixel.

## Detailed Description

RGBA data packing.

Definition at line 211 of file packrgb.h.

## Member Function Documentation

static csRGBpixel* csPackRGBA::CopyUnpackRGBAtoRGBpixel | ( | const uint8 * | rgba,
|  | size_t | numPixels |
| ) |  |  | `[inline, static]`

Unpack a RGBA byte array into an array of csRGBpixel.

Remarks:
  Never returns `rgba`. Allocate memory. Free it using delete[] when finished.

Parameters:

  | rgba | Source array of RGBA data
  | numPixels | Number of pixels in the array

Returns:
  An array containing the source data in csRGBpixel structs.

Definition at line 324 of file packrgb.h.

References IsRGBpixelSane(), and UnpackRGBAtoRGBpixel().

static void csPackRGBA::csDiscardUnpackedRGBpixel | ( | const csRGBpixel * | pixels | ) | `[inline, static]`

Frees memory possibly allocated by UnpackRGBAtoRGBpixel().

Parameters:

  | pixels | Pointer to csRGBpixel array returned by UnpackRGBAtoRGBpixel().

Definition at line 341 of file packrgb.h.

References IsRGBpixelSane().

static void csPackRGBA::DiscardPackedRGBA | ( | const uint8 * | rgba | ) | `[inline, static]`

Frees memory possibly allocated by PackRGBpixelToRGBA().

Parameters:

  | rgba | Pointer to packed RGB data returned by PackRGBpixelToRGBA().

Definition at line 263 of file packrgb.h.

References IsRGBpixelSane().

static const uint8* csPackRGBA::PackRGBpixelToRGBA | ( | const csRGBpixel * | pixels,
|  | size_t | numPixels |
| ) |  |  | `[inline, static]`

Pack an array of csRGBpixel into a RGBA byte array.

Remarks:
  May return `pixels`. May allocate memory. Free it using DiscardPackedRGBA() when finished.

Parameters:

  | pixels | Source array of csRGBpixel data
  | numPixels | Number of pixels in the array

Returns:
  A byte array containing the source data packed as RGBA.

Definition at line 247 of file packrgb.h.

References IsRGBpixelSane(), and PackRGBpixelToRGBA().

static void csPackRGBA::PackRGBpixelToRGBA | ( | uint8 * | buf,
|  | const csRGBpixel * | pixels,
|  | size_t | numPixels |
| ) |  |  | `[inline, static]`

Pack an array of csRGBpixel into a RGBA byte array.

Parameters:

  | buf | Buffer to pack the data into.
  | pixels | Source array of csRGBpixel data
  | numPixels | Number of pixels in the array

Definition at line 220 of file packrgb.h.

References csRGBpixel::alpha, csRGBpixel::blue, csRGBpixel::green, IsRGBpixelSane(), and csRGBpixel::red.

Referenced by PackRGBpixelToRGBA().

static csRGBcolor* csPackRGBA::UnpackRGBAtoRGBcolor | ( | const uint8 * | rgba,
|  | size_t | numPixels |
| ) |  |  | `[inline, static]`

Unpack a RGBA byte array into an array of csRGBcolor.

Alpha information is discarded!

Remarks:
  Allocates memory. Free it using delete[] when finished.

Parameters:

  | rgba | Source array of RGBA data
  | numPixels | Number of pixels in the array

Returns:
  An array containing the source data in csRGBcolor structs.

Definition at line 355 of file packrgb.h.

References csRGBcolor::blue, csRGBcolor::green, and csRGBcolor::red.

static const csRGBpixel* csPackRGBA::UnpackRGBAtoRGBpixel | ( | const uint8 * | rgba,
|  | size_t | numPixels |
| ) |  |  | `[inline, static]`

Unpack a RGBA byte array into an array of csRGBpixel.

Remarks:
  May return `pixels`. May allocate memory. Free it using DiscardUnpackedRGBpixel() when finished.

Parameters:

  | rgba | Source array of RGBA data
  | numPixels | Number of pixels in the array

Returns:
  An array containing the source data in csRGBpixel structs.

Definition at line 303 of file packrgb.h.

References IsRGBpixelSane(), and UnpackRGBAtoRGBpixel().

static void csPackRGBA::UnpackRGBAtoRGBpixel | ( | csRGBpixel * | buf,
|  | const uint8 * | rgba,
|  | size_t | numPixels |
| ) |  |  | `[inline, static]`

Unpack a RGBA byte array into an array of csRGBpixel.

Parameters:

  | buf | Buffer to unpack the data into.
  | rgba | Source array of RGBA data
  | numPixels | Number of pixels in the array

Definition at line 276 of file packrgb.h.

References csRGBpixel::alpha, csRGBpixel::blue, csRGBpixel::green, IsRGBpixelSane(), and csRGBpixel::red.

Referenced by CopyUnpackRGBAtoRGBpixel(), and UnpackRGBAtoRGBpixel().

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

- csgfx/packrgb.h