Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rgbpix(2) [plan9 man page]

RGBPIX(2)							System Calls Manual							 RGBPIX(2)

NAME
RGB, rgbpix, rdcolmap, wrcolmap - handle color screens SYNOPSIS
#include <u.h> #include <libc.h> #include <libg.h> ulong rgbpix(Bitmap *b, RGB rgb) void rdcolmap(Bitmap *b, RGB *map) void wrcolmap(Bitmap *b, RGB *map) DESCRIPTION
Colors are described by the red, green, and blue light intensities, in an RGB datum: typedef struct RGB { ulong red; ulong green; ulong blue; } RGB; Black is represented by zero in all three positions and white has the maximum unsigned long value in all three positions. Some of the graphics functions, such as point (see bitblt(2)), take a pixel value argument, which is a single unsigned long. For a given bitmap, rgbpix returns the pixel value with a color closest to the color represented by the rgb argument. There is a colormap associated with each Bitmap. A colormap is an array of RGBs, of length 2^(2^ldepth), giving the colors for pixels 0, 1, 2, etc. Rdcolmap reads the colormap for the given bitmap into the provided map, which must have enough space to hold it. Wrcolmap associates the given colormap with the given bitmap, if possible. (The hardware might not allow this.) SOURCE
/sys/src/libg SEE ALSO
graphics(2) BUGS
These functions work only for the screen bitmap. This interface will have to be refined for screens with more than 8 bits per pixel. RGBPIX(2)

Check Out this Related Man Page

BALLOC(2)							System Calls Manual							 BALLOC(2)

NAME
balloc, bfree, rdbitmap, wrbitmap, rdbitmapfile, wrbitmapfile - allocating, freeing, reading, writing bitmaps SYNOPSIS
#include <u.h> #include <libc.h> #include <libg.h> Bitmap *balloc(Rectangle r, int ldepth) void bfree(Bitmap *b) void rdbitmap(Bitmap *b, int ymin, int ymax, uchar *data) void wrbitmap(Bitmap *b, int ymin, int ymax, uchar *data) Bitmap *rdbitmapfile(int fd) void wrbitmapfile(int fd, Bitmap *b) DESCRIPTION
A new bitmap is allocated with balloc; it will have the extent and ldepth (log base 2 of the number of bits per pixel) given by its argu- ments, and will be filled with zeros. The id field will have been set to the identifying number used by /dev/bitblt (see bit(3)), and the cache field will be zero. Balloc returns 0 if the server has run out of bitmap resources. Bfree frees the resources used by its argument bitmap. The remaining functions deal with moving groups of pixel values between bitmaps and user space or external files. There is a fixed format for the exchange and storage of bitmap data (see bitmap(6)). Rdbitmap reads rows of pixels from bitmap b into data. The rows read have y=ymin,ymin+1, ... ymax-1. Those rows must be within the range allowed by b.r. Wrbitmap replaces the specified rows of pixels in bitmap b with data. Rdbitmapfile creates a bitmap from data contained an external file (see bitmap(6) for the file format); fd is a file descriptor obtained by opening such a file for reading. The returned bitmap is allocated using balloc. Wrbitmapfile writes bitmap b onto file descriptor fd, which should be open for writing. The format is as described for rdbitmapfile. Rdbitmapfile and wrbitmapfile do not close fd. SOURCE
/sys/src/libg SEE ALSO
graphics(2), bitblt(2), bit(3), bitmap(6) DIAGNOSTICS
These functions return 0 on failure, usually due to insufficient memory. May set errstr. BUGS
Ldepth must be 0, 1, 2, or 3. BALLOC(2)
Man Page

We Also Found This Discussion For You

1. Programming

Xlib - Mapping Pixel Values to RGB Colors

Hi everyone... I'm working with XLib and I want to find out the pixel value of a particular point on screen and then map it to RGB values. I used XGetImage and XGetPixel to get the pixel value, but how do I get the RGB values of the pixel? I went through a few XLib manuals, there seems to be no... (1 Reply)
Discussion started by: thebin
1 Replies