1 /* Copyright (C) 2001-2006 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: gxwts.h 8022 2007-06-05 22:23:38Z giles $ */ 14 #ifndef gxwts_INCLUDED 15 # define gxwts_INCLUDED 16 17 typedef bits16 wts_screen_sample_t; 18 19 #ifndef wts_screen_t_DEFINED 20 # define wts_screen_t_DEFINED 21 typedef struct wts_screen_s wts_screen_t; 22 #endif 23 24 /* We cache intermediate results for wts_get_samples_j. In general, if these 25 are set so that a band fits, then the hit rate will be excellent. */ 26 #define WTS_CACHE_SIZE_X 512 27 #define WTS_CACHE_SIZE_Y 512 28 29 typedef enum { 30 WTS_SCREEN_RAT, 31 WTS_SCREEN_J, 32 WTS_SCREEN_H 33 } wts_screen_type; 34 35 struct wts_screen_s { 36 wts_screen_type type; 37 int cell_width; 38 int cell_height; 39 int cell_shift; 40 wts_screen_sample_t *samples; 41 }; 42 43 typedef struct { 44 int tag; 45 int x; 46 int y; 47 int nsamples; 48 } wts_j_cache_el; 49 50 typedef struct { 51 wts_screen_t base; 52 53 /* Probabilities of "jumps". A and B jumps can happen when moving 54 one pixel to the right. C and D can happen when moving one pixel 55 down. */ 56 int pa; /* change to double? */ 57 int pb; 58 int pc; 59 int pd; 60 61 int XA; 62 int YA; 63 int XB; 64 int YB; 65 int XC; 66 int YC; 67 int XD; 68 int YD; 69 70 #ifdef WTS_CACHE_SIZE_X 71 #define WTS_SCREEN_J_SIZE_NOCACHE 68 72 wts_j_cache_el xcache[WTS_CACHE_SIZE_X]; 73 wts_j_cache_el ycache[WTS_CACHE_SIZE_Y]; 74 #endif 75 } wts_screen_j_t; 76 77 typedef struct { 78 wts_screen_t base; 79 80 /* This is the exact value that x1 and (width-x1) approximates. */ 81 double px; 82 /* Ditto y1 and (height-y1). */ 83 double py; 84 85 int x1; 86 int y1; 87 } wts_screen_h_t; 88 89 int 90 wts_get_samples(wts_screen_t *ws, int x, int y, 91 int *pcellx, int *pcelly, int *p_nsamples); 92 93 #endif 94