2 |
- |
1 |
/* Copyright (C) 1998, 1999 Aladdin Enterprises. 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: gdevhit.c,v 1.4 2002/02/21 22:24:51 giles Exp $ */
|
|
|
18 |
/* Hit detection device */
|
|
|
19 |
#include "std.h"
|
|
|
20 |
#include "gserror.h"
|
|
|
21 |
#include "gserrors.h"
|
|
|
22 |
#include "gstypes.h"
|
|
|
23 |
#include "gsmemory.h"
|
|
|
24 |
#include "gxdevice.h"
|
|
|
25 |
|
|
|
26 |
/* Define the value returned for a detected hit. */
|
|
|
27 |
const int gs_hit_detected = gs_error_hit_detected;
|
|
|
28 |
|
|
|
29 |
/*
|
|
|
30 |
* Define a minimal device for insideness testing.
|
|
|
31 |
* It returns e_hit whenever it is asked to actually paint any pixels.
|
|
|
32 |
*/
|
|
|
33 |
private dev_proc_fill_rectangle(hit_fill_rectangle);
|
|
|
34 |
const gx_device gs_hit_device = {
|
|
|
35 |
std_device_std_body(gx_device, 0, "hit detector",
|
|
|
36 |
0, 0, 1, 1),
|
|
|
37 |
{NULL, /* open_device */
|
|
|
38 |
NULL, /* get_initial_matrix */
|
|
|
39 |
NULL, /* sync_output */
|
|
|
40 |
NULL, /* output_page */
|
|
|
41 |
NULL, /* close_device */
|
|
|
42 |
gx_default_map_rgb_color,
|
|
|
43 |
gx_default_map_color_rgb,
|
|
|
44 |
hit_fill_rectangle,
|
|
|
45 |
NULL, /* tile_rectangle */
|
|
|
46 |
NULL, /* copy_mono */
|
|
|
47 |
NULL, /* copy_color */
|
|
|
48 |
gx_default_draw_line,
|
|
|
49 |
NULL, /* get_bits */
|
|
|
50 |
NULL, /* get_params */
|
|
|
51 |
NULL, /* put_params */
|
|
|
52 |
gx_default_map_cmyk_color,
|
|
|
53 |
NULL, /* get_xfont_procs */
|
|
|
54 |
NULL, /* get_xfont_device */
|
|
|
55 |
gx_default_map_rgb_alpha_color,
|
|
|
56 |
gx_default_get_page_device,
|
|
|
57 |
gx_default_get_alpha_bits,
|
|
|
58 |
NULL, /* copy_alpha */
|
|
|
59 |
gx_default_get_band,
|
|
|
60 |
NULL, /* copy_rop */
|
|
|
61 |
gx_default_fill_path,
|
|
|
62 |
NULL, /* stroke_path */
|
|
|
63 |
NULL, /* fill_mask */
|
|
|
64 |
gx_default_fill_trapezoid,
|
|
|
65 |
gx_default_fill_parallelogram,
|
|
|
66 |
gx_default_fill_triangle,
|
|
|
67 |
gx_default_draw_thin_line,
|
|
|
68 |
gx_default_begin_image,
|
|
|
69 |
gx_default_image_data,
|
|
|
70 |
gx_default_end_image,
|
|
|
71 |
gx_default_strip_tile_rectangle,
|
|
|
72 |
gx_default_strip_copy_rop,
|
|
|
73 |
gx_get_largest_clipping_box,
|
|
|
74 |
gx_default_begin_typed_image,
|
|
|
75 |
NULL, /* get_bits_rectangle */
|
|
|
76 |
gx_default_map_color_rgb_alpha,
|
|
|
77 |
gx_non_imaging_create_compositor,
|
|
|
78 |
NULL /* get_hardware_params */
|
|
|
79 |
}
|
|
|
80 |
};
|
|
|
81 |
|
|
|
82 |
/* Test for a hit when filling a rectangle. */
|
|
|
83 |
private int
|
|
|
84 |
hit_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
|
|
|
85 |
gx_color_index color)
|
|
|
86 |
{
|
|
|
87 |
if (w > 0 && h > 0)
|
|
|
88 |
return_error(gs_error_hit_detected);
|
|
|
89 |
return 0;
|
|
|
90 |
}
|