1 /* Copyright (C) 2001-2008 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 /* $Id: dwimg.h 9043 2008-08-28 22:48:19Z giles $ */
14 
15 #ifndef dwimg_INCLUDED
16 #  define dwimg_INCLUDED
17 
18 
19 /* Windows Image Window structure */
20 
21 typedef struct IMAGE_DEVICEN_S IMAGE_DEVICEN;
22 struct IMAGE_DEVICEN_S {
23     int used;		/* non-zero if in use */
24     int visible;	/* show on window */
25     char name[64];
26     int cyan;
27     int magenta;
28     int yellow;
29     int black;
30     int menu;		/* non-zero if menu item added to system menu */
31 };
32 #define IMAGE_DEVICEN_MAX 8
33 
34 typedef struct IMAGE_S IMAGE;
35 struct IMAGE_S {
36     void *handle;
37     void *device;
38     HWND hwnd;
39     HBRUSH hBrush;	/* background */
40     int raster;
41     unsigned int format;
42     unsigned char *image;
43     BITMAPINFOHEADER bmih;
44     HPALETTE palette;
45     int bytewidth;
46     int devicen_gray;	/* true if a single separation should be shown gray */
47     IMAGE_DEVICEN devicen[IMAGE_DEVICEN_MAX];
48 
49     /* periodic redrawing */
50     UINT update_timer;		/* identifier */
51     int update_tick;		/* timer duration in milliseconds */
52     int update_count;		/* Number of WM_TIMER messages received */
53     int update_interval;	/* Number of WM_TIMER until refresh */
54     int pending_update;		/* We have asked for periodic updates */
55     int pending_sync;		/* We have asked for a SYNC */
56 
57     /* Window scrolling stuff */
58     int cxClient, cyClient;
59     int cxAdjust, cyAdjust;
60     int nVscrollPos, nVscrollMax;
61     int nHscrollPos, nHscrollMax;
62 
63     /* thread synchronisation */
64     HANDLE hmutex;
65 
66     IMAGE *next;
67 
68     HWND hwndtext;	/* handle to text window */
69 
70     int x, y, cx, cy;	/* window position */
71 };
72 
73 extern IMAGE *first_image;
74 
75 /* Main thread only */
76 IMAGE *image_find(void *handle, void *device);
77 IMAGE *image_new(void *handle, void *device);
78 void image_delete(IMAGE *img);
79 int image_size(IMAGE *img, int new_width, int new_height, int new_raster,
80    unsigned int new_format, void *pimage);
81 int image_separation(IMAGE *img, int comp_num, const char *name,
82    unsigned short c, unsigned short m, unsigned short y, unsigned short k);
83 
84 /* GUI thread only */
85 void image_open(IMAGE *img);
86 void image_close(IMAGE *img);
87 void image_sync(IMAGE *img);
88 void image_page(IMAGE *img);
89 void image_presize(IMAGE *img, int new_width, int new_height, int new_raster,
90    unsigned int new_format);
91 void image_poll(IMAGE *img);
92 void image_updatesize(IMAGE *img);
93 
94 /* To be called during initialization after the text window has been created */
95 void image_textwindow(HWND hwnd);
96 
97 
98 #endif /* dwimg_INCLUDED */
99