xwindow-private.h

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

Generated on 31 Oct 2019 for MagickCore by  doxygen 1.6.1