pixmap(3)
NAME
sipp_pixmap - pixmap handling code for sipp.
sipp_bitmap - bitmap handling code for sipp.
SYNOPSIS
#include <sipp_pixmap.h> or #include <sipp_bitmap.h> [g]cc [flags] files -lsipp -lm [ libraries ]
DESCRIPTION
- The sipp(3) library has provisions to create an image in a
- pixmap in core. The most common use of this will probably be
- rendering into X bitmaps, Macintosh bitmaps or something similar
- but for those who do not want to use system dependent pixmaps we
- provide the Sipp_pixmap. When rendering a line image the target
- is a bitmap file or a bitmap in core rather than a pixmap. To
- faciliate this, we also provide a bitmap implementation, the
- Sipp_bitmap.
PIXMAP
- A Sipp_pixmap is defined like this:
- typedef struct {
int width; /* Width of the pixmap */ int height; /* Height of the pixmap */ u_char * buffer; /* A pointer to the image.*/
- } Sipp_pixmap;
- The pointer buffer is a pointer to the image where
- each pixel is stored as three unsigned chars in the order red,
- green blue. Thus, the buffer is 3 * width * height bytes long.
- The following functions operate on a Sipp_pixmap:
- Sipp_pixmap *sipp_pixmap_create(width, height)
- int width;
int height; - Returns a new Sipp_pixmap with the given size. The
- memory used is allocated using malloc(3).
- void sipp_pixmap_destruct(pm)
- Sipp_pixmap *pm;
- Frees all memory associated to the Sipp_pixmap pm.
- void sipp_pixmap_set_pixel(pm, col, row, red, grn, blu)
- Sipp_pixmap *pm;
int col;
int row;
u_char red;
u_char grn;
u_char blu - Set the pixel at (col, row) in pixmap pm to be the
- color (red, grn, blu). (0, 0) is upper left.
- void sipp_pixmap_write(file, pm)
- FILE *file;
Sipp_pixmap *pm - Write the pixmap pm to the open file file. The im
- age is written in the Portable Pixmap format (ppm), the same for
- mat sipp is using when rendering to a file.
BITMAP
- A Sipp_bitmap is defined like this:
- typedef struct {
int width; /* Width of the bitmap inpixels */
int height; /* Height of the bitmap inpixels */
int width_bytes; /* Width of the bitmap inbytes. */
u_char * buffer; /* A pointer to the image.*/ - } Sipp_bitmap;
- The pointer buffer is a pointer to the image where
- each pixel is a bit in an unsigned char. If the width field is
- not a multiple of 8, the last bits in the last byte of a row are
- not used. The most significant bit in each byte is the leftmost
- pixel. The entire buffer is width_bytes * height bytes long.
- The following functions operate on a Sipp_bitmap:
- Sipp_bitmap *sipp_bitmap_create(width, height)
- int width;
int height; - Returns a new Sipp_bitmap with the given size. The
- memory used is allocated using malloc(3).
- void sipp_bitmap_destruct(bm)
- Sipp_bitmap *bm;
- Frees all memory associated to the Sipp_bitmap bm.
- void sipp_bitmap_line(bm, col1, row1, col2, row2)
- Sipp_bitmap *bm;
int col1;
int row1;
int col2;
int row2; - Draw a line from (col1, row1) to (col2, row2) in
- the bitmap bm. (0, 0) is upper left.
- void sipp_bitmap_write(file, bm)
- FILE *file;
Sipp_bitmap *bm - Write the bitmap bm to the open file file. The im
- age is written in the Portable Bitmap format (pbm), the same for
- mat sipp is using when rendering a line drawing to a file.
SEE ALSO
- sipp(3) - simple polygon processor, a 3d-graphics library
sipp_geometric(3) - Vector and matrix functions for the - sipp(3) library
sipp_primitives(3) - a collection of geometric primitives - for sipp.
sipp_shaders(3) - a collection of shaders for sipp.
AUTHORS
Jonas Yngvesson (jonas-y@isy.liu.se)
Inge Wallin (ingwa@isy.liu.se)
BUGS
- No known bugs.
- 3 July , 1991