Utah Raster Toolkit
9999-git
URT Development version (post-3.1b)
Main Page
Data Structures
Files
File List
Globals
get
getx11
getx11.h
Go to the documentation of this file.
1
/*
2
* This software is copyrighted as noted below. It may be freely copied,
3
* modified, and redistributed, provided that the copyright notices are
4
* preserved on all copies.
5
*
6
* There is no warranty or other guarantee of fitness for this software,
7
* it is provided solely "as is". Bug reports or fixes may be sent
8
* to the author, who may or may not act on them as he desires.
9
*
10
* You may not include this software in a program or other software product
11
* without supplying the source, or without informing the end-user that the
12
* source is available for no extra charge.
13
*
14
* If you modify this software, you should include a notice giving the
15
* name of the person performing the modification, the date of modification,
16
* and the reason for such modification.
17
*/
18
19
/*
20
* getx11.h - Declaration for image_information structure... (tote a global)
21
*
22
* Author: Martin R. Friedmann
23
* Dept of Electrical Engineering and Computer Science
24
* University of Michigan
25
* Date: Tue, Dec 10, 1989
26
* Copyright (c) 1989, University of Michigan
27
*/
28
29
#
include
<
stdio
.
h
>
30
#
include
<
math
.
h
>
31
#
include
<
ctype
.
h
>
32
#
include
<
X11
/
X
.
h
>
33
#
include
<
X11
/
Xlib
.
h
>
34
#
ifndef
XLIBINT_H_NOT_AVAILABLE
35
#
include
<
X11
/
Xlibint
.
h
>
36
#
endif
37
#
include
<
X11
/
Xutil
.
h
>
38
#
include
<
X11
/
cursorfont
.
h
>
39
40
#
include
"rle.h"
41
#
ifdef
X_SHARED_MEMORY
42
#
include
<
sys
/
ipc
.
h
>
43
#
include
<
sys
/
shm
.
h
>
44
#
include
<
X11
/
extensions
/
XShm
.
h
>
45
#
ifndef
USE_PROTOTYPES
46
extern
void_star shmat();
47
#
endif
48
#
endif
49
50
#
define
COUNT_OF
(
_array_
)
(
sizeof
(
_array_
)
/
sizeof
(
_array_
[
0
]
)
)
51
#
define
IMAGE_BORDERWIDTH
3
52
53
typedef
int
Boolean
;
54
typedef
unsigned
long
Pixel
;
55
56
#
define
MALLOC_FAILURE
3
57
#
define
FILE_FAILURE
2
58
#
define
FATAL_FAILURE
1
59
#
define
SUCCESS
0
60
61
#
define
VPRINTF
if
(
verbose_flag
)
fprintf
62
#
define
DPRINTF
if
(
debug_flag
)
fprintf
63
64
#
define
SHIFT_MASK_PIXEL
(
r
,
g
,
b
)
65
(
(
(
(
(
r
)
<<
cmap_i
.
red_shift
)
&
cmap_i
.
red_mask
)
66
|
(
(
(
g
)
<<
cmap_i
.
green_shift
)
&
cmap_i
.
green_mask
)
67
|
(
(
(
b
)
<<
cmap_i
.
blue_shift
)
&
cmap_i
.
blue_mask
)
)
+
68
cmap_i
.
pixel_base
)
69
70
#
define
SHIFT_MASK_PIXEL_32
(
r
,
g
,
b
)
71
(
(
(
r
)
<<
cmap_i
.
red_shift
)
72
|
(
(
g
)
<<
cmap_i
.
green_shift
)
73
|
(
(
b
)
<<
cmap_i
.
blue_shift
)
)
74
75
#
define
Min
(
x
,
y
)
(
(
(
x
)
<
(
y
)
)
?
(
x
)
:
(
y
)
)
76
#
define
Max
(
x
,
y
)
(
(
(
x
)
>
(
y
)
)
?
(
x
)
:
(
y
)
)
77
78
typedef
void
VOID_FUNCTION
();
79
typedef
int
array16
[16];
80
81
extern
double
display_gamma
;
82
extern
int
iflag
;
83
84
extern
char
*
progname
;
85
extern
Display *
dpy
;
86
extern
Window
root_window
;
87
extern
int
screen
;
88
89
extern
Boolean
debug_flag
;
/* set if debug mode -D */
90
extern
Boolean
verbose_flag
;
/* set if verbose mode -v */
91
extern
int
stingy_flag
;
92
extern
int
specified_levels
;
93
#
ifdef
X_SHARED_MEMORY
94
/*
95
* use_shared_pixmaps is TRUE if the server supports shared images.
96
* no_shared_space is set to TRUE the first time shmget returns
97
* ENOSPC, so the error message is only printed once. We still
98
* try, though, as an 'r' or 'q' command could release segments.
99
*/
100
extern
Boolean
do_sharing
;
101
extern
Boolean
use_shared_pixmaps
;
102
extern
Boolean
no_shared_space
;
103
#
endif
104
105
/* X11/NeWS server bug workaround. */
106
extern
int
no_color_ref_counts
;
107
108
/*
109
* Color map, gamma correction map, and lookup tables
110
*/
111
112
typedef
struct
_cmap_info_struct
113
{
114
int
red_shift
;
115
int
green_shift
;
116
int
blue_shift
;
117
Pixel
red_mask
;
118
Pixel
green_mask
;
119
Pixel
blue_mask
;
120
Pixel
pixel_base
;
121
} cmap_info;
122
123
typedef
struct
_image_info_struct
124
{
125
Window
window
,
icn_window
;
/* X windows and pixmaps */
126
Window
pix_info_window
;
127
Pixmap
pixmap
,
icn_pixmap
;
128
GC
gc
,
icn_gc
;
/* And GC's and XImages */
129
XImage *
image
, *
icn_image
;
130
Colormap
colormap
;
131
int
visual_class
;
132
Visual *
dpy_visual
;
133
int
dpy_depth
;
134
Boolean
pixmap_failed
;
135
136
CONST_DECL
char
*
filename
;
/* file that Image came from. */
137
CONST_DECL
char
*
title
;
/* title for this image... */
138
int
img_num
;
/* Number of image within file. */
139
FILE *
fd
;
140
unsigned
char
*
scan_data
;
/* a[img_h][img_w][img_clr_channels] */
141
int
img_channels
;
/* # of color channels in file */
142
int
dpy_channels
;
/* # of channels we will display */
143
VOID_FUNCTION
*
map_scanline
;
/* map_scanline routine to use */
144
VOID_FUNCTION
*
MAG_scanline
;
/* MAG_scanline routine to use */
145
float
gamma
;
146
float
dpy_gamma
;
147
148
int
x
,
y
;
/* Original origin of image */
149
int
xo
,
yo
;
/* Origin of image in X11 window (-y)*/
150
int
w
,
h
;
/* width and height of image */
151
int
win_w
,
win_h
;
/* width and height of window */
152
int
icn_w
,
icn_h
;
/* width and height of icon */
153
int
pix_w
,
pix_h
;
/* width and height of img->pixmap */
154
int
icn_factor
;
/* divide factor from img -> icon */
155
156
int
pan_x
,
pan_y
,
pan_w
,
pan_h
;
/* image rect currently being viewed */
157
int
mag_fact
,
save_mag_fact
;
/* current magnification factor */
158
Boolean
mag_mode
;
/* are we display magnified image? */
159
int
save_pan_x
,
save_pan_y
;
160
int
save_pan_w
,
save_pan_h
;
161
int
save_win_w
,
save_win_h
;
/* wdth and hgt of window when saved */
162
163
Boolean
binary_img
;
/* will we make it 2 color? (-W) */
164
Boolean
mono_img
;
/* do we make it grey scale? (-w) */
165
Boolean
dither_img
;
/* do we dither it? (-a) */
166
Boolean
rw_cmap
;
/* is the colormap writable? */
167
Boolean
sep_colors
;
/* is the visual True or DirectColor?*/
168
Boolean
mono_color
;
/* a one channel color image (mcut) */
169
Boolean
color_dpy
;
/* False if we are FORCED to b/w */
170
171
rle_pixel
**
in_cmap
;
172
int
ncmap
;
/* rle_hdr.ncmap */
173
int
cmlen
;
/* Comment `color_map_length` in file*/
174
175
int
*
modN
;
/* dither arrays, all of them */
176
int
*
divN
;
177
array16
*
dm16
;
178
cmap_info
x_cmap
;
179
Pixel
*
pixel_table
;
180
Pixel
white_pixel
,
black_pixel
;
181
int
lvls
,
lvls_squared
;
182
#
ifdef
X_SHARED_MEMORY
183
XShmSegmentInfo
shm_img
;
184
XShmSegmentInfo
shm_pix
;
185
#
endif
186
} image_information;
187
188
/* pointer arithmetic... gack! */
189
/* Returns Y'th row in our saved data array. Works around problem with */
190
/* rle_getrow by adding 1 to y. We waste the first line of this array */
191
/* SAVED_RLE_ROW(img, -1) == img->scan_data, and is never used... */
192
#
define
SAVED_RLE_ROW
(
img
,
y
)
193
(
(
img
)
->
scan_data
+
(
(
(
y
)
+
1
)
*
(
img
)
->
w
*
(
img
)
->
dpy_channels
)
)
194
195
196
#
define
duff8
(
counter
,
block
)
{
197
while
(
counter
>=
8
)
{
198
{
block
;
}
199
{
block
;
}
200
{
block
;
}
201
{
block
;
}
202
{
block
;
}
203
{
block
;
}
204
{
block
;
}
205
{
block
;
}
206
counter
-=
8
;
207
}
208
switch
(
counter
&
7
)
{
209
case
7
:
{
block
;
}
210
case
6
:
{
block
;
}
211
case
5
:
{
block
;
}
212
case
4
:
{
block
;
}
213
case
3
:
{
block
;
}
214
case
2
:
{
block
;
}
215
case
1
:
{
block
;
}
216
case
0
:
counter
=
0
;
217
}
\
218
}
219
220
/* add missing prototype (moved to prototypes.h)
221
* extern Status XAllocColors(register Display *dpy, Colormap cmap, XColor *defs, int ndefs, Status *statuses);
222
*/
223
224
#
ifdef
USE_PROTOTYPES
225
/* Prototypes.h contains prototypes for all global functions. It is
226
* automatically generated using the cproto program.
227
*/
228
#
include
"prototypes.h"
229
#
else
230
/* This is also automatically generated by cproto. */
231
#
include
"fn_decls.h"
232
#
endif
_image_info_struct::scan_data
unsigned char * scan_data
Definition:
getx11.h:140
_image_info_struct::save_win_w
int save_win_w
Definition:
getx11.h:161
_image_info_struct::dpy_depth
int dpy_depth
Definition:
getx11.h:133
use_shared_pixmaps
Boolean use_shared_pixmaps
Definition:
getx11.c:85
Boolean
int Boolean
Definition:
getx11.h:53
_image_info_struct::x_cmap
cmap_info x_cmap
Definition:
getx11.h:178
_image_info_struct::ncmap
int ncmap
Definition:
getx11.h:172
_cmap_info_struct::blue_mask
Pixel blue_mask
Definition:
getx11.h:119
_image_info_struct::gamma
float gamma
Definition:
getx11.h:145
_image_info_struct::visual_class
int visual_class
Definition:
getx11.h:131
_image_info_struct::dpy_gamma
float dpy_gamma
Definition:
getx11.h:146
_image_info_struct::rw_cmap
Boolean rw_cmap
Definition:
getx11.h:166
_image_info_struct::save_pan_h
int save_pan_h
Definition:
getx11.h:160
_image_info_struct::w
int w
Definition:
getx11.h:150
stingy_flag
int stingy_flag
Definition:
getx11.c:81
_cmap_info_struct::green_mask
Pixel green_mask
Definition:
getx11.h:118
_image_info_struct::pixmap_failed
Boolean pixmap_failed
Definition:
getx11.h:134
no_color_ref_counts
int no_color_ref_counts
Definition:
getx11.c:88
USE_PROTOTYPES
#define USE_PROTOTYPES
Definition:
rle_config.h:22
_image_info_struct::img_num
int img_num
Definition:
getx11.h:138
_image_info_struct::mag_mode
Boolean mag_mode
Definition:
getx11.h:158
_image_info_struct::shm_img
XShmSegmentInfo shm_img
Definition:
getx11.h:183
debug_flag
Boolean debug_flag
Definition:
get_orion.c:79
array16
int array16[16]
Definition:
getx11.h:79
dpy
Display * dpy
Definition:
getx10.c:94
_image_info_struct::save_mag_fact
int save_mag_fact
Definition:
getx11.h:157
_image_info_struct::save_pan_x
int save_pan_x
Definition:
getx11.h:159
_cmap_info_struct::red_mask
Pixel red_mask
Definition:
getx11.h:117
_image_info_struct::icn_h
int icn_h
Definition:
getx11.h:152
specified_levels
int specified_levels
Definition:
getx11.c:82
_image_info_struct::gc
GC gc
Definition:
getx11.h:128
no_shared_space
Boolean no_shared_space
Definition:
getx11.c:86
_image_info_struct::cmlen
int cmlen
Definition:
getx11.h:173
_image_info_struct::save_pan_y
int save_pan_y
Definition:
getx11.h:159
_image_info_struct::fd
FILE * fd
Definition:
getx11.h:139
_image_info_struct::pan_x
int pan_x
Definition:
getx11.h:156
_image_info_struct::lvls_squared
int lvls_squared
Definition:
getx11.h:181
_image_info_struct::title
const char * title
Definition:
getx11.h:137
_image_info_struct::lvls
int lvls
Definition:
getx11.h:181
_image_info_struct::shm_pix
XShmSegmentInfo shm_pix
Definition:
getx11.h:184
_image_info_struct::pix_w
int pix_w
Definition:
getx11.h:153
progname
char * progname
Definition:
unslice.c:51
_cmap_info_struct::pixel_base
Pixel pixel_base
Definition:
getx11.h:120
_cmap_info_struct
Definition:
getx11.h:112
_image_info_struct::pan_h
int pan_h
Definition:
getx11.h:156
_image_info_struct::dpy_visual
Visual * dpy_visual
Definition:
getx11.h:132
verbose_flag
short verbose_flag
Definition:
qcr.c:17
_image_info_struct::filename
const char * filename
Definition:
getx11.h:136
_image_info_struct::xo
int xo
Definition:
getx11.h:149
_image_info_struct::mono_color
Boolean mono_color
Definition:
getx11.h:168
_image_info_struct::icn_w
int icn_w
Definition:
getx11.h:152
_image_info_struct::modN
int * modN
Definition:
getx11.h:175
_image_info_struct::win_w
int win_w
Definition:
getx11.h:151
_image_info_struct::icn_factor
int icn_factor
Definition:
getx11.h:154
_image_info_struct::icn_window
Window icn_window
Definition:
getx11.h:125
screen
int screen
Definition:
show3.c:29
_image_info_struct::pixel_table
Pixel * pixel_table
Definition:
getx11.h:179
_cmap_info_struct::blue_shift
int blue_shift
Definition:
getx11.h:116
root_window
Window root_window
Definition:
getx11.c:76
_image_info_struct::save_pan_w
int save_pan_w
Definition:
getx11.h:160
_image_info_struct::icn_gc
GC icn_gc
Definition:
getx11.h:128
_image_info_struct::pan_y
int pan_y
Definition:
getx11.h:156
X_SHARED_MEMORY
#define X_SHARED_MEMORY
Definition:
rle_config.h:30
iflag
int iflag
Definition:
getsun.c:80
_image_info_struct::x
int x
Definition:
getx11.h:148
_image_info_struct::color_dpy
Boolean color_dpy
Definition:
getx11.h:169
CONST_DECL
#define CONST_DECL
Definition:
rle_config.h:42
_image_info_struct::divN
int * divN
Definition:
getx11.h:176
_cmap_info_struct::red_shift
int red_shift
Definition:
getx11.h:114
_image_info_struct::img_channels
int img_channels
Definition:
getx11.h:141
VOID_FUNCTION
void VOID_FUNCTION()
Definition:
getx11.h:78
_image_info_struct::binary_img
Boolean binary_img
Definition:
getx11.h:163
_image_info_struct::y
int y
Definition:
getx11.h:148
_image_info_struct::dpy_channels
int dpy_channels
Definition:
getx11.h:142
_image_info_struct::sep_colors
Boolean sep_colors
Definition:
getx11.h:167
_image_info_struct::mag_fact
int mag_fact
Definition:
getx11.h:157
_image_info_struct::pan_w
int pan_w
Definition:
getx11.h:156
_image_info_struct::pix_h
int pix_h
Definition:
getx11.h:153
_image_info_struct::pixmap
Pixmap pixmap
Definition:
getx11.h:127
_image_info_struct::icn_pixmap
Pixmap icn_pixmap
Definition:
getx11.h:127
_image_info_struct::image
XImage * image
Definition:
getx11.h:129
_image_info_struct::icn_image
XImage * icn_image
Definition:
getx11.h:129
rle_pixel
unsigned char rle_pixel
Definition:
rle.h:56
_image_info_struct::mono_img
Boolean mono_img
Definition:
getx11.h:164
_image_info_struct::in_cmap
rle_pixel ** in_cmap
Definition:
getx11.h:171
_image_info_struct::black_pixel
Pixel black_pixel
Definition:
getx11.h:180
_image_info_struct::MAG_scanline
VOID_FUNCTION * MAG_scanline
Definition:
getx11.h:144
_image_info_struct::pix_info_window
Window pix_info_window
Definition:
getx11.h:126
_cmap_info_struct::green_shift
int green_shift
Definition:
getx11.h:115
_image_info_struct::yo
int yo
Definition:
getx11.h:149
_image_info_struct::colormap
Colormap colormap
Definition:
getx11.h:130
_image_info_struct::dither_img
Boolean dither_img
Definition:
getx11.h:165
display_gamma
double display_gamma
Definition:
getx11.c:64
_image_info_struct::win_h
int win_h
Definition:
getx11.h:151
_image_info_struct::save_win_h
int save_win_h
Definition:
getx11.h:161
_image_info_struct::map_scanline
VOID_FUNCTION * map_scanline
Definition:
getx11.h:143
_image_info_struct::window
Window window
Definition:
getx11.h:125
_image_info_struct::dm16
array16 * dm16
Definition:
getx11.h:177
_image_info_struct::white_pixel
Pixel white_pixel
Definition:
getx11.h:180
_image_info_struct::h
int h
Definition:
getx11.h:150
do_sharing
Boolean do_sharing
Definition:
getx11.c:84
_image_info_struct
Definition:
getx11.h:123
Pixel
unsigned long Pixel
Definition:
getx11.h:54
Generated on Thu Sep 24 2015 11:47:02 for Utah Raster Toolkit by
1.8.10