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/pixel-accessor.h"
25 #include "MagickCore/quantize.h"
27 #if defined(__cplusplus) || defined(c_plusplus)
31 #if defined(MAGICKCORE_X11_DELEGATE)
35 #include <X11/Xatom.h>
36 #include <X11/cursorfont.h>
37 #include <X11/keysym.h>
38 #include <X11/Xresource.h>
39 #include <X11/Xutil.h>
41 #if defined(__cplusplus) || defined(c_plusplus)
42 # define klass c_class
48 Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6.
50 #if XlibSpecificationRelease < 6
51 #if !defined(PRE_R6_ICCCM)
56 Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined.
58 #if !defined(XlibSpecificationRelease)
62 Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined.
64 #if !defined(PWinGravity)
68 #define MaxIconSize 96
69 #define MaxNumberPens 11
70 #define MaxNumberFonts 11
71 #define MaxXWindows 12
74 #define ThrowXWindowException(severity,tag,context) \
79 GetExceptionInfo(&exception); \
80 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
81 tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context, \
83 CatchException(&exception); \
84 (void) DestroyExceptionInfo(&exception); \
86 #define ThrowXWindowFatalException(severity,tag,context) \
88 ThrowXWindowException(severity,tag,context); \
106 FillRectangleElement,
126 typedef struct _XDrawInfo
164 geometry[MaxTextExtent];
169 DefaultState = 0x0000,
170 EscapeState = 0x0001,
172 FormerImageState = 0x0004,
173 ModifierState = 0x0008,
174 MontageImageState = 0x0010,
175 NextImageState = 0x0020,
176 RetainColorsState = 0x0040,
178 UpdateConfigurationState = 0x0080,
179 UpdateRegionState = 0x0100
182 typedef struct _XAnnotateInfo
205 geometry[MaxTextExtent];
207 struct _XAnnotateInfo
212 typedef struct _XPixelInfo
231 pen_colors[MaxNumberPens];
243 typedef struct _XResourceInfo
287 *font_name[MaxNumberFonts],
314 *pen_colors[MaxNumberPens];
346 home_directory[MaxTextExtent];
349 typedef struct _XWindowInfo
454 typedef struct _XWindows
511 extern MagickPrivate Cursor
512 XMakeCursor(Display *,Window,Colormap,char *,char *);
514 extern MagickPrivate int
515 XCheckDefineCursor(Display *,Window,Cursor);
517 extern MagickPrivate MagickBooleanType
518 XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *,
520 XComponentGenesis(void),
521 XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *,ExceptionInfo *),
522 XGetWindowColor(Display *,XWindows *,char *,ExceptionInfo *),
523 XMagickProgressMonitor(const char *,const MagickOffsetType,
524 const MagickSizeType,void *),
525 XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int,
526 unsigned int,ExceptionInfo *),
527 XQueryColorCompliance(const char *,XColor *);
529 extern MagickPrivate void
530 XBestIconSize(Display *,XWindowInfo *,Image *),
531 XBestPixel(Display *,const Colormap,XColor *,unsigned int,XColor *),
532 XCheckRefreshWindows(Display *,XWindows *),
533 XClientMessage(Display *,const Window,const Atom,const Atom,const Time),
534 XComponentTerminus(void),
535 XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *,
537 XConstrainWindowPosition(Display *,XWindowInfo *),
538 XDelay(Display *,const size_t),
539 XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *,
541 XDestroyWindowColors(Display *,Window),
542 XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
543 XFontStruct *,XResourceInfo *,XWindowInfo *),
544 XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *,
546 XHighlightEllipse(Display *,Window,GC,const RectangleInfo *),
547 XHighlightLine(Display *,Window,GC,const XSegment *),
548 XHighlightRectangle(Display *,Window,GC,const RectangleInfo *),
549 XGetAnnotateInfo(XAnnotateInfo *),
550 XGetPixelInfo(Display *,const XVisualInfo *,const XStandardColormap *,
551 const XResourceInfo *,Image *,XPixelInfo *),
552 XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *),
553 XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
554 XFontStruct *,XResourceInfo *,XWindowInfo *),
555 XMakeMagnifyImage(Display *,XWindows *,ExceptionInfo *),
556 XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
557 XStandardColormap *,XPixelInfo *,ExceptionInfo *),
558 XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *,
560 XQueryPosition(Display *,const Window,int *,int *),
561 XRefreshWindow(Display *,const XWindowInfo *,const XEvent *),
562 XSetCursorState(Display *,XWindows *,const MagickStatusType),
563 XUserPreferences(XResourceInfo *),
564 XWarning(const ExceptionType,const char *,const char *);
566 extern MagickPrivate Window
567 XWindowByID(Display *,const Window,const size_t),
568 XWindowByName(Display *,const Window,const char *),
569 XWindowByProperty(Display *,const Window,const Atom);
571 extern MagickPrivate XFontStruct
572 *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
574 extern MagickPrivate XVisualInfo
575 *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
577 extern MagickPrivate XWindows
578 *XInitializeWindows(Display *,XResourceInfo *),
579 *XSetWindows(XWindows *);
581 extern MagickExport char
582 *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
583 *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
584 *XGetScreenDensity(Display *);
586 extern MagickExport int
587 XError(Display *,XErrorEvent *);
589 extern MagickExport MagickBooleanType
590 XRemoteCommand(Display *,const char *,const char *);
592 extern MagickExport void
593 DestroyXResources(void),
594 XDestroyResourceInfo(XResourceInfo *),
595 XGetResourceInfo(const ImageInfo *,XrmDatabase,const char *,XResourceInfo *),
596 XRetainWindowColors(Display *,const Window);
598 extern MagickExport XrmDatabase
599 XGetResourceDatabase(Display *,const char *);
601 static inline double XPixelIntensity(const XColor *pixel)
606 if ((pixel->red == pixel->green) && (pixel->green == pixel->blue))
607 return((double) pixel->red);
608 intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
614 extern MagickPrivate MagickBooleanType
615 XRenderImage(Image *,const DrawInfo *,const PointInfo *,TypeMetric *,
618 #if defined(__cplusplus) || defined(c_plusplus)