cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
cristy | 1454be7 | 2011-12-19 01:52:48 +0000 | [diff] [blame] | 2 | Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | dedicated to making software imaging solutions freely available. |
| 4 | |
| 5 | You may not use this file except in compliance with the License. |
| 6 | obtain a copy of the License at |
| 7 | |
| 8 | http://www.imagemagick.org/script/license.php |
| 9 | |
| 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. |
| 15 | |
| 16 | MagickCore X11 window methods. |
| 17 | */ |
| 18 | #ifndef _MAGICKCORE_XWINDOW_PRIVATE_H |
| 19 | #define _MAGICKCORE_XWINDOW_PRIVATE_H |
| 20 | |
| 21 | #if defined(__cplusplus) || defined(c_plusplus) |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | #if defined(MAGICKCORE_X11_DELEGATE) |
| 26 | |
| 27 | #include <X11/Xos.h> |
| 28 | #include <X11/Xlib.h> |
| 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> |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 34 | #include "MagickCore/exception.h" |
| 35 | #include "MagickCore/geometry.h" |
cristy | d7027ca | 2012-06-16 00:41:11 +0000 | [diff] [blame] | 36 | #include "MagickCore/pixel-accessor.h" |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 37 | #include "MagickCore/quantize.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 38 | |
| 39 | #if defined(__cplusplus) || defined(c_plusplus) |
| 40 | # define klass c_class |
| 41 | #else |
| 42 | # define klass class |
| 43 | #endif |
| 44 | |
| 45 | /* |
| 46 | Invoke pre-X11R6 ICCCM routines if XlibSpecificationRelease is not 6. |
| 47 | */ |
| 48 | #if XlibSpecificationRelease < 6 |
| 49 | #if !defined(PRE_R6_ICCCM) |
| 50 | #define PRE_R6_ICCCM |
| 51 | #endif |
| 52 | #endif |
| 53 | /* |
| 54 | Invoke pre-X11R5 ICCCM routines if XlibSpecificationRelease is not defined. |
| 55 | */ |
| 56 | #if !defined(XlibSpecificationRelease) |
| 57 | #define PRE_R5_ICCCM |
| 58 | #endif |
| 59 | /* |
| 60 | Invoke pre-X11R4 ICCCM routines if PWinGravity is not defined. |
| 61 | */ |
| 62 | #if !defined(PWinGravity) |
| 63 | #define PRE_R4_ICCCM |
| 64 | #endif |
| 65 | |
| 66 | #define MaxIconSize 96 |
| 67 | #define MaxNumberPens 11 |
| 68 | #define MaxNumberFonts 11 |
| 69 | #define MaxXWindows 12 |
| 70 | #undef index |
| 71 | |
| 72 | #define ThrowXWindowException(severity,tag,context) \ |
| 73 | { \ |
| 74 | ExceptionInfo \ |
| 75 | exception; \ |
| 76 | \ |
| 77 | GetExceptionInfo(&exception); \ |
| 78 | (void) ThrowMagickException(&exception,GetMagickModule(),severity, \ |
anthony | e5b3965 | 2012-04-21 05:37:29 +0000 | [diff] [blame] | 79 | tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context, \ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 80 | strerror(errno)); \ |
| 81 | CatchException(&exception); \ |
| 82 | (void) DestroyExceptionInfo(&exception); \ |
| 83 | } |
| 84 | #define ThrowXWindowFatalException(severity,tag,context) \ |
| 85 | { \ |
| 86 | ThrowXWindowException(severity,tag,context); \ |
| 87 | _exit(1); \ |
| 88 | } |
| 89 | |
| 90 | typedef enum |
| 91 | { |
| 92 | ForegroundStencil, |
| 93 | BackgroundStencil, |
| 94 | OpaqueStencil, |
| 95 | TransparentStencil |
| 96 | } AnnotationStencil; |
| 97 | |
| 98 | typedef enum |
| 99 | { |
| 100 | UndefinedElement, |
| 101 | PointElement, |
| 102 | LineElement, |
| 103 | RectangleElement, |
| 104 | FillRectangleElement, |
| 105 | CircleElement, |
| 106 | FillCircleElement, |
| 107 | EllipseElement, |
| 108 | FillEllipseElement, |
| 109 | PolygonElement, |
| 110 | FillPolygonElement, |
| 111 | ColorElement, |
| 112 | MatteElement, |
| 113 | TextElement, |
| 114 | ImageElement |
| 115 | } ElementType; |
| 116 | |
| 117 | typedef enum |
| 118 | { |
| 119 | UndefinedColormap, |
| 120 | PrivateColormap, |
| 121 | SharedColormap |
| 122 | } XColormapType; |
| 123 | |
| 124 | typedef struct _XDrawInfo |
| 125 | { |
| 126 | int |
| 127 | x, |
| 128 | y; |
| 129 | |
| 130 | unsigned int |
| 131 | width, |
| 132 | height; |
| 133 | |
| 134 | double |
| 135 | degrees; |
| 136 | |
| 137 | AnnotationStencil |
| 138 | stencil; |
| 139 | |
| 140 | ElementType |
| 141 | element; |
| 142 | |
| 143 | Pixmap |
| 144 | stipple; |
| 145 | |
| 146 | unsigned int |
| 147 | line_width; |
| 148 | |
| 149 | XSegment |
| 150 | line_info; |
| 151 | |
| 152 | unsigned int |
| 153 | number_coordinates; |
| 154 | |
| 155 | RectangleInfo |
| 156 | rectangle_info; |
| 157 | |
| 158 | XPoint |
| 159 | *coordinate_info; |
| 160 | |
| 161 | char |
| 162 | geometry[MaxTextExtent]; |
| 163 | } XDrawInfo; |
| 164 | |
| 165 | typedef enum |
| 166 | { |
| 167 | DefaultState = 0x0000, |
| 168 | EscapeState = 0x0001, |
| 169 | ExitState = 0x0002, |
| 170 | FormerImageState = 0x0004, |
| 171 | ModifierState = 0x0008, |
| 172 | MontageImageState = 0x0010, |
| 173 | NextImageState = 0x0020, |
| 174 | RetainColorsState = 0x0040, |
| 175 | SuspendTime = 50, |
| 176 | UpdateConfigurationState = 0x0080, |
| 177 | UpdateRegionState = 0x0100 |
| 178 | } XState; |
| 179 | |
| 180 | typedef struct _XAnnotateInfo |
| 181 | { |
| 182 | int |
| 183 | x, |
| 184 | y; |
| 185 | |
| 186 | unsigned int |
| 187 | width, |
| 188 | height; |
| 189 | |
| 190 | double |
| 191 | degrees; |
| 192 | |
| 193 | XFontStruct |
| 194 | *font_info; |
| 195 | |
| 196 | char |
| 197 | *text; |
| 198 | |
| 199 | AnnotationStencil |
| 200 | stencil; |
| 201 | |
| 202 | char |
| 203 | geometry[MaxTextExtent]; |
| 204 | |
| 205 | struct _XAnnotateInfo |
| 206 | *next, |
| 207 | *previous; |
| 208 | } XAnnotateInfo; |
| 209 | |
| 210 | typedef struct _XPixelInfo |
| 211 | { |
cristy | f2faecf | 2010-05-28 19:19:36 +0000 | [diff] [blame] | 212 | ssize_t |
| 213 | colors; |
| 214 | |
| 215 | unsigned long |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 216 | *pixels; |
| 217 | |
| 218 | XColor |
| 219 | foreground_color, |
| 220 | background_color, |
| 221 | border_color, |
| 222 | matte_color, |
| 223 | highlight_color, |
| 224 | shadow_color, |
| 225 | depth_color, |
| 226 | trough_color, |
| 227 | box_color, |
| 228 | pen_color, |
| 229 | pen_colors[MaxNumberPens]; |
| 230 | |
| 231 | GC |
| 232 | annotate_context, |
| 233 | highlight_context, |
| 234 | widget_context; |
| 235 | |
| 236 | unsigned short |
| 237 | box_index, |
| 238 | pen_index; |
| 239 | } XPixelInfo; |
| 240 | |
cristy | e3099b7 | 2011-09-08 18:21:13 +0000 | [diff] [blame] | 241 | typedef struct _XResourceInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 242 | { |
| 243 | XrmDatabase |
| 244 | resource_database; |
| 245 | |
| 246 | ImageInfo |
| 247 | *image_info; |
| 248 | |
| 249 | QuantizeInfo |
| 250 | *quantize_info; |
| 251 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 252 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 253 | colors; |
| 254 | |
| 255 | MagickBooleanType |
| 256 | close_server, |
| 257 | backdrop; |
| 258 | |
| 259 | char |
| 260 | *background_color, |
| 261 | *border_color; |
| 262 | |
| 263 | char |
| 264 | *client_name; |
| 265 | |
| 266 | XColormapType |
| 267 | colormap; |
| 268 | |
| 269 | unsigned int |
| 270 | border_width; |
| 271 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 272 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 273 | delay; |
| 274 | |
| 275 | MagickBooleanType |
| 276 | color_recovery, |
| 277 | confirm_exit, |
| 278 | confirm_edit; |
| 279 | |
| 280 | char |
| 281 | *display_gamma; |
| 282 | |
| 283 | char |
| 284 | *font, |
| 285 | *font_name[MaxNumberFonts], |
| 286 | *foreground_color; |
| 287 | |
| 288 | MagickBooleanType |
| 289 | display_warnings, |
| 290 | gamma_correct; |
| 291 | |
| 292 | char |
| 293 | *icon_geometry; |
| 294 | |
| 295 | MagickBooleanType |
| 296 | iconic, |
| 297 | immutable; |
| 298 | |
| 299 | char |
| 300 | *image_geometry; |
| 301 | |
| 302 | char |
| 303 | *map_type, |
| 304 | *matte_color, |
| 305 | *name; |
| 306 | |
| 307 | unsigned int |
| 308 | magnify, |
| 309 | pause; |
| 310 | |
| 311 | char |
| 312 | *pen_colors[MaxNumberPens]; |
| 313 | |
| 314 | char |
| 315 | *text_font, |
| 316 | *title; |
| 317 | |
| 318 | int |
| 319 | quantum; |
| 320 | |
| 321 | unsigned int |
| 322 | update; |
| 323 | |
| 324 | MagickBooleanType |
| 325 | use_pixmap, |
| 326 | use_shared_memory; |
| 327 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 328 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 329 | undo_cache; |
| 330 | |
| 331 | char |
| 332 | *visual_type, |
| 333 | *window_group, |
| 334 | *window_id, |
| 335 | *write_filename; |
| 336 | |
| 337 | Image |
| 338 | *copy_image; |
| 339 | |
| 340 | int |
| 341 | gravity; |
| 342 | |
| 343 | char |
| 344 | home_directory[MaxTextExtent]; |
cristy | e3099b7 | 2011-09-08 18:21:13 +0000 | [diff] [blame] | 345 | } XResourceInfo; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 346 | |
| 347 | typedef struct _XWindowInfo |
| 348 | { |
| 349 | Window |
| 350 | id; |
| 351 | |
| 352 | Window |
| 353 | root; |
| 354 | |
| 355 | Visual |
| 356 | *visual; |
| 357 | |
| 358 | unsigned int |
| 359 | storage_class, |
| 360 | depth; |
| 361 | |
| 362 | XVisualInfo |
| 363 | *visual_info; |
| 364 | |
| 365 | XStandardColormap |
| 366 | *map_info; |
| 367 | |
| 368 | XPixelInfo |
| 369 | *pixel_info; |
| 370 | |
| 371 | XFontStruct |
| 372 | *font_info; |
| 373 | |
| 374 | GC |
| 375 | annotate_context, |
| 376 | highlight_context, |
| 377 | widget_context; |
| 378 | |
| 379 | Cursor |
| 380 | cursor, |
| 381 | busy_cursor; |
| 382 | |
| 383 | char |
| 384 | *name, |
| 385 | *geometry, |
| 386 | *icon_name, |
| 387 | *icon_geometry, |
| 388 | *crop_geometry; |
| 389 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 390 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 391 | data, |
| 392 | flags; |
| 393 | |
| 394 | int |
| 395 | x, |
| 396 | y; |
| 397 | |
| 398 | unsigned int |
| 399 | width, |
| 400 | height, |
| 401 | min_width, |
| 402 | min_height, |
| 403 | width_inc, |
| 404 | height_inc, |
| 405 | border_width; |
| 406 | |
| 407 | MagickBooleanType |
| 408 | use_pixmap, |
| 409 | immutable, |
| 410 | shape, |
| 411 | shared_memory; |
| 412 | |
| 413 | int |
| 414 | screen; |
| 415 | |
| 416 | XImage |
| 417 | *ximage, |
| 418 | *matte_image; |
| 419 | |
| 420 | Pixmap |
| 421 | highlight_stipple, |
| 422 | shadow_stipple, |
| 423 | pixmap, |
| 424 | *pixmaps, |
| 425 | matte_pixmap, |
| 426 | *matte_pixmaps; |
| 427 | |
| 428 | XSetWindowAttributes |
| 429 | attributes; |
| 430 | |
| 431 | XWindowChanges |
| 432 | window_changes; |
| 433 | |
| 434 | void |
| 435 | *segment_info; |
| 436 | |
cristy | 8891f9c | 2010-06-04 23:32:17 +0000 | [diff] [blame] | 437 | long |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 438 | mask; |
| 439 | |
| 440 | MagickBooleanType |
| 441 | orphan, |
| 442 | mapped, |
| 443 | stasis; |
| 444 | |
| 445 | Image |
| 446 | *image; |
| 447 | |
| 448 | MagickBooleanType |
| 449 | destroy; |
| 450 | } XWindowInfo; |
| 451 | |
| 452 | typedef struct _XWindows |
| 453 | { |
| 454 | Display |
| 455 | *display; |
| 456 | |
| 457 | XStandardColormap |
| 458 | *map_info, |
| 459 | *icon_map; |
| 460 | |
| 461 | XVisualInfo |
| 462 | *visual_info, |
| 463 | *icon_visual; |
| 464 | |
| 465 | XPixelInfo |
| 466 | *pixel_info, |
| 467 | *icon_pixel; |
| 468 | |
| 469 | XFontStruct |
| 470 | *font_info; |
| 471 | |
| 472 | XResourceInfo |
| 473 | *icon_resources; |
| 474 | |
| 475 | XClassHint |
| 476 | *class_hints; |
| 477 | |
| 478 | XWMHints |
| 479 | *manager_hints; |
| 480 | |
| 481 | XWindowInfo |
| 482 | context, |
| 483 | group_leader, |
| 484 | backdrop, |
| 485 | icon, |
| 486 | image, |
| 487 | info, |
| 488 | magnify, |
| 489 | pan, |
| 490 | command, |
| 491 | widget, |
| 492 | popup; |
| 493 | |
| 494 | Atom |
| 495 | wm_protocols, |
| 496 | wm_delete_window, |
| 497 | wm_take_focus, |
| 498 | im_protocols, |
| 499 | im_remote_command, |
| 500 | im_update_widget, |
| 501 | im_update_colormap, |
| 502 | im_former_image, |
| 503 | im_retain_colors, |
| 504 | im_next_image, |
| 505 | im_exit, |
| 506 | dnd_protocols; |
| 507 | } XWindows; |
| 508 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 509 | extern MagickPrivate Cursor |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 510 | XMakeCursor(Display *,Window,Colormap,char *,char *); |
| 511 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 512 | extern MagickPrivate int |
| 513 | XCheckDefineCursor(Display *,Window,Cursor); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 514 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 515 | extern MagickPrivate MagickBooleanType |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 516 | XAnnotateImage(Display *,const XPixelInfo *,XAnnotateInfo *,Image *, |
| 517 | ExceptionInfo *), |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 518 | XComponentGenesis(void), |
cristy | 6710d84 | 2011-10-20 23:23:00 +0000 | [diff] [blame] | 519 | XDrawImage(Display *,const XPixelInfo *,XDrawInfo *,Image *,ExceptionInfo *), |
| 520 | XGetWindowColor(Display *,XWindows *,char *,ExceptionInfo *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 521 | XMagickProgressMonitor(const char *,const MagickOffsetType, |
| 522 | const MagickSizeType,void *), |
| 523 | XMakeImage(Display *,const XResourceInfo *,XWindowInfo *,Image *,unsigned int, |
cristy | 051718b | 2011-08-28 22:49:25 +0000 | [diff] [blame] | 524 | unsigned int,ExceptionInfo *), |
cristy | 9950d57 | 2011-10-01 18:22:35 +0000 | [diff] [blame] | 525 | XQueryColorCompliance(const char *,XColor *); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 526 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 527 | extern MagickPrivate void |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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), |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 532 | XComponentTerminus(void), |
cristy | 6710d84 | 2011-10-20 23:23:00 +0000 | [diff] [blame] | 533 | XConfigureImageColormap(Display *,XResourceInfo *,XWindows *,Image *, |
| 534 | ExceptionInfo *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 535 | XConstrainWindowPosition(Display *,XWindowInfo *), |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 536 | XDelay(Display *,const size_t), |
cristy | 6710d84 | 2011-10-20 23:23:00 +0000 | [diff] [blame] | 537 | XDisplayImageInfo(Display *,const XResourceInfo *,XWindows *,Image *,Image *, |
| 538 | ExceptionInfo *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 539 | XDestroyWindowColors(Display *,Window), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 540 | XFreeResources(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *, |
| 541 | XFontStruct *,XResourceInfo *,XWindowInfo *), |
| 542 | XFreeStandardColormap(Display *,const XVisualInfo *,XStandardColormap *, |
| 543 | XPixelInfo *), |
| 544 | XHighlightEllipse(Display *,Window,GC,const RectangleInfo *), |
| 545 | XHighlightLine(Display *,Window,GC,const XSegment *), |
| 546 | XHighlightRectangle(Display *,Window,GC,const RectangleInfo *), |
| 547 | XGetAnnotateInfo(XAnnotateInfo *), |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 548 | XGetPixelInfo(Display *,const XVisualInfo *,const XStandardColormap *, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 549 | const XResourceInfo *,Image *,XPixelInfo *), |
| 550 | XGetMapInfo(const XVisualInfo *,const Colormap,XStandardColormap *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 551 | XGetWindowInfo(Display *,XVisualInfo *,XStandardColormap *,XPixelInfo *, |
| 552 | XFontStruct *,XResourceInfo *,XWindowInfo *), |
cristy | 6710d84 | 2011-10-20 23:23:00 +0000 | [diff] [blame] | 553 | XMakeMagnifyImage(Display *,XWindows *,ExceptionInfo *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 554 | XMakeStandardColormap(Display *,XVisualInfo *,XResourceInfo *,Image *, |
cristy | 6710d84 | 2011-10-20 23:23:00 +0000 | [diff] [blame] | 555 | XStandardColormap *,XPixelInfo *,ExceptionInfo *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 556 | XMakeWindow(Display *,Window,char **,int,XClassHint *,XWMHints *, |
| 557 | XWindowInfo *), |
| 558 | XQueryPosition(Display *,const Window,int *,int *), |
| 559 | XRefreshWindow(Display *,const XWindowInfo *,const XEvent *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 560 | XSetCursorState(Display *,XWindows *,const MagickStatusType), |
| 561 | XUserPreferences(XResourceInfo *), |
| 562 | XWarning(const ExceptionType,const char *,const char *); |
| 563 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 564 | extern MagickPrivate Window |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 565 | XWindowByID(Display *,const Window,const size_t), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 566 | XWindowByName(Display *,const Window,const char *), |
| 567 | XWindowByProperty(Display *,const Window,const Atom); |
| 568 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 569 | extern MagickPrivate XFontStruct |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 570 | *XBestFont(Display *,const XResourceInfo *,const MagickBooleanType); |
| 571 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 572 | extern MagickPrivate XVisualInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 573 | *XBestVisualInfo(Display *,XStandardColormap *,XResourceInfo *); |
| 574 | |
cristy | bcbda3f | 2011-09-03 13:01:22 +0000 | [diff] [blame] | 575 | extern MagickPrivate XWindows |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 576 | *XInitializeWindows(Display *,XResourceInfo *), |
| 577 | *XSetWindows(XWindows *); |
| 578 | |
cristy | e3099b7 | 2011-09-08 18:21:13 +0000 | [diff] [blame] | 579 | extern MagickExport char |
| 580 | *XGetResourceClass(XrmDatabase,const char *,const char *,char *), |
| 581 | *XGetResourceInstance(XrmDatabase,const char *,const char *,const char *), |
| 582 | *XGetScreenDensity(Display *); |
| 583 | |
| 584 | extern MagickExport int |
| 585 | XError(Display *,XErrorEvent *); |
| 586 | |
| 587 | extern MagickExport MagickBooleanType |
| 588 | XRemoteCommand(Display *,const char *,const char *); |
| 589 | |
| 590 | extern MagickExport void |
| 591 | DestroyXResources(void), |
| 592 | XDestroyResourceInfo(XResourceInfo *), |
| 593 | XGetResourceInfo(const ImageInfo *,XrmDatabase,const char *,XResourceInfo *), |
| 594 | XRetainWindowColors(Display *,const Window); |
| 595 | |
| 596 | extern MagickExport XrmDatabase |
| 597 | XGetResourceDatabase(Display *,const char *); |
| 598 | |
cristy | a19f1d7 | 2012-08-07 18:24:38 +0000 | [diff] [blame] | 599 | static inline double XPixelIntensity(const XColor *pixel) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 600 | { |
cristy | d7027ca | 2012-06-16 00:41:11 +0000 | [diff] [blame] | 601 | double |
| 602 | blue, |
| 603 | green, |
| 604 | red; |
| 605 | |
cristy | 36abbdf | 2012-10-10 22:44:05 +0000 | [diff] [blame] | 606 | red=DecodesRGBGamma((double) pixel->red); |
| 607 | green=DecodesRGBGamma((double) pixel->green); |
| 608 | blue=DecodesRGBGamma((double) pixel->blue); |
cristy | a86a5cb | 2012-10-14 13:40:33 +0000 | [diff] [blame^] | 609 | return(0.298839f*red+0.586811f*green+0.114350f*blue); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 610 | } |
| 611 | |
| 612 | #endif |
| 613 | |
| 614 | #if defined(__cplusplus) || defined(c_plusplus) |
| 615 | } |
| 616 | #endif |
| 617 | |
| 618 | #endif |