Blame man/XInitImage.man

Packit 5bd3a9
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Permission is hereby granted, free of charge, to any person obtaining
Packit 5bd3a9
.\" a copy of this software and associated documentation files (the
Packit 5bd3a9
.\" "Software"), to deal in the Software without restriction, including
Packit 5bd3a9
.\" without limitation the rights to use, copy, modify, merge, publish,
Packit 5bd3a9
.\" distribute, sublicense, and/or sell copies of the Software, and to
Packit 5bd3a9
.\" permit persons to whom the Software is furnished to do so, subject to
Packit 5bd3a9
.\" the following conditions:
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" The above copyright notice and this permission notice shall be included
Packit 5bd3a9
.\" in all copies or substantial portions of the Software.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit 5bd3a9
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 5bd3a9
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Packit 5bd3a9
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit 5bd3a9
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit 5bd3a9
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit 5bd3a9
.\" OTHER DEALINGS IN THE SOFTWARE.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Except as contained in this notice, the name of the X Consortium shall
Packit 5bd3a9
.\" not be used in advertising or otherwise to promote the sale, use or
Packit 5bd3a9
.\" other dealings in this Software without prior written authorization
Packit 5bd3a9
.\" from the X Consortium.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
Packit 5bd3a9
.\" Digital Equipment Corporation
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Portions Copyright \(co 1990, 1991 by
Packit 5bd3a9
.\" Tektronix, Inc.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Permission to use, copy, modify and distribute this documentation for
Packit 5bd3a9
.\" any purpose and without fee is hereby granted, provided that the above
Packit 5bd3a9
.\" copyright notice appears in all copies and that both that copyright notice
Packit 5bd3a9
.\" and this permission notice appear in all copies, and that the names of
Packit 5bd3a9
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
Packit 5bd3a9
.\" to this documentation without specific, written prior permission.
Packit 5bd3a9
.\" Digital and Tektronix makes no representations about the suitability
Packit 5bd3a9
.\" of this documentation for any purpose.
Packit 5bd3a9
.\" It is provided ``as is'' without express or implied warranty.
Packit 5bd3a9
.\" 
Packit 5bd3a9
.\"
Packit 5bd3a9
.ds xT X Toolkit Intrinsics \- C Language Interface
Packit 5bd3a9
.ds xW Athena X Widgets \- C Language X Toolkit Interface
Packit 5bd3a9
.ds xL Xlib \- C Language X Interface
Packit 5bd3a9
.ds xC Inter-Client Communication Conventions Manual
Packit 5bd3a9
.na
Packit 5bd3a9
.de Ds
Packit 5bd3a9
.nf
Packit 5bd3a9
.\\$1D \\$2 \\$1
Packit 5bd3a9
.ft CW
Packit 5bd3a9
.\".ps \\n(PS
Packit 5bd3a9
.\".if \\n(VS>=40 .vs \\n(VSu
Packit 5bd3a9
.\".if \\n(VS<=39 .vs \\n(VSp
Packit 5bd3a9
..
Packit 5bd3a9
.de De
Packit 5bd3a9
.ce 0
Packit 5bd3a9
.if \\n(BD .DF
Packit 5bd3a9
.nr BD 0
Packit 5bd3a9
.in \\n(OIu
Packit 5bd3a9
.if \\n(TM .ls 2
Packit 5bd3a9
.sp \\n(DDu
Packit 5bd3a9
.fi
Packit 5bd3a9
..
Packit 5bd3a9
.de IN		\" send an index entry to the stderr
Packit 5bd3a9
..
Packit 5bd3a9
.de Pn
Packit 5bd3a9
.ie t \\$1\fB\^\\$2\^\fR\\$3
Packit 5bd3a9
.el \\$1\fI\^\\$2\^\fP\\$3
Packit 5bd3a9
..
Packit 5bd3a9
.de ZN
Packit 5bd3a9
.ie t \fB\^\\$1\^\fR\\$2
Packit 5bd3a9
.el \fI\^\\$1\^\fP\\$2
Packit 5bd3a9
..
Packit 5bd3a9
.de hN
Packit 5bd3a9
.ie t <\fB\\$1\fR>\\$2
Packit 5bd3a9
.el <\fI\\$1\fP>\\$2
Packit 5bd3a9
..
Packit 5bd3a9
.ny0
Packit 5bd3a9
.TH XCreateImage __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
Packit 5bd3a9
.SH NAME
Packit 5bd3a9
XInitImage, XCreateImage, XGetPixel, XPutPixel, XSubImage, XAddPixel, XDestroyImage \- image utilities
Packit 5bd3a9
.SH SYNTAX
Packit 5bd3a9
.HP
Packit 5bd3a9
Status XInitImage\^(\^XImage *\fIimage\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
XImage *XCreateImage\^(\^Display *\fIdisplay\fP\^, Visual *\fIvisual\fP\^,
Packit 5bd3a9
unsigned int \fIdepth\fP\^, int \fIformat\fP\^, int \fIoffset\fP\^, char
Packit 5bd3a9
*\fIdata\fP\^, unsigned int \fIwidth\fP\^, unsigned int \fIheight\fP\^, int
Packit 5bd3a9
\fIbitmap_pad\fP\^, int \fIbytes_per_line\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
unsigned long XGetPixel\^(\^XImage *\fIximage\fP\^, int \fIx\fP\^, int
Packit 5bd3a9
\fIy\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
int XPutPixel\^(\^XImage *\fIximage\fP\^, int \fIx\fP\^, int \fIy\fP\^,
Packit 5bd3a9
unsigned long \fIpixel\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
XImage *XSubImage\^(\^XImage *\fIximage\fP\^, int \fIx\fP\^, int \fIy\fP\^,
Packit 5bd3a9
unsigned int \fIsubimage_width\fP\^, unsigned int \fIsubimage_height\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
int XAddPixel\^(\^XImage *\fIximage\fP\^, long \fIvalue\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
int XDestroyImage\^(\^XImage *\^\fIximage\fP\^); 
Packit 5bd3a9
.SH ARGUMENTS
Packit 5bd3a9
.IP \fIbitmap_pad\fP 1i
Packit 5bd3a9
Specifies the quantum of a scanline (8, 16, or 32).
Packit 5bd3a9
In other words, the start of one scanline is separated in client memory from 
Packit 5bd3a9
the start of the next scanline by an integer multiple of this many bits.  
Packit 5bd3a9
.IP \fIbytes_per_line\fP 1i
Packit 5bd3a9
Specifies the number of bytes in the client image between
Packit 5bd3a9
the start of one scanline and the start of the next.  
Packit 5bd3a9
.IP \fIdata\fP 1i
Packit 5bd3a9
Specifies the image data.
Packit 5bd3a9
.IP \fIdepth\fP 1i
Packit 5bd3a9
Specifies the depth of the image.
Packit 5bd3a9
.IP \fIdisplay\fP 1i
Packit 5bd3a9
Specifies the connection to the X server.
Packit 5bd3a9
.IP \fIformat\fP 1i
Packit 5bd3a9
Specifies the format for the image.
Packit 5bd3a9
You can pass
Packit 5bd3a9
.ZN XYBitmap ,
Packit 5bd3a9
.ZN XYPixmap ,
Packit 5bd3a9
or 
Packit 5bd3a9
.ZN ZPixmap .
Packit 5bd3a9
.IP \fIheight\fP 1i
Packit 5bd3a9
Specifies the height of the image, in pixels.
Packit 5bd3a9
.IP \fIoffset\fP 1i
Packit 5bd3a9
Specifies the number of pixels to ignore at the beginning of the scanline.
Packit 5bd3a9
.IP \fIpixel\fP 1i
Packit 5bd3a9
Specifies the new pixel value.
Packit 5bd3a9
.IP \fIsubimage_height\fP 1i
Packit 5bd3a9
Specifies the height of the new subimage, in pixels.
Packit 5bd3a9
.IP \fIsubimage_width\fP 1i
Packit 5bd3a9
Specifies the width of the new subimage, in pixels.
Packit 5bd3a9
.IP \fIvalue\fP 1i
Packit 5bd3a9
Specifies the constant value that is to be added.
Packit 5bd3a9
.IP \fIvisual\fP 1i
Packit 5bd3a9
Specifies the
Packit 5bd3a9
.ZN Visual
Packit 5bd3a9
structure.
Packit 5bd3a9
.IP \fIwidth\fP 1i
Packit 5bd3a9
Specifies the width of the image, in pixels.
Packit 5bd3a9
.IP \fIximage\fP 1i
Packit 5bd3a9
Specifies the image.
Packit 5bd3a9
.IP \fIx\fP 1i
Packit 5bd3a9
.br
Packit 5bd3a9
.ns
Packit 5bd3a9
.IP \fIy\fP 1i
Packit 5bd3a9
Specify the x and y coordinates.
Packit 5bd3a9
.SH DESCRIPTION
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XInitImage
Packit 5bd3a9
function initializes the internal image manipulation routines of an
Packit 5bd3a9
image structure, based on the values of the various structure members.
Packit 5bd3a9
All fields other than the manipulation routines must already be initialized.
Packit 5bd3a9
If the bytes_per_line member is zero,
Packit 5bd3a9
.ZN XInitImage
Packit 5bd3a9
will assume the image data is contiguous in memory and set the
Packit 5bd3a9
bytes_per_line member to an appropriate value based on the other
Packit 5bd3a9
members; otherwise, the value of bytes_per_line is not changed.
Packit 5bd3a9
All of the manipulation routines are initialized to functions
Packit 5bd3a9
that other Xlib image manipulation functions need to operate on the
Packit 5bd3a9
type of image specified by the rest of the structure.
Packit 5bd3a9
.LP
Packit 5bd3a9
This function must be called for any image constructed by the client
Packit 5bd3a9
before passing it to any other Xlib function.
Packit 5bd3a9
Image structures created or returned by Xlib do not need to be
Packit 5bd3a9
initialized in this fashion.
Packit 5bd3a9
.LP
Packit 5bd3a9
This function returns a nonzero status if initialization of the
Packit 5bd3a9
structure is successful.  It returns zero if it detected some error
Packit 5bd3a9
or inconsistency in the structure, in which case the image is not changed.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XCreateImage
Packit 5bd3a9
function allocates the memory needed for an
Packit 5bd3a9
.ZN XImage
Packit 5bd3a9
structure for the
Packit 5bd3a9
specified display but does not allocate space for the image itself.
Packit 5bd3a9
Rather, it initializes the structure byte-order, bit-order, and bitmap-unit
Packit 5bd3a9
values from the display and returns a pointer to the 
Packit 5bd3a9
.ZN XImage 
Packit 5bd3a9
structure.
Packit 5bd3a9
The red, green, and blue mask values are defined for Z format images only
Packit 5bd3a9
and are derived from the 
Packit 5bd3a9
.ZN Visual 
Packit 5bd3a9
structure passed in.
Packit 5bd3a9
Other values also are passed in.
Packit 5bd3a9
The offset permits the rapid displaying of the image without requiring each 
Packit 5bd3a9
scanline to be shifted into position.
Packit 5bd3a9
If you pass a zero value in bytes_per_line,
Packit 5bd3a9
Xlib assumes that the scanlines are contiguous
Packit 5bd3a9
in memory and calculates the value of bytes_per_line itself.
Packit 5bd3a9
.LP
Packit 5bd3a9
Note that when the image is created using
Packit 5bd3a9
.ZN XCreateImage ,
Packit 5bd3a9
.ZN XGetImage ,
Packit 5bd3a9
or
Packit 5bd3a9
.ZN XSubImage ,
Packit 5bd3a9
the destroy procedure that the 
Packit 5bd3a9
.ZN XDestroyImage
Packit 5bd3a9
function calls frees both the image structure 
Packit 5bd3a9
and the data pointed to by the image structure.
Packit 5bd3a9
.LP
Packit 5bd3a9
The basic functions used to get a pixel, set a pixel, create a subimage,
Packit 5bd3a9
and add a constant value to an image are defined in the image object.
Packit 5bd3a9
The functions in this section are really macro invocations of the functions
Packit 5bd3a9
in the image object and are defined in
Packit 5bd3a9
.hN X11/Xutil.h .
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XGetPixel
Packit 5bd3a9
function returns the specified pixel from the named image.
Packit 5bd3a9
The pixel value is returned in normalized format (that is,
Packit 5bd3a9
the least significant byte of the long is the least significant byte
Packit 5bd3a9
of the pixel).
Packit 5bd3a9
The image must contain the x and y coordinates.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XPutPixel
Packit 5bd3a9
function overwrites the pixel in the named image with the specified pixel value.
Packit 5bd3a9
The input pixel value must be in normalized format
Packit 5bd3a9
(that is, the least significant byte of the long is the least significant
Packit 5bd3a9
byte of the pixel).
Packit 5bd3a9
The image must contain the x and y coordinates.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XSubImage
Packit 5bd3a9
function creates a new image that is a subsection of an existing one.
Packit 5bd3a9
It allocates the memory necessary for the new
Packit 5bd3a9
.ZN XImage
Packit 5bd3a9
structure
Packit 5bd3a9
and returns a pointer to the new image.
Packit 5bd3a9
The data is copied from the source image,
Packit 5bd3a9
and the image must contain the rectangle defined by x, y, subimage_width,
Packit 5bd3a9
and subimage_height.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XAddPixel
Packit 5bd3a9
function adds a constant value to every pixel in an image.
Packit 5bd3a9
It is useful when you have a base pixel value from allocating
Packit 5bd3a9
color resources and need to manipulate the image to that form.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XDestroyImage
Packit 5bd3a9
function deallocates the memory associated with the
Packit 5bd3a9
.ZN XImage
Packit 5bd3a9
structure.
Packit 5bd3a9
.SH "SEE ALSO"
Packit 5bd3a9
XPutImage(__libmansuffix__)
Packit 5bd3a9
.br
Packit 5bd3a9
\fI\*(xL\fP