# xwindow.c File Reference

`#include "magick/studio.h"`
`#include "magick/animate.h"`
`#include "magick/blob.h"`
`#include "magick/client.h"`
`#include "magick/color.h"`
`#include "magick/color-private.h"`
`#include "magick/composite.h"`
`#include "magick/display.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/geometry.h"`
`#include "magick/identify.h"`
`#include "magick/image.h"`
`#include "magick/image-private.h"`
`#include "magick/list.h"`
`#include "magick/locale_.h"`
`#include "magick/log.h"`
`#include "magick/magick.h"`
`#include "magick/memory_.h"`
`#include "magick/monitor.h"`
`#include "magick/option.h"`
`#include "magick/PreRvIcccm.h"`
`#include "magick/quantize.h"`
`#include "magick/quantum.h"`
`#include "magick/quantum-private.h"`
`#include "magick/resource_.h"`
`#include "magick/resize.h"`
`#include "magick/shear.h"`
`#include "magick/statistic.h"`
`#include "magick/string_.h"`
`#include "magick/transform.h"`
`#include "magick/utility.h"`
`#include "magick/widget.h"`
`#include "magick/xwindow.h"`
`#include "magick/xwindow-private.h"`
`#include "magick/version.h"`
`#include <X11/Xproto.h>`
`#include <X11/Xlocale.h>`
`#include <sys/ipc.h>`
`#include <sys/shm.h>`
`#include <X11/extensions/XShm.h>`
`#include <X11/extensions/shape.h>`

## Data Structures
struct | _DiversityPacket
## Defines
#define | XBlueGamma(color)
#define | XGammaPixel(map, color)
#define | XGreenGamma(color)
#define | XRedGamma(color)
#define | XStandardPixel(map, color)
#define | AccentuateModulate ScaleCharToQuantum(80)
#define | HighlightModulate ScaleCharToQuantum(125)
#define | ShadowModulate ScaleCharToQuantum(135)
#define | DepthModulate ScaleCharToQuantum(185)
#define | TroughModulate ScaleCharToQuantum(110)
#define | XLIB_ILLEGAL_ACCESS 1
#define | XFD_SET fd_set
#define | MaxStandardColormaps 7
#define | XVisualColormapSize(visual_info)
#define | scope_height 17
#define | scope_x_hot 8
#define | scope_y_hot 8
#define | scope_width 17
#define | MinWindowSize 64
#define | MinimumCropArea (unsigned int) 9
## Typedefs
typedef struct _DiversityPacket | DiversityPacket
## Enumerations
enum | XColorFlags { DoRed = 0x0001, DoGreen = 0x0002, DoBlue = 0x0004, DoMatte = 0x0008 }
## Functions
static const char * | XVisualClassName (const int)
static MagickBooleanType | XMakePixmap (Display *, const XResourceInfo *, XWindowInfo *)
static void | XMakeImageLSBFirst (const XResourceInfo *, const XWindowInfo *, Image *, XImage *, XImage *)
static void | XMakeImageMSBFirst (const XResourceInfo *, const XWindowInfo *, Image *, XImage *, XImage *)
static Window | XSelectWindow (Display *, RectangleInfo *)
MagickExport void | DestroyXResources (void)
MagickExport MagickBooleanType | XAnnotateImage (Display *display, const XPixelInfo *pixel, XAnnotateInfo *annotate_info, Image *image)
static char ** | FontToList (char *font)
MagickExport XFontStruct * | XBestFont (Display *display, const XResourceInfo *resource_info, const MagickBooleanType text_font)
MagickExport void | XBestIconSize (Display *display, XWindowInfo *window, Image *image)
MagickExport void | XBestPixel (Display *display, const Colormap colormap, XColor *colors, unsigned int number_colors, XColor *color)
static int | MagickMax (const int x, const int y)
static unsigned long | MagickMin (const unsigned int x, const unsigned int y)
MagickExport XVisualInfo * | XBestVisualInfo (Display *display, XStandardColormap *map_info, XResourceInfo *resource_info)
MagickExport int | XCheckDefineCursor (Display *display, Window window, Cursor cursor)
MagickExport void | XCheckRefreshWindows (Display *display, XWindows *windows)
MagickExport void | XClientMessage (Display *display, const Window window, const Atom protocol, const Atom reason, const Time timestamp)
static Window | XClientWindow (Display *display, Window target_window)
MagickExport void | XConfigureImageColormap (Display *display, XResourceInfo *resource_info, XWindows *windows, Image *image)
MagickExport void | XConstrainWindowPosition (Display *display, XWindowInfo *window_info)
MagickExport void | XDelay (Display *display, const unsigned long milliseconds)
MagickExport void | XDestroyResourceInfo (XResourceInfo *resource_info)
MagickExport void | XDestroyWindowColors (Display *display, Window window)
MagickExport void | XDisplayImageInfo (Display *display, const XResourceInfo *resource_info, XWindows *windows, Image *undo_image, Image *image)
static void | XDitherImage (Image *image, XImage *ximage)
MagickExport MagickBooleanType | XDrawImage (Display *display, const XPixelInfo *pixel, XDrawInfo *draw_info, Image *image)
MagickExport int | XError (Display *display, XErrorEvent *error)
MagickExport void | XFreeResources (Display *display, XVisualInfo *visual_info, XStandardColormap *map_info, XPixelInfo *pixel, XFontStruct *font_info, XResourceInfo *resource_info, XWindowInfo *window_info)
MagickExport void | XFreeStandardColormap (Display *display, const XVisualInfo *visual_info, XStandardColormap *map_info, XPixelInfo *pixel)
MagickExport void | XGetAnnotateInfo (XAnnotateInfo *annotate_info)
MagickExport void | XGetMapInfo (const XVisualInfo *visual_info, const Colormap colormap, XStandardColormap *map_info)
MagickExport void | XGetPixelPacket (Display *display, const XVisualInfo *visual_info, const XStandardColormap *map_info, const XResourceInfo *resource_info, Image *image, XPixelInfo *pixel)
MagickExport char * | XGetResourceClass (XrmDatabase database, const char *client_name, const char *keyword, char *resource_default)
MagickExport XrmDatabase | XGetResourceDatabase (Display *display, const char *client_name)
MagickExport void | XGetResourceInfo (XrmDatabase database, const char *client_name, XResourceInfo *resource_info)
MagickExport char * | XGetResourceInstance (XrmDatabase database, const char *client_name, const char *keyword, const char *resource_default)
MagickExport char * | XGetScreenDensity (Display *display)
static Window | XGetSubwindow (Display *display, Window window, int x, int y)
MagickExport MagickBooleanType | XGetWindowColor (Display *display, XWindows *windows, char *name)
static Image * | XGetWindowImage (Display *display, const Window window, const unsigned int borders, const unsigned int level)
MagickExport void | XGetWindowInfo (Display *display, XVisualInfo *visual_info, XStandardColormap *map_info, XPixelInfo *pixel, XFontStruct *font_info, XResourceInfo *resource_info, XWindowInfo *window)
MagickExport void | XHighlightEllipse (Display *display, Window window, GC annotate_context, const RectangleInfo *highlight_info)
MagickExport void | XHighlightLine (Display *display, Window window, GC annotate_context, const XSegment *highlight_info)
MagickExport void | XHighlightRectangle (Display *display, Window window, GC annotate_context, const RectangleInfo *highlight_info)
MagickExport Image * | XImportImage (const ImageInfo *image_info, XImportInfo *ximage_info)
MagickExport XWindows * | XInitializeWindows (Display *display, XResourceInfo *resource_info)
MagickExport Cursor | XMakeCursor (Display *display, Window window, Colormap colormap, char *background_color, char *foreground_color)
MagickExport MagickBooleanType | XMakeImage (Display *display, const XResourceInfo *resource_info, XWindowInfo *window, Image *image, unsigned int width, unsigned int height)
MagickExport void | XMakeMagnifyImage (Display *display, XWindows *windows)
static MagickRealType | DiversityPixelIntensity (const DiversityPacket *pixel)
static int | IntensityCompare (const void *x, const void *y)
static int | PopularityCompare (const void *x, const void *y)
static Quantum | ScaleXToQuantum (const unsigned long x, const unsigned long scale)
MagickExport void | XMakeStandardColormap (Display *display, XVisualInfo *visual_info, XResourceInfo *resource_info, Image *image, XStandardColormap *map_info, XPixelInfo *pixel)
MagickExport void | XMakeWindow (Display *display, Window parent, char **argv, int argc, XClassHint *class_hint, XWMHints *manager_hints, XWindowInfo *window_info)
static const char * | GetLocaleMonitorMessage (const char *tag)
MagickExport MagickBooleanType | XMagickProgressMonitor (const char *tag, const MagickOffsetType quantum, const MagickSizeType span, void *magick_unused(client_data))
MagickExport MagickBooleanType | XQueryColorDatabase (const char *target, XColor *color)
MagickExport void | XQueryPosition (Display *display, const Window window, int *x, int *y)
MagickExport void | XRefreshWindow (Display *display, const XWindowInfo *window, const XEvent *event)
MagickExport MagickBooleanType | XRemoteCommand (Display *display, const char *window, const char *filename)
MagickExport void | XRetainWindowColors (Display *display, const Window window)
MagickExport void | XSetCursorState (Display *display, XWindows *windows, const MagickStatusType state)
MagickExport XWindows * | XSetWindows (XWindows *windows_info)
MagickExport void | XUserPreferences (XResourceInfo *resource_info)
MagickExport void | XWarning (const ExceptionType magick_unused(warning), const char *reason, const char *description)
MagickExport Window | XWindowByID (Display *display, const Window root_window, const unsigned long id)
MagickExport Window | XWindowByName (Display *display, const Window root_window, const char *name)
MagickExport Window | XWindowByProperty (Display *display, const Window window, const Atom property)
MagickExport void | XGetImportInfo (XImportInfo *ximage_info)
## Variables
static MagickBooleanType | xerror_alert = MagickFalse
static MagickRealType | blue_gamma = 1.0
static MagickRealType | green_gamma = 1.0
static MagickRealType | red_gamma = 1.0

## Define Documentation

#define AccentuateModulate ScaleCharToQuantum(80)

#define DepthModulate ScaleCharToQuantum(185)

#define HighlightModulate ScaleCharToQuantum(125)

#define MaxStandardColormaps 7

#define MinimumCropArea (unsigned int) 9

#define MinWindowSize 64

#define scope_height 17

#define scope_width 17

#define scope_x_hot 8

#define scope_y_hot 8

#define ShadowModulate ScaleCharToQuantum(135)

#define TroughModulate ScaleCharToQuantum(110)

#define XBlueGamma | ( | color |  | ) |

Value:

    RoundToQuantum(blue_gamma == 1.0 ? (double) \
      (color) : ((pow(((double) QuantumScale*(color)),1.0/(double) blue_gamma)* \
      QuantumRange)))

#define XFD_SET fd_set

#define XGammaPixel | ( | map,
|  | color |  | ) |

Value:

    (unsigned long) (map->base_pixel+ \
      ((ScaleQuantumToShort(XRedGamma((color)->red))*map->red_max/65535L)* \
        map->red_mult)+ \
      ((ScaleQuantumToShort(XGreenGamma((color)->green))*map->green_max/65535L)* \
        map->green_mult)+ \
      ((ScaleQuantumToShort(XBlueGamma((color)->blue))*map->blue_max/65535L)* \
        map->blue_mult))

#define XGreenGamma | ( | color |  | ) |

Value:

    RoundToQuantum(green_gamma == 1.0 ? (double) \
      (color) : ((pow(((double) QuantumScale*(color)),1.0/(double) green_gamma)* \
      QuantumRange)))

#define XLIB_ILLEGAL_ACCESS 1

#define XRedGamma | ( | color |  | ) |

Value:

    RoundToQuantum(red_gamma == 1.0 ? (double) \
      (color) : ((pow(((double) QuantumScale*(color)),1.0/(double) red_gamma)* \
      QuantumRange)))

#define XStandardPixel | ( | map,
|  | color |  | ) |

Value:

    (unsigned long) (map->base_pixel+ \
      (((color)->red*map->red_max/65535L)*map->red_mult)+ \
      (((color)->green*map->green_max/65535L)*map->green_mult)+ \
      (((color)->blue*map->blue_max/65535L)*map->blue_mult))

#define XVisualColormapSize | ( | visual_info |  | ) |

Value:

    MagickMin((unsigned int) (\
      (visual_info->klass == TrueColor) || (visual_info->klass == DirectColor) ? \
       visual_info->red_mask | visual_info->green_mask | visual_info->blue_mask : \
       (unsigned int) visual_info->colormap_size),1U << visual_info->depth)

## Typedef Documentation

typedef struct _DiversityPacket DiversityPacket

## Enumeration Type Documentation

enum XColorFlags

Enumerator:

  DoRed |
  DoGreen |
  DoBlue |
  DoMatte |

## Function Documentation

MagickExport void DestroyXResources | ( | void |  | ) |

static MagickRealType DiversityPixelIntensity | ( | const DiversityPacket * | pixel | ) | `[inline, static]`

static char** FontToList | ( | char * | font | ) | `[static]`

static const char* GetLocaleMonitorMessage | ( | const char * | tag | ) | `[static]`

static int IntensityCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static int MagickMax | ( | const int | x,
|  | const int | y |
| ) |  |  | `[inline, static]`

static unsigned long MagickMin | ( | const unsigned int | x,
|  | const unsigned int | y |
| ) |  |  | `[inline, static]`

static int PopularityCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static Quantum ScaleXToQuantum | ( | const unsigned long | x,
|  | const unsigned long | scale |
| ) |  |  | `[inline, static]`

MagickExport MagickBooleanType XAnnotateImage | ( | Display * | display,
|  | const XPixelInfo * | pixel,
|  | XAnnotateInfo * | annotate_info,
|  | Image * | image |
| ) |  |  |

MagickExport XFontStruct* XBestFont | ( | Display * | display,
|  | const XResourceInfo * | resource_info,
|  | const MagickBooleanType | text_font |
| ) |  |  |

MagickExport void XBestIconSize | ( | Display * | display,
|  | XWindowInfo * | window,
|  | Image * | image |
| ) |  |  |

MagickExport void XBestPixel | ( | Display * | display,
|  | const Colormap | colormap,
|  | XColor * | colors,
|  | unsigned int | number_colors,
|  | XColor * | color |
| ) |  |  |

MagickExport XVisualInfo* XBestVisualInfo | ( | Display * | display,
|  | XStandardColormap * | map_info,
|  | XResourceInfo * | resource_info |
| ) |  |  |

MagickExport int XCheckDefineCursor | ( | Display * | display,
|  | Window | window,
|  | Cursor | cursor |
| ) |  |  |

MagickExport void XCheckRefreshWindows | ( | Display * | display,
|  | XWindows * | windows |
| ) |  |  |

MagickExport void XClientMessage | ( | Display * | display,
|  | const Window | window,
|  | const Atom | protocol,
|  | const Atom | reason,
|  | const Time | timestamp |
| ) |  |  |

static Window XClientWindow | ( | Display * | display,
|  | Window | target_window |
| ) |  |  | `[static]`

MagickExport void XConfigureImageColormap | ( | Display * | display,
|  | XResourceInfo * | resource_info,
|  | XWindows * | windows,
|  | Image * | image |
| ) |  |  |

MagickExport void XConstrainWindowPosition | ( | Display * | display,
|  | XWindowInfo * | window_info |
| ) |  |  |

MagickExport void XDelay | ( | Display * | display,
|  | const unsigned long | milliseconds |
| ) |  |  |

MagickExport void XDestroyResourceInfo | ( | XResourceInfo * | resource_info | ) |

MagickExport void XDestroyWindowColors | ( | Display * | display,
|  | Window | window |
| ) |  |  |

MagickExport void XDisplayImageInfo | ( | Display * | display,
|  | const XResourceInfo * | resource_info,
|  | XWindows * | windows,
|  | Image * | undo_image,
|  | Image * | image |
| ) |  |  |

static void XDitherImage | ( | Image * | image,
|  | XImage * | ximage |
| ) |  |  | `[static]`

MagickExport MagickBooleanType XDrawImage | ( | Display * | display,
|  | const XPixelInfo * | pixel,
|  | XDrawInfo * | draw_info,
|  | Image * | image |
| ) |  |  |

MagickExport int XError | ( | Display * | display,
|  | XErrorEvent * | error |
| ) |  |  |

MagickExport void XFreeResources | ( | Display * | display,
|  | XVisualInfo * | visual_info,
|  | XStandardColormap * | map_info,
|  | XPixelInfo * | pixel,
|  | XFontStruct * | font_info,
|  | XResourceInfo * | resource_info,
|  | XWindowInfo * | window_info |
| ) |  |  |

MagickExport void XFreeStandardColormap | ( | Display * | display,
|  | const XVisualInfo * | visual_info,
|  | XStandardColormap * | map_info,
|  | XPixelInfo * | pixel |
| ) |  |  |

MagickExport void XGetAnnotateInfo | ( | XAnnotateInfo * | annotate_info | ) |

MagickExport void XGetImportInfo | ( | XImportInfo * | ximage_info | ) |

MagickExport void XGetMapInfo | ( | const XVisualInfo * | visual_info,
|  | const Colormap | colormap,
|  | XStandardColormap * | map_info |
| ) |  |  |

MagickExport void XGetPixelPacket | ( | Display * | display,
|  | const XVisualInfo * | visual_info,
|  | const XStandardColormap * | map_info,
|  | const XResourceInfo * | resource_info,
|  | Image * | image,
|  | XPixelInfo * | pixel |
| ) |  |  |

MagickExport char* XGetResourceClass | ( | XrmDatabase | database,
|  | const char * | client_name,
|  | const char * | keyword,
|  | char * | resource_default |
| ) |  |  |

MagickExport XrmDatabase XGetResourceDatabase | ( | Display * | display,
|  | const char * | client_name |
| ) |  |  |

MagickExport void XGetResourceInfo | ( | XrmDatabase | database,
|  | const char * | client_name,
|  | XResourceInfo * | resource_info |
| ) |  |  |

MagickExport char* XGetResourceInstance | ( | XrmDatabase | database,
|  | const char * | client_name,
|  | const char * | keyword,
|  | const char * | resource_default |
| ) |  |  |

MagickExport char* XGetScreenDensity | ( | Display * | display | ) |

static Window XGetSubwindow | ( | Display * | display,
|  | Window | window,
|  | int | x,
|  | int | y |
| ) |  |  | `[static]`

MagickExport MagickBooleanType XGetWindowColor | ( | Display * | display,
|  | XWindows * | windows,
|  | char * | name |
| ) |  |  |

static Image* XGetWindowImage | ( | Display * | display,
|  | const Window | window,
|  | const unsigned int | borders,
|  | const unsigned int | level |
| ) |  |  | `[static]`

MagickExport void XGetWindowInfo | ( | Display * | display,
|  | XVisualInfo * | visual_info,
|  | XStandardColormap * | map_info,
|  | XPixelInfo * | pixel,
|  | XFontStruct * | font_info,
|  | XResourceInfo * | resource_info,
|  | XWindowInfo * | window |
| ) |  |  |

MagickExport void XHighlightEllipse | ( | Display * | display,
|  | Window | window,
|  | GC | annotate_context,
|  | const RectangleInfo * | highlight_info |
| ) |  |  |

MagickExport void XHighlightLine | ( | Display * | display,
|  | Window | window,
|  | GC | annotate_context,
|  | const XSegment * | highlight_info |
| ) |  |  |

MagickExport void XHighlightRectangle | ( | Display * | display,
|  | Window | window,
|  | GC | annotate_context,
|  | const RectangleInfo * | highlight_info |
| ) |  |  |

MagickExport Image* XImportImage | ( | const ImageInfo * | image_info,
|  | XImportInfo * | ximage_info |
| ) |  |  |

MagickExport XWindows* XInitializeWindows | ( | Display * | display,
|  | XResourceInfo * | resource_info |
| ) |  |  |

MagickExport MagickBooleanType XMagickProgressMonitor | ( | const char * | tag,
|  | const MagickOffsetType | quantum,
|  | const MagickSizeType | span,
|  | void * | magick_unused(client_data) |
| ) |  |  |

MagickExport Cursor XMakeCursor | ( | Display * | display,
|  | Window | window,
|  | Colormap | colormap,
|  | char * | background_color,
|  | char * | foreground_color |
| ) |  |  |

MagickExport MagickBooleanType XMakeImage | ( | Display * | display,
|  | const XResourceInfo * | resource_info,
|  | XWindowInfo * | window,
|  | Image * | image,
|  | unsigned int | width,
|  | unsigned int | height |
| ) |  |  |

static void XMakeImageLSBFirst | ( | const XResourceInfo * | resource_info,
|  | const XWindowInfo * | window,
|  | Image * | image,
|  | XImage * | ximage,
|  | XImage * | matte_image |
| ) |  |  | `[static]`

static void XMakeImageMSBFirst | ( | const XResourceInfo * | resource_info,
|  | const XWindowInfo * | window,
|  | Image * | image,
|  | XImage * | ximage,
|  | XImage * | matte_image |
| ) |  |  |

MagickExport void XMakeMagnifyImage | ( | Display * | display,
|  | XWindows * | windows |
| ) |  |  |

static MagickBooleanType XMakePixmap | ( | Display * | display,
|  | const XResourceInfo * | resource_info,
|  | XWindowInfo * | window |
| ) |  |  | `[static]`

MagickExport void XMakeStandardColormap | ( | Display * | display,
|  | XVisualInfo * | visual_info,
|  | XResourceInfo * | resource_info,
|  | Image * | image,
|  | XStandardColormap * | map_info,
|  | XPixelInfo * | pixel |
| ) |  |  |

MagickExport void XMakeWindow | ( | Display * | display,
|  | Window | parent,
|  | char ** | argv,
|  | int | argc,
|  | XClassHint * | class_hint,
|  | XWMHints * | manager_hints,
|  | XWindowInfo * | window_info |
| ) |  |  |

MagickExport MagickBooleanType XQueryColorDatabase | ( | const char * | target,
|  | XColor * | color |
| ) |  |  |

MagickExport void XQueryPosition | ( | Display * | display,
|  | const Window | window,
|  | int * | x,
|  | int * | y |
| ) |  |  |

MagickExport void XRefreshWindow | ( | Display * | display,
|  | const XWindowInfo * | window,
|  | const XEvent * | event |
| ) |  |  |

MagickExport MagickBooleanType XRemoteCommand | ( | Display * | display,
|  | const char * | window,
|  | const char * | filename |
| ) |  |  |

MagickExport void XRetainWindowColors | ( | Display * | display,
|  | const Window | window |
| ) |  |  |

static Window XSelectWindow | ( | Display * | display,
|  | RectangleInfo * | crop_info |
| ) |  |  | `[static]`

MagickExport void XSetCursorState | ( | Display * | display,
|  | XWindows * | windows,
|  | const MagickStatusType | state |
| ) |  |  |

MagickExport XWindows* XSetWindows | ( | XWindows * | windows_info | ) |

MagickExport void XUserPreferences | ( | XResourceInfo * | resource_info | ) |

static const char * XVisualClassName | ( | const | int | ) | `[static]`

MagickExport void XWarning | ( | const ExceptionType | magick_unused(warning),
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

MagickExport Window XWindowByID | ( | Display * | display,
|  | const Window | root_window,
|  | const unsigned long | id |
| ) |  |  |

MagickExport Window XWindowByName | ( | Display * | display,
|  | const Window | root_window,
|  | const char * | name |
| ) |  |  |

MagickExport Window XWindowByProperty | ( | Display * | display,
|  | const Window | window,
|  | const Atom | property |
| ) |  |  |

## Variable Documentation

MagickRealType blue_gamma = 1.0`[static]`

MagickRealType green_gamma = 1.0`[static]`

MagickRealType red_gamma = 1.0`[static]`

MagickBooleanType xerror_alert = MagickFalse`[static]`