18#ifndef MAGICKCORE_XWINDOW_PRIVATE_H
19#define MAGICKCORE_XWINDOW_PRIVATE_H
21#include "MagickCore/draw.h"
22#include "MagickCore/exception.h"
23#include "MagickCore/geometry.h"
24#include "MagickCore/nt-base-private.h"
25#include "MagickCore/pixel-accessor.h"
26#include "MagickCore/quantize.h"
28#if defined(__cplusplus) || defined(c_plusplus)
32#if defined(MAGICKCORE_X11_DELEGATE)
37#include <X11/cursorfont.h>
38#include <X11/keysym.h>
39#include <X11/Xresource.h>
42#if defined(__cplusplus) || defined(c_plusplus)
49#define MaxNumberPens 11
50#define MaxNumberFonts 11
54#define ThrowXWindowException(severity,tag,context) \
59 exception=AcquireExceptionInfo(); \
60 (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
61 "'%s': %s",context,strerror(errno)); \
62 CatchException(exception); \
63 (void) DestroyExceptionInfo(exception); \
65#define ThrowXWindowFatalException(severity,tag,context) \
67 ThrowXWindowException(severity,tag,context); \
105typedef struct _XDrawInfo
143 geometry[MagickPathExtent];
148 DefaultState = 0x0000U,
149 EscapeState = 0x0001U,
151 FormerImageState = 0x0004U,
152 ModifierState = 0x0008U,
153 MontageImageState = 0x0010U,
154 NextImageState = 0x0020U,
155 RetainColorsState = 0x0040U,
157 UpdateConfigurationState = 0x0080U,
158 UpdateRegionState = 0x0100U
161typedef struct _XAnnotateInfo
184 geometry[MagickPathExtent];
186 struct _XAnnotateInfo
191typedef struct _XPixelInfo
210 pen_colors[MaxNumberPens];
225typedef struct _XResourceInfo
269 *font_name[MaxNumberFonts],
296 *pen_colors[MaxNumberPens];
328 home_directory[MagickPathExtent],
335typedef struct _XWindowInfo
440typedef struct _XWindows
497extern MagickPrivate Cursor
498 XMakeCursor(Display *,Window,Colormap,
char *,
char *);
500extern MagickPrivate
int
501 XCheckDefineCursor(Display *,Window,Cursor);
503extern MagickPrivate MagickBooleanType
504 XAnnotateImage(Display *,
const XPixelInfo *,XAnnotateInfo *,
Image *,
506 XComponentGenesis(
void),
508 XGetWindowColor(Display *,XWindows *,
char *,
ExceptionInfo *),
509 XMagickProgressMonitor(
const char *,
const MagickOffsetType,
510 const MagickSizeType,
void *),
511 XMakeImage(Display *,
const XResourceInfo *,XWindowInfo *,
Image *,
unsigned int,
513 XQueryColorCompliance(
const char *,XColor *);
515extern MagickPrivate
void
516 XBestIconSize(Display *,XWindowInfo *,
Image *),
517 XBestPixel(Display *,
const Colormap,XColor *,
unsigned int,XColor *),
518 XCheckRefreshWindows(Display *,XWindows *),
519 XClientMessage(Display *,
const Window,
const Atom,
const Atom,
const Time),
520 XComponentTerminus(
void),
521 XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,
Image *,
523 XConstrainWindowPosition(Display *,XWindowInfo *),
524 XDelay(Display *,
const size_t),
525 XDisplayImageInfo(Display *,
const XResourceInfo *,XWindows *,
Image *,
Image *,
527 XDestroyWindowColors(Display *,Window),
528 XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
529 XFontStruct *,XResourceInfo *,XWindowInfo *),
530 XFreeStandardColormap(Display *,
const XVisualInfo *,XStandardColormap *,
532 XHighlightEllipse(Display *,Window,GC,
const RectangleInfo *),
533 XHighlightLine(Display *,Window,GC,
const XSegment *),
534 XHighlightRectangle(Display *,Window,GC,
const RectangleInfo *),
535 XGetAnnotateInfo(XAnnotateInfo *),
536 XGetPixelInfo(Display *,
const XVisualInfo *,
const XStandardColormap *,
537 const XResourceInfo *,
Image *,XPixelInfo *),
538 XGetMapInfo(
const XVisualInfo *,
const Colormap,XStandardColormap *),
539 XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
540 XFontStruct *,XResourceInfo *,XWindowInfo *),
542 XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,
Image *,
544 XMakeWindow(Display *,Window,
char **,
int,XClassHint *,XWMHints *,
546 XQueryPosition(Display *,
const Window,
int *,
int *),
547 XRefreshWindow(Display *,
const XWindowInfo *,
const XEvent *),
548 XSetCursorState(Display *,XWindows *,
const MagickStatusType),
549 XUserPreferences(XResourceInfo *),
550 XWarning(
const ExceptionType,
const char *,
const char *);
552extern MagickPrivate Window
553 XWindowByID(Display *,
const Window,
const size_t),
554 XWindowByName(Display *,
const Window,
const char *),
555 XWindowByProperty(Display *,
const Window,
const Atom);
557extern MagickPrivate XFontStruct
558 *XBestFont(Display *,
const XResourceInfo *,
const MagickBooleanType);
560extern MagickPrivate XVisualInfo
561 *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
563extern MagickPrivate XWindows
564 *XInitializeWindows(Display *,XResourceInfo *),
565 *XSetWindows(XWindows *);
567extern MagickExport
char
568 *XGetResourceClass(XrmDatabase,
const char *,
const char *,
char *),
569 *XGetResourceInstance(XrmDatabase,
const char *,
const char *,
const char *),
570 *XGetScreenDensity(Display *);
572extern MagickExport
int
573 XError(Display *,XErrorEvent *);
575extern MagickExport MagickBooleanType
576 XRemoteCommand(Display *,
const char *,
const char *);
578extern MagickExport
void
579 DestroyXResources(
void),
580 XDestroyResourceInfo(XResourceInfo *),
581 XGetResourceInfo(
const ImageInfo *,XrmDatabase,
const char *,XResourceInfo *),
582 XRetainWindowColors(Display *,
const Window);
584extern MagickExport XrmDatabase
585 XGetResourceDatabase(Display *,
const char *);
587static inline double XPixelIntensity(
const XColor *pixel)
592 if ((pixel->red == pixel->green) && (pixel->green == pixel->blue))
593 return((
double) pixel->red);
594 intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
600extern MagickPrivate MagickBooleanType
604#if defined(__cplusplus) || defined(c_plusplus)