2 Copyright 1999-2011 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/quantize.h"
38 #if defined(__cplusplus) || defined(c_plusplus)
39 # define klass c_class
45 Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6.
47 #if XlibSpecificationRelease < 6
48 #if !defined(PRE_R6_ICCCM)
53 Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined.
55 #if !defined(XlibSpecificationRelease)
59 Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined.
61 #if !defined(PWinGravity)
65 #define MaxIconSize 96
66 #define MaxNumberPens 11
67 #define MaxNumberFonts 11
68 #define MaxXWindows 12
71 #define ThrowXWindowException(severity,tag,context) \
76 GetExceptionInfo(&exception); \
77 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
78 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
80 CatchException(&exception); \
81 (void) DestroyExceptionInfo(&exception); \
83 #define ThrowXWindowFatalException(severity,tag,context) \
85 ThrowXWindowException(severity,tag,context); \
103 FillRectangleElement,
123 typedef struct _XDrawInfo
161 geometry[MaxTextExtent];
166 DefaultState = 0x0000,
167 EscapeState = 0x0001,
169 FormerImageState = 0x0004,
170 ModifierState = 0x0008,
171 MontageImageState = 0x0010,
172 NextImageState = 0x0020,
173 RetainColorsState = 0x0040,
175 UpdateConfigurationState = 0x0080,
176 UpdateRegionState = 0x0100
179 typedef struct _XAnnotateInfo
202 geometry[MaxTextExtent];
204 struct _XAnnotateInfo
209 typedef struct _XPixelInfo
228 pen_colors[MaxNumberPens];
240 typedef struct _XResourceInfo
284 *font_name[MaxNumberFonts],
311 *pen_colors[MaxNumberPens];
343 home_directory[MaxTextExtent];
346 typedef struct _XWindowInfo
451 typedef struct _XWindows
508 extern MagickPrivate Cursor
509 XMakeCursor(Display *,Window,Colormap,char *,char *);
511 extern MagickPrivate int
512 XCheckDefineCursor(Display *,Window,Cursor);
514 extern MagickPrivate MagickBooleanType
515 XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *,
517 XComponentGenesis(void),
518 XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *,ExceptionInfo *),
519 XGetWindowColor(Display *,XWindows *,char *,ExceptionInfo *),
520 XMagickProgressMonitor(const char *,const MagickOffsetType,
521 const MagickSizeType,void *),
522 XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int,
523 unsigned int,ExceptionInfo *),
524 XQueryColorCompliance(const char *,XColor *);
526 extern MagickPrivate void
527 XBestIconSize(Display *,XWindowInfo *,Image *),
528 XBestPixel(Display *,const Colormap,XColor *,unsigned int,XColor *),
529 XCheckRefreshWindows(Display *,XWindows *),
530 XClientMessage(Display *,const Window,const Atom,const Atom,const Time),
531 XComponentTerminus(void),
532 XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *,
534 XConstrainWindowPosition(Display *,XWindowInfo *),
535 XDelay(Display *,const size_t),
536 XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *,
538 XDestroyWindowColors(Display *,Window),
539 XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
540 XFontStruct *,XResourceInfo *,XWindowInfo *),
541 XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *,
543 XHighlightEllipse(Display *,Window,GC,const RectangleInfo *),
544 XHighlightLine(Display *,Window,GC,const XSegment *),
545 XHighlightRectangle(Display *,Window,GC,const RectangleInfo *),
546 XGetAnnotateInfo(XAnnotateInfo *),
547 XGetPixelInfo(Display *,const XVisualInfo *,const XStandardColormap *,
548 const XResourceInfo *,Image *,XPixelInfo *),
549 XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *),
550 XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
551 XFontStruct *,XResourceInfo *,XWindowInfo *),
552 XMakeMagnifyImage(Display *,XWindows *,ExceptionInfo *),
553 XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
554 XStandardColormap *,XPixelInfo *,ExceptionInfo *),
555 XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *,
557 XQueryPosition(Display *,const Window,int *,int *),
558 XRefreshWindow(Display *,const XWindowInfo *,const XEvent *),
559 XSetCursorState(Display *,XWindows *,const MagickStatusType),
560 XUserPreferences(XResourceInfo *),
561 XWarning(const ExceptionType,const char *,const char *);
563 extern MagickPrivate Window
564 XWindowByID(Display *,const Window,const size_t),
565 XWindowByName(Display *,const Window,const char *),
566 XWindowByProperty(Display *,const Window,const Atom);
568 extern MagickPrivate XFontStruct
569 *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
571 extern MagickPrivate XVisualInfo
572 *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
574 extern MagickPrivate XWindows
575 *XInitializeWindows(Display *,XResourceInfo *),
576 *XSetWindows(XWindows *);
578 extern MagickExport char
579 *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
580 *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
581 *XGetScreenDensity(Display *);
583 extern MagickExport int
584 XError(Display *,XErrorEvent *);
586 extern MagickExport MagickBooleanType
587 XRemoteCommand(Display *,const char *,const char *);
589 extern MagickExport void
590 DestroyXResources(void),
591 XDestroyResourceInfo(XResourceInfo *),
592 XGetResourceInfo(const ImageInfo *,XrmDatabase,const char *,XResourceInfo *),
593 XRetainWindowColors(Display *,const Window);
595 extern MagickExport XrmDatabase
596 XGetResourceDatabase(Display *,const char *);
598 static inline MagickRealType XPixelIntensity(const XColor *pixel)
603 intensity=0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue;
609 #if defined(__cplusplus) || defined(c_plusplus)