multivis.h revision 469
87N/A#ifndef _MULTIVIS_H
70N/A#define _MULTIVIS_H
292N/A/*-
70N/A * multivis.h - Header file for Mechanism for GetImage across Multiple Visuals
70N/A *
70N/A * @(#)multivis.h 35.1 94/09/01
70N/A *
70N/A * Copyright (c) 1989,90 by Sun Microsystems, Inc.
70N/A *
70N/A * Permission to use, copy, modify, and distribute this software and its
70N/A * documentation for any purpose and without fee is hereby granted,
70N/A * provided that the above copyright notice appear in all copies and that
70N/A * both that copyright notice and this permission notice appear in
70N/A * supporting documentation.
70N/A *
70N/A * This file is provided AS IS with no warranties of any kind. The author
70N/A * shall have no liability with respect to the infringement of copyrights,
70N/A * trade secrets or any patents by this file or any part thereof. In no
70N/A * event will the author be liable for any lost revenue or profits or
70N/A * other special, indirect and consequential damages.
70N/A *
70N/A * Comments and additions should be sent to the author:
70N/A *
70N/A * milind@Eng.Sun.COM
70N/A *
70N/A * Milind M. Pansare
70N/A * MS 14-01
70N/A * Windows and Graphics Group
70N/A * Sun Microsystems, Inc.
70N/A * 2550 Garcia Ave
292N/A * Mountain View, CA 94043
70N/A *
70N/A * Revision History:
70N/A * 11-15-90 Written
70N/A */
156N/A
70N/A#include <X11/Xlib.h>
156N/A#include <X11/Xutil.h>
70N/A#include <stdio.h>
70N/A/*
70N/A * Data Structures used ...
70N/A*/
70N/A
70N/Atypedef struct _colmap { /* Colormap Information */
70N/A Colormap cmap; /* X Colormap ID */
70N/A XColor *Colors; /* Actual list of RGB values */
70N/A struct _colmap *next; /* link in chain */
156N/A int doComposite; /* True for Direct & TrueColor */
156N/A unsigned long red_mask, /* All these valid only for */
156N/A green_mask, /* Direct & TrueColor */
156N/A blue_mask;
156N/A unsigned long rmax, /* Max indices into each primary */
156N/A gmax,
156N/A bmax;
156N/A int rshft, /* Quick calcs for later */
70N/A gshft,
70N/A bshft,
70N/A rgbshft;
156N/A} MVColmap;
87N/A
162N/Atypedef struct _winVisInfo { /* A window & it's VisualInfo */
87N/A Window window;
70N/A int depth;
70N/A XVisualInfo *visinfo;
87N/A MVColmap *colmap; /* Colormap information */
70N/A int x, y, width, height; /* GetImage, in window space */
292N/A int x1, y1; /* Top left of image in root space */
292N/A#ifdef SHAPE
292N/A Region region; /* Computed effective bounding region */
292N/A#endif /* SHAPE */
87N/A} MVWinVisInfo;
255N/A
292N/Atypedef struct _winVisInfoList { /* An Array of winVisInfo */
87N/A unsigned long allocated, used;
87N/A MVWinVisInfo *wins;
156N/A} MVWinVisInfoList;
70N/A
70N/Atypedef struct _pel { /* One for each pixel position */
70N/A MVColmap *colmap; /* cmap used for this position */
70N/A unsigned long pixel; /* pixel value */
70N/A} MVPel;
70N/A
70N/A/*
70N/A * CAUTION: There will be one _pel for each pixel position in the
70N/A * requested dump area. This could potentially explode the data space.
292N/A * There are 2 remedies for this.
70N/A * 1. Dump small areas at a time
156N/A * 2. Change this data structure to contain only the final RGB value,
278N/A * if the pixel value is not of consequence to the application.
* Pixel Examination type of clients (eg. XMag) require the
* pixel value, and operate on a relatively small dump area, so this
* is not a problem.
*/
/*
* Defines & macros ...
*/
/* Return MVPel * for this pixel position */
#define mvFindPel(x,y) ((mvImg+((y)*request_width))+(x))
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))
/* This is the number of windows we typically expect on a desktop */
#define MV_WIN_TUNE1 20
/* If not, this is a likely multiplier ... */
#define MV_WIN_TUNE2 2
#ifdef UPDATE_HACK
typedef void (*mvCallbackFunc)(void *);
#endif /* UPDATE_HACK */
/*
* extern declarations ... These are the mvLib's PUBLIC routines
* There are no other PUBLIC interfaces to mvLib.
* None of the Data Structures are PUBLIC.
*/
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif /* __cplusplus */
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
int mvShifts(unsigned long mask);
int mvOnes(unsigned long mask);
#ifdef UPDATE_HACK
void mvInit(Display *display, int screen, XVisualInfo *visuals, int numVisual,
void *callbackFunction, mvCallbackFunc cbFunction);
#else
void mvInit(Display *display, int screen, XVisualInfo *visuals, int numVisual);
#endif /* UPDATE_HACK */
void mvReset();
void mvWalkTree(Window window, int parentX, int parentY,
int requestX, int requestY, int requestWidth, int requestHeight
#ifdef SHAPE
, Bool ancestorShaped, Region ancestorRegion
#endif /* SHAPE */
);
int mvIsMultiVis();
int mvCreatImg(int width, int height, int x, int y);
void mvDoWindowsFrontToBack();
XColor *mvFindColorInColormap(int x, int y);
#else /* ! __STDC__ */
extern int mvShifts();
extern int mvOnes();
extern void mvInit();
extern void mvReset();
extern void mvWalkTree();
extern int mvIsMultiVis();
extern int mvCreatImg();
extern void mvDoWindowsFrontToBack();
extern XColor *mvFindColorInColormap();
#endif /* __STDC__ */
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif /* __cplusplus */
#endif /* _MULTIVIS_H */