gdevmswn.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Copyright (C) 1989, 1992, 1993, 1994, 1998 Aladdin Enterprises. All rights reserved.
  2. This file is part of AFPL Ghostscript.
  3. AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  4. distributor accepts any responsibility for the consequences of using it, or
  5. for whether it serves any particular purpose or works at all, unless he or
  6. she says so in writing. Refer to the Aladdin Free Public License (the
  7. "License") for full details.
  8. Every copy of AFPL Ghostscript must include a copy of the License, normally
  9. in a plain ASCII text file named PUBLIC. The License grants you the right
  10. to copy, modify and redistribute AFPL Ghostscript, but only under certain
  11. conditions described in the License. Among other things, the License
  12. requires that the copyright notice and this notice be preserved on all
  13. copies.
  14. */
  15. /*$Id: gdevmswn.h,v 1.2 2000/09/19 19:00:14 lpd Exp $ */
  16. /* Shared definitions for Microsoft Windows 3.n drivers */
  17. #ifndef gdevmswn_INCLUDED
  18. # define gdevmswn_INCLUDED
  19. #include "string_.h"
  20. #include <stdlib.h>
  21. #include "dos_.h"
  22. #include "gx.h"
  23. #include "gserrors.h"
  24. #include "gxdevice.h"
  25. #include "memory_.h"
  26. #include "windows_.h"
  27. #include <shellapi.h>
  28. #include "gp_mswin.h"
  29. typedef struct gx_device_win_s gx_device_win;
  30. /* Utility routines in gdevmswn.c */
  31. LPLOGPALETTE win_makepalette(P1(gx_device_win *));
  32. int win_nomemory(P0());
  33. void win_update(P1(gx_device_win *));
  34. /* Device procedures shared by all implementations. */
  35. /* Implementations may wrap their own code around _open and _close. */
  36. dev_proc_open_device(win_open);
  37. dev_proc_sync_output(win_sync_output);
  38. dev_proc_output_page(win_output_page);
  39. dev_proc_close_device(win_close);
  40. dev_proc_map_rgb_color(win_map_rgb_color);
  41. dev_proc_map_color_rgb(win_map_color_rgb);
  42. dev_proc_get_params(win_get_params);
  43. dev_proc_put_params(win_put_params);
  44. dev_proc_get_xfont_procs(win_get_xfont_procs);
  45. dev_proc_get_alpha_bits(win_get_alpha_bits);
  46. /* Common part of the device descriptor. */
  47. #define win_proc_copy_to_clipboard(proc)\
  48. void proc(P1(gx_device_win *))
  49. #define win_proc_repaint(proc)\
  50. void proc(P8(gx_device_win *, HDC, int, int, int, int, int, int))
  51. #define win_proc_alloc_bitmap(proc)\
  52. int proc(P2(gx_device_win *, gx_device *))
  53. #define win_proc_free_bitmap(proc)\
  54. void proc(P1(gx_device_win *))
  55. #define win_gsview_sizeof 80
  56. #define gx_device_win_common\
  57. int BitsPerPixel;\
  58. int nColors;\
  59. byte *mapped_color_flags;\
  60. /* Implementation-specific procedures */\
  61. win_proc_alloc_bitmap((*alloc_bitmap));\
  62. win_proc_free_bitmap((*free_bitmap));\
  63. /* Handles */\
  64. HPALETTE himgpalette;\
  65. LPLOGPALETTE limgpalette
  66. /* The basic window device */
  67. struct gx_device_win_s {
  68. gx_device_common;
  69. gx_device_win_common;
  70. };
  71. /* Initial values for width and height */
  72. #define INITIAL_RESOLUTION 96.0
  73. #define INITIAL_WIDTH (INITIAL_RESOLUTION * 85 / 10 + 1)
  74. #define INITIAL_HEIGHT (INITIAL_RESOLUTION * 11 + 1)
  75. /* A macro for casting the device argument */
  76. #define wdev ((gx_device_win *)dev)
  77. /* RasterOp codes */
  78. #define rop_write_at_1s 0xE20746L /* BitBlt: write brush at 1's */
  79. #define rop_write_at_0s 0xB8074AL /* BitBlt: write brush at 0's */
  80. #define rop_write_0_at_1s 0x220326L /* BitBlt: ~S & D */
  81. #define rop_write_0_at_0s 0x8800C6L /* BitBlt: S & D */
  82. #define rop_write_1s 0xFF0062L /* write 1's */
  83. #define rop_write_0s 0x000042L /* write 0's */
  84. #define rop_write_pattern 0xF00021L /* PatBlt: write brush */
  85. /* Compress a gx_color_value into an 8-bit Windows color value, */
  86. /* using only the high order 5 bits. */
  87. #define win_color_value(z)\
  88. ((((z) >> (gx_color_value_bits - 5)) << 3) +\
  89. ((z) >> (gx_color_value_bits - 3)))
  90. #endif /* gdevmswn_INCLUDED */