1 /* Copyright (C) 1996-2004, Ghostgum Software Pty Ltd. 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: dwimg.h,v 1.11 2004/09/15 19:41:01 ray Exp $ */ 18 19 #ifndef dwimg_INCLUDED 20 # define dwimg_INCLUDED 21 22 23 /* Windows Image Window structure */ 24 25 typedef struct IMAGE_DEVICEN_S IMAGE_DEVICEN; 26 struct IMAGE_DEVICEN_S { 27 int used; /* non-zero if in use */ 28 int visible; /* show on window */ 29 char name[64]; 30 int cyan; 31 int magenta; 32 int yellow; 33 int black; 34 int menu; /* non-zero if menu item added to system menu */ 35 }; 36 #define IMAGE_DEVICEN_MAX 8 37 38 typedef struct IMAGE_S IMAGE; 39 struct IMAGE_S { 40 void *handle; 41 void *device; 42 HWND hwnd; 43 HBRUSH hBrush; /* background */ 44 int raster; 45 unsigned int format; 46 unsigned char *image; 47 BITMAPINFOHEADER bmih; 48 HPALETTE palette; 49 int bytewidth; 50 int devicen_gray; /* true if a single separation should be shown gray */ 51 IMAGE_DEVICEN devicen[IMAGE_DEVICEN_MAX]; 52 53 /* periodic redrawing */ 54 UINT update_timer; /* identifier */ 55 int update_tick; /* timer duration in milliseconds */ 56 int update_count; /* Number of WM_TIMER messages received */ 57 int update_interval; /* Number of WM_TIMER until refresh */ 58 int pending_update; /* We have asked for periodic updates */ 59 int pending_sync; /* We have asked for a SYNC */ 60 61 /* Window scrolling stuff */ 62 int cxClient, cyClient; 63 int cxAdjust, cyAdjust; 64 int nVscrollPos, nVscrollMax; 65 int nHscrollPos, nHscrollMax; 66 67 /* thread synchronisation */ 68 HANDLE hmutex; 69 70 IMAGE *next; 71 72 HWND hwndtext; /* handle to text window */ 73 74 int x, y, cx, cy; /* window position */ 75 }; 76 77 extern IMAGE *first_image; 78 79 /* Main thread only */ 80 IMAGE *image_find(void *handle, void *device); 81 IMAGE *image_new(void *handle, void *device); 82 void image_delete(IMAGE *img); 83 int image_size(IMAGE *img, int new_width, int new_height, int new_raster, 84 unsigned int new_format, void *pimage); 85 86 /* GUI thread only */ 87 void image_open(IMAGE *img); 88 void image_close(IMAGE *img); 89 void image_sync(IMAGE *img); 90 void image_page(IMAGE *img); 91 void image_presize(IMAGE *img, int new_width, int new_height, int new_raster, 92 unsigned int new_format); 93 void image_poll(IMAGE *img); 94 void image_updatesize(IMAGE *img); 95 96 97 #endif /* dwimg_INCLUDED */ 98