Bentley-Ottann test implementation
[geda-pcb/pcjc2.git] / src / borast / borast-types-private.h
blob69a2ea5ce57077ab13a5bc4b6dc1808fa6070850
1 /* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
2 /* cairo - a vector graphics library with display and print output
4 * Copyright © 2002 University of Southern California
5 * Copyright © 2005 Red Hat, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it either under the terms of the GNU Lesser General Public
9 * License version 2.1 as published by the Free Software Foundation
10 * (the "LGPL") or, at your option, under the terms of the Mozilla
11 * Public License Version 1.1 (the "MPL"). If you do not alter this
12 * notice, a recipient may use your version of this file under either
13 * the MPL or the LGPL.
15 * You should have received a copy of the LGPL along with this library
16 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * You should have received a copy of the MPL along with this library
19 * in the file COPYING-MPL-1.1
21 * The contents of this file are subject to the Mozilla Public License
22 * Version 1.1 (the "License"); you may not use this file except in
23 * compliance with the License. You may obtain a copy of the License at
24 * http://www.mozilla.org/MPL/
26 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
27 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
28 * the specific language governing rights and limitations.
30 * The Original Code is the cairo graphics library.
32 * The Initial Developer of the Original Code is University of Southern
33 * California.
35 * Contributor(s):
36 * Carl D. Worth <cworth@cworth.org>
39 #ifndef BORAST_TYPES_PRIVATE_H
40 #define BORAST_TYPES_PRIVATE_H
42 #include "borast-minimal.h"
43 #include "borast-fixed-type-private.h"
44 #include "borast-compiler-private.h"
46 typedef struct _borast_array borast_array_t;
47 typedef struct _borast_backend borast_backend_t;
48 typedef struct _borast_cache borast_cache_t;
49 typedef struct _borast_clip borast_clip_t;
50 typedef struct _borast_clip_path borast_clip_path_t;
51 typedef struct _borast_gstate borast_gstate_t;
52 typedef struct _borast_hash_entry borast_hash_entry_t;
53 typedef struct _borast_hash_table borast_hash_table_t;
54 typedef struct _borast_path_fixed borast_path_fixed_t;
56 typedef borast_array_t borast_user_data_array_t;
58 /**
59 * borast_hash_entry_t:
61 * A #borast_hash_entry_t contains both a key and a value for
62 * #borast_hash_table_t. User-derived types for #borast_hash_entry_t must
63 * be type-compatible with this structure (eg. they must have an
64 * unsigned long as the first parameter. The easiest way to get this
65 * is to use:
67 * typedef _my_entry {
68 * borast_hash_entry_t base;
69 * ... Remainder of key and value fields here ..
70 * } my_entry_t;
72 * which then allows a pointer to my_entry_t to be passed to any of
73 * the #borast_hash_table_t functions as follows without requiring a cast:
75 * _borast_hash_table_insert (hash_table, &my_entry->base);
77 * IMPORTANT: The caller is reponsible for initializing
78 * my_entry->base.hash with a hash code derived from the key. The
79 * essential property of the hash code is that keys_equal must never
80 * return %TRUE for two keys that have different hashes. The best hash
81 * code will reduce the frequency of two keys with the same code for
82 * which keys_equal returns %FALSE.
84 * Which parts of the entry make up the "key" and which part make up
85 * the value are entirely up to the caller, (as determined by the
86 * computation going into base.hash as well as the keys_equal
87 * function). A few of the #borast_hash_table_t functions accept an entry
88 * which will be used exclusively as a "key", (indicated by a
89 * parameter name of key). In these cases, the value-related fields of
90 * the entry need not be initialized if so desired.
91 **/
92 struct _borast_hash_entry {
93 unsigned long hash;
96 struct _borast_array {
97 unsigned int size;
98 unsigned int num_elements;
99 unsigned int element_size;
100 char **elements;
102 borast_bool_t is_snapshot;
105 /* Sure wish C had a real enum type so that this would be distinct
106 * from #borast_status_t. Oh well, without that, I'll use this bogus 100
107 * offset. We want to keep it fit in int8_t as the compiler may choose
108 * that for #borast_status_t */
109 typedef enum _borast_int_status {
110 BORAST_INT_STATUS_UNSUPPORTED = 100,
111 BORAST_INT_STATUS_DEGENERATE,
112 BORAST_INT_STATUS_NOTHING_TO_DO,
113 BORAST_INT_STATUS_FLATTEN_TRANSPARENCY,
114 BORAST_INT_STATUS_IMAGE_FALLBACK,
115 BORAST_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN,
117 BORAST_INT_STATUS_LAST_STATUS
118 } borast_int_status_t;
120 typedef struct _borast_slope {
121 borast_fixed_t dx;
122 borast_fixed_t dy;
123 } borast_slope_t, borast_distance_t;
125 typedef struct _borast_point_double {
126 double x;
127 double y;
128 } borast_point_double_t;
130 typedef struct _borast_distance_double {
131 double dx;
132 double dy;
133 } borast_distance_double_t;
135 typedef struct _borast_line {
136 borast_point_t p1;
137 borast_point_t p2;
138 } borast_line_t, borast_box_t;
140 typedef struct _borast_trapezoid {
141 borast_fixed_t top, bottom;
142 borast_line_t left, right;
143 } borast_trapezoid_t;
145 typedef struct _borast_point_int {
146 int x, y;
147 } borast_point_int_t;
149 #define BORAST_RECT_INT_MIN (INT_MIN >> BORAST_FIXED_FRAC_BITS)
150 #define BORAST_RECT_INT_MAX (INT_MAX >> BORAST_FIXED_FRAC_BITS)
152 /* Rectangles that take part in a composite operation.
154 * This defines four translations that define which pixels of the
155 * source pattern, mask, clip and destination surface take part in a
156 * general composite operation. The idea is that the pixels at
158 * (i,j)+(src.x, src.y) of the source,
159 * (i,j)+(mask.x, mask.y) of the mask,
160 * (i,j)+(clip.x, clip.y) of the clip and
161 * (i,j)+(dst.x, dst.y) of the destination
163 * all combine together to form the result at (i,j)+(dst.x,dst.y),
164 * for i,j ranging in [0,width) and [0,height) respectively.
166 typedef struct _borast_composite_rectangles {
167 borast_point_int_t src;
168 borast_point_int_t mask;
169 borast_point_int_t clip;
170 borast_point_int_t dst;
171 int width;
172 int height;
173 } borast_composite_rectangles_t;
175 typedef struct _borast_edge {
176 borast_line_t line;
177 int top, bottom;
178 int dir;
179 } borast_edge_t;
181 typedef struct _borast_polygon {
182 borast_status_t status;
184 borast_point_t first_point;
185 borast_point_t last_point;
186 borast_point_t current_point;
187 borast_slope_t current_edge;
188 borast_bool_t has_current_point;
189 borast_bool_t has_current_edge;
191 borast_box_t extents;
192 borast_box_t limit;
193 const borast_box_t *limits;
194 int num_limits;
196 int num_edges;
197 int edges_size;
198 borast_edge_t *edges;
199 borast_edge_t edges_embedded[32];
200 } borast_polygon_t;
202 typedef borast_warn borast_status_t
203 (*borast_spline_add_point_func_t) (void *closure,
204 const borast_point_t *point);
206 #endif /* BORAST_TYPES_PRIVATE_H */