2 * Copyright 2012 Google, Inc. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 * Google Author(s): Behdad Esfahbod, Maysum Panju
22 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
28 typedef int glyphy_bool_t;
47 glyphy_extents_clear (glyphy_extents_t *extents);
50 glyphy_extents_is_empty (const glyphy_extents_t *extents);
53 glyphy_extents_add (glyphy_extents_t *extents,
54 const glyphy_point_t *p);
57 glyphy_extents_extend (glyphy_extents_t *extents,
58 const glyphy_extents_t *other);
61 glyphy_extents_includes (const glyphy_extents_t *extents,
62 const glyphy_point_t *p);
65 glyphy_extents_scale (glyphy_extents_t *extents,
80 * Approximate outlines with multiple arcs
86 } glyphy_arc_endpoint_t;
88 typedef glyphy_bool_t (*glyphy_arc_endpoint_accumulator_callback_t) (glyphy_arc_endpoint_t *endpoint,
91 typedef struct glyphy_arc_accumulator_t glyphy_arc_accumulator_t;
93 glyphy_arc_accumulator_t *
94 glyphy_arc_accumulator_create (void);
97 glyphy_arc_accumulator_destroy (glyphy_arc_accumulator_t *acc);
100 glyphy_arc_accumulator_reset (glyphy_arc_accumulator_t *acc);
102 /* Configure accumulator */
105 glyphy_arc_accumulator_set_tolerance (glyphy_arc_accumulator_t *acc,
109 glyphy_arc_accumulator_get_tolerance (glyphy_arc_accumulator_t *acc);
112 glyphy_arc_accumulator_set_callback (glyphy_arc_accumulator_t *acc,
113 glyphy_arc_endpoint_accumulator_callback_t callback,
117 glyphy_arc_accumulator_get_callback (glyphy_arc_accumulator_t *acc,
118 glyphy_arc_endpoint_accumulator_callback_t *callback,
121 /* Accumulation results */
124 glyphy_arc_accumulator_get_error (glyphy_arc_accumulator_t *acc);
127 glyphy_arc_accumulator_successful (glyphy_arc_accumulator_t *acc);
133 glyphy_arc_accumulator_move_to (glyphy_arc_accumulator_t *acc,
134 const glyphy_point_t *p0);
137 glyphy_arc_accumulator_line_to (glyphy_arc_accumulator_t *acc,
138 const glyphy_point_t *p1);
141 glyphy_arc_accumulator_conic_to (glyphy_arc_accumulator_t *acc,
142 const glyphy_point_t *p1,
143 const glyphy_point_t *p2);
146 glyphy_arc_accumulator_cubic_to (glyphy_arc_accumulator_t *acc,
147 const glyphy_point_t *p1,
148 const glyphy_point_t *p2,
149 const glyphy_point_t *p3);
152 glyphy_arc_accumulator_arc_to (glyphy_arc_accumulator_t *acc,
153 const glyphy_point_t *p1,
157 glyphy_arc_accumulator_close_path (glyphy_arc_accumulator_t *acc);
160 glyphy_arc_list_extents (const glyphy_arc_endpoint_t *endpoints,
161 unsigned int num_endpoints,
162 glyphy_extents_t *extents);
165 * Modify outlines for proper consumption
169 glyphy_outline_reverse (glyphy_arc_endpoint_t *endpoints,
170 unsigned int num_endpoints);
172 /* Returns true if outline was modified */
174 glyphy_outline_winding_from_even_odd (glyphy_arc_endpoint_t *endpoints,
175 unsigned int num_endpoints,
176 glyphy_bool_t inverse);
179 * Encode an arc outline into binary blob for fast SDF calculation
182 typedef Dali::TextAbstraction::VectorBlob glyphy_rgba_t;
185 glyphy_arc_list_encode_blob (const glyphy_arc_endpoint_t *endpoints,
186 unsigned int num_endpoints,
188 unsigned int blob_size,
190 double avg_fetch_desired,
191 double *avg_fetch_achieved,
192 unsigned int *output_len,
193 unsigned int *nominal_width, /* 6bit */
194 unsigned int *nominal_height, /* 6bit */
195 glyphy_extents_t *extents);
198 * Calculate signed-distance-field from (encoded) arc list
202 glyphy_sdf_from_arc_list (const glyphy_arc_endpoint_t *endpoints,
203 unsigned int num_endpoints,
204 const glyphy_point_t *p,
205 glyphy_point_t *closest_p /* may be NULL; TBD not implemented yet */);
208 glyphy_sdf_from_blob (const glyphy_rgba_t *blob,
209 unsigned int nominal_width,
210 unsigned int nominal_height,
211 const glyphy_point_t *p,
212 glyphy_point_t *closest_p /* may be NULL; TBD not implemented yet */);
218 #endif /* GLYPHY_H */