MagickCore: xwindow-private.h Source File

# xwindow-private.h

Go to the documentation of this file.

    00001 /*
    00002   Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization
    00003   dedicated to making software imaging solutions freely available.
    00004
    00005   You may not use this file except in compliance with the License.
    00006   obtain a copy of the License at
    00007
    00008     http://www.imagemagick.org/script/license.php
    00009
    00010   Unless required by applicable law or agreed to in writing, software
    00011   distributed under the License is distributed on an "AS IS" BASIS,
    00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013   See the License for the specific language governing permissions and
    00014   limitations under the License.
    00015
    00016   MagickCore X11 window methods.
    00017 */
    00018 #ifndef _MAGICKCORE_XWINDOW_PRIVATE_H
    00019 #define _MAGICKCORE_XWINDOW_PRIVATE_H
    00020
    00021 #if defined(__cplusplus) || defined(c_plusplus)
    00022 extern "C" {
    00023 #endif
    00024
    00025 #if defined(MAGICKCORE_X11_DELEGATE)
    00026
    00027 #include <X11/Xos.h>
    00028 #include <X11/Xlib.h>
    00029 #include <X11/Xatom.h>
    00030 #include <X11/cursorfont.h>
    00031 #include <X11/keysym.h>
    00032 #include <X11/Xresource.h>
    00033 #include <X11/Xutil.h>
    00034 #include "magick/exception.h"
    00035 #include "magick/geometry.h"
    00036 #include "magick/quantize.h"
    00037
    00038 #if defined(__cplusplus) || defined(c_plusplus)
    00039 # define klass  c_class
    00040 #else
    00041 # define klass  class
    00042 #endif
    00043
    00044 /*
    00045   Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6.
    00046 */
    00047 #if XlibSpecificationRelease < 6
    00048 #if !defined(PRE_R6_ICCCM)
    00049 #define PRE_R6_ICCCM
    00050 #endif
    00051 #endif
    00052 /*
    00053   Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined.
    00054 */
    00055 #if !defined(XlibSpecificationRelease)
    00056 #define PRE_R5_ICCCM
    00057 #endif
    00058 /*
    00059   Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined.
    00060 */
    00061 #if !defined(PWinGravity)
    00062 #define PRE_R4_ICCCM
    00063 #endif
    00064
    00065 #define MaxIconSize  96
    00066 #define MaxNumberPens  11
    00067 #define MaxNumberFonts  11
    00068 #define MaxXWindows  12
    00069 #undef index
    00070
    00071 #define ThrowXWindowException(severity,tag,context) \
    00072 { \
    00073   ExceptionInfo \
    00074     exception; \
    00075  \
    00076   GetExceptionInfo(&exception); \
    00077   (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
    00078     tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
    00079     strerror(errno)); \
    00080   CatchException(&exception); \
    00081   (void) DestroyExceptionInfo(&exception); \
    00082 }
    00083 #define ThrowXWindowFatalException(severity,tag,context) \
    00084 { \
    00085    ThrowXWindowException(severity,tag,context); \
    00086   _exit(1); \
    00087 }
    00088
    00089 typedef enum
    00090 {
    00091   ForegroundStencil,
    00092   BackgroundStencil,
    00093   OpaqueStencil,
    00094   TransparentStencil
    00095 } AnnotationStencil;
    00096
    00097 typedef enum
    00098 {
    00099   UndefinedElement,
    00100   PointElement,
    00101   LineElement,
    00102   RectangleElement,
    00103   FillRectangleElement,
    00104   CircleElement,
    00105   FillCircleElement,
    00106   EllipseElement,
    00107   FillEllipseElement,
    00108   PolygonElement,
    00109   FillPolygonElement,
    00110   ColorElement,
    00111   MatteElement,
    00112   TextElement,
    00113   ImageElement
    00114 } ElementType;
    00115
    00116 typedef enum
    00117 {
    00118   UndefinedColormap,
    00119   PrivateColormap,
    00120   SharedColormap
    00121 } XColormapType;
    00122
    00123 typedef struct _XDrawInfo
    00124 {
    00125   int
    00126     x,
    00127     y;
    00128
    00129   unsigned int
    00130     width,
    00131     height;
    00132
    00133   double
    00134     degrees;
    00135
    00136   AnnotationStencil
    00137     stencil;
    00138
    00139   ElementType
    00140     element;
    00141
    00142   Pixmap
    00143     stipple;
    00144
    00145   unsigned int
    00146     line_width;
    00147
    00148   XSegment
    00149     line_info;
    00150
    00151   unsigned int
    00152     number_coordinates;
    00153
    00154   RectangleInfo
    00155     rectangle_info;
    00156
    00157   XPoint
    00158     *coordinate_info;
    00159
    00160   char
    00161     geometry[MaxTextExtent];
    00162 } XDrawInfo;
    00163
    00164 typedef enum
    00165 {
    00166   DefaultState = 0x0000,
    00167   EscapeState = 0x0001,
    00168   ExitState = 0x0002,
    00169   FormerImageState = 0x0004,
    00170   ModifierState = 0x0008,
    00171   MontageImageState = 0x0010,
    00172   NextImageState = 0x0020,
    00173   RetainColorsState = 0x0040,
    00174   SuspendTime = 50,
    00175   UpdateConfigurationState = 0x0080,
    00176   UpdateRegionState = 0x0100
    00177 } XState;
    00178
    00179 typedef struct _XAnnotateInfo
    00180 {
    00181   int
    00182     x,
    00183     y;
    00184
    00185   unsigned int
    00186     width,
    00187     height;
    00188
    00189   double
    00190     degrees;
    00191
    00192   XFontStruct
    00193     *font_info;
    00194
    00195   char
    00196     *text;
    00197
    00198   AnnotationStencil
    00199     stencil;
    00200
    00201   char
    00202     geometry[MaxTextExtent];
    00203
    00204   struct _XAnnotateInfo
    00205     *next,
    00206     *previous;
    00207 } XAnnotateInfo;
    00208
    00209 typedef struct _XPixelInfo
    00210 {
    00211   unsigned long
    00212     colors,
    00213     *pixels;
    00214
    00215   XColor
    00216     foreground_color,
    00217     background_color,
    00218     border_color,
    00219     matte_color,
    00220     highlight_color,
    00221     shadow_color,
    00222     depth_color,
    00223     trough_color,
    00224     box_color,
    00225     pen_color,
    00226     pen_colors[MaxNumberPens];
    00227
    00228   GC
    00229     annotate_context,
    00230     highlight_context,
    00231     widget_context;
    00232
    00233   unsigned short
    00234     box_index,
    00235     pen_index;
    00236 } XPixelInfo;
    00237
    00238 typedef struct _XResourceInfo
    00239 {
    00240   XrmDatabase
    00241     resource_database;
    00242
    00243   ImageInfo
    00244     *image_info;
    00245
    00246   QuantizeInfo
    00247     *quantize_info;
    00248
    00249   unsigned long
    00250     colors;
    00251
    00252   MagickBooleanType
    00253     close_server,
    00254     backdrop;
    00255
    00256   char
    00257     *background_color,
    00258     *border_color;
    00259
    00260   char
    00261     *client_name;
    00262
    00263   XColormapType
    00264     colormap;
    00265
    00266   unsigned int
    00267     border_width;
    00268
    00269   unsigned long
    00270     delay;
    00271
    00272   MagickBooleanType
    00273     color_recovery,
    00274     confirm_exit,
    00275     confirm_edit;
    00276
    00277   char
    00278     *display_gamma;
    00279
    00280   char
    00281     *font,
    00282     *font_name[MaxNumberFonts],
    00283     *foreground_color;
    00284
    00285   MagickBooleanType
    00286     display_warnings,
    00287     gamma_correct;
    00288
    00289   char
    00290     *icon_geometry;
    00291
    00292   MagickBooleanType
    00293     iconic,
    00294     immutable;
    00295
    00296   char
    00297     *image_geometry;
    00298
    00299   char
    00300     *map_type,
    00301     *matte_color,
    00302     *name;
    00303
    00304   unsigned int
    00305     magnify,
    00306     pause;
    00307
    00308   char
    00309     *pen_colors[MaxNumberPens];
    00310
    00311   char
    00312     *text_font,
    00313     *title;
    00314
    00315   int
    00316     quantum;
    00317
    00318   unsigned int
    00319     update;
    00320
    00321   MagickBooleanType
    00322     use_pixmap,
    00323     use_shared_memory;
    00324
    00325   unsigned long
    00326     undo_cache;
    00327
    00328   char
    00329     *visual_type,
    00330     *window_group,
    00331     *window_id,
    00332     *write_filename;
    00333
    00334   Image
    00335     *copy_image;
    00336
    00337   int
    00338     gravity;
    00339
    00340   char
    00341     home_directory[MaxTextExtent];
    00342 } XResourceInfo;
    00343
    00344 typedef struct _XWindowInfo
    00345 {
    00346   Window
    00347     id;
    00348
    00349   Window
    00350     root;
    00351
    00352   Visual
    00353     *visual;
    00354
    00355   unsigned int
    00356     storage_class,
    00357     depth;
    00358
    00359   XVisualInfo
    00360     *visual_info;
    00361
    00362   XStandardColormap
    00363     *map_info;
    00364
    00365   XPixelInfo
    00366     *pixel_info;
    00367
    00368   XFontStruct
    00369     *font_info;
    00370
    00371   GC
    00372     annotate_context,
    00373     highlight_context,
    00374     widget_context;
    00375
    00376   Cursor
    00377     cursor,
    00378     busy_cursor;
    00379
    00380   char
    00381     *name,
    00382     *geometry,
    00383     *icon_name,
    00384     *icon_geometry,
    00385     *crop_geometry;
    00386
    00387   unsigned long
    00388     data,
    00389     flags;
    00390
    00391   int
    00392     x,
    00393     y;
    00394
    00395   unsigned int
    00396     width,
    00397     height,
    00398     min_width,
    00399     min_height,
    00400     width_inc,
    00401     height_inc,
    00402     border_width;
    00403
    00404   MagickBooleanType
    00405     use_pixmap,
    00406     immutable,
    00407     shape,
    00408     shared_memory;
    00409
    00410   int
    00411     screen;
    00412
    00413   XImage
    00414     *ximage,
    00415     *matte_image;
    00416
    00417   Pixmap
    00418     highlight_stipple,
    00419     shadow_stipple,
    00420     pixmap,
    00421     *pixmaps,
    00422     matte_pixmap,
    00423     *matte_pixmaps;
    00424
    00425   XSetWindowAttributes
    00426     attributes;
    00427
    00428   XWindowChanges
    00429     window_changes;
    00430
    00431   void
    00432     *segment_info;
    00433
    00434   unsigned long
    00435     mask;
    00436
    00437   MagickBooleanType
    00438     orphan,
    00439     mapped,
    00440     stasis;
    00441
    00442   Image
    00443     *image;
    00444
    00445   MagickBooleanType
    00446     destroy;
    00447 } XWindowInfo;
    00448
    00449 typedef struct _XWindows
    00450 {
    00451   Display
    00452     *display;
    00453
    00454   XStandardColormap
    00455     *map_info,
    00456     *icon_map;
    00457
    00458   XVisualInfo
    00459     *visual_info,
    00460     *icon_visual;
    00461
    00462   XPixelInfo
    00463     *pixel_info,
    00464     *icon_pixel;
    00465
    00466   XFontStruct
    00467     *font_info;
    00468
    00469   XResourceInfo
    00470     *icon_resources;
    00471
    00472   XClassHint
    00473     *class_hints;
    00474
    00475   XWMHints
    00476     *manager_hints;
    00477
    00478   XWindowInfo
    00479     context,
    00480     group_leader,
    00481     backdrop,
    00482     icon,
    00483     image,
    00484     info,
    00485     magnify,
    00486     pan,
    00487     command,
    00488     widget,
    00489     popup;
    00490
    00491   Atom
    00492     wm_protocols,
    00493     wm_delete_window,
    00494     wm_take_focus,
    00495     im_protocols,
    00496     im_remote_command,
    00497     im_update_widget,
    00498     im_update_colormap,
    00499     im_former_image,
    00500     im_retain_colors,
    00501     im_next_image,
    00502     im_exit,
    00503     dnd_protocols;
    00504 } XWindows;
    00505
    00506 extern MagickExport char
    00507   *XGetResourceClass(XrmDatabase,const char *,const char *,char *),
    00508   *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *),
    00509   *XGetScreenDensity(Display *);
    00510
    00511 extern MagickExport Cursor
    00512   XMakeCursor(Display *,Window,Colormap,char *,char *);
    00513
    00514 extern MagickExport int
    00515   XCheckDefineCursor(Display *,Window,Cursor),
    00516   XError(Display *,XErrorEvent *);
    00517
    00518 extern MagickExport MagickBooleanType
    00519   XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *),
    00520   XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *),
    00521   XGetWindowColor(Display *,XWindows *,char *),
    00522   XMagickProgressMonitor(const char *,const MagickOffsetType,
    00523     const MagickSizeType,void *),
    00524   XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int,
    00525     unsigned int),
    00526   XQueryColorDatabase(const char *,XColor *),
    00527   XRemoteCommand(Display *,const char *,const char *);
    00528
    00529 extern MagickExport void
    00530   DestroyXResources(void),
    00531   XBestIconSize(Display *,XWindowInfo *,Image *),
    00532   XBestPixel(Display *,const Colormap,XColor *,unsigned int,XColor *),
    00533   XCheckRefreshWindows(Display *,XWindows *),
    00534   XClientMessage(Display *,const Window,const Atom,const Atom,const Time),
    00535   XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *),
    00536   XConstrainWindowPosition(Display *,XWindowInfo *),
    00537   XDelay(Display *,const unsigned long),
    00538   XDestroyResourceInfo(XResourceInfo *),
    00539   XDestroyWindowColors(Display *,Window),
    00540   XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *),
    00541   XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
    00542     XFontStruct *,XResourceInfo *,XWindowInfo *),
    00543   XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *,
    00544     XPixelInfo *),
    00545   XHighlightEllipse(Display *,Window,GC,const RectangleInfo *),
    00546   XHighlightLine(Display *,Window,GC,const XSegment *),
    00547   XHighlightRectangle(Display *,Window,GC,const RectangleInfo *),
    00548   XGetAnnotateInfo(XAnnotateInfo *),
    00549   XGetPixelPacket(Display *,const XVisualInfo *,const XStandardColormap *,
    00550     const XResourceInfo *,Image *,XPixelInfo *),
    00551   XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *),
    00552   XGetResourceInfo(XrmDatabase,const char *,XResourceInfo *),
    00553   XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *,
    00554     XFontStruct *,XResourceInfo *,XWindowInfo *),
    00555   XMakeMagnifyImage(Display *,XWindows *),
    00556   XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *,
    00557     XStandardColormap *,XPixelInfo *),
    00558   XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *,
    00559     XWindowInfo *),
    00560   XQueryPosition(Display *,const Window,int *,int *),
    00561   XRefreshWindow(Display *,const XWindowInfo *,const XEvent *),
    00562   XRetainWindowColors(Display *,const Window),
    00563   XSetCursorState(Display *,XWindows *,const MagickStatusType),
    00564   XUserPreferences(XResourceInfo *),
    00565   XWarning(const ExceptionType,const char *,const char *);
    00566
    00567 extern MagickExport Window
    00568   XWindowByID(Display *,const Window,const unsigned long),
    00569   XWindowByName(Display *,const Window,const char *),
    00570   XWindowByProperty(Display *,const Window,const Atom);
    00571
    00572 extern MagickExport XFontStruct
    00573   *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType);
    00574
    00575 extern MagickExport XrmDatabase
    00576   XGetResourceDatabase(Display *,const char *);
    00577
    00578 extern MagickExport XVisualInfo
    00579   *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *);
    00580
    00581 extern MagickExport XWindows
    00582   *XInitializeWindows(Display *,XResourceInfo *),
    00583   *XSetWindows(XWindows *);
    00584
    00585 static inline MagickRealType XPixelIntensity(const XColor *pixel)
    00586 {
    00587   MagickRealType
    00588     intensity;
    00589
    00590   intensity=0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue;
    00591   return(intensity);
    00592 }
    00593
    00594 #endif
    00595
    00596 #if defined(__cplusplus) || defined(c_plusplus)
    00597 }
    00598 #endif
    00599
    00600 #endif