#include <pixelformat.h>
Public Types | |
| enum | Format { ABGR8888, RGBA8888, ARGB8888, BGRA8888, RGB888, BGR888, RGB0888, BGR0888, RGB565, RGB555, IND8, NUM_FORMATS } |
| A list of predefined formats. More... | |
Public Member Functions | |
| Pixelformat () | |
| Create an invalid Pixelformat. | |
| Pixelformat (Format format) | |
| Get a predefined Pixelformat. | |
| Pixelformat (const Pixelformat &other) | |
| Copy a Pixelformat. | |
| Pixelformat (SDL_Surface *surface) | |
| Uses SDL_Surface's internal reference counting to keep the SDL_Pixelformat reference valid, regardless of what is done to the surface. | |
| operator const SDL_PixelFormat & () const | |
| Get a reference to the internal SDL_PixelFormat. | |
| Pixelformat & | operator= (const Pixelformat &pf) |
| Copy another Pixelformat into this one. | |
| Pixelformat & | operator= (Format) |
| Copy a predefined format into this one. | |
| std::string | asString () const |
| Get a string 'name' for the format. | |
| bool | operator== (const Pixelformat &pf) const |
| Compare two Pixelformats. | |
| bool | operator== (const SDL_PixelFormat &) const |
| Compare a Pixelformat with an SDL_PixelFormat. | |
| bool | operator!= (const Pixelformat &pf) const |
| Compare two Pixelformats. | |
| bool | operator!= (const SDL_PixelFormat &format) const |
| Compare a Pixelformat with an SDL_PixelFormat. | |
| Uint32 | mapToPixel (const Color &col) const |
| Map a Color to its pixel representation in this format. | |
| Color | mapToColor (Uint32 pixel) const |
| Map a pixel in this format to a color. | |
| bool | valid () const |
| Returns true if this is a valid Pixelformat. | |
| const SDL_Palette * | getPalette () const |
| Get the palette, if this surface is indexed. | |
| Color | getColor (unsigned color_num) const |
| Get the color_num color in the palette. | |
| int | bpp () const |
| Get bytes per pixel. | |
| int | bitspp () const |
| Get bits per pixel. | |
| Uint32 | rMask () const |
| Get the red mask. | |
| Uint32 | gMask () const |
| Get the green mask. | |
| Uint32 | bMask () const |
| Get the blue mask. | |
| Uint32 | aMask () const |
| Get the alpha mask. | |
Static Public Attributes | |
| static Pixelformat | displayFormat |
| The Pixelformat of the display (once it's been initialized). | |
Friends | |
| std::ostream & | operator<< (std::ostream &, const Pixelformat &) |
| Print the format's 'name' to the stream. | |
| bool | operator== (const SDL_PixelFormat &f1, const Pixelformat &f2) |
| Compare a Pixelformat with an SDL_PixelFormat. | |
| bool | operator!= (const SDL_PixelFormat &f1, const Pixelformat &f2) |
| Compare a Pixelformat with an SDL_PixelFormat. | |
The format RGB0888 means that the display runs at 24bpp, but the pixel values are 4-byte-aligned in memory for faster access on a 32bit system (Matrox cards do this).
This class is essentially a const reference to an SDL_PixelFormat. You can create one by passing it an SDL_Surface (in which case it increments the refcount of the surface, to keep the surface's pixelformat in memory until it's done with it), or you can take a reference to certain formats defined by an enum.
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.