2 Copyright 1999-2013 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 #if defined(__cplusplus) || defined(c_plusplus)
25 #if defined(MAGICKCORE_X11_DELEGATE)
29 #include <X11/Xatom.h>
30 #include <X11/cursorfont.h>
31 #include <X11/keysym.h>
32 #include <X11/Xresource.h>
33 #include <X11/Xutil.h>
34 #include "MagickCore/exception.h"
35 #include "MagickCore/geometry.h"
36 #include "MagickCore/pixel-accessor.h"
37 #include "MagickCore/quantize.h"
39 #if defined(__cplusplus) || defined(c_plusplus)
40 # define klass c_class
46 Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6.
48 #if XlibSpecificationRelease < 6
49 #if !defined(PRE_R6_ICCCM)
54 Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined.
56 #if !defined(XlibSpecificationRelease)
60 Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined.
62 #if !defined(PWinGravity)
66 #define MaxIconSize 96
67 #define MaxNumberPens 11
68 #define MaxNumberFonts 11
69 #define MaxXWindows 12
72 #define ThrowXWindowException(severity,tag,context) \
77 GetExceptionInfo(&exception); \
78 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
79 tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context, \
81 CatchException(&exception); \
82 (void) DestroyExceptionInfo(&exception); \
84 #define ThrowXWindowFatalException(severity,tag,context) \
86 ThrowXWindowException(severity,tag,context); \
104 FillRectangleElement,
124 typedef struct _XDrawInfo
162 geometry[MaxTextExtent];
167 DefaultState = 0x0000,
168 EscapeState = 0x0001,
170 FormerImageState = 0x0004,
171 ModifierState = 0x0008,
172 MontageImageState = 0x0010,
173 NextImageState = 0x0020,
174 RetainColorsState = 0x0040,
176 UpdateConfigurationState = 0x0080,
177 UpdateRegionState = 0x0100
180 typedef struct _XAnnotateInfo
203 geometry[MaxTextExtent];
205 struct _XAnnotateInfo
210 typedef struct _XPixelInfo
229 pen_colors[MaxNumberPens];
241 typedef struct _XResourceInfo
285 *font_name[MaxNumberFonts],
312 *pen_colors[MaxNumberPens];
344 home_directory[MaxTextExtent];
347 typedef struct _XWindowInfo
452 typedef struct _XWindows
509 extern MagickPrivate Cursor
510 XMakeCursor(Display *,Window,Colormap,char *,char *);
512 extern MagickPrivate int
513 XCheckDefineCursor(Display *,Window,Cursor);
515 extern MagickPrivate MagickBooleanType
516 XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *,
518 XComponentGenesis(void),
519 XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *,ExceptionInfo *),
520 XGetWindowColor(Display *,XWindows *,char *,ExceptionInfo *),
521 XMagickProgressMonitor(const char *,const MagickOffsetType,
522 const MagickSizeType,void *),
523 XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int,
524 unsigned int,ExceptionInfo *),
525 XQueryColorCompliance(const char *,XColor *);
527 extern MagickPrivate void
528 XBestIconSize(Display *,XWindowInfo *,Image *),
529 XBestPixel(Display *,const Colormap,XColor *,unsigned int,XColor *),
530 XCheckRefreshWindows(Display *,XWindows *),
531 XClientMessage(Display *,const Window,const Atom,const Atom,const Time),
532 XComponentTerminus(void),
533 XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *,
535 XConstrainWindowPosition(Display *,XWindowInfo *),
536 XDelay(Display *,const size_t),
537 XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *,
539 XDestroyWindowColors(Display *,Window),
540 XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
541 XFontStruct *,XResourceInfo *,XWindowInfo *),
542 XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *,
544 XHighlightEllipse(Display *,Window,GC,const RectangleInfo *),
545 XHighlightLine(Display *,Window,GC,const XSegment *),
546 XHighlightRectangle(Display *,Window,GC,const RectangleInfo *),
547 XGetAnnotateInfo(XAnnotateInfo *),
548 XGetPixelInfo(Display *,const XVisualInfo *,const XStandardColormap *,
549 const XResourceInfo *,Image *,XPixelInfo *),
550 XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *),
551 XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
552 XFontStruct *,XResourceInfo *,XWindowInfo *),
553 XMakeMagnifyImage(Display *,XWindows *,ExceptionInfo *),
554 XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
555 XStandardColormap *,XPixelInfo *,ExceptionInfo *),
556 XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *,
558 XQueryPosition(Display *,const Window,int *,int *),
559 XRefreshWindow(Display *,const XWindowInfo *,const XEvent *),
560 XSetCursorState(Display *,XWindows *,const MagickStatusType),
561 XUserPreferences(XResourceInfo *),
562 XWarning(const ExceptionType,const char *,const char *);
564 extern MagickPrivate Window
565 XWindowByID(Display *,const Window,const size_t),
566 XWindowByName(Display *,const Window,const char *),
567 XWindowByProperty(Display *,const Window,const Atom);
569 extern MagickPrivate XFontStruct
570 *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
572 extern MagickPrivate XVisualInfo
573 *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
575 extern MagickPrivate XWindows
576 *XInitializeWindows(Display *,XResourceInfo *),
577 *XSetWindows(XWindows *);
579 extern MagickExport char
580 *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
581 *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
582 *XGetScreenDensity(Display *);
584 extern MagickExport int
585 XError(Display *,XErrorEvent *);
587 extern MagickExport MagickBooleanType
588 XRemoteCommand(Display *,const char *,const char *);
590 extern MagickExport void
591 DestroyXResources(void),
592 XDestroyResourceInfo(XResourceInfo *),
593 XGetResourceInfo(const ImageInfo *,XrmDatabase,const char *,XResourceInfo *),
594 XRetainWindowColors(Display *,const Window);
596 extern MagickExport XrmDatabase
597 XGetResourceDatabase(Display *,const char *);
599 static inline double XPixelIntensity(const XColor *pixel)
606 red=DecodePixelGamma((MagickRealType) pixel->red);
607 green=DecodePixelGamma((MagickRealType) pixel->green);
608 blue=DecodePixelGamma((MagickRealType) pixel->blue);
609 return(0.298839f*red+0.586811f*green+0.114350f*blue);
614 #if defined(__cplusplus) || defined(c_plusplus)