You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_Image object:
Cvo_Image
#include
<Cvo/Image.h++>
new
Cvo_Image ( Cvo_Window *window,
[ char *filename,
[ char *resource ] ] )
new
Cvo_Image ( Cvo_Window *window,
int width,
int height,
int depth,
CARD8 *bitmap )
new
Cvo_Image ( Cvo_Window *window,
int width,
int height,
int ncolors,
int cpp,
char **colors,
char **pixels )
The Cvo_Image object stores an image (pixmap or bitmap) for later display in another object. The window parameter is used to determine things such as the display and depth of the window. It is also used for caching so that if the same image is loaded several times it will be shared. The window itself is used to look at resources, but for all other purposes the root window of that tree is used (so sibling windows may share Cvo_Image objects).
In all cases, if the resource pixmapFile(PixmapFile) (or
resource(PixmapFile) in the first construction method) identifies
a valid file, that file will be used and all other arguments will be
ignored. Valid file formats are: XBM
(X11 Bitmap), XPM
and
XPM2
.
If a filename argument is passed, the Cvo_Image object attempts to load an image from that file.
If width, height, depth and bitmap are specified they should refer to a valid X11 bitmap.
If width, height, ncolors, cpp, colors, and pixels are specified, they should refer to a valid XPM pixmap. The array colors is two string pairs (i.e. 2 * ncolors strings) in which the first string describes the code for the color and the second string identifies the color. The pixels array should consist of height strings, each identifying width pixels by the codes given in the colors string array.
This object defines the following member functions.
BOOL Loaded (
)
Return True
if an image has been loaded, False
if not.
ResetWindow (
arg Cvo_Window *window
)
Reset the Cvo_Window the Cvo_Image is associated with to be window.
int Width (
)
int Height (
)
Return the width or height of the image.
Show (
int x,
int y,
[ int width, int height,
[ int sx, int sy ] ] )
Copy the image to the location (x,y) in the window associated with the Cvo_Image object. The optional width and height arguments will be used as the size of the image to copy, for partial copies. If sx and sy are specified, they will be used as an offset into the image, rather than the default of (0,0).
Select (
)
UnSelect (
)
These functions set and unset the selected attribute of the image. If selected, the image will be drawn in either reverse video (monochrome windows) or with the first color darkened (color windows).
Cvo_XImage *Image (
)
Return the Cvo_XImage used for this Cvo_Image object's image. This is generally not useful.
Pixmap GetPixmap (
)
This function returns an X11 Pixmap
associated with this object's
image. This may cause the creation of the X11 pixmap if no pixmap
had been created up to this point.
Pixmap Mask (
)
This function returns a Pixmap
containing the mask for the X11
pixmap associated with this object's image. This may cause the
creation of the X11 pixmap if no pixmap had been created up to this
point.
See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.