2 |
- |
1 |
/* Copyright (C) 1989, 1992, 1993, 1994, 1998 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: gdevmswn.h,v 1.6 2002/10/07 08:28:56 ghostgum Exp $ */
|
|
|
18 |
/* Shared definitions for Microsoft Windows 3.n drivers */
|
|
|
19 |
|
|
|
20 |
#ifndef gdevmswn_INCLUDED
|
|
|
21 |
# define gdevmswn_INCLUDED
|
|
|
22 |
|
|
|
23 |
#include "string_.h"
|
|
|
24 |
#include <stdlib.h>
|
|
|
25 |
#include "gx.h"
|
|
|
26 |
#include "gserrors.h"
|
|
|
27 |
#include "gxdevice.h"
|
|
|
28 |
#include "memory_.h"
|
|
|
29 |
|
|
|
30 |
#include "windows_.h"
|
|
|
31 |
#include <shellapi.h>
|
|
|
32 |
#include "gp_mswin.h"
|
|
|
33 |
|
|
|
34 |
typedef struct gx_device_win_s gx_device_win;
|
|
|
35 |
|
|
|
36 |
/* Utility routines in gdevmswn.c */
|
|
|
37 |
LPLOGPALETTE win_makepalette(gx_device_win *);
|
|
|
38 |
int win_nomemory(void);
|
|
|
39 |
void win_update(gx_device_win *);
|
|
|
40 |
|
|
|
41 |
/* Device procedures shared by all implementations. */
|
|
|
42 |
/* Implementations may wrap their own code around _open and _close. */
|
|
|
43 |
dev_proc_open_device(win_open);
|
|
|
44 |
dev_proc_sync_output(win_sync_output);
|
|
|
45 |
dev_proc_output_page(win_output_page);
|
|
|
46 |
dev_proc_close_device(win_close);
|
|
|
47 |
dev_proc_map_rgb_color(win_map_rgb_color);
|
|
|
48 |
dev_proc_map_color_rgb(win_map_color_rgb);
|
|
|
49 |
dev_proc_get_params(win_get_params);
|
|
|
50 |
dev_proc_put_params(win_put_params);
|
|
|
51 |
dev_proc_get_xfont_procs(win_get_xfont_procs);
|
|
|
52 |
dev_proc_get_alpha_bits(win_get_alpha_bits);
|
|
|
53 |
|
|
|
54 |
/* Common part of the device descriptor. */
|
|
|
55 |
|
|
|
56 |
#define win_proc_copy_to_clipboard(proc)\
|
|
|
57 |
void proc(gx_device_win *)
|
|
|
58 |
|
|
|
59 |
#define win_proc_repaint(proc)\
|
|
|
60 |
void proc(gx_device_win *, HDC, int, int, int, int, int, int)
|
|
|
61 |
|
|
|
62 |
#define win_proc_alloc_bitmap(proc)\
|
|
|
63 |
int proc(gx_device_win *, gx_device *)
|
|
|
64 |
|
|
|
65 |
#define win_proc_free_bitmap(proc)\
|
|
|
66 |
void proc(gx_device_win *)
|
|
|
67 |
|
|
|
68 |
#define win_gsview_sizeof 80
|
|
|
69 |
|
|
|
70 |
#define gx_device_win_common\
|
|
|
71 |
int BitsPerPixel;\
|
|
|
72 |
int nColors;\
|
|
|
73 |
byte *mapped_color_flags;\
|
|
|
74 |
/* Implementation-specific procedures */\
|
|
|
75 |
win_proc_alloc_bitmap((*alloc_bitmap));\
|
|
|
76 |
win_proc_free_bitmap((*free_bitmap));\
|
|
|
77 |
/* Handles */\
|
|
|
78 |
HPALETTE himgpalette;\
|
|
|
79 |
LPLOGPALETTE limgpalette
|
|
|
80 |
|
|
|
81 |
/* The basic window device */
|
|
|
82 |
struct gx_device_win_s {
|
|
|
83 |
gx_device_common;
|
|
|
84 |
gx_device_win_common;
|
|
|
85 |
};
|
|
|
86 |
|
|
|
87 |
/* Initial values for width and height */
|
|
|
88 |
#define INITIAL_RESOLUTION 96.0
|
|
|
89 |
#define INITIAL_WIDTH (int)(INITIAL_RESOLUTION * 85 / 10 + 0.5)
|
|
|
90 |
#define INITIAL_HEIGHT (int)(INITIAL_RESOLUTION * 11 + 0.5)
|
|
|
91 |
|
|
|
92 |
/* A macro for casting the device argument */
|
|
|
93 |
#define wdev ((gx_device_win *)dev)
|
|
|
94 |
|
|
|
95 |
/* RasterOp codes */
|
|
|
96 |
#define rop_write_at_1s 0xE20746L /* BitBlt: write brush at 1's */
|
|
|
97 |
#define rop_write_at_0s 0xB8074AL /* BitBlt: write brush at 0's */
|
|
|
98 |
#define rop_write_0_at_1s 0x220326L /* BitBlt: ~S & D */
|
|
|
99 |
#define rop_write_0_at_0s 0x8800C6L /* BitBlt: S & D */
|
|
|
100 |
#define rop_write_1s 0xFF0062L /* write 1's */
|
|
|
101 |
#define rop_write_0s 0x000042L /* write 0's */
|
|
|
102 |
#define rop_write_pattern 0xF00021L /* PatBlt: write brush */
|
|
|
103 |
|
|
|
104 |
/* Compress a gx_color_value into an 8-bit Windows color value, */
|
|
|
105 |
/* using only the high order 5 bits. */
|
|
|
106 |
#define win_color_value(z)\
|
|
|
107 |
((((z) >> (gx_color_value_bits - 5)) << 3) +\
|
|
|
108 |
((z) >> (gx_color_value_bits - 3)))
|
|
|
109 |
|
|
|
110 |
#endif /* gdevmswn_INCLUDED */
|