2 Copyright 1999-2014 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 http://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
49 Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6.
51 #if XlibSpecificationRelease < 6
52 #if !defined(PRE_R6_ICCCM)
57 Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined.
59 #if !defined(XlibSpecificationRelease)
63 Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined.
65 #if !defined(PWinGravity)
69 #define MaxIconSize 96
70 #define MaxNumberPens 11
71 #define MaxNumberFonts 11
72 #define MaxXWindows 12
75 #define ThrowXWindowException(severity,tag,context) \
80 GetExceptionInfo(&exception); \
81 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
82 tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context, \
84 CatchException(&exception); \
85 (void) DestroyExceptionInfo(&exception); \
87 #define ThrowXWindowFatalException(severity,tag,context) \
89 ThrowXWindowException(severity,tag,context); \
107 FillRectangleElement,
127 typedef struct _XDrawInfo
165 geometry[MaxTextExtent];
170 DefaultState = 0x0000,
171 EscapeState = 0x0001,
173 FormerImageState = 0x0004,
174 ModifierState = 0x0008,
175 MontageImageState = 0x0010,
176 NextImageState = 0x0020,
177 RetainColorsState = 0x0040,
179 UpdateConfigurationState = 0x0080,
180 UpdateRegionState = 0x0100
183 typedef struct _XAnnotateInfo
206 geometry[MaxTextExtent];
208 struct _XAnnotateInfo
213 typedef struct _XPixelInfo
232 pen_colors[MaxNumberPens];
244 typedef struct _XResourceInfo
288 *font_name[MaxNumberFonts],
315 *pen_colors[MaxNumberPens];
347 home_directory[MaxTextExtent];
350 typedef struct _XWindowInfo
455 typedef struct _XWindows
512 extern MagickPrivate Cursor
513 XMakeCursor(Display *,Window,Colormap,char *,char *);
515 extern MagickPrivate int
516 XCheckDefineCursor(Display *,Window,Cursor);
518 extern MagickPrivate MagickBooleanType
519 XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *,
521 XComponentGenesis(void),
522 XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *,ExceptionInfo *),
523 XGetWindowColor(Display *,XWindows *,char *,ExceptionInfo *),
524 XMagickProgressMonitor(const char *,const MagickOffsetType,
525 const MagickSizeType,void *),
526 XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int,
527 unsigned int,ExceptionInfo *),
528 XQueryColorCompliance(const char *,XColor *);
530 extern MagickPrivate void
531 XBestIconSize(Display *,XWindowInfo *,Image *),
532 XBestPixel(Display *,const Colormap,XColor *,unsigned int,XColor *),
533 XCheckRefreshWindows(Display *,XWindows *),
534 XClientMessage(Display *,const Window,const Atom,const Atom,const Time),
535 XComponentTerminus(void),
536 XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *,
538 XConstrainWindowPosition(Display *,XWindowInfo *),
539 XDelay(Display *,const size_t),
540 XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *,
542 XDestroyWindowColors(Display *,Window),
543 XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
544 XFontStruct *,XResourceInfo *,XWindowInfo *),
545 XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *,
547 XHighlightEllipse(Display *,Window,GC,const RectangleInfo *),
548 XHighlightLine(Display *,Window,GC,const XSegment *),
549 XHighlightRectangle(Display *,Window,GC,const RectangleInfo *),
550 XGetAnnotateInfo(XAnnotateInfo *),
551 XGetPixelInfo(Display *,const XVisualInfo *,const XStandardColormap *,
552 const XResourceInfo *,Image *,XPixelInfo *),
553 XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *),
554 XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
555 XFontStruct *,XResourceInfo *,XWindowInfo *),
556 XMakeMagnifyImage(Display *,XWindows *,ExceptionInfo *),
557 XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
558 XStandardColormap *,XPixelInfo *,ExceptionInfo *),
559 XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *,
561 XQueryPosition(Display *,const Window,int *,int *),
562 XRefreshWindow(Display *,const XWindowInfo *,const XEvent *),
563 XSetCursorState(Display *,XWindows *,const MagickStatusType),
564 XUserPreferences(XResourceInfo *),
565 XWarning(const ExceptionType,const char *,const char *);
567 extern MagickPrivate Window
568 XWindowByID(Display *,const Window,const size_t),
569 XWindowByName(Display *,const Window,const char *),
570 XWindowByProperty(Display *,const Window,const Atom);
572 extern MagickPrivate XFontStruct
573 *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
575 extern MagickPrivate XVisualInfo
576 *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
578 extern MagickPrivate XWindows
579 *XInitializeWindows(Display *,XResourceInfo *),
580 *XSetWindows(XWindows *);
582 extern MagickExport char
583 *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
584 *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
585 *XGetScreenDensity(Display *);
587 extern MagickExport int
588 XError(Display *,XErrorEvent *);
590 extern MagickExport MagickBooleanType
591 XRemoteCommand(Display *,const char *,const char *);
593 extern MagickExport void
594 DestroyXResources(void),
595 XDestroyResourceInfo(XResourceInfo *),
596 XGetResourceInfo(const ImageInfo *,XrmDatabase,const char *,XResourceInfo *),
597 XRetainWindowColors(Display *,const Window);
599 extern MagickExport XrmDatabase
600 XGetResourceDatabase(Display *,const char *);
602 static inline double XPixelIntensity(const XColor *pixel)
607 if ((pixel->red == pixel->green) && (pixel->green == pixel->blue))
608 return((double) pixel->red);
609 intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
615 extern MagickPrivate MagickBooleanType
616 XRenderImage(Image *,const DrawInfo *,const PointInfo *,TypeMetric *,
619 #if defined(__cplusplus) || defined(c_plusplus)