Learn how to evaluate and integrate the VNC SDK

We're here if you need help.

PixelFormat.h

Configure a format for the framebuffer’s pixels. (more...)

Standard pixel formats

Modifier and Type Name and Description
function const vnc_PixelFormat *

vnc_PixelFormat_rgb888()

32 bits per pixel stored as XXXXXXXXRRRRRRRRGGGGGGGGBBBBBBBB in most significant to least significant bit order

function const vnc_PixelFormat *

vnc_PixelFormat_bgr888()

32 bits per pixel stored as XXXXXXXXBBBBBBBBGGGGGGGGRRRRRRRR in most significant to least significant bit order

function const vnc_PixelFormat *

vnc_PixelFormat_rgb565()

16 bits per pixel stored as RRRRRGGGGGGBBBBB in most significant to least significant bit order

function const vnc_PixelFormat *

vnc_PixelFormat_rgb555()

16 bits per pixel stored as XRRRRRGGGGGBBBBB in most significant to least significant bit order

Accessor functions for pixel format parameters

Modifier and Type Name and Description
function int

vnc_PixelFormat_bpp(const vnc_PixelFormat *pf)

Gets the total number of bits per pixel.

function int

vnc_PixelFormat_depth(const vnc_PixelFormat *pf)

Gets the number of significant bits that are used to store pixel data.

function int

vnc_PixelFormat_redMax(const vnc_PixelFormat *pf)

Gets the maximum value for the red pixel value.

function int

vnc_PixelFormat_greenMax(const vnc_PixelFormat *pf)

Gets the maximum value for the green pixel value.

function int

vnc_PixelFormat_blueMax(const vnc_PixelFormat *pf)

Gets the maximum value for the blue pixel value.

function int

vnc_PixelFormat_redShift(const vnc_PixelFormat *pf)

Gets the number of bits the red pixel value is shifted.

function int

vnc_PixelFormat_greenShift(const vnc_PixelFormat *pf)

Gets the number of bits the green pixel value is shifted.

function int

vnc_PixelFormat_blueShift(const vnc_PixelFormat *pf)

Gets the number of bits the blue pixel value is shifted.

Custom pixel formats

Modifier and Type Name and Description
function vnc_PixelFormat *

vnc_PixelFormat_create(int bitsPerPixel, int redMax, int greenMax, int blueMax, int redShift, int greenShift, int blueShift)

Creates a custom pixel format based on the given parameters.

function void

vnc_PixelFormat_destroy(vnc_PixelFormat *pf)

Destroy a custom pixel format.

Detailed description

Configure a format for the framebuffer’s pixels.

A pixel format describes the representation of individual pixels in a framebuffer. This includes how many bits are used for each red, green and blue value, and in what order these are placed. It also includes the total number of bits per pixel (since there may be some unused bits to allow for efficient alignment in memory).

Each pixel value is taken to be an integer, and the color components are specified in terms of the maximum value and the “shift”, the offset of the component in the pixel value. When stored in memory, each pixel is written using the CPU’s native endianness. For example, the “rgb888” pixel format uses the bottom eight bits of a four-byte integer to represent the blue component ((R<<16)|(G<<8)|B), but on a little-endian machine blue is the first byte in memory ([B,G,R,X]).

Note that Intel x86 and x64 are little-endian; Android and iOS use ARM in little-endian mode; and the VNC SDK on HTML5 represents pixels using little-endian ordering.

Standard pixel formats

const vnc_PixelFormat *vnc_PixelFormat_rgb888(void)

32 bits per pixel stored as XXXXXXXXRRRRRRRRGGGGGGGGBBBBBBBB in most significant to least significant bit order

const vnc_PixelFormat *vnc_PixelFormat_bgr888(void)

32 bits per pixel stored as XXXXXXXXBBBBBBBBGGGGGGGGRRRRRRRR in most significant to least significant bit order

const vnc_PixelFormat *vnc_PixelFormat_rgb565(void)

16 bits per pixel stored as RRRRRGGGGGGBBBBB in most significant to least significant bit order

const vnc_PixelFormat *vnc_PixelFormat_rgb555(void)

16 bits per pixel stored as XRRRRRGGGGGBBBBB in most significant to least significant bit order

Accessor functions for pixel format parameters

int vnc_PixelFormat_bpp(const vnc_PixelFormat *pf)

Gets the total number of bits per pixel.

int vnc_PixelFormat_depth(const vnc_PixelFormat *pf)

Gets the number of significant bits that are used to store pixel data.

int vnc_PixelFormat_redMax(const vnc_PixelFormat *pf)

Gets the maximum value for the red pixel value.

int vnc_PixelFormat_greenMax(const vnc_PixelFormat *pf)

Gets the maximum value for the green pixel value.

int vnc_PixelFormat_blueMax(const vnc_PixelFormat *pf)

Gets the maximum value for the blue pixel value.

int vnc_PixelFormat_redShift(const vnc_PixelFormat *pf)

Gets the number of bits the red pixel value is shifted.

int vnc_PixelFormat_greenShift(const vnc_PixelFormat *pf)

Gets the number of bits the green pixel value is shifted.

int vnc_PixelFormat_blueShift(const vnc_PixelFormat *pf)

Gets the number of bits the blue pixel value is shifted.

Custom pixel formats

vnc_PixelFormat *vnc_PixelFormat_create(int bitsPerPixel, int redMax, int greenMax, int blueMax, int redShift, int greenShift, int blueShift)

Creates a custom pixel format based on the given parameters.

Parameters
  • bitsPerPixel -

    The total number of bits per pixel (a multiple of eight).

  • redMax -

    The maximum value for the red pixel value.

  • greenMax -

    The maximum value for the red pixel value.

  • blueMax -

    The maximum value for the red pixel value.

  • redShift -

    The number of bits the red pixel is shifted.

  • greenShift -

    The number of bits the green pixel is shifted.

  • blueShift -

    The number of bits the blue pixel is shifted.

void vnc_PixelFormat_destroy(vnc_PixelFormat *pf)

Destroy a custom pixel format.

Parameters
  • pf -

    The pixel format object.

×