nr-pixblock.h revision b8346b59f65f93ecaece3be77f5faae8c642810b
#ifndef __NR_PIXBLOCK_H__
#define __NR_PIXBLOCK_H__
/** \file
* \brief Pixel block structure. Used for low-level rendering.
*
* Authors:
* (C) 1999-2002 Lauris Kaplinski <lauris@kaplinski.com>
* (C) 2005 Ralf Stephan <ralf@ark.in-berlin.de> (some cleanup)
*
* This code is in the Public Domain.
*/
#include <libnr/nr-rect-l.h>
#include <libnr/nr-forward.h>
/// Size indicator. Hardcoded to max. 3 bits.
typedef enum {
NR_PIXBLOCK_SIZE_TINY, ///< Fits in (unsigned char *)
NR_PIXBLOCK_SIZE_4K, ///< Pixelstore
NR_PIXBLOCK_SIZE_16K, ///< Pixelstore
NR_PIXBLOCK_SIZE_64K, ///< Pixelstore
NR_PIXBLOCK_SIZE_256K, ///< Pixelstore
NR_PIXBLOCK_SIZE_1M, ///< Pixelstore
NR_PIXBLOCK_SIZE_BIG, ///< Normally allocated
NR_PIXBLOCK_SIZE_STATIC ///< Externally managed
/// Mode indicator. Hardcoded to max. 2 bits.
typedef enum {
NR_PIXBLOCK_MODE_A8, ///< Grayscale
NR_PIXBLOCK_MODE_R8G8B8, ///< 8 bit RGB
NR_PIXBLOCK_MODE_R8G8B8A8N, ///< Normal 8 bit RGBA
NR_PIXBLOCK_MODE_R8G8B8A8P ///< Premultiplied 8 bit RGBA
/// The pixel block struct.
struct NRPixBlock {
unsigned int rs; ///< Size of line in bytes
union {
unsigned char *px; ///< Pointer to buffer
unsigned char p[sizeof (unsigned char *)]; ///< Tiny buffer
} data;
};
/// Returns number of bytes per pixel (1, 3, or 4).
inline int
{
}
/// Returns pointer to pixel data.
inline unsigned char*
{
}
void nr_pixblock_setup (NRPixBlock *pb, NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear);
void nr_pixblock_setup_fast (NRPixBlock *pb, NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear);
void nr_pixblock_setup_extern (NRPixBlock *pb, NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, unsigned char *px, int rs, bool empty, bool clear);
NRPixBlock *nr_pixblock_new_fast (NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear);
void nr_pixelstore_4K_free (unsigned char *px);
void nr_pixelstore_16K_free (unsigned char *px);
void nr_pixelstore_64K_free (unsigned char *px);
void nr_pixelstore_256K_free (unsigned char *px);
void nr_pixelstore_1M_free (unsigned char *px);
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :