xref: /plan9/sys/src/cmd/gs/src/gxwts.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 2002 artofcode LLC.  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 /*$Id: gxwts.h,v 1.2 2002/11/02 07:31:45 raph Exp $ */
17 #ifndef gxwts_INCLUDED
18 #  define gxwts_INCLUDED
19 
20 typedef bits16 wts_screen_sample_t;
21 
22 #ifndef wts_screen_t_DEFINED
23 #  define wts_screen_t_DEFINED
24 typedef struct wts_screen_s wts_screen_t;
25 #endif
26 
27 typedef enum {
28     WTS_SCREEN_RAT,
29     WTS_SCREEN_J,
30     WTS_SCREEN_H
31 } wts_screen_type;
32 
33 struct wts_screen_s {
34     wts_screen_type type;
35     int cell_width;
36     int cell_height;
37     int cell_shift;
38     wts_screen_sample_t *samples;
39 };
40 
41 typedef struct {
42     wts_screen_t base;
43 
44     /* Probabilities of "jumps". A and B jumps can happen when moving
45        one pixel to the right. C and D can happen when moving one pixel
46        down. */
47     int pa; /* change to double? */
48     int pb;
49     int pc;
50     int pd;
51 
52     int XA;
53     int YA;
54     int XB;
55     int YB;
56     int XC;
57     int YC;
58     int XD;
59     int YD;
60 } wts_screen_j_t;
61 
62 typedef struct {
63     wts_screen_t base;
64 
65     /* This is the exact value that x1 and (width-x1) approximates. */
66     double px;
67     /* Ditto y1 and (height-y1). */
68     double py;
69 
70     int x1;
71     int y1;
72 } wts_screen_h_t;
73 
74 int
75 wts_get_samples(const wts_screen_t *ws, int x, int y,
76 		wts_screen_sample_t **samples, int *p_nsamples);
77 
78 #endif
79