2 Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 https://www.imagemagick.org/script/license.php
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 MagickCore X11 window methods.
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)
36 #include <X11/Xatom.h>
37 #include <X11/cursorfont.h>
38 #include <X11/keysym.h>
39 #include <X11/Xresource.h>
40 #include <X11/Xutil.h>
42 #if defined(__cplusplus) || defined(c_plusplus)
43 # define klass c_class
48 #define MaxIconSize 96
49 #define MaxNumberPens 11
50 #define MaxNumberFonts 11
51 #define MaxXWindows 12
54 #define ThrowXWindowException(severity,tag,context) \
59 exception=AcquireExceptionInfo(); \
60 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
61 tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context, \
63 CatchException(exception); \
64 (void) DestroyExceptionInfo(exception); \
66 #define ThrowXWindowFatalException(severity,tag,context) \
68 ThrowXWindowException(severity,tag,context); \
106 typedef struct _XDrawInfo
144 geometry[MagickPathExtent];
149 DefaultState = 0x0000,
150 EscapeState = 0x0001,
152 FormerImageState = 0x0004,
153 ModifierState = 0x0008,
154 MontageImageState = 0x0010,
155 NextImageState = 0x0020,
156 RetainColorsState = 0x0040,
158 UpdateConfigurationState = 0x0080,
159 UpdateRegionState = 0x0100
162 typedef struct _XAnnotateInfo
185 geometry[MagickPathExtent];
187 struct _XAnnotateInfo
192 typedef struct _XPixelInfo
201 alpha_color, /* deprecated */
211 pen_colors[MaxNumberPens];
226 typedef struct _XResourceInfo
270 *font_name[MaxNumberFonts],
288 *alpha_color, /* deprecated */
297 *pen_colors[MaxNumberPens];
329 home_directory[MagickPathExtent];
335 typedef struct _XWindowInfo
440 typedef struct _XWindows
497 extern MagickPrivate Cursor
498 XMakeCursor(Display *,Window,Colormap,char *,char *);
500 extern MagickPrivate int
501 XCheckDefineCursor(Display *,Window,Cursor);
503 extern MagickPrivate MagickBooleanType
504 XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *,
506 XComponentGenesis(void),
507 XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *,ExceptionInfo *),
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,
512 unsigned int,ExceptionInfo *),
513 XQueryColorCompliance(const char *,XColor *);
515 extern 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 *),
541 XMakeMagnifyImage(Display *,XWindows *,ExceptionInfo *),
542 XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
543 XStandardColormap *,XPixelInfo *,ExceptionInfo *),
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 *);
552 extern MagickPrivate Window
553 XWindowByID(Display *,const Window,const size_t),
554 XWindowByName(Display *,const Window,const char *),
555 XWindowByProperty(Display *,const Window,const Atom);
557 extern MagickPrivate XFontStruct
558 *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
560 extern MagickPrivate XVisualInfo
561 *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
563 extern MagickPrivate XWindows
564 *XInitializeWindows(Display *,XResourceInfo *),
565 *XSetWindows(XWindows *);
567 extern MagickExport char
568 *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
569 *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
570 *XGetScreenDensity(Display *);
572 extern MagickExport int
573 XError(Display *,XErrorEvent *);
575 extern MagickExport MagickBooleanType
576 XRemoteCommand(Display *,const char *,const char *);
578 extern MagickExport void
579 DestroyXResources(void),
580 XDestroyResourceInfo(XResourceInfo *),
581 XGetResourceInfo(const ImageInfo *,XrmDatabase,const char *,XResourceInfo *),
582 XRetainWindowColors(Display *,const Window);
584 extern MagickExport XrmDatabase
585 XGetResourceDatabase(Display *,const char *);
587 static 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;
600 extern MagickPrivate MagickBooleanType
601 XRenderImage(Image *,const DrawInfo *,const PointInfo *,TypeMetric *,
604 #if defined(__cplusplus) || defined(c_plusplus)