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