зеркало из https://github.com/mozilla/pjs.git
b=416018, upgrade cairo to 1.5.8-30-g80e11a8 ; r=me
This commit is contained in:
Родитель
132331f5d0
Коммит
09aa6197e4
|
@ -7,7 +7,7 @@ http://www.cairographics.org/.
|
|||
|
||||
VERSIONS:
|
||||
|
||||
cairo (1.5.x - 1.5.6-75-gc621d8d)
|
||||
cairo (1.5.x - 1.5.8-30-g80e11a8)
|
||||
pixman (0.9.x - pixman-0.9.6-34-g787cc57)
|
||||
glitz 0.5.2 (cvs - 2006-01-10)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
/**
|
||||
* _cairo_array_init:
|
||||
*
|
||||
* Initialize a new cairo_array object to store objects each of size
|
||||
* Initialize a new #cairo_array_t object to store objects each of size
|
||||
* @element_size.
|
||||
*
|
||||
* The #cairo_array_t object provides grow-by-doubling storage. It
|
||||
|
@ -177,7 +177,7 @@ _cairo_array_truncate (cairo_array_t *array, unsigned int num_elements)
|
|||
* pointer may be used for further direct indexing with []. For
|
||||
* example:
|
||||
*
|
||||
* cairo_array_t array;
|
||||
* #cairo_array_t array;
|
||||
* double *values;
|
||||
*
|
||||
* _cairo_array_init (&array, sizeof(double));
|
||||
|
@ -231,7 +231,7 @@ _cairo_array_copy_element (cairo_array_t *array, int index, void *dst)
|
|||
*
|
||||
* _cairo_array_index (array, _cairo_array_num_elements (array) - 1);
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if insufficient memory is available for the
|
||||
* operation.
|
||||
**/
|
||||
|
@ -251,7 +251,7 @@ _cairo_array_append (cairo_array_t *array,
|
|||
* @num_elements, then copying @num_elements * element_size bytes from
|
||||
* @elements into the array.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if insufficient memory is available for the
|
||||
* operation.
|
||||
**/
|
||||
|
@ -282,7 +282,7 @@ _cairo_array_append_multiple (cairo_array_t *array,
|
|||
* @elements. This memory will be unitialized, but will be accounted
|
||||
* for in the return value of _cairo_array_num_elements().
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if insufficient memory is available for the
|
||||
* operation.
|
||||
**/
|
||||
|
@ -331,7 +331,7 @@ _cairo_array_size (cairo_array_t *array)
|
|||
return array->size;
|
||||
}
|
||||
|
||||
/* cairo_user_data_array_t */
|
||||
/* #cairo_user_data_array_t */
|
||||
|
||||
typedef struct {
|
||||
const cairo_user_data_key_t *key;
|
||||
|
|
|
@ -208,6 +208,7 @@ CreateSizedCopyOfStyle(ATSUStyle inStyle,
|
|||
static cairo_status_t
|
||||
_cairo_atsui_font_set_metrics (cairo_atsui_font_t *font)
|
||||
{
|
||||
cairo_status_t status;
|
||||
ATSFontRef atsFont;
|
||||
ATSFontMetrics metrics;
|
||||
OSStatus err;
|
||||
|
@ -228,9 +229,9 @@ _cairo_atsui_font_set_metrics (cairo_atsui_font_t *font)
|
|||
/* The FT backend doesn't handle max_y_advance either, so we'll ignore it for now. */
|
||||
extents.max_y_advance = 0.0;
|
||||
|
||||
_cairo_scaled_font_set_metrics (&font->base, &extents);
|
||||
status = _cairo_scaled_font_set_metrics (&font->base, &extents);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,6 +257,8 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face,
|
|||
if (font == NULL)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
memset (font, 0, sizeof(cairo_atsui_font_t));
|
||||
|
||||
status = _cairo_scaled_font_init (&font->base,
|
||||
font_face, font_matrix, ctm, options,
|
||||
&cairo_atsui_scaled_font_backend);
|
||||
|
@ -264,12 +267,23 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face,
|
|||
return status;
|
||||
}
|
||||
|
||||
_cairo_matrix_compute_scale_factors (&font->base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
status = _cairo_matrix_compute_scale_factors (&font->base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
goto FAIL;
|
||||
|
||||
/* ATS can't handle 0-sized bits; we end up in an odd infinite loop
|
||||
* if we send down a size of 0. */
|
||||
if (xscale == 0.0) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
font->font_matrix = CGAffineTransformMake (1., 0.,
|
||||
0., yscale/xscale,
|
||||
0., 0.);
|
||||
font->size = FloatToFixed (xscale);
|
||||
font->style = NULL;
|
||||
|
||||
err = CreateSizedCopyOfStyle (style, &font->size, &font->font_matrix, &font->style);
|
||||
if (err != noErr) {
|
||||
|
@ -306,6 +320,7 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face,
|
|||
if (font) {
|
||||
if (font->style)
|
||||
ATSUDisposeStyle(font->style);
|
||||
_cairo_scaled_font_fini(font);
|
||||
free (font);
|
||||
}
|
||||
|
||||
|
@ -466,6 +481,7 @@ static cairo_status_t
|
|||
_cairo_atsui_font_init_glyph_metrics (cairo_atsui_font_t *scaled_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_text_extents_t extents = {0, 0, 0, 0, 0, 0};
|
||||
OSStatus err;
|
||||
ATSGlyphScreenMetrics metricsH;
|
||||
|
@ -489,8 +505,11 @@ _cairo_atsui_font_init_glyph_metrics (cairo_atsui_font_t *scaled_font,
|
|||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
/* Scale down to font units.*/
|
||||
_cairo_matrix_compute_scale_factors (&scaled_font->base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
status = _cairo_matrix_compute_scale_factors (&scaled_font->base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
xscale = 1.0/xscale;
|
||||
yscale = 1.0/yscale;
|
||||
|
||||
|
@ -601,6 +620,7 @@ static cairo_status_t
|
|||
_cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph)
|
||||
{
|
||||
cairo_status_t status;
|
||||
static ATSCubicMoveToUPP moveProc = NULL;
|
||||
static ATSCubicLineToUPP lineProc = NULL;
|
||||
static ATSCubicCurveToUPP curveProc = NULL;
|
||||
|
@ -625,7 +645,10 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font,
|
|||
}
|
||||
|
||||
/* extract the rotation/shear component of the scale matrix. */
|
||||
_cairo_matrix_compute_scale_factors (font_to_device, &xscale, &yscale, 1);
|
||||
status = _cairo_matrix_compute_scale_factors (font_to_device, &xscale, &yscale, 1);
|
||||
if (status)
|
||||
goto FAIL;
|
||||
|
||||
cairo_matrix_init (&unscaled_font_to_device,
|
||||
font_to_device->xx,
|
||||
font_to_device->yx,
|
||||
|
@ -649,14 +672,18 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font,
|
|||
curveProc,
|
||||
closePathProc, (void *)&scaled_path, &err);
|
||||
if (err != noErr) {
|
||||
_cairo_path_fixed_destroy (scaled_path.path);
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
_cairo_scaled_glyph_set_path (scaled_glyph, &scaled_font->base,
|
||||
scaled_path.path);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
FAIL:
|
||||
_cairo_path_fixed_destroy (scaled_path.path);
|
||||
return status;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
@ -681,7 +708,6 @@ _cairo_atsui_scaled_font_init_glyph_surface (cairo_atsui_font_t *scaled_font,
|
|||
CGRect bbox;
|
||||
CGAffineTransform transform;
|
||||
|
||||
|
||||
if (theGlyph == kATSDeletedGlyphcode) {
|
||||
surface = (cairo_image_surface_t *)cairo_image_surface_create (CAIRO_FORMAT_A8, 2, 2);
|
||||
status = cairo_surface_status ((cairo_surface_t *)surface);
|
||||
|
@ -701,8 +727,11 @@ _cairo_atsui_scaled_font_init_glyph_surface (cairo_atsui_font_t *scaled_font,
|
|||
height = extents.ascent + extents.descent + 2.0;
|
||||
bottom = -extents.descent - 1.0;
|
||||
|
||||
_cairo_matrix_compute_scale_factors (&base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
status = _cairo_matrix_compute_scale_factors (&base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
bbox = CGRectApplyAffineTransform (CGRectMake (1.0, bottom, 1.0, height), CGAffineTransformMakeScale(xscale, yscale));
|
||||
bottom = CGRectGetMinY (bbox);
|
||||
height = bbox.size.height;
|
||||
|
@ -734,8 +763,11 @@ _cairo_atsui_scaled_font_init_glyph_surface (cairo_atsui_font_t *scaled_font,
|
|||
-base.scale.xy,
|
||||
base.scale.yy,
|
||||
0., 0.);
|
||||
_cairo_matrix_compute_scale_factors (&base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
status = _cairo_matrix_compute_scale_factors (&base.scale,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
transform = CGAffineTransformScale (transform, 1.0/xscale, 1.0/yscale);
|
||||
|
||||
/* Rotate the bounding box. This computes the smallest CGRect
|
||||
|
@ -896,6 +928,11 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font,
|
|||
goto BAIL2;
|
||||
}
|
||||
|
||||
status = _cairo_matrix_compute_scale_factors (&font->base.ctm,
|
||||
&xscale, &yscale, 1);
|
||||
if (status)
|
||||
goto BAIL2;
|
||||
|
||||
*num_glyphs = glyphCount - 1;
|
||||
*glyphs =
|
||||
(cairo_glyph_t *) _cairo_malloc_ab(*num_glyphs, sizeof (cairo_glyph_t));
|
||||
|
@ -903,7 +940,7 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font,
|
|||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto BAIL1;
|
||||
}
|
||||
_cairo_matrix_compute_scale_factors (&font->base.ctm, &xscale, &yscale, 1);
|
||||
|
||||
device_to_user_scale =
|
||||
CGAffineTransformInvert (CGAffineTransformMake (xscale, 0,
|
||||
0, yscale,
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is cairo_output_stream.c as distributed with the
|
||||
* cairo graphics library.
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Red Hat, Inc.
|
||||
*
|
||||
|
|
|
@ -129,7 +129,7 @@ typedef struct _cairo_bo_event_queue {
|
|||
unsigned num_startstop_events;
|
||||
} cairo_bo_event_queue_t;
|
||||
|
||||
/* This structure extends cairo_skip_list_t, which must come first. */
|
||||
/* This structure extends #cairo_skip_list_t, which must come first. */
|
||||
typedef struct _cairo_bo_sweep_line {
|
||||
cairo_skip_list_t active_edges;
|
||||
cairo_bo_edge_t *head;
|
||||
|
@ -385,7 +385,7 @@ cairo_bo_event_compare (cairo_bo_event_t const *a,
|
|||
* need a different sense for start and stop events based on the
|
||||
* shortening rule.
|
||||
*
|
||||
* NOTE: Fortunately, we get to ignore errors in the relative
|
||||
* Note: Fortunately, we get to ignore errors in the relative
|
||||
* ordering of intersection events. This means we don't even have
|
||||
* to look at e2 here, nor worry about which sense of the slope
|
||||
* comparison test is used for intersection events.
|
||||
|
@ -507,7 +507,7 @@ det64_128 (cairo_int64_t a,
|
|||
/* Compute the intersection of two lines as defined by two edges. The
|
||||
* result is provided as a coordinate pair of 128-bit integers.
|
||||
*
|
||||
* Returns CAIRO_BO_STATUS_INTERSECTION if there is an intersection or
|
||||
* Returns %CAIRO_BO_STATUS_INTERSECTION if there is an intersection or
|
||||
* CAIRO_BO_STATUS_PARALLEL if the two lines are exactly parallel.
|
||||
*/
|
||||
static cairo_bo_status_t
|
||||
|
@ -638,10 +638,10 @@ _cairo_bo_edge_contains_intersect_point (cairo_bo_edge_t *edge,
|
|||
/* Compute the intersection of two edges. The result is provided as a
|
||||
* coordinate pair of 128-bit integers.
|
||||
*
|
||||
* Returns CAIRO_BO_STATUS_INTERSECTION if there is an intersection
|
||||
* that is within both edges, CAIRO_BO_STATUS_NO_INTERSECTION if the
|
||||
* Returns %CAIRO_BO_STATUS_INTERSECTION if there is an intersection
|
||||
* that is within both edges, %CAIRO_BO_STATUS_NO_INTERSECTION if the
|
||||
* intersection of the lines defined by the edges occurs outside of
|
||||
* one or both edges, and CAIRO_BO_STATUS_PARALLEL if the two edges
|
||||
* one or both edges, and %CAIRO_BO_STATUS_PARALLEL if the two edges
|
||||
* are exactly parallel.
|
||||
*
|
||||
* Note that when determining if a candidate intersection is "inside"
|
||||
|
@ -1053,7 +1053,7 @@ print_state (const char *msg,
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Adds the trapezoid, if any, of the left edge to the cairo_traps_t
|
||||
/* Adds the trapezoid, if any, of the left edge to the #cairo_traps_t
|
||||
* of bo_traps. */
|
||||
static cairo_status_t
|
||||
_cairo_bo_edge_end_trap (cairo_bo_edge_t *left,
|
||||
|
|
|
@ -964,7 +964,7 @@ cairo_beos_surface_create (BView* view)
|
|||
* before the surface.
|
||||
*
|
||||
* For views that draw to a bitmap (as opposed to a screen), use this function
|
||||
* rather than cairo_beos_surface_create. Not using this function WILL lead to
|
||||
* rather than cairo_beos_surface_create(). Not using this function WILL lead to
|
||||
* incorrect behaviour.
|
||||
*
|
||||
* For now, only views that draw to the entire area of bmp are supported.
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
* cairo_cache_entry_t:
|
||||
*
|
||||
* A #cairo_cache_entry_t contains both a key and a value for
|
||||
* cairo_cache_t. User-derived types for cairo_cache_entry_t must
|
||||
* have a cairo_cache_entry_t as their first field. For example:
|
||||
* #cairo_cache_t. User-derived types for #cairo_cache_entry_t must
|
||||
* have a #cairo_cache_entry_t as their first field. For example:
|
||||
*
|
||||
* typedef _my_entry {
|
||||
* cairo_cache_entry_t base;
|
||||
|
@ -55,7 +55,7 @@
|
|||
* } my_entry_t;
|
||||
*
|
||||
* which then allows a pointer to my_entry_t to be passed to any of
|
||||
* the cairo_cache functions as follows without requiring a cast:
|
||||
* the #cairo_cache_t functions as follows without requiring a cast:
|
||||
*
|
||||
* _cairo_cache_insert (cache, &my_entry->base, size);
|
||||
*
|
||||
|
@ -78,7 +78,7 @@
|
|||
* Which parts of the entry make up the "key" and which part make up
|
||||
* the value are entirely up to the caller, (as determined by the
|
||||
* computation going into base.hash as well as the keys_equal
|
||||
* function). A few of the cairo_cache functions accept an entry which
|
||||
* function). A few of the #cairo_cache_t functions accept an entry which
|
||||
* will be used exclusively as a "key", (indicated by a parameter name
|
||||
* of key). In these cases, the value-related fields of the entry need
|
||||
* not be initialized if so desired.
|
||||
|
|
|
@ -97,7 +97,7 @@ _cairo_cache_fini (cairo_cache_t *cache)
|
|||
* the equality of entries.
|
||||
*
|
||||
* Data is provided to the cache in the form of user-derived version
|
||||
* of cairo_cache_entry_t. A cache entry must be able to hold hash
|
||||
* of #cairo_cache_entry_t. A cache entry must be able to hold hash
|
||||
* code, a size, and the key/value pair being stored in the
|
||||
* cache. Sometimes only the key will be necessary, (as in
|
||||
* _cairo_cache_lookup()), and in these cases the value portion of the
|
||||
|
@ -172,7 +172,7 @@ _cairo_cache_destroy (cairo_cache_t *cache)
|
|||
* add new entries to the cache regardless of how large the cache
|
||||
* grows. See _cairo_cache_thaw().
|
||||
*
|
||||
* NOTE: Multiple calls to _cairo_cache_freeze() will stack, in that
|
||||
* Note: Multiple calls to _cairo_cache_freeze() will stack, in that
|
||||
* the cache will remain "frozen" until a corresponding number of
|
||||
* calls are made to _cairo_cache_thaw().
|
||||
**/
|
||||
|
@ -239,8 +239,8 @@ _cairo_cache_lookup (cairo_cache_t *cache,
|
|||
*
|
||||
* Remove a random entry from the cache.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if an entry was successfully
|
||||
* removed. CAIRO_INT_STATUS_CACHE_EMPTY if there are no entries that
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if an entry was successfully
|
||||
* removed. %CAIRO_INT_STATUS_CACHE_EMPTY if there are no entries that
|
||||
* can be removed.
|
||||
**/
|
||||
static cairo_int_status_t
|
||||
|
@ -295,7 +295,7 @@ _cairo_cache_shrink_to_accommodate (cairo_cache_t *cache,
|
|||
* a matching key, then the old entry will be removed first, (and the
|
||||
* entry_destroy() callback will be called on it).
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if insufficient memory is available.
|
||||
**/
|
||||
cairo_status_t
|
||||
|
@ -323,7 +323,7 @@ _cairo_cache_insert (cairo_cache_t *cache,
|
|||
*
|
||||
* Remove an existing entry from the cache.
|
||||
*
|
||||
* (NOTE: If any caller wanted access to a non-static version of this
|
||||
* (Note: If any caller wanted access to a non-static version of this
|
||||
* function, an improved version would require only a key rather than
|
||||
* an entry. Fixing that would require fixing _cairo_hash_table_remove
|
||||
* to return (a copy of?) the entry being removed.)
|
||||
|
|
|
@ -451,11 +451,41 @@ _cairo_clip_intersect_mask (cairo_clip_t *clip,
|
|||
|
||||
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE,
|
||||
CAIRO_CONTENT_COLOR);
|
||||
/* The clipping operation should ideally be something like the following to
|
||||
* avoid having to do as many passes over the data
|
||||
|
||||
if (clip->surface != NULL) {
|
||||
_cairo_pattern_init_for_surface (&pattern.surface, clip->surface);
|
||||
} else {
|
||||
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE,
|
||||
CAIRO_CONTENT_COLOR);
|
||||
}
|
||||
status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN,
|
||||
&pattern.base,
|
||||
surface,
|
||||
antialias,
|
||||
0, 0,
|
||||
0, 0,
|
||||
surface_rect.width,
|
||||
surface_rect.height,
|
||||
traps->traps,
|
||||
traps->num_traps);
|
||||
|
||||
However this operation is not accelerated by pixman
|
||||
|
||||
I believe the best possible operation would probably an unbounded SRC
|
||||
operator. Using SRC we could potentially avoid having to initialize
|
||||
the surface which would be ideal from an efficiency point of view.
|
||||
However, _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_SOURCE) is
|
||||
bounded by the mask.
|
||||
|
||||
*/
|
||||
|
||||
surface = _cairo_surface_create_similar_solid (target,
|
||||
CAIRO_CONTENT_ALPHA,
|
||||
surface_rect.width,
|
||||
surface_rect.height,
|
||||
CAIRO_COLOR_WHITE,
|
||||
CAIRO_COLOR_TRANSPARENT,
|
||||
&pattern.base);
|
||||
if (surface->status) {
|
||||
_cairo_pattern_fini (&pattern.base);
|
||||
|
@ -466,7 +496,7 @@ _cairo_clip_intersect_mask (cairo_clip_t *clip,
|
|||
|
||||
_cairo_traps_translate (traps, -surface_rect.x, -surface_rect.y);
|
||||
|
||||
status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN,
|
||||
status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_ADD,
|
||||
&pattern.base,
|
||||
surface,
|
||||
antialias,
|
||||
|
|
|
@ -44,9 +44,9 @@
|
|||
*
|
||||
* This function is intended to be useful when using memory-checking
|
||||
* tools such as valgrind. When valgrind's memcheck analyzes a
|
||||
* cairo-using program without a call to cairo_debug_reset_static_data,
|
||||
* cairo-using program without a call to cairo_debug_reset_static_data(),
|
||||
* it will report all data reachable via cairo's static objects as
|
||||
* "still reachable". Calling cairo_debug_reset_static_data just prior
|
||||
* "still reachable". Calling cairo_debug_reset_static_data() just prior
|
||||
* to program termination will make it easier to get squeaky clean
|
||||
* reports from valgrind.
|
||||
*
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is cairo_output_stream.c as distributed with the
|
||||
* cairo graphics library.
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Adrian Johnson.
|
||||
*
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#ifndef CAIRO_DEPRECATED_H
|
||||
#define CAIRO_DEPRECATED_H
|
||||
|
||||
/* The CAIRO_FORMAT_RGB16_565 value was added in cairo 1.2.0 as part
|
||||
/* The %CAIRO_FORMAT_RGB16_565 value was added in cairo 1.2.0 as part
|
||||
* of fixing cairo's xlib backend to work with X servers advertising a
|
||||
* 16-bit, 565 visual. But as it turned out, adding this format to
|
||||
* #cairo_format_t was not necessary, and was a mistake, (cairo's xlib
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
/*
|
||||
* Environment variables affecting the backend:
|
||||
*
|
||||
* CAIRO_DIRECTFB_NO_ACCEL (boolean)
|
||||
* %CAIRO_DIRECTFB_NO_ACCEL (boolean)
|
||||
* if found, disables acceleration at all
|
||||
*
|
||||
* CAIRO_DIRECTFB_ARGB_FONT (boolean)
|
||||
* %CAIRO_DIRECTFB_ARGB_FONT (boolean)
|
||||
* if found, enables using ARGB fonts instead of A8
|
||||
*/
|
||||
|
||||
|
|
|
@ -61,10 +61,10 @@ typedef cairo_int128_t cairo_fixed_96_32_t;
|
|||
*/
|
||||
#define CAIRO_FIXED_FRAC_BITS 8
|
||||
|
||||
/* A signed type CAIRO_FIXED_BITS in size; the main fixed point type */
|
||||
/* A signed type %CAIRO_FIXED_BITS in size; the main fixed point type */
|
||||
typedef int32_t cairo_fixed_t;
|
||||
|
||||
/* An unsigned type of the same size as cairo_fixed_t */
|
||||
/* An unsigned type of the same size as #cairo_fixed_t */
|
||||
typedef uint32_t cairo_fixed_unsigned_t;
|
||||
|
||||
#endif /* CAIRO_FIXED_TYPE_PRIVATE_H */
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
*/
|
||||
static const cairo_font_face_backend_t _cairo_toy_font_face_backend;
|
||||
|
||||
/* cairo_font_face_t */
|
||||
/* #cairo_font_face_t */
|
||||
|
||||
const cairo_font_face_t _cairo_font_face_nil = {
|
||||
{ 0 }, /* hash_entry */
|
||||
|
@ -256,10 +256,10 @@ _cairo_toy_font_face_keys_equal (const void *key_a,
|
|||
const void *key_b);
|
||||
|
||||
/* We maintain a hash table from family/weight/slant =>
|
||||
* cairo_font_face_t for cairo_toy_font_t. The primary purpose of
|
||||
* this mapping is to provide unique cairo_font_face_t values so that
|
||||
* our cache and mapping from cairo_font_face_t => cairo_scaled_font_t
|
||||
* works. Once the corresponding cairo_font_face_t objects fall out of
|
||||
* #cairo_font_face_t for #cairo_toy_font_t. The primary purpose of
|
||||
* this mapping is to provide unique #cairo_font_face_t values so that
|
||||
* our cache and mapping from #cairo_font_face_t => #cairo_scaled_font_t
|
||||
* works. Once the corresponding #cairo_font_face_t objects fall out of
|
||||
* downstream caches, we don't need them in this hash table anymore.
|
||||
*
|
||||
* Modifications to this hash table are protected by
|
||||
|
@ -295,11 +295,11 @@ _cairo_toy_font_face_hash_table_unlock (void)
|
|||
/**
|
||||
* _cairo_toy_font_face_init_key:
|
||||
*
|
||||
* Initialize those portions of cairo_toy_font_face_t needed to use
|
||||
* Initialize those portions of #cairo_toy_font_face_t needed to use
|
||||
* it as a hash table key, including the hash code buried away in
|
||||
* font_face->base.hash_entry. No memory allocation is performed here
|
||||
* so that no fini call is needed. We do this to make it easier to use
|
||||
* an automatic cairo_toy_font_face_t variable as a key.
|
||||
* an automatic #cairo_toy_font_face_t variable as a key.
|
||||
**/
|
||||
static void
|
||||
_cairo_toy_font_face_init_key (cairo_toy_font_face_t *key,
|
||||
|
|
|
@ -241,7 +241,7 @@ slim_hidden_def (cairo_font_options_equal);
|
|||
* @options: a #cairo_font_options_t
|
||||
*
|
||||
* Compute a hash for the font options object; this value will
|
||||
* be useful when storing an object containing a cairo_font_options_t
|
||||
* be useful when storing an object containing a #cairo_font_options_t
|
||||
* in a hash table.
|
||||
*
|
||||
* Return value: the hash value for the font options object.
|
||||
|
|
|
@ -50,14 +50,14 @@ _cairo_freelist_fini (cairo_freelist_t *freelist);
|
|||
/* Allocate a new node from the freelist. If the freelist contains no
|
||||
* nodes, a new one will be allocated using malloc(). The caller is
|
||||
* responsible for calling _cairo_freelist_free() or free() on the
|
||||
* returned node. Returns NULL on memory allocation error. */
|
||||
* returned node. Returns %NULL on memory allocation error. */
|
||||
cairo_private void *
|
||||
_cairo_freelist_alloc (cairo_freelist_t *freelist);
|
||||
|
||||
/* Allocate a new node from the freelist. If the freelist contains no
|
||||
* nodes, a new one will be allocated using calloc(). The caller is
|
||||
* responsible for calling _cairo_freelist_free() or free() on the
|
||||
* returned node. Returns NULL on memory allocation error. */
|
||||
* returned node. Returns %NULL on memory allocation error. */
|
||||
cairo_private void *
|
||||
_cairo_freelist_calloc (cairo_freelist_t *freelist);
|
||||
|
||||
|
|
|
@ -144,11 +144,11 @@ struct _cairo_ft_font_face {
|
|||
static const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend;
|
||||
|
||||
/*
|
||||
* We maintain a hash table to map file/id => cairo_ft_unscaled_font_t.
|
||||
* We maintain a hash table to map file/id => #cairo_ft_unscaled_font_t.
|
||||
* The hash table itself isn't limited in size. However, we limit the
|
||||
* number of FT_Face objects we keep around; when we've exceeded that
|
||||
* limit and need to create a new FT_Face, we dump the FT_Face from a
|
||||
* random cairo_ft_unscaled_font_t which has an unlocked FT_Face, (if
|
||||
* random #cairo_ft_unscaled_font_t which has an unlocked FT_Face, (if
|
||||
* there are any).
|
||||
*/
|
||||
|
||||
|
@ -299,21 +299,21 @@ _cairo_ft_unscaled_font_init_key (cairo_ft_unscaled_font_t *key,
|
|||
/**
|
||||
* _cairo_ft_unscaled_font_init:
|
||||
*
|
||||
* Initialize a cairo_ft_unscaled_font_t.
|
||||
* Initialize a #cairo_ft_unscaled_font_t.
|
||||
*
|
||||
* There are two basic flavors of cairo_ft_unscaled_font_t, one
|
||||
* There are two basic flavors of #cairo_ft_unscaled_font_t, one
|
||||
* created from an FT_Face and the other created from a filename/id
|
||||
* pair. These two flavors are identified as from_face and !from_face.
|
||||
*
|
||||
* To initialize a from_face font, pass filename==NULL, id=0 and the
|
||||
* To initialize a from_face font, pass filename==%NULL, id=0 and the
|
||||
* desired face.
|
||||
*
|
||||
* To initialize a !from_face font, pass the filename/id as desired
|
||||
* and face==NULL.
|
||||
* and face==%NULL.
|
||||
*
|
||||
* Note that the code handles these two flavors in very distinct
|
||||
* ways. For example there is a hash_table mapping
|
||||
* filename/id->cairo_unscaled_font_t in the !from_face case, but no
|
||||
* filename/id->#cairo_unscaled_font_t in the !from_face case, but no
|
||||
* parallel in the from_face case, (where the calling code would have
|
||||
* to do its own mapping to ensure similar sharing).
|
||||
**/
|
||||
|
@ -362,10 +362,10 @@ _cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font)
|
|||
/**
|
||||
* _cairo_ft_unscaled_font_fini:
|
||||
*
|
||||
* Free all data associated with a cairo_ft_unscaled_font_t.
|
||||
* Free all data associated with a #cairo_ft_unscaled_font_t.
|
||||
*
|
||||
* CAUTION: The unscaled->face field must be NULL before calling this
|
||||
* function. This is because the cairo_ft_unscaled_font_map keeps a
|
||||
* CAUTION: The unscaled->face field must be %NULL before calling this
|
||||
* function. This is because the #cairo_ft_unscaled_font_t_map keeps a
|
||||
* count of these faces (font_map->num_open_faces) so it maintains the
|
||||
* unscaled->face field while it has its lock held. See
|
||||
* _font_map_release_face_lock_held().
|
||||
|
@ -394,7 +394,7 @@ _cairo_ft_unscaled_font_keys_equal (const void *key_a,
|
|||
unscaled_a->id == unscaled_b->id);
|
||||
}
|
||||
|
||||
/* Finds or creates a cairo_ft_unscaled_font for the filename/id from
|
||||
/* Finds or creates a #cairo_ft_unscaled_font_t for the filename/id from
|
||||
* pattern. Returns a new reference to the unscaled font.
|
||||
*/
|
||||
static cairo_ft_unscaled_font_t *
|
||||
|
@ -593,10 +593,11 @@ _cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled)
|
|||
}
|
||||
slim_hidden_def (cairo_ft_scaled_font_unlock_face);
|
||||
|
||||
static void
|
||||
static cairo_status_t
|
||||
_compute_transform (cairo_ft_font_transform_t *sf,
|
||||
cairo_matrix_t *scale)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_matrix_t normalized = *scale;
|
||||
|
||||
/* The font matrix has x and y "scale" components which we extract and
|
||||
|
@ -606,9 +607,11 @@ _compute_transform (cairo_ft_font_transform_t *sf,
|
|||
* freetype's transformation.
|
||||
*/
|
||||
|
||||
_cairo_matrix_compute_scale_factors (&normalized,
|
||||
&sf->x_scale, &sf->y_scale,
|
||||
/* XXX */ 1);
|
||||
status = _cairo_matrix_compute_scale_factors (&normalized,
|
||||
&sf->x_scale, &sf->y_scale,
|
||||
/* XXX */ 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
if (sf->x_scale != 0 && sf->y_scale != 0) {
|
||||
cairo_matrix_scale (&normalized, 1.0 / sf->x_scale, 1.0 / sf->y_scale);
|
||||
|
@ -621,6 +624,8 @@ _compute_transform (cairo_ft_font_transform_t *sf,
|
|||
sf->shape[0][0] = sf->shape[1][1] = 1.0;
|
||||
sf->shape[0][1] = sf->shape[1][0] = 0.0;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Temporarily scales an unscaled font to the give scale. We catch
|
||||
|
@ -630,6 +635,7 @@ static cairo_status_t
|
|||
_cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
|
||||
cairo_matrix_t *scale)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_ft_font_transform_t sf;
|
||||
FT_Matrix mat;
|
||||
FT_Error error;
|
||||
|
@ -646,7 +652,9 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
|
|||
unscaled->have_scale = TRUE;
|
||||
unscaled->current_scale = *scale;
|
||||
|
||||
_compute_transform (&sf, scale);
|
||||
status = _compute_transform (&sf, scale);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
unscaled->x_scale = sf.x_scale;
|
||||
unscaled->y_scale = sf.y_scale;
|
||||
|
@ -1257,7 +1265,7 @@ static const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend = {
|
|||
#endif
|
||||
};
|
||||
|
||||
/* cairo_ft_scaled_font_t */
|
||||
/* #cairo_ft_scaled_font_t */
|
||||
|
||||
typedef struct _cairo_ft_scaled_font {
|
||||
cairo_scaled_font_t base;
|
||||
|
@ -1301,9 +1309,6 @@ _get_pattern_ft_options (FcPattern *pattern, cairo_ft_options_t *ret)
|
|||
if (antialias) {
|
||||
cairo_subpixel_order_t subpixel_order;
|
||||
|
||||
if (!bitmap)
|
||||
ft_options.load_flags |= FT_LOAD_NO_BITMAP;
|
||||
|
||||
/* disable hinting if requested */
|
||||
if (FcPatternGetBool (pattern,
|
||||
FC_HINTING, 0, &hinting) != FcResultMatch)
|
||||
|
@ -1366,6 +1371,14 @@ _get_pattern_ft_options (FcPattern *pattern, cairo_ft_options_t *ret)
|
|||
ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE;
|
||||
}
|
||||
#endif /* FC_HINT_STYLE */
|
||||
|
||||
/* Force embedded bitmaps off if no hinting requested */
|
||||
if (ft_options.base.hint_style == CAIRO_HINT_STYLE_NONE)
|
||||
bitmap = FcFalse;
|
||||
|
||||
if (!bitmap)
|
||||
ft_options.load_flags |= FT_LOAD_NO_BITMAP;
|
||||
|
||||
} else {
|
||||
ft_options.base.antialias = CAIRO_ANTIALIAS_NONE;
|
||||
}
|
||||
|
@ -1526,8 +1539,13 @@ _cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
|
|||
/*
|
||||
* Get to unscaled metrics so that the upper level can get back to
|
||||
* user space
|
||||
*
|
||||
* Also use this path for bitmap-only fonts. The other branch uses
|
||||
* face members that are only relevant for scalable fonts. This is
|
||||
* detected by simply checking for units_per_EM==0.
|
||||
*/
|
||||
if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) {
|
||||
if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF ||
|
||||
face->units_per_EM == 0) {
|
||||
double x_factor, y_factor;
|
||||
|
||||
if (unscaled->x_scale == 0)
|
||||
|
@ -1565,7 +1583,7 @@ _cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
|
|||
}
|
||||
}
|
||||
|
||||
_cairo_scaled_font_set_metrics (&scaled_font->base, &fs_metrics);
|
||||
status = _cairo_scaled_font_set_metrics (&scaled_font->base, &fs_metrics);
|
||||
|
||||
*font_out = &scaled_font->base;
|
||||
|
||||
|
@ -2195,7 +2213,7 @@ const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend = {
|
|||
_cairo_ft_map_glyphs_to_unicode,
|
||||
};
|
||||
|
||||
/* cairo_ft_font_face_t */
|
||||
/* #cairo_ft_font_face_t */
|
||||
|
||||
static void
|
||||
_cairo_ft_font_face_destroy (void *abstract_face)
|
||||
|
@ -2609,7 +2627,7 @@ cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *abstract_font)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* NOTE: We deliberately release the unscaled font's mutex here,
|
||||
/* Note: We deliberately release the unscaled font's mutex here,
|
||||
* so that we are not holding a lock across two separate calls to
|
||||
* cairo function, (which would give the application some
|
||||
* opportunity for creating deadlock. This is obviously unsafe,
|
||||
|
@ -2637,7 +2655,7 @@ cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *abstract_font)
|
|||
if (scaled_font->base.status)
|
||||
return;
|
||||
|
||||
/* NOTE: We released the unscaled font's mutex at the end of
|
||||
/* Note: We released the unscaled font's mutex at the end of
|
||||
* cairo_ft_scaled_font_lock_face, so we have to acquire it again
|
||||
* as _cairo_ft_unscaled_font_unlock_face expects it to be held
|
||||
* when we call into it. */
|
||||
|
|
|
@ -126,7 +126,7 @@ _cairo_gstate_init (cairo_gstate_t *gstate,
|
|||
* _cairo_gstate_init_copy:
|
||||
*
|
||||
* Initialize @gstate by performing a deep copy of state fields from
|
||||
* @other. Note that gstate->next is not copied but is set to NULL by
|
||||
* @other. Note that gstate->next is not copied but is set to %NULL by
|
||||
* this function.
|
||||
**/
|
||||
static cairo_status_t
|
||||
|
@ -215,14 +215,14 @@ _cairo_gstate_destroy (cairo_gstate_t *gstate)
|
|||
|
||||
/**
|
||||
* _cairo_gstate_clone:
|
||||
* @other: a #cairo_gstate_t to be copied, not NULL.
|
||||
* @other: a #cairo_gstate_t to be copied, not %NULL.
|
||||
*
|
||||
* Create a new #cairo_gstate_t setting all graphics state parameters
|
||||
* to the same values as contained in @other. gstate->next will be set
|
||||
* to NULL and may be used by the caller to chain cairo_gstate_t
|
||||
* to %NULL and may be used by the caller to chain #cairo_gstate_t
|
||||
* objects together.
|
||||
*
|
||||
* Return value: a new cairo_gstate_t or NULL if there is insufficient
|
||||
* Return value: a new #cairo_gstate_t or %NULL if there is insufficient
|
||||
* memory.
|
||||
**/
|
||||
static cairo_gstate_t*
|
||||
|
@ -364,8 +364,8 @@ _cairo_gstate_redirect_target (cairo_gstate_t *gstate, cairo_surface_t *child)
|
|||
* _cairo_gstate_is_redirected
|
||||
* @gstate: a #cairo_gstate_t
|
||||
*
|
||||
* Return value: TRUE if the gstate is redirected to a target
|
||||
* different than the original, FALSE otherwise.
|
||||
* Return value: %TRUE if the gstate is redirected to a target
|
||||
* different than the original, %FALSE otherwise.
|
||||
**/
|
||||
cairo_bool_t
|
||||
_cairo_gstate_is_redirected (cairo_gstate_t *gstate)
|
||||
|
@ -393,7 +393,7 @@ _cairo_gstate_get_target (cairo_gstate_t *gstate)
|
|||
* @gstate: a #cairo_gstate_t
|
||||
*
|
||||
* Return the parent surface of the current drawing target surface;
|
||||
* if this particular gstate isn't a redirect gstate, this will return NULL.
|
||||
* if this particular gstate isn't a redirect gstate, this will return %NULL.
|
||||
**/
|
||||
cairo_surface_t *
|
||||
_cairo_gstate_get_parent_target (cairo_gstate_t *gstate)
|
||||
|
@ -422,7 +422,7 @@ _cairo_gstate_get_original_target (cairo_gstate_t *gstate)
|
|||
* _cairo_gstate_get_clip:
|
||||
* @gstate: a #cairo_gstate_t
|
||||
*
|
||||
* Return value: a pointer to the gstate's cairo_clip_t structure.
|
||||
* Return value: a pointer to the gstate's #cairo_clip_t structure.
|
||||
*/
|
||||
cairo_clip_t *
|
||||
_cairo_gstate_get_clip (cairo_gstate_t *gstate)
|
||||
|
@ -1151,13 +1151,15 @@ BAIL:
|
|||
cairo_status_t
|
||||
_cairo_gstate_copy_page (cairo_gstate_t *gstate)
|
||||
{
|
||||
return cairo_surface_copy_page (gstate->target);
|
||||
cairo_surface_copy_page (gstate->target);
|
||||
return cairo_surface_status (gstate->target);
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
_cairo_gstate_show_page (cairo_gstate_t *gstate)
|
||||
{
|
||||
return cairo_surface_show_page (gstate->target);
|
||||
cairo_surface_show_page (gstate->target);
|
||||
return cairo_surface_status (gstate->target);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1467,7 +1469,7 @@ _cairo_gstate_get_scaled_font (cairo_gstate_t *gstate,
|
|||
* and then ignored by the "scaled-font" layer.
|
||||
*
|
||||
* In order to perform any action on a font, we must build an object
|
||||
* called a cairo_font_scale_t; this contains the central 2x2 matrix
|
||||
* called a #cairo_font_scale_t; this contains the central 2x2 matrix
|
||||
* resulting from "font matrix * CTM" (sans the font matrix translation
|
||||
* components as stated in the previous paragraph).
|
||||
*
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
* An entry can be in one of three states:
|
||||
*
|
||||
* FREE: Entry has never been used, terminates all searches.
|
||||
* Appears in the table as a NULL pointer.
|
||||
* Appears in the table as a %NULL pointer.
|
||||
*
|
||||
* DEAD: Entry had been live in the past. A dead entry can be reused
|
||||
* but does not terminate a search for an exact entry.
|
||||
* Appears in the table as a pointer to DEAD_ENTRY.
|
||||
*
|
||||
* LIVE: Entry is currently being used.
|
||||
* Appears in the table as any non-NULL, non-DEAD_ENTRY pointer.
|
||||
* Appears in the table as any non-%NULL, non-DEAD_ENTRY pointer.
|
||||
*/
|
||||
|
||||
static cairo_hash_entry_t dead_entry = { 0 };
|
||||
|
@ -129,11 +129,11 @@ struct _cairo_hash_table {
|
|||
|
||||
/**
|
||||
* _cairo_hash_table_create:
|
||||
* @keys_equal: a function to return TRUE if two keys are equal
|
||||
* @keys_equal: a function to return %TRUE if two keys are equal
|
||||
*
|
||||
* Creates a new hash table which will use the keys_equal() function
|
||||
* to compare hash keys. Data is provided to the hash table in the
|
||||
* form of user-derived versions of cairo_hash_entry_t. A hash entry
|
||||
* form of user-derived versions of #cairo_hash_entry_t. A hash entry
|
||||
* must be able to hold both a key (including a hash code) and a
|
||||
* value. Sometimes only the key will be necessary, (as in
|
||||
* _cairo_hash_table_remove), and other times both a key and a value
|
||||
|
@ -141,7 +141,7 @@ struct _cairo_hash_table {
|
|||
*
|
||||
* See #cairo_hash_entry_t for more details.
|
||||
*
|
||||
* Return value: the new hash table or NULL if out of memory.
|
||||
* Return value: the new hash table or %NULL if out of memory.
|
||||
**/
|
||||
cairo_hash_table_t *
|
||||
_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal)
|
||||
|
@ -212,9 +212,9 @@ _cairo_hash_table_destroy (cairo_hash_table_t *hash_table)
|
|||
* @hash_table: a #cairo_hash_table_t to search
|
||||
* @key: the key to search on
|
||||
* @hash_code: the hash_code for @key
|
||||
* @key_unique: If TRUE, then caller asserts that no key already
|
||||
* @key_unique: If %TRUE, then caller asserts that no key already
|
||||
* exists that will compare equal to #key, so search can be
|
||||
* optimized. If unsure, set to FALSE and the code will always work.
|
||||
* optimized. If unsure, set to %FALSE and the code will always work.
|
||||
*
|
||||
* Search the hashtable for a live entry for which
|
||||
* hash_table->keys_equal returns true. If no such entry exists then
|
||||
|
@ -295,7 +295,7 @@ _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table,
|
|||
* bigger or smaller than the ideal number of entries for the current
|
||||
* size.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if out of memory.
|
||||
**/
|
||||
static cairo_status_t
|
||||
|
@ -361,9 +361,9 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table)
|
|||
* key that matches @key, (as determined by the keys_equal() function
|
||||
* passed to _cairo_hash_table_create).
|
||||
*
|
||||
* Return value: TRUE if there is an entry in the hash table that
|
||||
* matches the given key, (which will now be in *entry_return). FALSE
|
||||
* otherwise, (in which case *entry_return will be NULL).
|
||||
* Return value: %TRUE if there is an entry in the hash table that
|
||||
* matches the given key, (which will now be in *entry_return). %FALSE
|
||||
* otherwise, (in which case *entry_return will be %NULL).
|
||||
**/
|
||||
cairo_bool_t
|
||||
_cairo_hash_table_lookup (cairo_hash_table_t *hash_table,
|
||||
|
@ -386,22 +386,22 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table,
|
|||
/**
|
||||
* _cairo_hash_table_random_entry:
|
||||
* @hash_table: a hash table
|
||||
* @predicate: a predicate function, or NULL for any entry.
|
||||
* @predicate: a predicate function, or %NULL for any entry.
|
||||
*
|
||||
* Find a random entry in the hash table satisfying the given
|
||||
* @predicate. A NULL @predicate is taken as equivalent to a function
|
||||
* which always returns TRUE, (eg. any entry in the table will do).
|
||||
* @predicate. A %NULL @predicate is taken as equivalent to a function
|
||||
* which always returns %TRUE, (eg. any entry in the table will do).
|
||||
*
|
||||
* We use the same algorithm as the lookup algorithm to walk over the
|
||||
* entries in the hash table in a pseudo-random order. Walking
|
||||
* linearly would favor entries following gaps in the hash table. We
|
||||
* could also call rand() repeatedly, which works well for almost-full
|
||||
* tables, but degrades when the table is almost empty, or predicate
|
||||
* returns TRUE for most entries.
|
||||
* returns %TRUE for most entries.
|
||||
*
|
||||
* Return value: a random live entry or NULL if there are no entries
|
||||
* Return value: a random live entry or %NULL if there are no entries
|
||||
* that match the given predicate. In particular, if predicate is
|
||||
* NULL, a NULL return value indicates that the table is empty.
|
||||
* NULL, a %NULL return value indicates that the table is empty.
|
||||
**/
|
||||
void *
|
||||
_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table,
|
||||
|
@ -458,7 +458,7 @@ _cairo_hash_table_random_entry (cairo_hash_table_t *hash_table,
|
|||
* the entry obtained with _cairo_hash_table_lookup. Or if absolutely
|
||||
* necessary, use _cairo_hash_table_remove first.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if insufficient memory is available.
|
||||
**/
|
||||
cairo_status_t
|
||||
|
@ -503,7 +503,7 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table,
|
|||
* @key, if any (as determined by the keys_equal() function passed to
|
||||
* _cairo_hash_table_create).
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful or
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful or
|
||||
* CAIRO_STATUS_NO_MEMORY if out of memory.
|
||||
**/
|
||||
void
|
||||
|
|
|
@ -280,7 +280,7 @@ _pixman_format_to_masks (pixman_format_code_t pixman_format,
|
|||
/* XXX: This function really should be eliminated. We don't really
|
||||
* want to advertise a cairo image surface that supports any possible
|
||||
* format. A minimal step would be to replace this function with one
|
||||
* that accepts a cairo_internal_format_t rather than mask values. */
|
||||
* that accepts a #cairo_internal_format_t rather than mask values. */
|
||||
cairo_surface_t *
|
||||
_cairo_image_surface_create_with_masks (unsigned char *data,
|
||||
cairo_format_masks_t *masks,
|
||||
|
@ -358,7 +358,7 @@ _cairo_image_surface_create_with_pixman_format (unsigned char *data,
|
|||
* but not belonging to the given format are undefined).
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -394,17 +394,55 @@ _cairo_image_surface_create_with_content (cairo_content_t content,
|
|||
width, height);
|
||||
}
|
||||
|
||||
/* pixman required stride alignment in bytes. should be power of two. */
|
||||
#define STRIDE_ALIGNMENT (sizeof (uint32_t))
|
||||
|
||||
/**
|
||||
* cairo_format_stride_for_width:
|
||||
* @format: A #cairo_format_t value
|
||||
* @width: The desired width of an image surface to be created.
|
||||
*
|
||||
* This function provides a stride value that will respect all
|
||||
* alignment requirements of the accelerated image-rendering code
|
||||
* within cairo. Typical usage will be of the form:
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* int stride;
|
||||
* unsigned char *data;
|
||||
* #cairo_surface_t *surface;
|
||||
*
|
||||
* stride = cairo_format_stride_for_width (format, width);
|
||||
* data = malloc (stride * height);
|
||||
* surface = cairo_image_surface_create_for_data (data, format,
|
||||
* width, height);
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* Return value: the appropriate stride to use given the desired
|
||||
* format and width.
|
||||
*
|
||||
* Since: 1.6
|
||||
**/
|
||||
int
|
||||
cairo_format_stride_for_width (cairo_format_t format,
|
||||
int width)
|
||||
{
|
||||
int bpp = _cairo_format_bits_per_pixel (format);
|
||||
|
||||
return ((bpp*width+7)/8 + STRIDE_ALIGNMENT-1) & ~(STRIDE_ALIGNMENT-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_image_surface_create_for_data:
|
||||
* @data: a pointer to a buffer supplied by the application
|
||||
* in which to write contents.
|
||||
* @data: a pointer to a buffer supplied by the application in which
|
||||
* to write contents. This pointer must be suitably aligned for any
|
||||
* kind of variable, (for example, a pointer returned by malloc).
|
||||
* @format: the format of pixels in the buffer
|
||||
* @width: the width of the image to be stored in the buffer
|
||||
* @height: the height of the image to be stored in the buffer
|
||||
* @stride: the number of bytes between the start of rows
|
||||
* in the buffer. Having this be specified separate from @width
|
||||
* allows for padding at the end of rows, or for writing
|
||||
* to a subportion of a larger image.
|
||||
* @stride: the number of bytes between the start of rows in the
|
||||
* buffer as allocated. This value should always be computed by
|
||||
* cairo_format_stride_for_width() before allocating the data
|
||||
* buffer.
|
||||
*
|
||||
* Creates an image surface for the provided pixel data. The output
|
||||
* buffer must be kept around until the #cairo_surface_t is destroyed
|
||||
|
@ -413,13 +451,25 @@ _cairo_image_surface_create_with_content (cairo_content_t content,
|
|||
* must explicitly clear the buffer, using, for example,
|
||||
* cairo_rectangle() and cairo_fill() if you want it cleared.
|
||||
*
|
||||
* Note that the stride may be larger than
|
||||
* width*bytes_per_pixel to provide proper alignment for each pixel
|
||||
* and row. This alignment is required to allow high-performance rendering
|
||||
* within cairo. The correct way to obtain a legal stride value is to
|
||||
* call cairo_format_stride_for_width() with the desired format and
|
||||
* maximum image width value, and the use the resulting stride value
|
||||
* to allocate the data and to create the image surface. See
|
||||
* cairo_format_stride_for_width() for example code.
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
* pointer to a "nil" surface if an error such as out of memory
|
||||
* occurs. You can use cairo_surface_status() to check for this.
|
||||
* pointer to a "nil" surface in the case of an error such as out of
|
||||
* memory or an invalid stride value. In case of invalid stride value
|
||||
* the error status of the returned surface will be
|
||||
* %CAIRO_STATUS_INVALID_STRIDE. You can use
|
||||
* cairo_surface_status() to check for this.
|
||||
*
|
||||
* See cairo_surface_set_user_data() for a means of attaching a
|
||||
* destroy-notification fallback to the surface if necessary.
|
||||
|
@ -433,12 +483,12 @@ cairo_image_surface_create_for_data (unsigned char *data,
|
|||
{
|
||||
pixman_format_code_t pixman_format;
|
||||
|
||||
/* XXX pixman does not support images with arbitrary strides and
|
||||
* attempting to create such surfaces will failure but we will interpret
|
||||
* such failure as CAIRO_STATUS_NO_MEMORY. */
|
||||
if (! CAIRO_FORMAT_VALID (format) || stride % sizeof (uint32_t) != 0)
|
||||
if (! CAIRO_FORMAT_VALID (format))
|
||||
return _cairo_surface_create_in_error (_cairo_error(CAIRO_STATUS_INVALID_FORMAT));
|
||||
|
||||
if ((stride & (STRIDE_ALIGNMENT-1)) != 0)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
|
||||
|
||||
pixman_format = _cairo_format_to_pixman_format_code (format);
|
||||
|
||||
return _cairo_image_surface_create_with_pixman_format (data, pixman_format,
|
||||
|
@ -468,7 +518,7 @@ _cairo_image_surface_create_for_data_with_content (unsigned char *data,
|
|||
* Get a pointer to the data of the image surface, for direct
|
||||
* inspection or modification.
|
||||
*
|
||||
* Return value: a pointer to the image data of this surface or NULL
|
||||
* Return value: a pointer to the image data of this surface or %NULL
|
||||
* if @surface is not an image surface.
|
||||
*
|
||||
* Since: 1.2
|
||||
|
@ -615,14 +665,14 @@ _cairo_content_from_format (cairo_format_t format)
|
|||
return CAIRO_CONTENT_COLOR_ALPHA;
|
||||
}
|
||||
|
||||
cairo_private cairo_format_t
|
||||
_cairo_format_width (cairo_format_t format)
|
||||
int
|
||||
_cairo_format_bits_per_pixel (cairo_format_t format)
|
||||
{
|
||||
switch (format) {
|
||||
case CAIRO_FORMAT_ARGB32:
|
||||
return 32;
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
return 24;
|
||||
return 32;
|
||||
case CAIRO_FORMAT_A8:
|
||||
return 8;
|
||||
case CAIRO_FORMAT_A1:
|
||||
|
@ -1200,7 +1250,7 @@ _cairo_image_surface_reset (void *abstract_surface)
|
|||
*
|
||||
* Checks if a surface is an #cairo_image_surface_t
|
||||
*
|
||||
* Return value: TRUE if the surface is an image surface
|
||||
* Return value: %TRUE if the surface is an image surface
|
||||
**/
|
||||
cairo_bool_t
|
||||
_cairo_surface_is_image (const cairo_surface_t *surface)
|
||||
|
|
|
@ -58,7 +58,7 @@ typedef struct _lzw_buf {
|
|||
* Instead of returning failure from any functions, lzw_buf_t provides
|
||||
* a status value that the caller can query, (and should query at
|
||||
* least once when done with the object). The status value will be
|
||||
* either CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY;
|
||||
* either %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY;
|
||||
*/
|
||||
static void
|
||||
_lzw_buf_init (lzw_buf_t *buf, int size)
|
||||
|
@ -82,7 +82,7 @@ _lzw_buf_init (lzw_buf_t *buf, int size)
|
|||
|
||||
/* Increase the buffer size by doubling.
|
||||
*
|
||||
* Returns CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY
|
||||
* Returns %CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY
|
||||
*/
|
||||
static cairo_status_t
|
||||
_lzw_buf_grow (lzw_buf_t *buf)
|
||||
|
@ -113,13 +113,13 @@ _lzw_buf_grow (lzw_buf_t *buf)
|
|||
|
||||
/* Store the lowest num_bits bits of values into buf.
|
||||
*
|
||||
* NOTE: The bits of value above size_in_bits must be 0, (so don't lie
|
||||
* Note: The bits of value above size_in_bits must be 0, (so don't lie
|
||||
* about the size).
|
||||
*
|
||||
* See also _lzw_buf_store_pending which must be called after the last
|
||||
* call to _lzw_buf_store_bits.
|
||||
*
|
||||
* Sets buf->status to either CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY.
|
||||
* Sets buf->status to either %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY.
|
||||
*/
|
||||
static void
|
||||
_lzw_buf_store_bits (lzw_buf_t *buf, uint16_t value, int num_bits)
|
||||
|
@ -147,10 +147,10 @@ _lzw_buf_store_bits (lzw_buf_t *buf, uint16_t value, int num_bits)
|
|||
|
||||
/* Store the last remaining pending bits into the buffer.
|
||||
*
|
||||
* NOTE: This function must be called after the last call to
|
||||
* Note: This function must be called after the last call to
|
||||
* _lzw_buf_store_bits.
|
||||
*
|
||||
* Sets buf->status to either CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY.
|
||||
* Sets buf->status to either %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY.
|
||||
*/
|
||||
static void
|
||||
_lzw_buf_store_pending (lzw_buf_t *buf)
|
||||
|
@ -234,11 +234,11 @@ _lzw_symbol_table_init (lzw_symbol_table_t *table)
|
|||
/* Lookup a symbol in the symbol table. The PREV and NEXT fields of
|
||||
* symbol form the key for the lookup.
|
||||
*
|
||||
* If successful, then this function returns TRUE and slot_ret will be
|
||||
* If successful, then this function returns %TRUE and slot_ret will be
|
||||
* left pointing at the result that will have the CODE field of
|
||||
* interest.
|
||||
*
|
||||
* If the lookup fails, then this function returns FALSE and slot_ret
|
||||
* If the lookup fails, then this function returns %FALSE and slot_ret
|
||||
* will be pointing at the location in the table to which a new CODE
|
||||
* value should be stored along with PREV and NEXT.
|
||||
*/
|
||||
|
@ -312,7 +312,7 @@ _lzw_symbol_table_lookup (lzw_symbol_table_t *table,
|
|||
* to 12 bits).
|
||||
*
|
||||
* This function returns a pointer to a newly allocated buffer holding
|
||||
* the compressed data, or NULL if an out-of-memory situation
|
||||
* the compressed data, or %NULL if an out-of-memory situation
|
||||
* occurs.
|
||||
*
|
||||
* Notice that any one of the _lzw_buf functions called here could
|
||||
|
|
|
@ -68,7 +68,7 @@ slim_hidden_def(cairo_matrix_init_identity);
|
|||
|
||||
/**
|
||||
* cairo_matrix_init:
|
||||
* @matrix: a cairo_matrix_t
|
||||
* @matrix: a #cairo_matrix_t
|
||||
* @xx: xx component of the affine transformation
|
||||
* @yx: yx component of the affine transformation
|
||||
* @xy: xy component of the affine transformation
|
||||
|
@ -137,7 +137,7 @@ _cairo_matrix_get_affine (const cairo_matrix_t *matrix,
|
|||
|
||||
/**
|
||||
* cairo_matrix_init_translate:
|
||||
* @matrix: a cairo_matrix_t
|
||||
* @matrix: a #cairo_matrix_t
|
||||
* @tx: amount to translate in the X direction
|
||||
* @ty: amount to translate in the Y direction
|
||||
*
|
||||
|
@ -157,7 +157,7 @@ slim_hidden_def(cairo_matrix_init_translate);
|
|||
|
||||
/**
|
||||
* cairo_matrix_translate:
|
||||
* @matrix: a cairo_matrix_t
|
||||
* @matrix: a #cairo_matrix_t
|
||||
* @tx: amount to translate in the X direction
|
||||
* @ty: amount to translate in the Y direction
|
||||
*
|
||||
|
@ -179,7 +179,7 @@ slim_hidden_def (cairo_matrix_translate);
|
|||
|
||||
/**
|
||||
* cairo_matrix_init_scale:
|
||||
* @matrix: a cairo_matrix_t
|
||||
* @matrix: a #cairo_matrix_t
|
||||
* @sx: scale factor in the X direction
|
||||
* @sy: scale factor in the Y direction
|
||||
*
|
||||
|
@ -220,7 +220,7 @@ slim_hidden_def(cairo_matrix_scale);
|
|||
|
||||
/**
|
||||
* cairo_matrix_init_rotate:
|
||||
* @matrix: a cairo_matrix_t
|
||||
* @matrix: a #cairo_matrix_t
|
||||
* @radians: angle of rotation, in radians. The direction of rotation
|
||||
* is defined such that positive angles rotate in the direction from
|
||||
* the positive X axis toward the positive Y axis. With the default
|
||||
|
@ -514,7 +514,7 @@ _cairo_matrix_compute_determinant (const cairo_matrix_t *matrix,
|
|||
}
|
||||
|
||||
/* Compute the amount that each basis vector is scaled by. */
|
||||
void
|
||||
cairo_status_t
|
||||
_cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
||||
double *sx, double *sy, int x_major)
|
||||
{
|
||||
|
@ -522,7 +522,8 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
|||
|
||||
_cairo_matrix_compute_determinant (matrix, &det);
|
||||
|
||||
assert (ISFINITE (det));
|
||||
if (! ISFINITE (det))
|
||||
return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
|
||||
|
||||
if (det == 0)
|
||||
{
|
||||
|
@ -556,6 +557,8 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
|||
*sy = major;
|
||||
}
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
cairo_bool_t
|
||||
|
|
|
@ -485,7 +485,7 @@ _cairo_meta_surface_show_glyphs (void *abstract_surface,
|
|||
*
|
||||
* The caller owns the return value and should call
|
||||
* cairo_surface_destroy when finished with it. This function will not
|
||||
* return NULL, but will return a nil surface instead.
|
||||
* return %NULL, but will return a nil surface instead.
|
||||
*
|
||||
* Return value: The snapshot surface.
|
||||
**/
|
||||
|
@ -583,7 +583,7 @@ _cairo_meta_surface_get_extents (void *abstract_surface,
|
|||
*
|
||||
* Checks if a surface is a #cairo_meta_surface_t
|
||||
*
|
||||
* Return value: TRUE if the surface is a meta surface
|
||||
* Return value: %TRUE if the surface is a meta surface
|
||||
**/
|
||||
cairo_bool_t
|
||||
_cairo_surface_is_meta (const cairo_surface_t *surface)
|
||||
|
@ -868,7 +868,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
|
|||
}
|
||||
|
||||
/* Replay meta to surface. When the return status of each operation is
|
||||
* one of CAIRO_STATUS_SUCCESS, CAIRO_INT_STATUS_UNSUPPORTED, or
|
||||
* one of %CAIRO_STATUS_SUCCESS, %CAIRO_INT_STATUS_UNSUPPORTED, or
|
||||
* CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY the status of each operation
|
||||
* will be stored in the meta surface. Any other status will abort the
|
||||
* replay and return the status.
|
||||
|
|
|
@ -76,7 +76,7 @@ CAIRO_BEGIN_DECLS
|
|||
|
||||
#ifdef CAIRO_MUTEX_INIT
|
||||
|
||||
/* If CAIRO_MUTEX_INIT is defined, we may need to initialize all
|
||||
/* If %CAIRO_MUTEX_INIT is defined, we may need to initialize all
|
||||
* static mutex'es. */
|
||||
# ifndef CAIRO_MUTEX_INITIALIZE
|
||||
# define CAIRO_MUTEX_INITIALIZE() do { \
|
||||
|
@ -108,7 +108,7 @@ CAIRO_BEGIN_DECLS
|
|||
|
||||
#ifdef CAIRO_MUTEX_FINI
|
||||
|
||||
/* If CAIRO_MUTEX_FINI is defined, we may need to finalize all
|
||||
/* If %CAIRO_MUTEX_FINI is defined, we may need to finalize all
|
||||
* static mutex'es. */
|
||||
# ifndef CAIRO_MUTEX_FINALIZE
|
||||
# define CAIRO_MUTEX_FINALIZE() do { \
|
||||
|
|
|
@ -65,7 +65,7 @@ CAIRO_BEGIN_DECLS
|
|||
* on a win32 system even if you do not compile the win32
|
||||
* surface/backend.
|
||||
*
|
||||
* - typedef cairo_mutex_t to the proper mutex type on your target
|
||||
* - typedef #cairo_mutex_t to the proper mutex type on your target
|
||||
* system. Note that you may or may not need to use a pointer,
|
||||
* depending on what kinds of initialization your mutex
|
||||
* implementation supports. No trailing semicolon needed.
|
||||
|
@ -85,21 +85,21 @@ CAIRO_BEGIN_DECLS
|
|||
* cairo_mutex_t _cairo_some_mutex;
|
||||
*
|
||||
* if (1)
|
||||
* CAIRO_MUTEX_LOCK (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_LOCK (_cairo_some_mutex);
|
||||
* else
|
||||
* CAIRO_MUTEX_UNLOCK (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_UNLOCK (_cairo_some_mutex);
|
||||
*
|
||||
* - #define CAIRO_MUTEX_NIL_INITIALIZER to something that can
|
||||
* initialize the cairo_mutex_t type you defined. Most of the
|
||||
* time one of 0, NULL, or {} works. At this point
|
||||
* - #define %CAIRO_MUTEX_NIL_INITIALIZER to something that can
|
||||
* initialize the #cairo_mutex_t type you defined. Most of the
|
||||
* time one of 0, %NULL, or {} works. At this point
|
||||
* you should be able to compile the following snippet:
|
||||
*
|
||||
* cairo_mutex_t _cairo_some_mutex = CAIRO_MUTEX_NIL_INITIALIZER;
|
||||
*
|
||||
* if (1)
|
||||
* CAIRO_MUTEX_LOCK (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_LOCK (_cairo_some_mutex);
|
||||
* else
|
||||
* CAIRO_MUTEX_UNLOCK (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_UNLOCK (_cairo_some_mutex);
|
||||
*
|
||||
* - If the above code is not enough to initialize a mutex on
|
||||
* your platform, #define CAIRO_MUTEX_INIT(mutex) to statement
|
||||
|
@ -108,17 +108,17 @@ CAIRO_BEGIN_DECLS
|
|||
*
|
||||
* cairo_mutex_t _cairo_some_mutex = CAIRO_MUTEX_NIL_INITIALIZER;
|
||||
*
|
||||
* CAIRO_MUTEX_INIT (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_INIT (_cairo_some_mutex);
|
||||
*
|
||||
* if (1)
|
||||
* CAIRO_MUTEX_LOCK (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_LOCK (_cairo_some_mutex);
|
||||
* else
|
||||
* CAIRO_MUTEX_UNLOCK (_cairo_some_mutex);
|
||||
* %CAIRO_MUTEX_UNLOCK (_cairo_some_mutex);
|
||||
*
|
||||
* - If you define CAIRO_MUTEX_INIT(mutex), cairo will use it to
|
||||
* initialize all static mutex'es. If for any reason that should
|
||||
* not happen (eg. CAIRO_MUTEX_INIT is just a faster way than
|
||||
* what cairo does using CAIRO_MUTEX_NIL_INITIALIZER), then
|
||||
* not happen (eg. %CAIRO_MUTEX_INIT is just a faster way than
|
||||
* what cairo does using %CAIRO_MUTEX_NIL_INITIALIZER), then
|
||||
* #define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
|
||||
*
|
||||
* - If your system supports freeing a mutex object (deallocating
|
||||
|
@ -130,11 +130,11 @@ CAIRO_BEGIN_DECLS
|
|||
* However, it's up to you to call CAIRO_MUTEX_FINALIZE() at
|
||||
* proper places, eg. when the system is unloading the cairo library.
|
||||
* So, if for any reason finalizing static mutex'es is not needed
|
||||
* (eg. you never call CAIRO_MUTEX_FINALIZE), then
|
||||
* (eg. you never call %CAIRO_MUTEX_FINALIZE), then
|
||||
* #define CAIRO_MUTEX_FINALIZE() CAIRO_MUTEX_NOOP
|
||||
*
|
||||
* - That is all. If for any reason you think the above API is
|
||||
* not enough to implement cairo_mutex_t on your system, please
|
||||
* not enough to implement #cairo_mutex_t on your system, please
|
||||
* stop and write to the cairo mailing list about it. DO NOT
|
||||
* poke around cairo-mutex-private.h for possible solutions.
|
||||
*/
|
||||
|
|
|
@ -86,6 +86,16 @@ DisableFPUException (void)
|
|||
_control87 (usCW, MCW_EM | 0x80);
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_init:
|
||||
*
|
||||
* Initializes the Cairo library. This function is automatically called if
|
||||
* Cairo was compiled to be a DLL (however it's not a problem if it's called
|
||||
* multiple times). But if you link to Cairo statically, you have to call it
|
||||
* once to set up Cairo's internal structures and mutexes.
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
cairo_public void
|
||||
cairo_os2_init (void)
|
||||
{
|
||||
|
@ -102,6 +112,16 @@ cairo_os2_init (void)
|
|||
CAIRO_MUTEX_INITIALIZE ();
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_fini:
|
||||
*
|
||||
* Uninitializes the Cairo library. This function is automatically called if
|
||||
* Cairo was compiled to be a DLL (however it's not a problem if it's called
|
||||
* multiple times). But if you link to Cairo statically, you have to call it
|
||||
* once to shut down Cairo, to let it free all the resources it has allocated.
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
cairo_public void
|
||||
cairo_os2_fini (void)
|
||||
{
|
||||
|
@ -716,6 +736,26 @@ _cairo_os2_surface_get_extents (void *abstract_surface,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_surface_create:
|
||||
* @hps_client_window: the presentation handle to bind the surface to
|
||||
* @width: the width of the surface
|
||||
* @height: the height of the surface
|
||||
*
|
||||
* Create a Cairo surface which is bound to a given presentation space (HPS).
|
||||
* The surface will be created to have the given size.
|
||||
* By default every change to the surface will be made visible immediately by
|
||||
* blitting it into the window. This can be changed with
|
||||
* cairo_os2_surface_set_manual_window_refresh().
|
||||
* Note that the surface will contain garbage when created, so the pixels have
|
||||
* to be initialized by hand first. You can use the Cairo functions to fill it
|
||||
* with black, or use cairo_surface_mark_dirty() to fill the surface with pixels
|
||||
* from the window/HPS.
|
||||
*
|
||||
* Return value: the newly created surface
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
cairo_surface_t *
|
||||
cairo_os2_surface_create (HPS hps_client_window,
|
||||
int width,
|
||||
|
@ -814,6 +854,31 @@ cairo_os2_surface_create (HPS hps_client_window,
|
|||
return (cairo_surface_t *)local_os2_surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_surface_set_size:
|
||||
* @surface: the cairo surface to resize
|
||||
* @new_width: the new width of the surface
|
||||
* @new_height: the new height of the surface
|
||||
* @timeout: timeout value in milliseconds
|
||||
*
|
||||
* When the client window is resized, call this API to set the new size in the
|
||||
* underlying surface accordingly. This function will reallocate everything,
|
||||
* so you'll have to redraw everything in the surface after this call.
|
||||
* The surface will contain garbage after the resizing. So the notes of
|
||||
* cairo_os2_surface_create() apply here, too.
|
||||
*
|
||||
* The timeout value specifies how long the function should wait on other parts
|
||||
* of the program to release the buffers. It is necessary, because it can happen
|
||||
* that Cairo is just drawing something into the surface while we want to
|
||||
* destroy and recreate it.
|
||||
*
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if the surface could be resized,
|
||||
* %CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface is not an OS/2 surface,
|
||||
* %CAIRO_STATUS_NO_MEMORY if the new size could not be allocated, for invalid
|
||||
* sizes, or if the timeout happened before all the buffers were released
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
int
|
||||
cairo_os2_surface_set_size (cairo_surface_t *surface,
|
||||
int new_width,
|
||||
|
@ -921,6 +986,31 @@ cairo_os2_surface_set_size (cairo_surface_t *surface,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_surface_refresh_window:
|
||||
* @surface: the cairo surface to refresh
|
||||
* @hps_begin_paint: the presentation handle of the window to refresh
|
||||
* @prcl_begin_paint_rect: the rectangle to redraw
|
||||
*
|
||||
* This function can be used to force a repaint of a given area of the client
|
||||
* window. It should usually be called from the WM_PAINT processing of the
|
||||
* window procedure. However, it can be called any time a given part of the
|
||||
* window has to be updated.
|
||||
*
|
||||
* The HPS and RECTL to be passed can be taken from the usual WinBeginPaint call
|
||||
* of the window procedure, but you can also get the HPS using WinGetPS, and you
|
||||
* can assemble your own update rectangle by hand.
|
||||
* If hps_begin_paint is %NULL, the function will use the HPS passed into
|
||||
* cairo_os2_surface_create(). If @prcl_begin_paint_rect is %NULL, the function
|
||||
* will query the current window size and repaint the whole window.
|
||||
*
|
||||
* Cairo assumes that if you set the HWND to the surface using
|
||||
* cairo_os2_surface_set_hwnd(), this function will be called by the application
|
||||
* every time it gets a WM_PAINT for that HWND. If the HWND is set in the
|
||||
* surface, Cairo uses this function to handle dirty areas too.
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
void
|
||||
cairo_os2_surface_refresh_window (cairo_surface_t *surface,
|
||||
HPS hps_begin_paint,
|
||||
|
@ -1018,6 +1108,28 @@ _cairo_os2_surface_finish (void *abstract_surface)
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_surface_set_hwnd:
|
||||
* @surface: the cairo surface to associate with the window handle
|
||||
* @hwnd_client_window: the window handle of the client window
|
||||
*
|
||||
* Sets window handle for surface. If Cairo wants to blit into the window
|
||||
* because it is set to blit as the surface changes (see
|
||||
* cairo_os2_surface_set_manual_window_refresh()), then there are two ways it
|
||||
* can choose:
|
||||
* If it knows the HWND of the surface, then it invalidates that area, so the
|
||||
* application will get a WM_PAINT message and it can call
|
||||
* cairo_os2_surface_refresh_window() to redraw that area. Otherwise cairo itself
|
||||
* will use the HPS it got at surface creation time, and blit the pixels itself.
|
||||
* It's also a solution, but experience shows that if this happens from a non-PM
|
||||
* thread, then it can screw up PM internals.
|
||||
*
|
||||
* So, best solution is to set the HWND for the surface after the surface
|
||||
* creation, so every blit will be done from application's message processing
|
||||
* loop, which is the safest way to do.
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
void
|
||||
cairo_os2_surface_set_hwnd (cairo_surface_t *surface,
|
||||
HWND hwnd_client_window)
|
||||
|
@ -1044,6 +1156,25 @@ cairo_os2_surface_set_hwnd (cairo_surface_t *surface,
|
|||
DosReleaseMutexSem (local_os2_surface->hmtx_use_private_fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_surface_set_manual_window_refresh:
|
||||
* @surface: the cairo surface to set the refresh mode for
|
||||
* @manual_refresh: the switch for manual surface refresh
|
||||
*
|
||||
* This API can tell Cairo if it should show every change to this surface
|
||||
* immediately in the window or if it should be cached and will only be visible
|
||||
* once the user calls cairo_os2_surface_refresh_window() explicitly. If the
|
||||
* HWND was not set in the cairo surface, then the HPS will be used to blit the
|
||||
* graphics. Otherwise it will invalidate the given window region so the user
|
||||
* will get the WM_PAINT message to redraw that area of the window.
|
||||
*
|
||||
* So, if you're only interested in displaying the final result after several
|
||||
* drawing operations, you might get better performance if you put the surface
|
||||
* into manual refresh mode by passing a true value to this function. Then call
|
||||
* cairo_os2_surface_refresh() whenever desired.
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
void
|
||||
cairo_os2_surface_set_manual_window_refresh (cairo_surface_t *surface,
|
||||
cairo_bool_t manual_refresh)
|
||||
|
@ -1061,6 +1192,14 @@ cairo_os2_surface_set_manual_window_refresh (cairo_surface_t *surface,
|
|||
local_os2_surface->blit_as_changes = !manual_refresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_os2_surface_get_manual_window_refresh:
|
||||
* @surface: the cairo surface to query the refresh mode from
|
||||
*
|
||||
* Return value: current refresh mode of the surface (true by default)
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
cairo_bool_t
|
||||
cairo_os2_surface_get_manual_window_refresh (cairo_surface_t *surface)
|
||||
{
|
||||
|
|
|
@ -44,153 +44,38 @@ CAIRO_BEGIN_DECLS
|
|||
|
||||
/* The OS/2 Specific Cairo API */
|
||||
|
||||
/* cairo_os2_init () : */
|
||||
/* */
|
||||
/* Initializes the Cairo library. This function is automatically */
|
||||
/* called if Cairo was compiled to be a DLL (however it's not a */
|
||||
/* problem if it's called multiple times), but if you link to */
|
||||
/* Cairo statically, you have to call it once to set up Cairo's */
|
||||
/* internal structures and mutexes. */
|
||||
|
||||
cairo_public void
|
||||
cairo_os2_init (void);
|
||||
|
||||
/* cairo_os2_fini () : */
|
||||
/* */
|
||||
/* Uninitializes the Cairo library. This function is automatically */
|
||||
/* called if Cairo was compiled to be a DLL (however it's not a */
|
||||
/* problem if it's called multiple times), but if you link to */
|
||||
/* Cairo statically, you have to call it once to shut down Cairo, */
|
||||
/* to let it free all the resources it has allocated. */
|
||||
|
||||
cairo_public void
|
||||
cairo_os2_fini (void);
|
||||
|
||||
#if CAIRO_HAS_OS2_SURFACE
|
||||
|
||||
/* cairo_os2_surface_create () : */
|
||||
/* */
|
||||
/* Create a Cairo surface which is bounded to a given presentation */
|
||||
/* space (HPS). The surface will be created to have the given */
|
||||
/* size. */
|
||||
/* By default: Every change to the surface will be made visible */
|
||||
/* immediately by blitting it into the window. This */
|
||||
/* can be changed with the */
|
||||
/* cairo_os2_surface_set_manual_window_refresh () API. */
|
||||
/* Note that the surface will contain garbage when created, so the */
|
||||
/* pixels have to be initialized by hand first. You can use the */
|
||||
/* Cairo functions to fill it with black, or use the */
|
||||
/* cairo_surface_mark_dirty () API to fill the surface with pixels */
|
||||
/* from the window/HPS. */
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_os2_surface_create (HPS hps_client_window,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/* cairo_os2_surface_set_hwnd () : */
|
||||
/* */
|
||||
/* Sets window handle for surface. If Cairo wants to blit into the */
|
||||
/* window because it's set that it should blit as the surface */
|
||||
/* changes (see cairo_os2_surface_set_manual_window_refresh () API),*/
|
||||
/* then there are two ways it can choose: */
|
||||
/* If it knows the HWND of the surface, then it invalidates that */
|
||||
/* area, so the application will get a WM_PAINT message and it can */
|
||||
/* call cairo_os2_surface_refresh_window () to redraw that area. */
|
||||
/* Otherwise cairo itself will use the HPS it got at surface */
|
||||
/* creation time, and blit the pixels itself. */
|
||||
/* It's also a solution, but experience shows that if this happens */
|
||||
/* from a non-PM thread, then it can screw up PM internals. */
|
||||
/* */
|
||||
/* So, best solution is to set the HWND for the surface after the */
|
||||
/* surface creation, so every blit will be done from application's */
|
||||
/* message processing loop, which is the safest way to do. */
|
||||
|
||||
cairo_public void
|
||||
cairo_os2_surface_set_hwnd (cairo_surface_t *surface,
|
||||
HWND hwnd_client_window);
|
||||
|
||||
/* cairo_os2_surface_set_size () : */
|
||||
/* */
|
||||
/* When the client window is resized, call this API so the */
|
||||
/* underlaying surface will also be resized. This function will */
|
||||
/* reallocate everything, so you'll have to redraw everything in */
|
||||
/* the surface after this call. */
|
||||
/* The surface will contain garbage after the resizing, just like */
|
||||
/* after cairo_os2_surface_create (), so all those notes also apply */
|
||||
/* here, please read that! */
|
||||
/* */
|
||||
/* The timeout value is in milliseconds, and tells how much the */
|
||||
/* function should wait on other parts of the program to release */
|
||||
/* the buffers. It is necessary, because it can be that Cairo is */
|
||||
/* just drawing something into the surface while we want to */
|
||||
/* destroy and recreate it. */
|
||||
/* Returns CAIRO_STATUS_SUCCESS if the surface could be resized, */
|
||||
/* or returns other error code if */
|
||||
/* - the surface is not a real OS/2 Surface */
|
||||
/* - there is not enough memory to resize the surface */
|
||||
/* - waiting for all the buffers to be released timed out */
|
||||
|
||||
cairo_public int
|
||||
cairo_os2_surface_set_size (cairo_surface_t *surface,
|
||||
int new_width,
|
||||
int new_height,
|
||||
int timeout);
|
||||
|
||||
/* cairo_os2_surface_refresh_window () : */
|
||||
/* */
|
||||
/* This function can be used to force a repaint of a given area */
|
||||
/* of the client window. Most of the time it is called from the */
|
||||
/* WM_PAINT processing of the window proc. However, it can be */
|
||||
/* called anytime if a given part of the window has to be updated. */
|
||||
/* */
|
||||
/* The function expects a HPS of the window, and a RECTL to tell */
|
||||
/* which part of the window should be redrawn. */
|
||||
/* The returned values of WinBeginPaint () is just perfect here, */
|
||||
/* but you can also get the HPS by using the WinGetPS () function, */
|
||||
/* and you can assemble your own update rect by hand. */
|
||||
/* If the hps_begin_paint parameter is NULL, the function will use */
|
||||
/* the HPS you passed in to cairo_os2_surface_create (). If the */
|
||||
/* prcl_begin_paint_rect parameter is NULL, the function will query */
|
||||
/* the current window size and repaint the whole window. */
|
||||
/* */
|
||||
/* Cairo/2 assumes that if you told the HWND to the surface using */
|
||||
/* the cairo_os2_surface_set_hwnd () API, then this function will */
|
||||
/* be called by the application every time it gets a WM_PAINT for */
|
||||
/* that HWND. If the HWND is told to the surface, Cairo uses this */
|
||||
/* function to handle dirty areas too, so you were warned. :) */
|
||||
|
||||
cairo_public void
|
||||
cairo_os2_surface_refresh_window (cairo_surface_t *surface,
|
||||
HPS hps_begin_paint,
|
||||
PRECTL prcl_begin_paint_rect);
|
||||
|
||||
/* cairo_os2_surface_set_manual_window_refresh () : */
|
||||
/* */
|
||||
/* This API can tell Cairo if it should show every change to this */
|
||||
/* surface immediately in the window, or if it should be cached */
|
||||
/* and will only be visible if the user calls the */
|
||||
/* cairo_os2_surface_refresh_window () API explicitly. */
|
||||
/* If the HWND was not told to Cairo, then it will use the HPS to */
|
||||
/* blit the graphics. Otherwise it will invalidate the given */
|
||||
/* window region so the user will get WM_PAINT to redraw that area */
|
||||
/* of the window. */
|
||||
/* */
|
||||
/* So, if you're only interested in displaying the final result */
|
||||
/* after several drawing operations, you might get better */
|
||||
/* performance if you put the surface into a manual refresh mode */
|
||||
/* by passing a true value to cairo_os2_surface_set_manual_refresh()*/
|
||||
/* and then calling cairo_os2_surface_refresh() whenever desired. */
|
||||
|
||||
cairo_public void
|
||||
cairo_os2_surface_set_manual_window_refresh (cairo_surface_t *surface,
|
||||
cairo_bool_t manual_refresh);
|
||||
|
||||
/* cairo_os2_surface_get_manual_window_refresh () : */
|
||||
/* */
|
||||
/* This API can return the current mode of the surface. It is */
|
||||
/* TRUE by default. */
|
||||
|
||||
cairo_public cairo_bool_t
|
||||
cairo_os2_surface_get_manual_window_refresh (cairo_surface_t *surface);
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is cairo_output_stream.c as distributed with the
|
||||
* cairo graphics library.
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Red Hat, Inc.
|
||||
*
|
||||
|
@ -74,7 +73,7 @@ typedef cairo_status_t (*cairo_write_func_t) (void *closure,
|
|||
typedef cairo_status_t (*cairo_close_func_t) (void *closure);
|
||||
|
||||
|
||||
/* This function never returns NULL. If an error occurs (NO_MEMORY)
|
||||
/* This function never returns %NULL. If an error occurs (NO_MEMORY)
|
||||
* while trying to create the output stream this function returns a
|
||||
* valid pointer to a nil output stream.
|
||||
*
|
||||
|
@ -128,18 +127,18 @@ _cairo_output_stream_get_position (cairo_output_stream_t *stream);
|
|||
cairo_private cairo_status_t
|
||||
_cairo_output_stream_get_status (cairo_output_stream_t *stream);
|
||||
|
||||
/* This function never returns NULL. If an error occurs (NO_MEMORY or
|
||||
/* This function never returns %NULL. If an error occurs (NO_MEMORY or
|
||||
* WRITE_ERROR) while trying to create the output stream this function
|
||||
* returns a valid pointer to a nil output stream.
|
||||
*
|
||||
* NOTE: Even if a nil surface is returned, the caller should still
|
||||
* Note: Even if a nil surface is returned, the caller should still
|
||||
* call _cairo_output_stream_destroy (or _cairo_output_stream_close at
|
||||
* least) in order to ensure that everything is properly cleaned up.
|
||||
*/
|
||||
cairo_private cairo_output_stream_t *
|
||||
_cairo_output_stream_create_for_filename (const char *filename);
|
||||
|
||||
/* This function never returns NULL. If an error occurs (NO_MEMORY or
|
||||
/* This function never returns %NULL. If an error occurs (NO_MEMORY or
|
||||
* WRITE_ERROR) while trying to create the output stream this function
|
||||
* returns a valid pointer to a nil output stream.
|
||||
*
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is cairo_output_stream.c as distributed with the
|
||||
* cairo graphics library.
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Red Hat, Inc.
|
||||
*
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
struct _cairo_paginated_surface_backend {
|
||||
/* Optional. Will be called once for each page.
|
||||
*
|
||||
* NOTE: With respect to the order of drawing operations as seen
|
||||
* Note: With respect to the order of drawing operations as seen
|
||||
* by the target, this call will occur before any drawing
|
||||
* operations for the relevant page. However, with respect to the
|
||||
* function calls as made by the user, this call will be *after*
|
||||
|
@ -69,17 +69,17 @@ struct _cairo_paginated_surface_backend {
|
|||
cairo_box_t *bbox);
|
||||
};
|
||||
|
||||
/* A cairo_paginated_surface provides a very convenient wrapper that
|
||||
/* A #cairo_paginated_surface_t provides a very convenient wrapper that
|
||||
* is well-suited for doing the analysis common to most surfaces that
|
||||
* have paginated output, (that is, things directed at printers, or
|
||||
* for saving content in files such as PostScript or PDF files).
|
||||
*
|
||||
* To use the paginated surface, you'll first need to create your
|
||||
* 'real' surface using _cairo_surface_init and the standard
|
||||
* cairo_surface_backend_t. Then you also call
|
||||
* 'real' surface using _cairo_surface_init() and the standard
|
||||
* #cairo_surface_backend_t. Then you also call
|
||||
* _cairo_paginated_surface_create which takes its own, much simpler,
|
||||
* cairo_paginated_surface_backend. You are free to return the result
|
||||
* of _cairo_paginated_surface_create from your public
|
||||
* #cairo_paginated_surface_backend_t. You are free to return the result
|
||||
* of _cairo_paginated_surface_create() from your public
|
||||
* cairo_<foo>_surface_create. The paginated backend will be careful
|
||||
* to not let the user see that they really got a "wrapped"
|
||||
* surface. See test-paginated-surface.c for a fairly minimal example
|
||||
|
@ -92,7 +92,7 @@ struct _cairo_paginated_surface_backend {
|
|||
* sequence of operations (using the backend functions passed to
|
||||
* cairo_paginated_surface_create):
|
||||
*
|
||||
* 1. Calls start_page (if non NULL). At this point, it is appropriate
|
||||
* 1. Calls start_page (if non %NULL). At this point, it is appropriate
|
||||
* for the target to emit any page-specific header information into
|
||||
* its output.
|
||||
*
|
||||
|
@ -121,13 +121,13 @@ struct _cairo_paginated_surface_backend {
|
|||
* the target should not actually perform any rendering, (for example,
|
||||
* if performing output to a file, no output should be generated
|
||||
* during this stage). Instead the drawing functions simply need to
|
||||
* return CAIRO_STATUS_SUCCESS or CAIRO_INT_STATUS_UNSUPPORTED to
|
||||
* return %CAIRO_STATUS_SUCCESS or %CAIRO_INT_STATUS_UNSUPPORTED to
|
||||
* indicate whether rendering would be supported. And it should do
|
||||
* this as quickly as possible. The FALLBACK phase allows the surface
|
||||
* to distinguish fallback images from native rendering in case they
|
||||
* need to be handled as a special case.
|
||||
*
|
||||
* NOTE: The paginated surface layer assumes that the target surface
|
||||
* Note: The paginated surface layer assumes that the target surface
|
||||
* is "blank" by default at the beginning of each page, without any
|
||||
* need for an explicit erase operation, (as opposed to an image
|
||||
* surface, for example, which might have uninitialized content
|
||||
|
|
|
@ -162,8 +162,10 @@ _cairo_paginated_surface_finish (void *abstract_surface)
|
|||
cairo_paginated_surface_t *surface = abstract_surface;
|
||||
cairo_status_t status = CAIRO_STATUS_SUCCESS;
|
||||
|
||||
if (surface->page_is_blank == FALSE || surface->page_num == 1)
|
||||
status = cairo_surface_show_page (abstract_surface);
|
||||
if (surface->page_is_blank == FALSE || surface->page_num == 1) {
|
||||
cairo_surface_show_page (abstract_surface);
|
||||
status = cairo_surface_status (abstract_surface);
|
||||
}
|
||||
|
||||
if (status == CAIRO_STATUS_SUCCESS) {
|
||||
cairo_surface_finish (surface->target);
|
||||
|
@ -444,7 +446,8 @@ _cairo_paginated_surface_copy_page (void *abstract_surface)
|
|||
* show_page and we implement the copying by simply not destroying
|
||||
* the meta-surface. */
|
||||
|
||||
return cairo_surface_show_page (surface->target);
|
||||
cairo_surface_show_page (surface->target);
|
||||
return cairo_surface_status (surface->target);
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
|
@ -461,7 +464,8 @@ _cairo_paginated_surface_show_page (void *abstract_surface)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
status = cairo_surface_show_page (surface->target);
|
||||
cairo_surface_show_page (surface->target);
|
||||
status = cairo_surface_status (surface->target);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ BAIL:
|
|||
* the general tessellator when drawing very common rectangles.
|
||||
*
|
||||
* If the path described anything but a device-axis aligned rectangle,
|
||||
* this function will return CAIRO_INT_STATUS_UNSUPPORTED.
|
||||
* this function will return %CAIRO_INT_STATUS_UNSUPPORTED.
|
||||
*/
|
||||
static cairo_int_status_t
|
||||
_cairo_path_fixed_fill_rectangle (cairo_path_fixed_t *path,
|
||||
|
|
|
@ -45,7 +45,7 @@ enum cairo_path_op {
|
|||
/* we want to make sure a single byte is used for thie enum */
|
||||
typedef char cairo_path_op_t;
|
||||
|
||||
/* make cairo_path_fixed fit a 512 bytes. about 50 items */
|
||||
/* make _cairo_path_fixed fit a 512 bytes. about 50 items */
|
||||
#define CAIRO_PATH_BUF_SIZE ((512 - 4 * sizeof (void*) - sizeof (cairo_path_buf_t)) \
|
||||
/ (2 * sizeof (cairo_point_t) + sizeof (cairo_path_op_t)))
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
|
||||
/* cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2002 University of Southern California
|
||||
|
@ -43,6 +44,8 @@ typedef struct cairo_stroker {
|
|||
cairo_matrix_t *ctm;
|
||||
cairo_matrix_t *ctm_inverse;
|
||||
double tolerance;
|
||||
double ctm_determinant;
|
||||
cairo_bool_t ctm_det_positive;
|
||||
|
||||
cairo_traps_t *traps;
|
||||
|
||||
|
@ -64,6 +67,9 @@ typedef struct cairo_stroker {
|
|||
cairo_bool_t dash_on;
|
||||
cairo_bool_t dash_starts_on;
|
||||
double dash_remain;
|
||||
|
||||
cairo_bool_t has_bounds;
|
||||
cairo_box_t bounds;
|
||||
} cairo_stroker_t;
|
||||
|
||||
/* private functions */
|
||||
|
@ -163,6 +169,12 @@ _cairo_stroker_init (cairo_stroker_t *stroker,
|
|||
stroker->tolerance = tolerance;
|
||||
stroker->traps = traps;
|
||||
|
||||
_cairo_matrix_compute_determinant (stroker->ctm, &stroker->ctm_determinant);
|
||||
if (stroker->ctm_determinant >= 0.0)
|
||||
stroker->ctm_det_positive = TRUE;
|
||||
else
|
||||
stroker->ctm_det_positive = FALSE;
|
||||
|
||||
status = _cairo_pen_init (&stroker->pen,
|
||||
stroke_style->line_width / 2.0,
|
||||
tolerance, ctm);
|
||||
|
@ -178,6 +190,27 @@ _cairo_stroker_init (cairo_stroker_t *stroker,
|
|||
else
|
||||
stroker->dashed = FALSE;
|
||||
|
||||
stroker->has_bounds = _cairo_traps_get_limit (traps, &stroker->bounds);
|
||||
if (stroker->has_bounds) {
|
||||
/* Extend the bounds in each direction to account for the maximum area
|
||||
* we might generate trapezoids, to capture line segments that are outside
|
||||
* of the bounds but which might generate rendering that's within bounds.
|
||||
*/
|
||||
double dx, dy;
|
||||
cairo_fixed_t fdx, fdy;
|
||||
|
||||
_cairo_stroke_style_max_distance_from_path (stroker->style, stroker->ctm, &dx, &dy);
|
||||
|
||||
fdx = _cairo_fixed_from_double (dx);
|
||||
fdy = _cairo_fixed_from_double (dy);
|
||||
|
||||
stroker->bounds.p1.x -= fdx;
|
||||
stroker->bounds.p2.x += fdx;
|
||||
|
||||
stroker->bounds.p1.y -= fdy;
|
||||
stroker->bounds.p2.y += fdy;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -553,8 +586,42 @@ _cairo_stroker_add_trailing_cap (cairo_stroker_t *stroker,
|
|||
return _cairo_stroker_add_cap (stroker, face);
|
||||
}
|
||||
|
||||
static inline cairo_bool_t
|
||||
_compute_normalized_device_slope (double *dx, double *dy, cairo_matrix_t *ctm_inverse, double *mag_out)
|
||||
{
|
||||
double dx0 = *dx, dy0 = *dy;
|
||||
double mag;
|
||||
|
||||
cairo_matrix_transform_distance (ctm_inverse, &dx0, &dy0);
|
||||
|
||||
if (dx0 == 0.0 && dy0 == 0.0) {
|
||||
if (mag_out)
|
||||
*mag_out = 0.0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dx0 == 0.0) {
|
||||
mag = dy0;
|
||||
*dx = 0.0;
|
||||
*dy = 1.0;
|
||||
} else if (dy0 == 0.0) {
|
||||
mag = dx0;
|
||||
*dx = 1.0;
|
||||
*dy = 0.0;
|
||||
} else {
|
||||
mag = sqrt (dx0 * dx0 + dy0 * dy0);
|
||||
*dx = dx0 / mag;
|
||||
*dy = dy0 / mag;
|
||||
}
|
||||
|
||||
if (mag_out)
|
||||
*mag_out = mag;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_stroker_t *stroker, cairo_stroke_face_t *face);
|
||||
_compute_face (cairo_point_t *point, double slope_dx, double slope_dy, cairo_stroker_t *stroker, cairo_stroke_face_t *face);
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_stroker_add_caps (cairo_stroker_t *stroker)
|
||||
|
@ -567,12 +634,14 @@ _cairo_stroker_add_caps (cairo_stroker_t *stroker)
|
|||
&& stroker->style->line_cap == CAIRO_LINE_JOIN_ROUND)
|
||||
{
|
||||
/* pick an arbitrary slope to use */
|
||||
cairo_slope_t slope = {1, 0};
|
||||
double dx = 1.0, dy = 0.0;
|
||||
cairo_stroke_face_t face;
|
||||
|
||||
_compute_normalized_device_slope (&dx, &dy, stroker->ctm_inverse, NULL);
|
||||
|
||||
/* arbitrarily choose first_point
|
||||
* first_point and current_point should be the same */
|
||||
_compute_face (&stroker->first_point, &slope, stroker, &face);
|
||||
_compute_face (&stroker->first_point, dx, dy, stroker, &face);
|
||||
|
||||
status = _cairo_stroker_add_leading_cap (stroker, &face);
|
||||
if (status)
|
||||
|
@ -598,33 +667,11 @@ _cairo_stroker_add_caps (cairo_stroker_t *stroker)
|
|||
}
|
||||
|
||||
static void
|
||||
_compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_stroker_t *stroker, cairo_stroke_face_t *face)
|
||||
_compute_face (cairo_point_t *point, double slope_dx, double slope_dy, cairo_stroker_t *stroker, cairo_stroke_face_t *face)
|
||||
{
|
||||
double mag, det;
|
||||
double line_dx, line_dy;
|
||||
double face_dx, face_dy;
|
||||
cairo_point_double_t usr_vector;
|
||||
cairo_point_t offset_ccw, offset_cw;
|
||||
|
||||
line_dx = _cairo_fixed_to_double (slope->dx);
|
||||
line_dy = _cairo_fixed_to_double (slope->dy);
|
||||
|
||||
/* faces are normal in user space, not device space */
|
||||
cairo_matrix_transform_distance (stroker->ctm_inverse, &line_dx, &line_dy);
|
||||
|
||||
mag = sqrt (line_dx * line_dx + line_dy * line_dy);
|
||||
if (mag == 0) {
|
||||
/* XXX: Can't compute other face points. Do we want a tag in the face for this case? */
|
||||
return;
|
||||
}
|
||||
|
||||
/* normalize to unit length */
|
||||
line_dx /= mag;
|
||||
line_dy /= mag;
|
||||
|
||||
usr_vector.x = line_dx;
|
||||
usr_vector.y = line_dy;
|
||||
|
||||
/*
|
||||
* rotate to get a line_width/2 vector along the face, note that
|
||||
* the vector must be rotated the right direction in device space,
|
||||
|
@ -632,16 +679,15 @@ _compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_stroker_t *stro
|
|||
* whether the ctm reflects or not, and that can be determined
|
||||
* by looking at the determinant of the matrix.
|
||||
*/
|
||||
_cairo_matrix_compute_determinant (stroker->ctm, &det);
|
||||
if (det >= 0)
|
||||
if (stroker->ctm_det_positive)
|
||||
{
|
||||
face_dx = - line_dy * (stroker->style->line_width / 2.0);
|
||||
face_dy = line_dx * (stroker->style->line_width / 2.0);
|
||||
face_dx = - slope_dy * (stroker->style->line_width / 2.0);
|
||||
face_dy = slope_dx * (stroker->style->line_width / 2.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
face_dx = line_dy * (stroker->style->line_width / 2.0);
|
||||
face_dy = - line_dx * (stroker->style->line_width / 2.0);
|
||||
face_dx = slope_dy * (stroker->style->line_width / 2.0);
|
||||
face_dy = - slope_dx * (stroker->style->line_width / 2.0);
|
||||
}
|
||||
|
||||
/* back to device space */
|
||||
|
@ -660,25 +706,26 @@ _compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_stroker_t *stro
|
|||
face->cw = *point;
|
||||
_translate_point (&face->cw, &offset_cw);
|
||||
|
||||
face->usr_vector.x = usr_vector.x;
|
||||
face->usr_vector.y = usr_vector.y;
|
||||
face->usr_vector.x = slope_dx;
|
||||
face->usr_vector.y = slope_dy;
|
||||
|
||||
face->dev_vector = *slope;
|
||||
face->dev_vector.dx = _cairo_fixed_from_double (slope_dx);
|
||||
face->dev_vector.dy = _cairo_fixed_from_double (slope_dy);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_stroker_add_sub_edge (cairo_stroker_t *stroker, cairo_point_t *p1, cairo_point_t *p2,
|
||||
cairo_slope_t *slope, cairo_stroke_face_t *start,
|
||||
double slope_dx, double slope_dy, cairo_stroke_face_t *start,
|
||||
cairo_stroke_face_t *end)
|
||||
{
|
||||
cairo_point_t rectangle[4];
|
||||
|
||||
_compute_face (p1, slope, stroker, start);
|
||||
_compute_face (p1, slope_dx, slope_dy, stroker, start);
|
||||
|
||||
/* XXX: This could be optimized slightly by not calling
|
||||
_compute_face again but rather translating the relevant
|
||||
fields from start. */
|
||||
_compute_face (p2, slope, stroker, end);
|
||||
_compute_face (p2, slope_dx, slope_dy, stroker, end);
|
||||
|
||||
if (p1->x == p2->x && p1->y == p2->y)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
@ -730,16 +777,18 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point)
|
|||
cairo_stroke_face_t start, end;
|
||||
cairo_point_t *p1 = &stroker->current_point;
|
||||
cairo_point_t *p2 = point;
|
||||
cairo_slope_t slope;
|
||||
double slope_dx, slope_dy;
|
||||
|
||||
stroker->has_initial_sub_path = TRUE;
|
||||
|
||||
if (p1->x == p2->x && p1->y == p2->y)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
_cairo_slope_init (&slope, p1, p2);
|
||||
slope_dx = _cairo_fixed_to_double (p2->x - p1->x);
|
||||
slope_dy = _cairo_fixed_to_double (p2->y - p1->y);
|
||||
_compute_normalized_device_slope (&slope_dx, &slope_dy, stroker->ctm_inverse, NULL);
|
||||
|
||||
status = _cairo_stroker_add_sub_edge (stroker, p1, p2, &slope, &start, &end);
|
||||
status = _cairo_stroker_add_sub_edge (stroker, p1, p2, slope_dx, slope_dy, &start, &end);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
|
@ -770,80 +819,90 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
|
|||
cairo_status_t status = CAIRO_STATUS_SUCCESS;
|
||||
cairo_stroker_t *stroker = closure;
|
||||
double mag, remain, step_length = 0;
|
||||
double dx, dy;
|
||||
double slope_dx, slope_dy;
|
||||
double dx2, dy2;
|
||||
cairo_point_t fd1, fd2;
|
||||
cairo_stroke_face_t sub_start, sub_end;
|
||||
cairo_point_t *p1 = &stroker->current_point;
|
||||
cairo_point_t *p2 = point;
|
||||
cairo_slope_t slope;
|
||||
cairo_bool_t fully_in_bounds = TRUE;
|
||||
cairo_line_t segment;
|
||||
|
||||
stroker->has_initial_sub_path = stroker->dash_starts_on;
|
||||
|
||||
if (p1->x == p2->x && p1->y == p2->y)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
_cairo_slope_init (&slope, p1, p2);
|
||||
if (stroker->has_bounds &&
|
||||
(!_cairo_box_contains_point (&stroker->bounds, p1) ||
|
||||
!_cairo_box_contains_point (&stroker->bounds, p2)))
|
||||
{
|
||||
fully_in_bounds = FALSE;
|
||||
}
|
||||
|
||||
dx = _cairo_fixed_to_double (p2->x - p1->x);
|
||||
dy = _cairo_fixed_to_double (p2->y - p1->y);
|
||||
slope_dx = _cairo_fixed_to_double (p2->x - p1->x);
|
||||
slope_dy = _cairo_fixed_to_double (p2->y - p1->y);
|
||||
|
||||
cairo_matrix_transform_distance (stroker->ctm_inverse, &dx, &dy);
|
||||
if (!_compute_normalized_device_slope (&slope_dx, &slope_dy, stroker->ctm_inverse, &mag))
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
mag = sqrt (dx * dx + dy * dy);
|
||||
remain = mag;
|
||||
fd1 = *p1;
|
||||
segment.p1 = *p1;
|
||||
while (remain) {
|
||||
step_length = MIN (stroker->dash_remain, remain);
|
||||
remain -= step_length;
|
||||
dx2 = dx * (mag - remain)/mag;
|
||||
dy2 = dy * (mag - remain)/mag;
|
||||
dx2 = slope_dx * (mag - remain);
|
||||
dy2 = slope_dy * (mag - remain);
|
||||
cairo_matrix_transform_distance (stroker->ctm, &dx2, &dy2);
|
||||
fd2.x = _cairo_fixed_from_double (dx2) + p1->x;
|
||||
fd2.y = _cairo_fixed_from_double (dy2) + p1->y;
|
||||
segment.p2.x = _cairo_fixed_from_double (dx2) + p1->x;
|
||||
segment.p2.y = _cairo_fixed_from_double (dy2) + p1->y;
|
||||
|
||||
if (stroker->dash_on) {
|
||||
status = _cairo_stroker_add_sub_edge (stroker, &fd1, &fd2, &slope, &sub_start, &sub_end);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
if (stroker->has_current_face) {
|
||||
/* Join with final face from previous segment */
|
||||
status = _cairo_stroker_join (stroker, &stroker->current_face, &sub_start);
|
||||
stroker->has_current_face = FALSE;
|
||||
if (fully_in_bounds ||
|
||||
_cairo_box_intersects_line_segment (&stroker->bounds, &segment))
|
||||
{
|
||||
if (stroker->dash_on) {
|
||||
status = _cairo_stroker_add_sub_edge (stroker, &segment.p1, &segment.p2, slope_dx, slope_dy, &sub_start, &sub_end);
|
||||
if (status)
|
||||
return status;
|
||||
} else if (!stroker->has_first_face && stroker->dash_starts_on) {
|
||||
/* Save sub path's first face in case needed for closing join */
|
||||
stroker->first_face = sub_start;
|
||||
stroker->has_first_face = TRUE;
|
||||
|
||||
if (stroker->has_current_face) {
|
||||
/* Join with final face from previous segment */
|
||||
status = _cairo_stroker_join (stroker, &stroker->current_face, &sub_start);
|
||||
stroker->has_current_face = FALSE;
|
||||
if (status)
|
||||
return status;
|
||||
} else if (!stroker->has_first_face && stroker->dash_starts_on) {
|
||||
/* Save sub path's first face in case needed for closing join */
|
||||
stroker->first_face = sub_start;
|
||||
stroker->has_first_face = TRUE;
|
||||
} else {
|
||||
/* Cap dash start if not connecting to a previous segment */
|
||||
status = _cairo_stroker_add_leading_cap (stroker, &sub_start);
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (remain) {
|
||||
/* Cap dash end if not at end of segment */
|
||||
status = _cairo_stroker_add_trailing_cap (stroker, &sub_end);
|
||||
if (status)
|
||||
return status;
|
||||
} else {
|
||||
stroker->current_face = sub_end;
|
||||
stroker->has_current_face = TRUE;
|
||||
}
|
||||
} else {
|
||||
/* Cap dash start if not connecting to a previous segment */
|
||||
status = _cairo_stroker_add_leading_cap (stroker, &sub_start);
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (remain) {
|
||||
/* Cap dash end if not at end of segment */
|
||||
status = _cairo_stroker_add_trailing_cap (stroker, &sub_end);
|
||||
if (status)
|
||||
return status;
|
||||
} else {
|
||||
stroker->current_face = sub_end;
|
||||
stroker->has_current_face = TRUE;
|
||||
}
|
||||
} else {
|
||||
if (stroker->has_current_face) {
|
||||
/* Cap final face from previous segment */
|
||||
status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face);
|
||||
if (status)
|
||||
return status;
|
||||
stroker->has_current_face = FALSE;
|
||||
if (stroker->has_current_face) {
|
||||
/* Cap final face from previous segment */
|
||||
status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face);
|
||||
if (status)
|
||||
return status;
|
||||
stroker->has_current_face = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_cairo_stroker_step_dash (stroker, step_length);
|
||||
fd1 = fd2;
|
||||
segment.p1 = segment.p2;
|
||||
}
|
||||
|
||||
if (stroker->dash_on && !stroker->has_current_face) {
|
||||
|
@ -854,7 +913,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
|
|||
* in the path. Whether this behaviour is desirable or not is debatable.
|
||||
* On one side these degnerate caps can not be reproduced with regular path stroking.
|
||||
* On the other side Acroread 7 also produces the degenerate caps. */
|
||||
_compute_face (point, &slope, stroker, &stroker->current_face);
|
||||
_compute_face (point, slope_dx, slope_dy, stroker, &stroker->current_face);
|
||||
stroker->has_current_face = TRUE;
|
||||
status = _cairo_stroker_add_leading_cap (stroker, &stroker->current_face);
|
||||
if (status)
|
||||
|
@ -879,6 +938,8 @@ _cairo_stroker_curve_to (void *closure,
|
|||
cairo_stroke_face_t start, end;
|
||||
cairo_point_t extra_points[4];
|
||||
cairo_point_t *a = &stroker->current_point;
|
||||
double initial_slope_dx, initial_slope_dy;
|
||||
double final_slope_dx, final_slope_dy;
|
||||
|
||||
status = _cairo_spline_init (&spline, a, b, c, d);
|
||||
if (status == CAIRO_INT_STATUS_DEGENERATE)
|
||||
|
@ -888,8 +949,16 @@ _cairo_stroker_curve_to (void *closure,
|
|||
if (status)
|
||||
goto CLEANUP_SPLINE;
|
||||
|
||||
_compute_face (a, &spline.initial_slope, stroker, &start);
|
||||
_compute_face (d, &spline.final_slope, stroker, &end);
|
||||
initial_slope_dx = _cairo_fixed_to_double (spline.initial_slope.dx);
|
||||
initial_slope_dy = _cairo_fixed_to_double (spline.initial_slope.dy);
|
||||
final_slope_dx = _cairo_fixed_to_double (spline.final_slope.dx);
|
||||
final_slope_dy = _cairo_fixed_to_double (spline.final_slope.dy);
|
||||
|
||||
if (_compute_normalized_device_slope (&initial_slope_dx, &initial_slope_dy, stroker->ctm_inverse, NULL))
|
||||
_compute_face (a, initial_slope_dx, initial_slope_dy, stroker, &start);
|
||||
|
||||
if (_compute_normalized_device_slope (&final_slope_dx, &final_slope_dy, stroker->ctm_inverse, NULL))
|
||||
_compute_face (d, final_slope_dx, final_slope_dy, stroker, &end);
|
||||
|
||||
if (stroker->has_current_face) {
|
||||
status = _cairo_stroker_join (stroker, &stroker->current_face, &start);
|
||||
|
|
|
@ -363,7 +363,7 @@ _cairo_path_create_internal (cairo_path_fixed_t *path_fixed,
|
|||
* to cairo_path_destroy() the @path pointer is no longer valid and
|
||||
* should not be used further.
|
||||
*
|
||||
* NOTE: cairo_path_destroy function should only be called with a
|
||||
* Note: cairo_path_destroy() should only be called with a
|
||||
* pointer to a #cairo_path_t returned by a cairo function. Any path
|
||||
* that is created manually (ie. outside of cairo) should be destroyed
|
||||
* manually as well.
|
||||
|
@ -390,9 +390,9 @@ cairo_path_destroy (cairo_path_t *path)
|
|||
* conversion.
|
||||
*
|
||||
* Return value: the new copy of the path. If there is insufficient
|
||||
* memory a pointer to a special static cairo_path_nil will be
|
||||
* returned instead with status==CAIRO_STATUS_NO_MEMORY and
|
||||
* data==NULL.
|
||||
* memory a pointer to a special static nil #cairo_path_t will be
|
||||
* returned instead with status==%CAIRO_STATUS_NO_MEMORY and
|
||||
* data==%NULL.
|
||||
**/
|
||||
cairo_path_t *
|
||||
_cairo_path_create (cairo_path_fixed_t *path,
|
||||
|
@ -412,9 +412,9 @@ _cairo_path_create (cairo_path_fixed_t *path,
|
|||
* accuracy of the flattening.
|
||||
*
|
||||
* Return value: the flattened copy of the path. If there is insufficient
|
||||
* memory a pointer to a special static cairo_path_nil will be
|
||||
* returned instead with status==CAIRO_STATUS_NO_MEMORY and
|
||||
* data==NULL.
|
||||
* memory a pointer to a special static nil #cairo_path_t will be
|
||||
* returned instead with status==%CAIRO_STATUS_NO_MEMORY and
|
||||
* data==%NULL.
|
||||
**/
|
||||
cairo_path_t *
|
||||
_cairo_path_create_flat (cairo_path_fixed_t *path,
|
||||
|
@ -430,8 +430,8 @@ _cairo_path_create_flat (cairo_path_fixed_t *path,
|
|||
*
|
||||
* Append @path to the current path within @cr.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_INVALID_PATH_DATA if the data in @path
|
||||
* is invalid, and CAIRO_STATUS_SUCCESS otherwise.
|
||||
* Return value: %CAIRO_STATUS_INVALID_PATH_DATA if the data in @path
|
||||
* is invalid, and %CAIRO_STATUS_SUCCESS otherwise.
|
||||
**/
|
||||
cairo_status_t
|
||||
_cairo_path_append_to_context (const cairo_path_t *path,
|
||||
|
|
|
@ -389,7 +389,7 @@ _cairo_pattern_create_in_error (cairo_status_t status)
|
|||
* @green: green component of the color
|
||||
* @blue: blue component of the color
|
||||
*
|
||||
* Creates a new cairo_pattern_t corresponding to an opaque color. The
|
||||
* Creates a new #cairo_pattern_t corresponding to an opaque color. The
|
||||
* color components are floating point numbers in the range 0 to 1.
|
||||
* If the values passed in are outside that range, they will be
|
||||
* clamped.
|
||||
|
@ -433,7 +433,7 @@ slim_hidden_def (cairo_pattern_create_rgb);
|
|||
* @blue: blue component of the color
|
||||
* @alpha: alpha component of the color
|
||||
*
|
||||
* Creates a new cairo_pattern_t corresponding to a translucent color.
|
||||
* Creates a new #cairo_pattern_t corresponding to a translucent color.
|
||||
* The color components are floating point numbers in the range 0 to
|
||||
* 1. If the values passed in are outside that range, they will be
|
||||
* clamped.
|
||||
|
@ -476,7 +476,7 @@ slim_hidden_def (cairo_pattern_create_rgba);
|
|||
* cairo_pattern_create_for_surface:
|
||||
* @surface: the surface
|
||||
*
|
||||
* Create a new cairo_pattern_t for the given surface.
|
||||
* Create a new #cairo_pattern_t for the given surface.
|
||||
*
|
||||
* Return value: the newly created #cairo_pattern_t if successful, or
|
||||
* an error pattern in case of no memory. The caller owns the
|
||||
|
@ -519,7 +519,7 @@ slim_hidden_def (cairo_pattern_create_for_surface);
|
|||
* @x1: x coordinate of the end point
|
||||
* @y1: y coordinate of the end point
|
||||
*
|
||||
* Create a new linear gradient cairo_pattern_t along the line defined
|
||||
* Create a new linear gradient #cairo_pattern_t along the line defined
|
||||
* by (x0, y0) and (x1, y1). Before using the gradient pattern, a
|
||||
* number of color stops should be defined using
|
||||
* cairo_pattern_add_color_stop_rgb() or
|
||||
|
@ -565,7 +565,7 @@ cairo_pattern_create_linear (double x0, double y0, double x1, double y1)
|
|||
* @cy1: y coordinate for the center of the end circle
|
||||
* @radius1: radius of the end circle
|
||||
*
|
||||
* Creates a new radial gradient cairo_pattern_t between the two
|
||||
* Creates a new radial gradient #cairo_pattern_t between the two
|
||||
* circles defined by (cx0, cy0, radius0) and (cx1, cy1, radius1). Before using the
|
||||
* gradient pattern, a number of color stops should be defined using
|
||||
* cairo_pattern_add_color_stop_rgb() or
|
||||
|
@ -1050,6 +1050,17 @@ cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix)
|
|||
*
|
||||
* Sets the filter to be used for resizing when using this pattern.
|
||||
* See #cairo_filter_t for details on each filter.
|
||||
*
|
||||
* * Note that you might want to control filtering even when you do not
|
||||
* have an explicit #cairo_pattern_t object, (for example when using
|
||||
* cairo_set_source_surface()). In these cases, it is convenient to
|
||||
* use cairo_get_source() to get access to the pattern that cairo
|
||||
* creates implicitly. For example:
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* cairo_set_source_surface (cr, image, x, y);
|
||||
* cairo_pattern_set_filter (cairo_get_source (cr), %CAIRO_FILTER_NEAREST);
|
||||
* </programlisting></informalexample>
|
||||
**/
|
||||
void
|
||||
cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter)
|
||||
|
|
|
@ -45,10 +45,9 @@
|
|||
#include "cairo-compiler-private.h"
|
||||
#include "cairo-types-private.h"
|
||||
|
||||
typedef cairo_status_t
|
||||
(*cairo_pdf_operators_use_font_subset_t) (unsigned int font_id,
|
||||
unsigned int subset_id,
|
||||
void *closure);
|
||||
typedef cairo_status_t (*cairo_pdf_operators_use_font_subset_t) (unsigned int font_id,
|
||||
unsigned int subset_id,
|
||||
void *closure);
|
||||
|
||||
typedef struct _cairo_pdf_operators {
|
||||
cairo_output_stream_t *stream;
|
||||
|
|
|
@ -278,7 +278,7 @@ _cairo_pdf_operators_emit_stroke_style (cairo_pdf_operators_t *pdf_operators,
|
|||
|
||||
_cairo_output_stream_printf (pdf_operators->stream,
|
||||
"%f M ",
|
||||
style->miter_limit);
|
||||
style->miter_limit < 1.0 ? 1.0 : style->miter_limit);
|
||||
|
||||
return _cairo_output_stream_get_status (pdf_operators->stream);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ typedef struct _cairo_pdf_group_resources {
|
|||
} cairo_pdf_group_resources_t;
|
||||
|
||||
typedef struct _cairo_pdf_pattern {
|
||||
double width;
|
||||
double height;
|
||||
cairo_pattern_t *pattern;
|
||||
cairo_pdf_resource_t pattern_res;
|
||||
cairo_pdf_resource_t gstate_res;
|
||||
|
@ -76,6 +78,8 @@ typedef enum _cairo_pdf_operation {
|
|||
|
||||
typedef struct _cairo_pdf_smask_group
|
||||
{
|
||||
double width;
|
||||
double height;
|
||||
cairo_pdf_resource_t group_res;
|
||||
cairo_pdf_operation_t operation;
|
||||
cairo_pattern_t *source;
|
||||
|
|
|
@ -332,7 +332,7 @@ BAIL0:
|
|||
* incrementally to the stream represented by @write_func and @closure.
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -368,7 +368,7 @@ cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func,
|
|||
* to @filename.
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -401,7 +401,7 @@ _cairo_surface_is_pdf (cairo_surface_t *surface)
|
|||
|
||||
/* If the abstract_surface is a paginated surface, and that paginated
|
||||
* surface's target is a pdf_surface, then set pdf_surface to that
|
||||
* target. Otherwise return CAIRO_STATUS_SURFACE_TYPE_MISMATCH.
|
||||
* target. Otherwise return %CAIRO_STATUS_SURFACE_TYPE_MISMATCH.
|
||||
*/
|
||||
static cairo_status_t
|
||||
_extract_pdf_surface (cairo_surface_t *surface,
|
||||
|
@ -424,7 +424,7 @@ _extract_pdf_surface (cairo_surface_t *surface,
|
|||
|
||||
/**
|
||||
* cairo_pdf_surface_set_size:
|
||||
* @surface: a PDF cairo_surface_t
|
||||
* @surface: a PDF #cairo_surface_t
|
||||
* @width_in_points: new surface width, in points (1 point == 1/72.0 inch)
|
||||
* @height_in_points: new surface height, in points (1 point == 1/72.0 inch)
|
||||
*
|
||||
|
@ -727,6 +727,8 @@ _cairo_pdf_surface_create_smask_group (cairo_pdf_surface_t *surface)
|
|||
free (group);
|
||||
return NULL;
|
||||
}
|
||||
group->width = surface->width;
|
||||
group->height = surface->height;
|
||||
|
||||
return group;
|
||||
}
|
||||
|
@ -800,6 +802,8 @@ _cairo_pdf_surface_add_pdf_pattern (cairo_pdf_surface_t *surface,
|
|||
}
|
||||
}
|
||||
|
||||
pdf_pattern.width = surface->width;
|
||||
pdf_pattern.height = surface->height;
|
||||
*pattern_res = pdf_pattern.pattern_res;
|
||||
*gstate_res = pdf_pattern.gstate_res;
|
||||
|
||||
|
@ -1245,9 +1249,16 @@ compress_dup (const void *data, unsigned long data_size,
|
|||
unsigned long *compressed_size)
|
||||
{
|
||||
void *compressed;
|
||||
unsigned long additional_size;
|
||||
|
||||
/* Bound calculation taken from zlib. */
|
||||
*compressed_size = data_size + (data_size >> 12) + (data_size >> 14) + 11;
|
||||
additional_size = (data_size >> 12) + (data_size >> 14) + 11;
|
||||
if (INT32_MAX - data_size <= additional_size) {
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*compressed_size = data_size + additional_size;
|
||||
compressed = malloc (*compressed_size);
|
||||
if (compressed == NULL) {
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
|
@ -1291,11 +1302,18 @@ _cairo_pdf_surface_emit_smask (cairo_pdf_surface_t *surface,
|
|||
|
||||
stream_ret->id = 0;
|
||||
|
||||
if (image->format == CAIRO_FORMAT_A1)
|
||||
alpha_size = (image->height * image->width + 7)/8;
|
||||
else
|
||||
if (image->format == CAIRO_FORMAT_A1) {
|
||||
/* We allocate using slightly different math so that we can get
|
||||
* the overflow checking from _cairo_malloc_ab, but alpha_size
|
||||
* needs to be the correct size for emitting the data in the PDF.
|
||||
*/
|
||||
alpha_size = (image->width*image->height + 7) / 8;
|
||||
alpha = _cairo_malloc_ab ((image->width+7) / 8, image->height);
|
||||
} else {
|
||||
alpha_size = image->height * image->width;
|
||||
alpha = malloc (alpha_size);
|
||||
alpha = _cairo_malloc_ab (image->height, image->width);
|
||||
}
|
||||
|
||||
if (alpha == NULL) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto CLEANUP;
|
||||
|
@ -1416,7 +1434,7 @@ _cairo_pdf_surface_emit_image (cairo_pdf_surface_t *surface,
|
|||
image->format == CAIRO_FORMAT_A1);
|
||||
|
||||
rgb_size = image->height * image->width * 3;
|
||||
rgb = malloc (rgb_size);
|
||||
rgb = _cairo_malloc_abc (image->width, image->height, 3);
|
||||
if (rgb == NULL) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto CLEANUP;
|
||||
|
@ -2572,23 +2590,42 @@ _cairo_pdf_surface_emit_radial_pattern (cairo_pdf_surface_t *surface,
|
|||
static cairo_status_t
|
||||
_cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pdf_pattern_t *pdf_pattern)
|
||||
{
|
||||
double old_width, old_height;
|
||||
cairo_status_t status;
|
||||
|
||||
old_width = surface->width;
|
||||
old_height = surface->height;
|
||||
surface->width = pdf_pattern->width;
|
||||
surface->height = pdf_pattern->height;
|
||||
|
||||
switch (pdf_pattern->pattern->type) {
|
||||
case CAIRO_PATTERN_TYPE_SOLID:
|
||||
ASSERT_NOT_REACHED;
|
||||
status = _cairo_error (CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
|
||||
break;
|
||||
|
||||
case CAIRO_PATTERN_TYPE_SURFACE:
|
||||
return _cairo_pdf_surface_emit_surface_pattern (surface, pdf_pattern);
|
||||
status = _cairo_pdf_surface_emit_surface_pattern (surface, pdf_pattern);
|
||||
break;
|
||||
|
||||
case CAIRO_PATTERN_TYPE_LINEAR:
|
||||
return _cairo_pdf_surface_emit_linear_pattern (surface, pdf_pattern);
|
||||
status = _cairo_pdf_surface_emit_linear_pattern (surface, pdf_pattern);
|
||||
break;
|
||||
|
||||
case CAIRO_PATTERN_TYPE_RADIAL:
|
||||
return _cairo_pdf_surface_emit_radial_pattern (surface, pdf_pattern);
|
||||
status = _cairo_pdf_surface_emit_radial_pattern (surface, pdf_pattern);
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT_NOT_REACHED;
|
||||
status = _cairo_error (CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
|
||||
break;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED;
|
||||
return _cairo_error (CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
|
||||
surface->width = old_width;
|
||||
surface->height = old_height;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
@ -3895,8 +3932,19 @@ static cairo_status_t
|
|||
_cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t *surface,
|
||||
cairo_pdf_smask_group_t *group)
|
||||
{
|
||||
double old_width, old_height;
|
||||
cairo_matrix_t old_cairo_to_pdf;
|
||||
cairo_status_t status;
|
||||
|
||||
old_width = surface->width;
|
||||
old_height = surface->height;
|
||||
old_cairo_to_pdf = surface->cairo_to_pdf;
|
||||
surface->width = group->width;
|
||||
surface->height = group->height;
|
||||
cairo_matrix_init (&surface->cairo_to_pdf, 1, 0, 0, -1, 0, surface->height);
|
||||
_cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
|
||||
surface->cairo_to_pdf);
|
||||
|
||||
/* _mask is a special case that requires two groups - source
|
||||
* and mask as well as a smask and gstate dictionary */
|
||||
if (group->operation == PDF_MASK)
|
||||
|
@ -3945,8 +3993,15 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t *surface,
|
|||
return status;
|
||||
|
||||
_cairo_pdf_surface_unselect_pattern (surface);
|
||||
status = _cairo_pdf_surface_close_group (surface, NULL);
|
||||
|
||||
return _cairo_pdf_surface_close_group (surface, NULL);
|
||||
surface->width = old_width;
|
||||
surface->height = old_height;
|
||||
surface->cairo_to_pdf = old_cairo_to_pdf;
|
||||
_cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
|
||||
surface->cairo_to_pdf);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
|
@ -302,7 +302,7 @@ _cairo_pen_compute_slopes (cairo_pen_t *pen)
|
|||
/*
|
||||
* Find active pen vertex for clockwise edge of stroke at the given slope.
|
||||
*
|
||||
* NOTE: The behavior of this function is sensitive to the sense of
|
||||
* Note: The behavior of this function is sensitive to the sense of
|
||||
* the inequality within _cairo_slope_clockwise/_cairo_slope_counter_clockwise.
|
||||
*
|
||||
* The issue is that the slope_ccw member of one pen vertex will be
|
||||
|
@ -336,7 +336,7 @@ _cairo_pen_find_active_cw_vertex_index (cairo_pen_t *pen,
|
|||
|
||||
/* Find active pen vertex for counterclockwise edge of stroke at the given slope.
|
||||
*
|
||||
* NOTE: The behavior of this function is sensitive to the sense of
|
||||
* Note: The behavior of this function is sensitive to the sense of
|
||||
* the inequality within _cairo_slope_clockwise/_cairo_slope_counter_clockwise.
|
||||
*/
|
||||
void
|
||||
|
|
|
@ -84,7 +84,7 @@ convert_data_to_bytes (png_structp png, png_row_infop row_info, png_bytep data)
|
|||
}
|
||||
|
||||
/* Use a couple of simple error callbacks that do not print anything to
|
||||
* stderr and rely on the user to check for errors via the cairo_status_t
|
||||
* stderr and rely on the user to check for errors via the #cairo_status_t
|
||||
* return.
|
||||
*/
|
||||
static void
|
||||
|
@ -260,11 +260,11 @@ stdio_write_func (png_structp png, png_bytep data, png_size_t size)
|
|||
* Writes the contents of @surface to a new file @filename as a PNG
|
||||
* image.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if the PNG file was written
|
||||
* successfully. Otherwise, CAIRO_STATUS_NO_MEMORY if memory could not
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if the PNG file was written
|
||||
* successfully. Otherwise, %CAIRO_STATUS_NO_MEMORY if memory could not
|
||||
* be allocated for the operation or
|
||||
* CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
|
||||
* pixel contents, or CAIRO_STATUS_WRITE_ERROR if an I/O error occurs
|
||||
* pixel contents, or %CAIRO_STATUS_WRITE_ERROR if an I/O error occurs
|
||||
* while attempting to write the file.
|
||||
**/
|
||||
cairo_status_t
|
||||
|
@ -320,8 +320,8 @@ stream_write_func (png_structp png, png_bytep data, png_size_t size)
|
|||
*
|
||||
* Writes the image surface to the write function.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if the PNG file was written
|
||||
* successfully. Otherwise, CAIRO_STATUS_NO_MEMORY is returned if
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if the PNG file was written
|
||||
* successfully. Otherwise, %CAIRO_STATUS_NO_MEMORY is returned if
|
||||
* memory could not be allocated for the operation,
|
||||
* CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
|
||||
* pixel contents.
|
||||
|
|
|
@ -289,7 +289,7 @@ _cairo_ps_surface_path_close_path (void *closure)
|
|||
* while cairo draws something only for round caps).
|
||||
*
|
||||
* When using this function to emit a path to be filled, rather than
|
||||
* stroked, simply pass CAIRO_LINE_CAP_ROUND which will guarantee that
|
||||
* stroked, simply pass %CAIRO_LINE_CAP_ROUND which will guarantee that
|
||||
* the stroke workaround will not modify the path being emitted.
|
||||
*/
|
||||
static cairo_status_t
|
||||
|
@ -1032,7 +1032,7 @@ _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream,
|
|||
* vary. See cairo_ps_surface_set_size().
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -1073,7 +1073,7 @@ cairo_ps_surface_create (const char *filename,
|
|||
* output can vary. See cairo_ps_surface_set_size().
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -1107,7 +1107,7 @@ _cairo_surface_is_ps (cairo_surface_t *surface)
|
|||
|
||||
/* If the abstract_surface is a paginated surface, and that paginated
|
||||
* surface's target is a ps_surface, then set ps_surface to that
|
||||
* target. Otherwise return CAIRO_STATUS_SURFACE_TYPE_MISMATCH.
|
||||
* target. Otherwise return %CAIRO_STATUS_SURFACE_TYPE_MISMATCH.
|
||||
*/
|
||||
static cairo_status_t
|
||||
_extract_ps_surface (cairo_surface_t *surface,
|
||||
|
@ -1187,7 +1187,7 @@ cairo_ps_get_levels (cairo_ps_level_t const **levels,
|
|||
* @level: a level id
|
||||
*
|
||||
* Get the string representation of the given @level id. This function
|
||||
* will return NULL if @level id isn't valid. See cairo_ps_get_levels()
|
||||
* will return %NULL if @level id isn't valid. See cairo_ps_get_levels()
|
||||
* for a way to get the list of valid level ids.
|
||||
*
|
||||
* Return value: the string associated to given level.
|
||||
|
@ -1205,16 +1205,16 @@ cairo_ps_level_to_string (cairo_ps_level_t level)
|
|||
|
||||
/**
|
||||
* cairo_ps_surface_set_eps:
|
||||
* @surface: a PostScript cairo_surface_t
|
||||
* @eps: TRUE to output EPS format PostScript
|
||||
* @surface: a PostScript #cairo_surface_t
|
||||
* @eps: %TRUE to output EPS format PostScript
|
||||
*
|
||||
* If @eps is TRUE, the PostScript surface will output Encapsulated
|
||||
* If @eps is %TRUE, the PostScript surface will output Encapsulated
|
||||
* PostScript.
|
||||
*
|
||||
* This function should only be called before any drawing operations
|
||||
* have been performed on the current page. The simplest way to do
|
||||
* this is to call this function immediately after creating the
|
||||
* surface. An Encapsulated Postscript file should never contain more
|
||||
* surface. An Encapsulated PostScript file should never contain more
|
||||
* than one page.
|
||||
*
|
||||
* Since: 1.6
|
||||
|
@ -1237,11 +1237,11 @@ cairo_ps_surface_set_eps (cairo_surface_t *surface,
|
|||
|
||||
/**
|
||||
* cairo_ps_surface_get_eps:
|
||||
* @surface: a PostScript cairo_surface_t
|
||||
* @surface: a PostScript #cairo_surface_t
|
||||
*
|
||||
* Check whether the PostScript surface will output Encapsulated PostScript.
|
||||
*
|
||||
* Return value: TRUE if the surface will output Encapsulated PostScript.
|
||||
* Return value: %TRUE if the surface will output Encapsulated PostScript.
|
||||
*
|
||||
* Since: 1.6
|
||||
**/
|
||||
|
@ -1262,7 +1262,7 @@ cairo_ps_surface_get_eps (cairo_surface_t *surface)
|
|||
|
||||
/**
|
||||
* cairo_ps_surface_set_size:
|
||||
* @surface: a PostScript cairo_surface_t
|
||||
* @surface: a PostScript #cairo_surface_t
|
||||
* @width_in_points: new surface width, in points (1 point == 1/72.0 inch)
|
||||
* @height_in_points: new surface height, in points (1 point == 1/72.0 inch)
|
||||
*
|
||||
|
@ -1302,7 +1302,7 @@ cairo_ps_surface_set_size (cairo_surface_t *surface,
|
|||
|
||||
/**
|
||||
* cairo_ps_surface_dsc_comment:
|
||||
* @surface: a PostScript cairo_surface_t
|
||||
* @surface: a PostScript #cairo_surface_t
|
||||
* @comment: a comment string to be emitted into the PostScript output
|
||||
*
|
||||
* Emit a comment into the PostScript output for the given surface.
|
||||
|
@ -1366,7 +1366,7 @@ cairo_ps_surface_set_size (cairo_surface_t *surface,
|
|||
* Here is an example sequence showing how this function might be used:
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* cairo_surface_t *surface = cairo_ps_surface_create (filename, width, height);
|
||||
* #cairo_surface_t *surface = cairo_ps_surface_create (filename, width, height);
|
||||
* ...
|
||||
* cairo_ps_surface_dsc_comment (surface, "%%Title: My excellent document");
|
||||
* cairo_ps_surface_dsc_comment (surface, "%%Copyright: Copyright (C) 2006 Cairo Lover")
|
||||
|
@ -1430,7 +1430,7 @@ cairo_ps_surface_dsc_comment (cairo_surface_t *surface,
|
|||
|
||||
/**
|
||||
* cairo_ps_surface_dsc_begin_setup:
|
||||
* @surface: a PostScript cairo_surface_t
|
||||
* @surface: a PostScript #cairo_surface_t
|
||||
*
|
||||
* This function indicates that subsequent calls to
|
||||
* cairo_ps_surface_dsc_comment() should direct comments to the Setup
|
||||
|
@ -1464,7 +1464,7 @@ cairo_ps_surface_dsc_begin_setup (cairo_surface_t *surface)
|
|||
|
||||
/**
|
||||
* cairo_ps_surface_dsc_begin_page_setup:
|
||||
* @surface: a PostScript cairo_surface_t
|
||||
* @surface: a PostScript #cairo_surface_t
|
||||
*
|
||||
* This function indicates that subsequent calls to
|
||||
* cairo_ps_surface_dsc_comment() should direct comments to the
|
||||
|
@ -1736,17 +1736,17 @@ _gradient_pattern_supported (cairo_ps_surface_t *surface,
|
|||
surface->ps_level_used = CAIRO_PS_LEVEL_3;
|
||||
extend = cairo_pattern_get_extend (pattern);
|
||||
|
||||
if (extend == CAIRO_EXTEND_REPEAT ||
|
||||
extend == CAIRO_EXTEND_REFLECT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Radial gradients are currently only supported when one circle
|
||||
* is inside the other. */
|
||||
if (pattern->type == CAIRO_PATTERN_TYPE_RADIAL) {
|
||||
double x1, y1, x2, y2, r1, r2, d;
|
||||
cairo_radial_pattern_t *radial = (cairo_radial_pattern_t *) pattern;
|
||||
|
||||
if (extend == CAIRO_EXTEND_REPEAT ||
|
||||
extend == CAIRO_EXTEND_REFLECT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
x1 = _cairo_fixed_to_double (radial->c1.x);
|
||||
y1 = _cairo_fixed_to_double (radial->c1.y);
|
||||
r1 = _cairo_fixed_to_double (radial->r1);
|
||||
|
@ -2095,7 +2095,7 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t *surface,
|
|||
}
|
||||
|
||||
rgb_size = 3 * image->width * image->height;
|
||||
rgb = malloc (rgb_size);
|
||||
rgb = _cairo_malloc_abc (image->width, image->height, 3);
|
||||
if (rgb == NULL) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto bail1;
|
||||
|
@ -2103,7 +2103,7 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t *surface,
|
|||
|
||||
if (use_mask) {
|
||||
mask_size = ((image->width+7) / 8) * image->height;
|
||||
mask = malloc (mask_size);
|
||||
mask = _cairo_malloc_ab ((image->width+7) / 8, image->height);
|
||||
if (mask == NULL) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto bail2;
|
||||
|
@ -2337,12 +2337,15 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
|
|||
surface->height = meta_extents.height;
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"/CairoPattern {\n"
|
||||
"gsave\n");
|
||||
" gsave\n"
|
||||
" 0 0 %f %f rectclip\n",
|
||||
surface->width,
|
||||
surface->height);
|
||||
|
||||
if (cairo_surface_get_content (meta_surface) == CAIRO_CONTENT_COLOR) {
|
||||
surface->content = CAIRO_CONTENT_COLOR;
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"0 G 0 0 %f %f rectfill\n",
|
||||
" 0 G 0 0 %f %f rectfill\n",
|
||||
surface->width,
|
||||
surface->height);
|
||||
}
|
||||
|
@ -2354,7 +2357,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
|
|||
return status;
|
||||
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"grestore\n"
|
||||
" grestore\n"
|
||||
"} bind def\n");
|
||||
surface->content = old_content;
|
||||
surface->width = old_width;
|
||||
|
@ -2479,10 +2482,13 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t *surface,
|
|||
break;
|
||||
}
|
||||
case CAIRO_EXTEND_REPEAT:
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
xstep = pattern_width;
|
||||
ystep = pattern_height;
|
||||
break;
|
||||
case CAIRO_EXTEND_REFLECT:
|
||||
xstep = pattern_width*2;
|
||||
ystep = pattern_height*2;
|
||||
break;
|
||||
/* All the rest (if any) should have been analyzed away, so these
|
||||
* cases should be unreachable. */
|
||||
default:
|
||||
|
@ -2495,15 +2501,34 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t *surface,
|
|||
"<< /PatternType 1\n"
|
||||
" /PaintType 1\n"
|
||||
" /TilingType 1\n");
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
" /BBox [0 0 %d %d]\n",
|
||||
pattern_width, pattern_height);
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
" /XStep %f /YStep %f\n",
|
||||
xstep, ystep);
|
||||
|
||||
if (pattern->base.extend == CAIRO_EXTEND_REFLECT) {
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
" /BBox [0 0 %d %d]\n"
|
||||
" /PaintProc {\n"
|
||||
" CairoPattern\n"
|
||||
" [-1 0 0 1 %d 0] concat CairoPattern\n"
|
||||
" [ 1 0 0 -1 0 %d] concat CairoPattern\n"
|
||||
" [-1 0 0 1 %d 0] concat CairoPattern\n"
|
||||
" CairoPattern\n"
|
||||
" } bind\n",
|
||||
pattern_width*2, pattern_height*2,
|
||||
pattern_width*2,
|
||||
pattern_height*2,
|
||||
pattern_width*2);
|
||||
} else {
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
" /BBox [0 0 %d %d]\n"
|
||||
" /PaintProc { CairoPattern } bind\n",
|
||||
pattern_width, pattern_height);
|
||||
}
|
||||
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
" /PaintProc { CairoPattern } bind\n"
|
||||
">>\n");
|
||||
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"[ %f %f %f %f %f %f ]\n",
|
||||
inverse.xx, inverse.yx,
|
||||
|
@ -2517,7 +2542,7 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t *surface,
|
|||
|
||||
typedef struct _cairo_ps_color_stop {
|
||||
double offset;
|
||||
double color[3];
|
||||
double color[4];
|
||||
} cairo_ps_color_stop_t;
|
||||
|
||||
static void
|
||||
|
@ -2526,12 +2551,12 @@ _cairo_ps_surface_emit_linear_colorgradient (cairo_ps_surface_t *surface,
|
|||
cairo_ps_color_stop_t *stop2)
|
||||
{
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"<< /FunctionType 2\n"
|
||||
" /Domain [ 0 1 ]\n"
|
||||
" /C0 [ %f %f %f ]\n"
|
||||
" /C1 [ %f %f %f ]\n"
|
||||
" /N 1\n"
|
||||
">>\n",
|
||||
" << /FunctionType 2\n"
|
||||
" /Domain [ 0 1 ]\n"
|
||||
" /C0 [ %f %f %f ]\n"
|
||||
" /C1 [ %f %f %f ]\n"
|
||||
" /N 1\n"
|
||||
" >>\n",
|
||||
stop1->color[0],
|
||||
stop1->color[1],
|
||||
stop1->color[2],
|
||||
|
@ -2548,25 +2573,35 @@ _cairo_ps_surface_emit_stitched_colorgradient (cairo_ps_surface_t *surface,
|
|||
unsigned int i;
|
||||
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
" << /FunctionType 3\n"
|
||||
" /Domain [ 0 1 ]\n"
|
||||
" /Functions [\n");
|
||||
"<< /FunctionType 3\n"
|
||||
" /Domain [ 0 1 ]\n"
|
||||
" /Functions [\n");
|
||||
for (i = 0; i < n_stops - 1; i++)
|
||||
_cairo_ps_surface_emit_linear_colorgradient (surface, &stops[i], &stops[i+1]);
|
||||
|
||||
_cairo_output_stream_printf (surface->stream, " ]\n");
|
||||
_cairo_output_stream_printf (surface->stream, " ]\n");
|
||||
|
||||
_cairo_output_stream_printf (surface->stream, " /Bounds [ ");
|
||||
_cairo_output_stream_printf (surface->stream, " /Bounds [ ");
|
||||
for (i = 1; i < n_stops-1; i++)
|
||||
_cairo_output_stream_printf (surface->stream, "%f ", stops[i].offset);
|
||||
_cairo_output_stream_printf (surface->stream, "]\n");
|
||||
|
||||
_cairo_output_stream_printf (surface->stream, " /Encode [ ");
|
||||
for (i = 1; i < n_stops; i++)
|
||||
_cairo_output_stream_printf (surface->stream, "0 1 ");
|
||||
_cairo_output_stream_printf (surface->stream, "]\n");
|
||||
_cairo_output_stream_printf (surface->stream, " /Encode [ 1 1 %d { pop 0 1 } for ]\n",
|
||||
n_stops - 1);
|
||||
|
||||
_cairo_output_stream_printf (surface->stream, " >>\n");
|
||||
_cairo_output_stream_printf (surface->stream, ">>\n");
|
||||
}
|
||||
|
||||
static void
|
||||
calc_gradient_color (cairo_ps_color_stop_t *new_stop,
|
||||
cairo_ps_color_stop_t *stop1,
|
||||
cairo_ps_color_stop_t *stop2)
|
||||
{
|
||||
int i;
|
||||
double offset = stop1->offset / (stop1->offset + 1.0 - stop2->offset);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
new_stop->color[i] = stop1->color[i] + offset*(stop2->color[i] - stop1->color[i]);
|
||||
}
|
||||
|
||||
#define COLOR_STOP_EPSILON 1e-6
|
||||
|
@ -2586,33 +2621,58 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t *surface,
|
|||
n_stops = pattern->n_stops;
|
||||
|
||||
for (i = 0; i < n_stops; i++) {
|
||||
double red, green, blue;
|
||||
cairo_gradient_stop_t *stop = &pattern->stops[i];
|
||||
|
||||
_cairo_ps_surface_flatten_transparency (surface,
|
||||
&pattern->stops[i].color,
|
||||
stops[i].color[0] = stop->color.red;
|
||||
stops[i].color[1] = stop->color.green;
|
||||
stops[i].color[2] = stop->color.blue;
|
||||
stops[i].color[3] = stop->color.alpha;
|
||||
stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].x);
|
||||
}
|
||||
|
||||
if (pattern->base.extend == CAIRO_EXTEND_REPEAT ||
|
||||
pattern->base.extend == CAIRO_EXTEND_REFLECT) {
|
||||
if (stops[0].offset > COLOR_STOP_EPSILON) {
|
||||
if (pattern->base.extend == CAIRO_EXTEND_REFLECT)
|
||||
memcpy (allstops, stops, sizeof (cairo_ps_color_stop_t));
|
||||
else
|
||||
calc_gradient_color (&allstops[0], &stops[0], &stops[n_stops-1]);
|
||||
stops = allstops;
|
||||
n_stops++;
|
||||
}
|
||||
stops[0].offset = 0.0;
|
||||
|
||||
if (stops[n_stops-1].offset < 1.0 - COLOR_STOP_EPSILON) {
|
||||
if (pattern->base.extend == CAIRO_EXTEND_REFLECT) {
|
||||
memcpy (&stops[n_stops],
|
||||
&stops[n_stops - 1],
|
||||
sizeof (cairo_ps_color_stop_t));
|
||||
} else {
|
||||
calc_gradient_color (&stops[n_stops], &stops[0], &stops[n_stops-1]);
|
||||
}
|
||||
n_stops++;
|
||||
}
|
||||
stops[n_stops-1].offset = 1.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_stops; i++) {
|
||||
double red, green, blue;
|
||||
cairo_color_t color;
|
||||
|
||||
_cairo_color_init_rgba (&color,
|
||||
stops[i].color[0],
|
||||
stops[i].color[1],
|
||||
stops[i].color[2],
|
||||
stops[i].color[3]);
|
||||
_cairo_ps_surface_flatten_transparency (surface, &color,
|
||||
&red, &green, &blue);
|
||||
stops[i].color[0] = red;
|
||||
stops[i].color[1] = green;
|
||||
stops[i].color[2] = blue;
|
||||
stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].x);
|
||||
}
|
||||
|
||||
/* make sure first offset is 0.0 and last offset is 1.0 */
|
||||
if (stops[0].offset > COLOR_STOP_EPSILON) {
|
||||
memcpy (allstops, stops, sizeof (cairo_ps_color_stop_t));
|
||||
stops = allstops;
|
||||
n_stops++;
|
||||
}
|
||||
stops[0].offset = 0.0;
|
||||
|
||||
if (stops[n_stops-1].offset < 1.0 - COLOR_STOP_EPSILON) {
|
||||
memcpy (&stops[n_stops],
|
||||
&stops[n_stops - 1],
|
||||
sizeof (cairo_ps_color_stop_t));
|
||||
n_stops++;
|
||||
}
|
||||
stops[n_stops-1].offset = 1.0;
|
||||
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"/CairoFunction\n");
|
||||
if (n_stops == 2) {
|
||||
/* no need for stitched function */
|
||||
_cairo_ps_surface_emit_linear_colorgradient (surface, &stops[0], &stops[1]);
|
||||
|
@ -2621,47 +2681,154 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t *surface,
|
|||
* stops do not require stitching. XXX */
|
||||
_cairo_ps_surface_emit_stitched_colorgradient (surface, n_stops,stops);
|
||||
}
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"def\n");
|
||||
|
||||
free (allstops);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_ps_surface_emit_repeating_function (cairo_ps_surface_t *surface,
|
||||
cairo_gradient_pattern_t *pattern,
|
||||
int begin,
|
||||
int end)
|
||||
{
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"/CairoFunction\n"
|
||||
"<< /FunctionType 3\n"
|
||||
" /Domain [ %d %d ]\n"
|
||||
" /Functions [ %d {CairoFunction} repeat ]\n"
|
||||
" /Bounds [ %d 1 %d {} for ]\n",
|
||||
begin,
|
||||
end,
|
||||
end - begin,
|
||||
begin + 1,
|
||||
end - 1);
|
||||
|
||||
if (pattern->base.extend == CAIRO_EXTEND_REFLECT) {
|
||||
_cairo_output_stream_printf (surface->stream, " /Encode [ %d 1 %d { 2 mod 0 eq {0 1} {1 0} ifelse } for ]\n",
|
||||
begin,
|
||||
end - 1);
|
||||
} else {
|
||||
_cairo_output_stream_printf (surface->stream, " /Encode [ %d 1 %d { pop 0 1 } for ]\n",
|
||||
begin,
|
||||
end - 1);
|
||||
}
|
||||
|
||||
_cairo_output_stream_printf (surface->stream, ">> def\n");
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_ps_surface_emit_linear_pattern (cairo_ps_surface_t *surface,
|
||||
cairo_linear_pattern_t *pattern)
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
double _x1, _y1, _x2, _y2;
|
||||
cairo_matrix_t pat_to_ps;
|
||||
cairo_extend_t extend;
|
||||
cairo_status_t status;
|
||||
cairo_matrix_t inverse = pattern->base.base.matrix;
|
||||
cairo_gradient_pattern_t *gradient = &pattern->base;
|
||||
double first_stop, last_stop;
|
||||
int repeat_begin = 0, repeat_end = 1;
|
||||
|
||||
if (pattern->base.n_stops == 0)
|
||||
return CAIRO_INT_STATUS_NOTHING_TO_DO;
|
||||
|
||||
extend = cairo_pattern_get_extend (&pattern->base.base);
|
||||
|
||||
status = cairo_matrix_invert (&inverse);
|
||||
if (status)
|
||||
return status;
|
||||
pat_to_ps = pattern->base.base.matrix;
|
||||
status = cairo_matrix_invert (&pat_to_ps);
|
||||
/* cairo_pattern_set_matrix ensures the matrix is invertible */
|
||||
assert (status == CAIRO_STATUS_SUCCESS);
|
||||
|
||||
first_stop = _cairo_fixed_to_double (gradient->stops[0].x);
|
||||
last_stop = _cairo_fixed_to_double (gradient->stops[gradient->n_stops - 1].x);
|
||||
|
||||
if (pattern->base.base.extend == CAIRO_EXTEND_REPEAT ||
|
||||
pattern->base.base.extend == CAIRO_EXTEND_REFLECT) {
|
||||
double dx, dy;
|
||||
int x_rep = 0, y_rep = 0;
|
||||
|
||||
x1 = _cairo_fixed_to_double (pattern->p1.x);
|
||||
y1 = _cairo_fixed_to_double (pattern->p1.y);
|
||||
cairo_matrix_transform_point (&pat_to_ps, &x1, &y1);
|
||||
|
||||
x2 = _cairo_fixed_to_double (pattern->p2.x);
|
||||
y2 = _cairo_fixed_to_double (pattern->p2.y);
|
||||
cairo_matrix_transform_point (&pat_to_ps, &x2, &y2);
|
||||
|
||||
dx = fabs (x2 - x1);
|
||||
dy = fabs (y2 - y1);
|
||||
if (dx > 1e-6)
|
||||
x_rep = (int) ceil (surface->width/dx);
|
||||
if (dy > 1e-6)
|
||||
y_rep = (int) ceil (surface->height/dy);
|
||||
|
||||
repeat_end = MAX (x_rep, y_rep);
|
||||
repeat_begin = -repeat_end;
|
||||
first_stop = repeat_begin;
|
||||
last_stop = repeat_end;
|
||||
}
|
||||
|
||||
/* PS requires the first and last stop to be the same as the line
|
||||
* coordinates. For repeating patterns this moves the line
|
||||
* coordinates out to the begin/end of the repeating function. For
|
||||
* non repeating patterns this may move the line coordinates in if
|
||||
* there are not stops at offset 0 and 1. */
|
||||
x1 = _cairo_fixed_to_double (pattern->p1.x);
|
||||
y1 = _cairo_fixed_to_double (pattern->p1.y);
|
||||
x2 = _cairo_fixed_to_double (pattern->p2.x);
|
||||
y2 = _cairo_fixed_to_double (pattern->p2.y);
|
||||
|
||||
_x1 = x1 + (x2 - x1)*first_stop;
|
||||
_y1 = y1 + (y2 - y1)*first_stop;
|
||||
_x2 = x1 + (x2 - x1)*last_stop;
|
||||
_y2 = y1 + (y2 - y1)*last_stop;
|
||||
|
||||
x1 = _x1;
|
||||
x2 = _x2;
|
||||
y1 = _y1;
|
||||
y2 = _y2;
|
||||
|
||||
/* For EXTEND_NONE and EXTEND_PAD if there are only two stops a
|
||||
* Type 2 function is used by itself without a stitching
|
||||
* function. Type 2 functions always have the domain [0 1] */
|
||||
if ((pattern->base.base.extend == CAIRO_EXTEND_NONE ||
|
||||
pattern->base.base.extend == CAIRO_EXTEND_PAD) &&
|
||||
gradient->n_stops == 2) {
|
||||
first_stop = 0.0;
|
||||
last_stop = 1.0;
|
||||
}
|
||||
|
||||
status = _cairo_ps_surface_emit_pattern_stops (surface,
|
||||
&pattern->base);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
if (pattern->base.base.extend == CAIRO_EXTEND_REPEAT ||
|
||||
pattern->base.base.extend == CAIRO_EXTEND_REFLECT) {
|
||||
status = _cairo_ps_surface_emit_repeating_function (surface,
|
||||
&pattern->base,
|
||||
repeat_begin,
|
||||
repeat_end);
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"<< /PatternType 2\n"
|
||||
" /Shading\n"
|
||||
" << /ShadingType 2\n"
|
||||
" /ColorSpace /DeviceRGB\n"
|
||||
" /Coords [ %f %f %f %f ]\n"
|
||||
" /Function\n",
|
||||
x1, y1, x2, y2);
|
||||
|
||||
status = _cairo_ps_surface_emit_pattern_stops (surface, &pattern->base);
|
||||
if (status)
|
||||
return status;
|
||||
" /Domain [ %f %f ]\r\n"
|
||||
" /Function CairoFunction\n",
|
||||
x1, y1, x2, y2,
|
||||
first_stop, last_stop);
|
||||
|
||||
if (extend == CAIRO_EXTEND_PAD) {
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
|
@ -2676,9 +2843,9 @@ _cairo_ps_surface_emit_linear_pattern (cairo_ps_surface_t *surface,
|
|||
">>\n");
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"[ %f %f %f %f %f %f ]\n",
|
||||
inverse.xx, inverse.yx,
|
||||
inverse.xy, inverse.yy,
|
||||
inverse.x0, inverse.y0);
|
||||
pat_to_ps.xx, pat_to_ps.yx,
|
||||
pat_to_ps.xy, pat_to_ps.yy,
|
||||
pat_to_ps.x0, pat_to_ps.y0);
|
||||
_cairo_output_stream_printf (surface->stream,
|
||||
"makepattern setpattern\n");
|
||||
|
||||
|
@ -3089,7 +3256,7 @@ _cairo_ps_surface_stroke (void *abstract_surface,
|
|||
|
||||
/* miter limit */
|
||||
_cairo_output_stream_printf (stream, "%f setmiterlimit\n",
|
||||
style->miter_limit);
|
||||
style->miter_limit < 1.0 ? 1.0 : style->miter_limit);
|
||||
_cairo_output_stream_printf (stream,
|
||||
"stroke\n");
|
||||
_cairo_output_stream_printf (stream,
|
||||
|
|
|
@ -48,7 +48,7 @@ CAIRO_BEGIN_DECLS
|
|||
/* PS-surface functions */
|
||||
|
||||
/**
|
||||
* cairo_ps_level_t
|
||||
* cairo_ps_level_t:
|
||||
* @CAIRO_PS_LEVEL_2: The language level 2 of the PostScript specification.
|
||||
* @CAIRO_PS_LEVEL_3: The language level 3 of the PostScript specification.
|
||||
*
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
|
||||
/* cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2002 University of Southern California
|
||||
|
@ -39,15 +40,15 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
/* XXX We currently have a confusing mix of boxes and rectangles as
|
||||
* exemplified by this function. A cairo_box_t is a rectangular area
|
||||
* exemplified by this function. A #cairo_box_t is a rectangular area
|
||||
* represented by the coordinates of the upper left and lower right
|
||||
* corners, expressed in fixed point numbers. A cairo_rectangle_int_t is
|
||||
* corners, expressed in fixed point numbers. A #cairo_rectangle_int_t is
|
||||
* also a rectangular area, but represented by the upper left corner
|
||||
* and the width and the height, as integer numbers.
|
||||
*
|
||||
* This function converts a cairo_box_t to a cairo_rectangle_int_t by
|
||||
* This function converts a #cairo_box_t to a #cairo_rectangle_int_t by
|
||||
* increasing the area to the nearest integer coordinates. We should
|
||||
* standardize on cairo_rectangle_fixed_t and cairo_rectangle_int_t, and
|
||||
* standardize on #cairo_rectangle_fixed_t and #cairo_rectangle_int_t, and
|
||||
* this function could be renamed to the more reasonable
|
||||
* _cairo_rectangle_fixed_round.
|
||||
*/
|
||||
|
@ -83,3 +84,102 @@ _cairo_rectangle_intersect (cairo_rectangle_int_t *dest, cairo_rectangle_int_t *
|
|||
dest->height = y2 - y1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define P1x (line->p1.x)
|
||||
#define P1y (line->p1.y)
|
||||
#define P2x (line->p2.x)
|
||||
#define P2y (line->p2.y)
|
||||
#define B1x (box->p1.x)
|
||||
#define B1y (box->p1.y)
|
||||
#define B2x (box->p2.x)
|
||||
#define B2y (box->p2.y)
|
||||
|
||||
/*
|
||||
* Check whether any part of line intersects box. This function essentially
|
||||
* computes whether the ray starting at line->p1 in the direction of line->p2
|
||||
* intersects the box before it reaches p2. Normally, this is done
|
||||
* by dividing by the lengths of the line projected onto each axis. Because
|
||||
* we're in fixed point, this function does a bit more work to avoid having to
|
||||
* do the division -- we don't care about the actual intersection point, so
|
||||
* it's of no interest to us.
|
||||
*/
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line)
|
||||
{
|
||||
cairo_fixed_t t1, t2, t3, t4;
|
||||
cairo_int64_t t1y, t2y, t3x, t4x;
|
||||
|
||||
cairo_fixed_t xlen, ylen;
|
||||
|
||||
if (_cairo_box_contains_point(box, &line->p1) ||
|
||||
_cairo_box_contains_point(box, &line->p2))
|
||||
return TRUE;
|
||||
|
||||
xlen = P2x - P1x;
|
||||
ylen = P2y - P1y;
|
||||
|
||||
if (xlen) {
|
||||
if (xlen > 0) {
|
||||
t1 = B1x - P1x;
|
||||
t2 = B2x - P1x;
|
||||
} else {
|
||||
t1 = P1x - B2x;
|
||||
t2 = P1x - B1x;
|
||||
xlen = - xlen;
|
||||
}
|
||||
|
||||
if ((t1 < 0 || t1 > xlen) &&
|
||||
(t2 < 0 || t2 > xlen))
|
||||
return FALSE;
|
||||
} else {
|
||||
/* Fully vertical line -- check that X is in bounds */
|
||||
if (P1x < B1x || P1x > B2x)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ylen) {
|
||||
if (ylen > 0) {
|
||||
t3 = B1y - P1y;
|
||||
t4 = B2y - P1y;
|
||||
} else {
|
||||
t3 = P1y - B2y;
|
||||
t4 = P1y - B1y;
|
||||
ylen = - ylen;
|
||||
}
|
||||
|
||||
if ((t3 < 0 || t3 > ylen) &&
|
||||
(t4 < 0 || t4 > ylen))
|
||||
return FALSE;
|
||||
} else {
|
||||
/* Fully horizontal line -- check Y */
|
||||
if (P1y < B1y || P1y > B2y)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If we had a horizontal or vertical line, then it's already been checked */
|
||||
if (P1x == P2x || P1y == P2y)
|
||||
return TRUE;
|
||||
|
||||
/* Check overlap. Note that t1 < t2 and t3 < t4 here. */
|
||||
t1y = _cairo_int32x32_64_mul (t1, ylen);
|
||||
t2y = _cairo_int32x32_64_mul (t2, ylen);
|
||||
t3x = _cairo_int32x32_64_mul (t3, xlen);
|
||||
t4x = _cairo_int32x32_64_mul (t4, xlen);
|
||||
|
||||
if (_cairo_int64_lt(t1y, t4x) &&
|
||||
_cairo_int64_lt(t3x, t2y))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point)
|
||||
{
|
||||
if (point->x < box->p1.x || point->x > box->p2.x ||
|
||||
point->y < box->p1.y || point->y > box->p2.y)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "cairo-compiler-private.h"
|
||||
|
||||
/* cairo_region_t is defined in cairoint.h */
|
||||
/* #cairo_region_t is defined in cairoint.h */
|
||||
|
||||
struct _cairo_region {
|
||||
pixman_region16_t rgn;
|
||||
|
|
|
@ -149,7 +149,7 @@ _cairo_region_boxes_fini (cairo_region_t *region, cairo_box_int_t *boxes)
|
|||
* @region: a #cairo_region_t
|
||||
* @rect: rectangle into which to store the extents
|
||||
*
|
||||
* Gets the bounding box of a region as a cairo_rectangle_int_t
|
||||
* Gets the bounding box of a region as a #cairo_rectangle_int_t
|
||||
**/
|
||||
void
|
||||
_cairo_region_get_extents (cairo_region_t *region, cairo_rectangle_int_t *extents)
|
||||
|
|
|
@ -52,9 +52,9 @@ typedef struct _cairo_scaled_font_subsets_glyph {
|
|||
* _cairo_scaled_font_subsets_create_scaled:
|
||||
*
|
||||
* Create a new #cairo_scaled_font_subsets_t object which can be used
|
||||
* to create subsets of any number of cairo_scaled_font_t
|
||||
* to create subsets of any number of #cairo_scaled_font_t
|
||||
* objects. This allows the (arbitrarily large and sparse) glyph
|
||||
* indices of a cairo_scaled_font to be mapped to one or more font
|
||||
* indices of a #cairo_scaled_font_t to be mapped to one or more font
|
||||
* subsets with glyph indices packed into the range
|
||||
* [0 .. max_glyphs_per_subset).
|
||||
*
|
||||
|
@ -74,7 +74,7 @@ _cairo_scaled_font_subsets_create_scaled (void);
|
|||
*
|
||||
* Glyphs with an outline path available will be mapped to one font
|
||||
* subset for each font face. Glyphs from bitmap fonts will mapped to
|
||||
* separate font subsets for each cairo_scaled_font_t object.
|
||||
* separate font subsets for each #cairo_scaled_font_t object.
|
||||
*
|
||||
* The maximum number of glyphs per subset is 256. Each subset
|
||||
* reserves the first glyph for the .notdef glyph.
|
||||
|
@ -98,7 +98,7 @@ _cairo_scaled_font_subsets_create_simple (void);
|
|||
* 65536 glyphs except for Type1 fonts which have a maximum of 256 glyphs.
|
||||
*
|
||||
* Glyphs from bitmap fonts will mapped to separate font subsets for
|
||||
* each cairo_scaled_font_t object. Each unscaled subset has a maximum
|
||||
* each #cairo_scaled_font_t object. Each unscaled subset has a maximum
|
||||
* of 256 glyphs.
|
||||
*
|
||||
* Each subset reserves the first glyph for the .notdef glyph.
|
||||
|
@ -167,7 +167,7 @@ _cairo_scaled_font_subsets_destroy (cairo_scaled_font_subsets_t *font_subsets);
|
|||
* used by #cairo_scaled_font_subset_t as provided by
|
||||
* _cairo_scaled_font_subsets_foreach.
|
||||
*
|
||||
* The returned values in the cairo_scaled_font_subsets_glyph_t struct are:
|
||||
* The returned values in the #cairo_scaled_font_subsets_glyph_t struct are:
|
||||
*
|
||||
* @font_id: The font ID of the mapped glyph
|
||||
* @subset_id : The subset ID of the mapped glyph within the @font_id
|
||||
|
@ -178,7 +178,7 @@ _cairo_scaled_font_subsets_destroy (cairo_scaled_font_subsets_t *font_subsets);
|
|||
* @x_advance: When @is_scaled is true, @x_advance contains the x_advance for the mapped glyph in device space.
|
||||
* When @is_scaled is false, @x_advance contains the x_advance for the the mapped glyph from an unhinted 1 point font.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful, or a non-zero
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful, or a non-zero
|
||||
* value indicating an error. Possible errors include
|
||||
* CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
|
@ -218,7 +218,7 @@ typedef cairo_status_t
|
|||
* values of the array correspond to the scaled_font_glyph_index
|
||||
* values passed as input to the same function.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful, or a non-zero
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful, or a non-zero
|
||||
* value indicating an error. Possible errors include
|
||||
* CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
|
@ -253,7 +253,7 @@ _cairo_scaled_font_subsets_foreach_scaled (cairo_scaled_font_subsets_t *fon
|
|||
* values of the array correspond to the scaled_font_glyph_index
|
||||
* values passed as input to the same function.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful, or a non-zero
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful, or a non-zero
|
||||
* value indicating an error. Possible errors include
|
||||
* CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
|
@ -269,10 +269,10 @@ _cairo_scaled_font_subsets_foreach_unscaled (cairo_scaled_font_subsets_t
|
|||
* Create an array of strings containing the glyph name for each glyph
|
||||
* in @font_subsets. The array as store in font_subsets->glyph_names.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font backend does not support
|
||||
* mapping the glyph indices to unicode characters. Possible errors
|
||||
* include CAIRO_STATUS_NO_MEMORY.
|
||||
* include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_scaled_font_subset_create_glyph_names (cairo_scaled_font_subset_t *subset);
|
||||
|
@ -292,15 +292,15 @@ typedef struct _cairo_cff_subset {
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate a
|
||||
* #cairo_scaled_font_t and the font backend in use) generate a
|
||||
* cff file corresponding to @font_subset and initialize
|
||||
* @cff_subset with information about the subset and the cff
|
||||
* data.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a
|
||||
* cff file, or an non-zero value indicating an error. Possible
|
||||
* errors include CAIRO_STATUS_NO_MEMORY.
|
||||
* errors include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_cff_subset_init (cairo_cff_subset_t *cff_subset,
|
||||
|
@ -324,14 +324,14 @@ _cairo_cff_subset_fini (cairo_cff_subset_t *cff_subset);
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate a cff
|
||||
* #cairo_scaled_font_t and the font backend in use) generate a cff
|
||||
* file corresponding to @font_subset and initialize @cff_subset
|
||||
* with information about the subset and the cff data.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a
|
||||
* cff file, or an non-zero value indicating an error. Possible
|
||||
* errors include CAIRO_STATUS_NO_MEMORY.
|
||||
* errors include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_cff_fallback_init (cairo_cff_subset_t *cff_subset,
|
||||
|
@ -366,15 +366,15 @@ typedef struct _cairo_truetype_subset {
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate a
|
||||
* #cairo_scaled_font_t and the font backend in use) generate a
|
||||
* truetype file corresponding to @font_subset and initialize
|
||||
* @truetype_subset with information about the subset and the truetype
|
||||
* data.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a
|
||||
* truetype file, or an non-zero value indicating an error. Possible
|
||||
* errors include CAIRO_STATUS_NO_MEMORY.
|
||||
* errors include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_truetype_subset_init (cairo_truetype_subset_t *truetype_subset,
|
||||
|
@ -411,14 +411,14 @@ typedef struct _cairo_type1_subset {
|
|||
* @hex_encode: if true the encrypted portion of the font is hex encoded
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate a type1
|
||||
* #cairo_scaled_font_t and the font backend in use) generate a type1
|
||||
* file corresponding to @font_subset and initialize @type1_subset
|
||||
* with information about the subset and the type1 data.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a type1
|
||||
* file, or an non-zero value indicating an error. Possible errors
|
||||
* include CAIRO_STATUS_NO_MEMORY.
|
||||
* include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_type1_subset_init (cairo_type1_subset_t *type_subset,
|
||||
|
@ -441,7 +441,7 @@ _cairo_type1_subset_fini (cairo_type1_subset_t *subset);
|
|||
* _cairo_type1_scaled_font_is_type1:
|
||||
* @scaled_font: a #cairo_scaled_font_t
|
||||
*
|
||||
* Return TRUE if @scaled_font is a Type 1 font, otherwise return FALSE.
|
||||
* Return %TRUE if @scaled_font is a Type 1 font, otherwise return %FALSE.
|
||||
**/
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_type1_scaled_font_is_type1 (cairo_scaled_font_t *scaled_font);
|
||||
|
@ -452,15 +452,15 @@ _cairo_type1_scaled_font_is_type1 (cairo_scaled_font_t *scaled_font);
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate a type1
|
||||
* #cairo_scaled_font_t and the font backend in use) generate a type1
|
||||
* file corresponding to @font_subset and initialize @type1_subset
|
||||
* with information about the subset and the type1 data. The encrypted
|
||||
* part of the font is binary encoded.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a type1
|
||||
* file, or an non-zero value indicating an error. Possible errors
|
||||
* include CAIRO_STATUS_NO_MEMORY.
|
||||
* include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_type1_fallback_init_binary (cairo_type1_subset_t *type_subset,
|
||||
|
@ -473,15 +473,15 @@ _cairo_type1_fallback_init_binary (cairo_type1_subset_t *type_subset,
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate a type1
|
||||
* #cairo_scaled_font_t and the font backend in use) generate a type1
|
||||
* file corresponding to @font_subset and initialize @type1_subset
|
||||
* with information about the subset and the type1 data. The encrypted
|
||||
* part of the font is hex encoded.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a type1
|
||||
* file, or an non-zero value indicating an error. Possible errors
|
||||
* include CAIRO_STATUS_NO_MEMORY.
|
||||
* include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_type1_fallback_init_hex (cairo_type1_subset_t *type_subset,
|
||||
|
@ -512,14 +512,14 @@ typedef struct _cairo_type2_charstrings {
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) generate type2
|
||||
* #cairo_scaled_font_t and the font backend in use) generate type2
|
||||
* charstrings to @font_subset and initialize @type2_subset
|
||||
* with information about the subset.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the font can't be subset as a type2
|
||||
* charstrings, or an non-zero value indicating an error. Possible errors
|
||||
* include CAIRO_STATUS_NO_MEMORY.
|
||||
* include %CAIRO_STATUS_NO_MEMORY.
|
||||
**/
|
||||
cairo_private cairo_status_t
|
||||
_cairo_type2_charstrings_init (cairo_type2_charstrings_t *charstrings,
|
||||
|
@ -541,11 +541,11 @@ _cairo_type2_charstrings_fini (cairo_type2_charstrings_t *charstrings);
|
|||
* @font_subset: the #cairo_scaled_font_subset_t to initialize from
|
||||
*
|
||||
* If possible (depending on the format of the underlying
|
||||
* cairo_scaled_font_t and the font backend in use) assign
|
||||
* #cairo_scaled_font_t and the font backend in use) assign
|
||||
* the unicode character of each glyph in font_subset to
|
||||
* fontsubset->to_unicode.
|
||||
*
|
||||
* Return value: CAIRO_STATUS_SUCCESS if successful,
|
||||
* Return value: %CAIRO_STATUS_SUCCESS if successful,
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED if the unicode encoding of
|
||||
* the glyphs is not available. Possible errors include
|
||||
* CAIRO_STATUS_NO_MEMORY.
|
||||
|
|
|
@ -41,16 +41,16 @@
|
|||
#include "cairo-scaled-font-private.h"
|
||||
|
||||
/*
|
||||
* NOTES:
|
||||
* Notes:
|
||||
*
|
||||
* To store rasterizations of glyphs, we use an image surface and the
|
||||
* device offset to represent the glyph origin.
|
||||
*
|
||||
* A device_transform converts from device space (a conceptual space) to
|
||||
* surface space. For simple cases of translation only, it's called a
|
||||
* device_offset and is public API (cairo_surface_[gs]et_device_offset).
|
||||
* device_offset and is public API (cairo_surface_[gs]et_device_offset()).
|
||||
* A possibly better name for those functions could have been
|
||||
* cairo_surface_[gs]et_origing. So, that's what they do: they set where
|
||||
* cairo_surface_[gs]et_origin(). So, that's what they do: they set where
|
||||
* the device-space origin (0,0) is in the surface. If the origin is inside
|
||||
* the surface, device_offset values are positive. It may look like this:
|
||||
*
|
||||
|
@ -271,21 +271,21 @@ cairo_scaled_font_status (cairo_scaled_font_t *scaled_font)
|
|||
slim_hidden_def (cairo_scaled_font_status);
|
||||
|
||||
/* Here we keep a unique mapping from
|
||||
* cairo_font_face_t/matrix/ctm/options => cairo_scaled_font_t.
|
||||
* font_face/matrix/ctm/font_options => #cairo_scaled_font_t.
|
||||
*
|
||||
* Here are the things that we want to map:
|
||||
*
|
||||
* a) All otherwise referenced cairo_scaled_font_t's
|
||||
* b) Some number of not otherwise referenced cairo_scaled_font_t's
|
||||
* a) All otherwise referenced #cairo_scaled_font_t's
|
||||
* b) Some number of not otherwise referenced #cairo_scaled_font_t's
|
||||
*
|
||||
* The implementation uses a hash table which covers (a)
|
||||
* completely. Then, for (b) we have an array of otherwise
|
||||
* unreferenced fonts (holdovers) which are expired in
|
||||
* least-recently-used order.
|
||||
*
|
||||
* The cairo_scaled_font_create code gets to treat this like a regular
|
||||
* The cairo_scaled_font_create() code gets to treat this like a regular
|
||||
* hash table. All of the magic for the little holdover cache is in
|
||||
* cairo_scaled_font_reference and cairo_scaled_font_destroy.
|
||||
* cairo_scaled_font_reference() and cairo_scaled_font_destroy().
|
||||
*/
|
||||
|
||||
/* This defines the size of the holdover array ... that is, the number
|
||||
|
@ -453,7 +453,7 @@ _cairo_scaled_font_keys_equal (const void *abstract_key_a, const void *abstract_
|
|||
#define MAX_GLYPHS_CACHED_PER_FONT 256
|
||||
|
||||
/*
|
||||
* Basic cairo_scaled_font_t object management
|
||||
* Basic #cairo_scaled_font_t object management
|
||||
*/
|
||||
|
||||
cairo_status_t
|
||||
|
@ -544,15 +544,18 @@ _cairo_scaled_font_reset_cache (cairo_scaled_font_t *scaled_font)
|
|||
MAX_GLYPHS_CACHED_PER_FONT);
|
||||
}
|
||||
|
||||
void
|
||||
cairo_status_t
|
||||
_cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
|
||||
cairo_font_extents_t *fs_metrics)
|
||||
{
|
||||
cairo_status_t status;
|
||||
double font_scale_x, font_scale_y;
|
||||
|
||||
_cairo_matrix_compute_scale_factors (&scaled_font->font_matrix,
|
||||
&font_scale_x, &font_scale_y,
|
||||
/* XXX */ 1);
|
||||
status = _cairo_matrix_compute_scale_factors (&scaled_font->font_matrix,
|
||||
&font_scale_x, &font_scale_y,
|
||||
/* XXX */ 1);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
/*
|
||||
* The font responded in unscaled units, scale by the font
|
||||
|
@ -564,6 +567,8 @@ _cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
|
|||
scaled_font->extents.height = fs_metrics->height * font_scale_y;
|
||||
scaled_font->extents.max_x_advance = fs_metrics->max_x_advance * font_scale_x;
|
||||
scaled_font->extents.max_y_advance = fs_metrics->max_y_advance * font_scale_y;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -704,7 +709,7 @@ slim_hidden_def (cairo_scaled_font_create);
|
|||
|
||||
/**
|
||||
* cairo_scaled_font_reference:
|
||||
* @scaled_font: a #cairo_scaled_font_t, (may be NULL in which case
|
||||
* @scaled_font: a #cairo_scaled_font_t, (may be %NULL in which case
|
||||
* this function does nothing)
|
||||
*
|
||||
* Increases the reference count on @scaled_font by one. This prevents
|
||||
|
@ -1270,7 +1275,8 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
|
|||
/* If we have glyphs of different formats, we "upgrade" the mask
|
||||
* to the wider of the formats. */
|
||||
if (glyph_surface->format != mask_format &&
|
||||
_cairo_format_width (mask_format) < _cairo_format_width (glyph_surface->format) )
|
||||
_cairo_format_bits_per_pixel (mask_format) <
|
||||
_cairo_format_bits_per_pixel (glyph_surface->format) )
|
||||
{
|
||||
cairo_surface_t *new_mask;
|
||||
cairo_surface_pattern_t mask_pattern;
|
||||
|
@ -1454,7 +1460,7 @@ _add_unit_rectangle_to_path (cairo_path_fixed_t *path, int x, int y)
|
|||
|
||||
/**
|
||||
* _trace_mask_to_path:
|
||||
* @bitmap: An alpha mask (either CAIRO_FORMAT_A1 or _A8)
|
||||
* @bitmap: An alpha mask (either %CAIRO_FORMAT_A1 or %CAIRO_FORMAT_A8)
|
||||
* @path: An initialized path to hold the result
|
||||
*
|
||||
* Given a mask surface, (an alpha image), fill out the provided path
|
||||
|
@ -1701,7 +1707,7 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
|
|||
* @scaled_glyph_ret: a #cairo_scaled_glyph_t * where the glyph
|
||||
* is returned.
|
||||
*
|
||||
* Returns a glyph with the requested portions filled in. Glyph
|
||||
* Returns: a glyph with the requested portions filled in. Glyph
|
||||
* lookup is cached and glyph will be automatically freed along
|
||||
* with the scaled_font so no explicit free is required.
|
||||
* @info can be one or more of:
|
||||
|
@ -1713,7 +1719,7 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
|
|||
* get INFO_PATH with a bitmapped font), this function will return
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED.
|
||||
*
|
||||
* NOTE: This function must be called with scaled_font->mutex held.
|
||||
* Note: This function must be called with scaled_font->mutex held.
|
||||
**/
|
||||
cairo_int_status_t
|
||||
_cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
|
||||
|
|
|
@ -88,7 +88,7 @@ _cairo_slope_compare (cairo_slope_t *a, cairo_slope_t *b)
|
|||
|
||||
/* Is a clockwise of b?
|
||||
*
|
||||
* NOTE: The strict equality here is not significant in and of itself,
|
||||
* Note: The strict equality here is not significant in and of itself,
|
||||
* but there are functions up above that are sensitive to it,
|
||||
* (cf. _cairo_pen_find_active_cw_vertex_index).
|
||||
*/
|
||||
|
|
|
@ -84,3 +84,20 @@ _cairo_stroke_style_fini (cairo_stroke_style_t *style)
|
|||
}
|
||||
style->num_dashes = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For a stroke in the given style, compute the maximum distance
|
||||
* from the path that vertices could be generated. In the case
|
||||
* of rotation in the ctm, the distance will not be exact.
|
||||
*/
|
||||
void
|
||||
_cairo_stroke_style_max_distance_from_path (const cairo_stroke_style_t *style,
|
||||
const cairo_matrix_t *ctm,
|
||||
double *dx, double *dy)
|
||||
{
|
||||
double style_expansion = MAX(style->line_cap == CAIRO_LINE_CAP_SQUARE ? M_SQRT1_2 : 0.5,
|
||||
style->line_join == CAIRO_LINE_JOIN_MITER ? style->miter_limit : 0.5);
|
||||
|
||||
*dx = style->line_width * style_expansion * (fabs(ctm->xx) + fabs(ctm->xy));
|
||||
*dy = style->line_width * style_expansion * (fabs(ctm->yy) + fabs(ctm->yx));
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ typedef struct {
|
|||
* Acquire destination image surface needed for an image-based
|
||||
* fallback.
|
||||
*
|
||||
* Return value: CAIRO_INT_STATUS_NOTHING_TO_DO if the extents are not
|
||||
* visible, CAIRO_STATUS_SUCCESS if some portion is visible and all
|
||||
* Return value: %CAIRO_INT_STATUS_NOTHING_TO_DO if the extents are not
|
||||
* visible, %CAIRO_STATUS_SUCCESS if some portion is visible and all
|
||||
* went well, or some error status otherwise.
|
||||
**/
|
||||
static cairo_int_status_t
|
||||
|
@ -273,7 +273,7 @@ _clip_and_composite_combine (cairo_clip_t *clip,
|
|||
return status;
|
||||
}
|
||||
|
||||
/* Handles compositing for CAIRO_OPERATOR_SOURCE, which is special; it's
|
||||
/* Handles compositing for %CAIRO_OPERATOR_SOURCE, which is special; it's
|
||||
* defined as (src IN mask IN clip) ADD (dst OUT (mask IN clip))
|
||||
*/
|
||||
static cairo_status_t
|
||||
|
|
|
@ -86,6 +86,7 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_FILE_NOT_FOUND, _cairo_surface_nil_file_n
|
|||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_TEMP_FILE_ERROR, _cairo_surface_nil_temp_file_error);
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_READ_ERROR, _cairo_surface_nil_read_error);
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_WRITE_ERROR, _cairo_surface_nil_write_error);
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_STRIDE, _cairo_surface_nil_invalid_stride);
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_surface_copy_pattern_for_destination (const cairo_pattern_t *pattern,
|
||||
|
@ -279,7 +280,7 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
|
|||
* have transparency, black otherwise.)
|
||||
*
|
||||
* Return value: a pointer to the newly allocated surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -881,7 +882,7 @@ slim_hidden_def (cairo_surface_get_device_offset);
|
|||
* device resolution. So this function has no effect on those
|
||||
* backends.
|
||||
*
|
||||
* NOTE: The fallback resolution only takes effect at the time of
|
||||
* Note: The fallback resolution only takes effect at the time of
|
||||
* completing a page (with cairo_show_page() or cairo_copy_page()) so
|
||||
* there is currently no way to have more than one fallback resolution
|
||||
* in effect on a single page.
|
||||
|
@ -971,7 +972,7 @@ _cairo_surface_release_source_image (cairo_surface_t *surface,
|
|||
* @surface: a #cairo_surface_t
|
||||
* @interest_rect: area of @surface for which fallback drawing is being done.
|
||||
* A value of %NULL indicates that the entire surface is desired.
|
||||
* XXXX I'd like to get rid of being able to pass NULL here (nothing seems to)
|
||||
* XXXX I'd like to get rid of being able to pass %NULL here (nothing seems to)
|
||||
* @image_out: location to store a pointer to an image surface that includes at least
|
||||
* the intersection of @interest_rect with the visible area of @surface.
|
||||
* This surface could be @surface itself, a surface held internal to @surface,
|
||||
|
@ -992,7 +993,7 @@ _cairo_surface_release_source_image (cairo_surface_t *surface,
|
|||
* Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY.
|
||||
* %CAIRO_INT_STATUS_UNSUPPORTED can be returned but this will mean that
|
||||
* the backend can't draw with fallbacks. It's possible for the routine
|
||||
* to store NULL in @local_out and return %CAIRO_STATUS_SUCCESS;
|
||||
* to store %NULL in @local_out and return %CAIRO_STATUS_SUCCESS;
|
||||
* that indicates that no part of @interest_rect is visible, so no drawing
|
||||
* is necessary. _cairo_surface_release_dest_image() should not be called in that
|
||||
* case.
|
||||
|
@ -1130,7 +1131,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
|
|||
*
|
||||
* The caller owns the return value and should call
|
||||
* cairo_surface_destroy when finished with it. This function will not
|
||||
* return NULL, but will return a nil surface instead.
|
||||
* return %NULL, but will return a nil surface instead.
|
||||
*
|
||||
* Return value: The snapshot surface. Note that the return surface
|
||||
* may not necessarily be of the same type as @surface.
|
||||
|
@ -1158,9 +1159,9 @@ _cairo_surface_snapshot (cairo_surface_t *surface)
|
|||
*
|
||||
* The definition of "similar" depends on the backend. In
|
||||
* general, it means that the surface is equivalent to one
|
||||
* that would have been generated by a call to cairo_surface_create_similar.
|
||||
* that would have been generated by a call to cairo_surface_create_similar().
|
||||
*
|
||||
* Return value: TRUE if the surfaces are similar.
|
||||
* Return value: %TRUE if the surfaces are similar.
|
||||
**/
|
||||
cairo_bool_t
|
||||
_cairo_surface_is_similar (cairo_surface_t *surface_a,
|
||||
|
@ -1649,7 +1650,7 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op,
|
|||
|
||||
/**
|
||||
* cairo_surface_copy_page:
|
||||
* @suface: a #cairo_surface_t
|
||||
* @surface: a #cairo_surface_t
|
||||
*
|
||||
* Emits the current page for backends that support multiple pages,
|
||||
* but doesn't clear it, so that the contents of the current page will
|
||||
|
@ -1658,23 +1659,25 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op,
|
|||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
cairo_status_t
|
||||
void
|
||||
cairo_surface_copy_page (cairo_surface_t *surface)
|
||||
{
|
||||
assert (! surface->is_snapshot);
|
||||
|
||||
if (surface->status)
|
||||
return surface->status;
|
||||
return;
|
||||
|
||||
if (surface->finished)
|
||||
return _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
|
||||
if (surface->finished) {
|
||||
_cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
|
||||
return;
|
||||
}
|
||||
|
||||
/* It's fine if some backends don't implement copy_page */
|
||||
if (surface->backend->copy_page == NULL)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return;
|
||||
|
||||
return _cairo_surface_set_error (surface,
|
||||
surface->backend->copy_page (surface));
|
||||
_cairo_surface_set_error (surface,
|
||||
surface->backend->copy_page (surface));
|
||||
}
|
||||
slim_hidden_def (cairo_surface_copy_page);
|
||||
|
||||
|
@ -1687,24 +1690,25 @@ slim_hidden_def (cairo_surface_copy_page);
|
|||
*
|
||||
* Since: 1.6
|
||||
**/
|
||||
|
||||
cairo_status_t
|
||||
void
|
||||
cairo_surface_show_page (cairo_surface_t *surface)
|
||||
{
|
||||
assert (! surface->is_snapshot);
|
||||
|
||||
if (surface->status)
|
||||
return surface->status;
|
||||
return;
|
||||
|
||||
if (surface->finished)
|
||||
return _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
|
||||
if (surface->finished) {
|
||||
_cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
|
||||
return;
|
||||
}
|
||||
|
||||
/* It's fine if some backends don't implement show_page */
|
||||
if (surface->backend->show_page == NULL)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return;
|
||||
|
||||
return _cairo_surface_set_error (surface,
|
||||
surface->backend->show_page (surface));
|
||||
_cairo_surface_set_error (surface,
|
||||
surface->backend->show_page (surface));
|
||||
}
|
||||
slim_hidden_def (cairo_surface_show_page);
|
||||
|
||||
|
@ -1712,7 +1716,7 @@ slim_hidden_def (cairo_surface_show_page);
|
|||
* _cairo_surface_get_current_clip_serial:
|
||||
* @surface: the #cairo_surface_t to return the serial number for
|
||||
*
|
||||
* Returns the serial number associated with the current
|
||||
* Returns: the serial number associated with the current
|
||||
* clip in the surface. All gstate functions must
|
||||
* verify that the correct clip is set in the surface before
|
||||
* invoking any surface drawing function
|
||||
|
@ -2001,10 +2005,10 @@ _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
|
|||
* maximum size at the time of surface_create. So get_extents uses
|
||||
* that size.
|
||||
*
|
||||
* NOTE: The coordinates returned are in "backend" space rather than
|
||||
* Note: The coordinates returned are in "backend" space rather than
|
||||
* "surface" space. That is, they are relative to the true (0,0)
|
||||
* origin rather than the device_transform origin. This might seem a
|
||||
* bit inconsistent with other cairo_surface interfaces, but all
|
||||
* bit inconsistent with other #cairo_surface_t interfaces, but all
|
||||
* current callers are within the surface layer where backend space is
|
||||
* desired.
|
||||
*
|
||||
|
@ -2026,7 +2030,7 @@ _cairo_surface_get_extents (cairo_surface_t *surface,
|
|||
}
|
||||
|
||||
/* Note: the backends may modify the contents of the glyph array as long as
|
||||
* they do not return CAIRO_STATUS_UNSUPPORTED. This makes it possible to
|
||||
* they do not return %CAIRO_STATUS_UNSUPPORTED. This makes it possible to
|
||||
* avoid copying the array again and again, and edit it in-place.
|
||||
* Backends are in fact free to use the array as a generic buffer as they
|
||||
* see fit.
|
||||
|
@ -2427,6 +2431,8 @@ _cairo_surface_create_in_error (cairo_status_t status)
|
|||
return (cairo_surface_t *) &_cairo_surface_nil_file_not_found;
|
||||
case CAIRO_STATUS_TEMP_FILE_ERROR:
|
||||
return (cairo_surface_t *) &_cairo_surface_nil_temp_file_error;
|
||||
case CAIRO_STATUS_INVALID_STRIDE:
|
||||
return (cairo_surface_t *) &_cairo_surface_nil_invalid_stride;
|
||||
default:
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return (cairo_surface_t *) &_cairo_surface_nil;
|
||||
|
|
|
@ -159,7 +159,7 @@ static const cairo_paginated_surface_backend_t cairo_svg_surface_paginated_backe
|
|||
* incrementally to the stream represented by @write_func and @closure.
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -193,7 +193,7 @@ cairo_svg_surface_create_for_stream (cairo_write_func_t write_func,
|
|||
* to @filename.
|
||||
*
|
||||
* Return value: a pointer to the newly created surface. The caller
|
||||
* owns the surface and should call cairo_surface_destroy when done
|
||||
* owns the surface and should call cairo_surface_destroy() when done
|
||||
* with it.
|
||||
*
|
||||
* This function always returns a valid pointer, but it will return a
|
||||
|
@ -224,7 +224,7 @@ _cairo_surface_is_svg (cairo_surface_t *surface)
|
|||
|
||||
/* If the abstract_surface is a paginated surface, and that paginated
|
||||
* surface's target is a svg_surface, then set svg_surface to that
|
||||
* target. Otherwise return CAIRO_STATUS_SURFACE_TYPE_MISMATCH.
|
||||
* target. Otherwise return %CAIRO_STATUS_SURFACE_TYPE_MISMATCH.
|
||||
*/
|
||||
static cairo_status_t
|
||||
_extract_svg_surface (cairo_surface_t *surface,
|
||||
|
@ -303,7 +303,7 @@ cairo_svg_get_versions (cairo_svg_version_t const **versions,
|
|||
* @version: a version id
|
||||
*
|
||||
* Get the string representation of the given @version id. This function
|
||||
* will return NULL if @version isn't valid. See cairo_svg_get_versions()
|
||||
* will return %NULL if @version isn't valid. See cairo_svg_get_versions()
|
||||
* for a way to get the list of valid version ids.
|
||||
*
|
||||
* Return value: the string associated to given version.
|
||||
|
@ -1045,7 +1045,8 @@ _cairo_svg_surface_emit_meta_surface (cairo_svg_document_t *document,
|
|||
return status;
|
||||
}
|
||||
|
||||
status = cairo_surface_show_page (paginated_surface);
|
||||
cairo_surface_show_page (paginated_surface);
|
||||
status = cairo_surface_status (paginated_surface);
|
||||
if (status) {
|
||||
cairo_surface_destroy (&meta->base);
|
||||
cairo_surface_destroy (paginated_surface);
|
||||
|
@ -1133,7 +1134,7 @@ _cairo_svg_surface_emit_composite_meta_pattern (cairo_output_stream_t *output,
|
|||
cairo_meta_surface_t *meta_surface;
|
||||
cairo_matrix_t p2u;
|
||||
cairo_status_t status;
|
||||
int id;
|
||||
int id = 0;
|
||||
|
||||
p2u = pattern->base.matrix;
|
||||
status = cairo_matrix_invert (&p2u);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
CAIRO_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* cairo_svg_version_t
|
||||
* cairo_svg_version_t:
|
||||
* @CAIRO_SVG_VERSION_1_1: The version 1.1 of the SVG specification.
|
||||
* @CAIRO_SVG_VERSION_1_2: The version 1.2 of the SVG specification.
|
||||
*
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* Keith R. Packard <keithp@keithp.com>
|
||||
* Carl D. Worth <cworth@cworth.org>
|
||||
*
|
||||
* 2002-07-15: Converted from XRenderCompositeDoublePoly to cairo_trap. Carl D. Worth
|
||||
* 2002-07-15: Converted from XRenderCompositeDoublePoly to #cairo_trap_t. Carl D. Worth
|
||||
*/
|
||||
|
||||
#include "cairoint.h"
|
||||
|
@ -75,6 +75,14 @@ _cairo_traps_limit (cairo_traps_t *traps,
|
|||
traps->limits = *limits;
|
||||
}
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_traps_get_limit (cairo_traps_t *traps,
|
||||
cairo_box_t *limits)
|
||||
{
|
||||
*limits = traps->limits;
|
||||
return traps->has_limits;
|
||||
}
|
||||
|
||||
void
|
||||
_cairo_traps_fini (cairo_traps_t *traps)
|
||||
{
|
||||
|
@ -92,7 +100,7 @@ _cairo_traps_fini (cairo_traps_t *traps)
|
|||
* @box: a box that will be converted to a single trapezoid
|
||||
* to store in @traps.
|
||||
*
|
||||
* Initializes a cairo_traps_t to contain a single rectangular
|
||||
* Initializes a #cairo_traps_t to contain a single rectangular
|
||||
* trapezoid.
|
||||
**/
|
||||
cairo_status_t
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef cairo_array_t cairo_user_data_array_t;
|
|||
* cairo_hash_entry_t:
|
||||
*
|
||||
* A #cairo_hash_entry_t contains both a key and a value for
|
||||
* cairo_hash_table_t. User-derived types for cairo_hash_entry_t must
|
||||
* #cairo_hash_table_t. User-derived types for #cairo_hash_entry_t must
|
||||
* be type-compatible with this structure (eg. they must have an
|
||||
* unsigned long as the first parameter. The easiest way to get this
|
||||
* is to use:
|
||||
|
@ -72,21 +72,21 @@ typedef cairo_array_t cairo_user_data_array_t;
|
|||
* } my_entry_t;
|
||||
*
|
||||
* which then allows a pointer to my_entry_t to be passed to any of
|
||||
* the cairo_hash_table functions as follows without requiring a cast:
|
||||
* the #cairo_hash_table_t functions as follows without requiring a cast:
|
||||
*
|
||||
* _cairo_hash_table_insert (hash_table, &my_entry->base);
|
||||
*
|
||||
* IMPORTANT: The caller is reponsible for initializing
|
||||
* my_entry->base.hash with a hash code derived from the key. The
|
||||
* essential property of the hash code is that keys_equal must never
|
||||
* return TRUE for two keys that have different hashes. The best hash
|
||||
* return %TRUE for two keys that have different hashes. The best hash
|
||||
* code will reduce the frequency of two keys with the same code for
|
||||
* which keys_equal returns FALSE.
|
||||
* which keys_equal returns %FALSE.
|
||||
*
|
||||
* Which parts of the entry make up the "key" and which part make up
|
||||
* the value are entirely up to the caller, (as determined by the
|
||||
* computation going into base.hash as well as the keys_equal
|
||||
* function). A few of the cairo_hash_table functions accept an entry
|
||||
* function). A few of the #cairo_hash_table_t functions accept an entry
|
||||
* which will be used exclusively as a "key", (indicated by a
|
||||
* parameter name of key). In these cases, the value-related fields of
|
||||
* the entry need not be initialized if so desired.
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is cairo_unicode.c as distributed with the
|
||||
* cairo graphics library.
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Tom Tromey.
|
||||
* and Red Hat, Inc.
|
||||
|
|
|
@ -130,7 +130,7 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
|
||||
#define NEARLY_ZERO(d) (fabs(d) < (1. / 65536.))
|
||||
|
||||
static void
|
||||
static cairo_status_t
|
||||
_compute_transform (cairo_win32_scaled_font_t *scaled_font,
|
||||
cairo_matrix_t *sc)
|
||||
{
|
||||
|
@ -175,9 +175,11 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
|
|||
sc->xx, sc->yx, sc->xy, sc->yy, 0, 0);
|
||||
|
||||
if (!scaled_font->preserve_axes) {
|
||||
_cairo_matrix_compute_scale_factors (&scaled_font->logical_to_device,
|
||||
&scaled_font->x_scale, &scaled_font->y_scale,
|
||||
TRUE); /* XXX: Handle vertical text */
|
||||
status = _cairo_matrix_compute_scale_factors (&scaled_font->logical_to_device,
|
||||
&scaled_font->x_scale, &scaled_font->y_scale,
|
||||
TRUE); /* XXX: Handle vertical text */
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
scaled_font->logical_size = _cairo_lround (WIN32_FONT_LOGICAL_SCALE *
|
||||
scaled_font->y_scale);
|
||||
|
@ -192,6 +194,8 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
|
|||
status = cairo_matrix_invert (&scaled_font->device_to_logical);
|
||||
if (status)
|
||||
cairo_matrix_init_identity (&scaled_font->device_to_logical);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_bool_t
|
||||
|
@ -240,7 +244,7 @@ _get_system_quality (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* If face_hfont is non-NULL then font_matrix must be a simple scale by some
|
||||
/* If face_hfont is non-%NULL then font_matrix must be a simple scale by some
|
||||
* factor S, ctm must be the identity, logfont->lfHeight must be -S,
|
||||
* logfont->lfWidth, logfont->lfEscapement, logfont->lfOrientation must
|
||||
* all be 0, and face_hfont is the result of calling CreateFontIndirectW on
|
||||
|
@ -312,7 +316,9 @@ _win32_scaled_font_create (LOGFONTW *logfont,
|
|||
f->delete_scaled_hfont = !f->scaled_hfont;
|
||||
|
||||
cairo_matrix_multiply (&scale, font_matrix, ctm);
|
||||
_compute_transform (f, &scale);
|
||||
status = _compute_transform (f, &scale);
|
||||
if (status)
|
||||
goto FAIL;
|
||||
|
||||
status = _cairo_scaled_font_init (&f->base, font_face,
|
||||
font_matrix, ctm, options,
|
||||
|
@ -872,9 +878,7 @@ _cairo_win32_scaled_font_set_metrics (cairo_win32_scaled_font_t *scaled_font)
|
|||
}
|
||||
}
|
||||
|
||||
_cairo_scaled_font_set_metrics (&scaled_font->base, &extents);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return _cairo_scaled_font_set_metrics (&scaled_font->base, &extents);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
@ -1763,11 +1767,11 @@ const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend = {
|
|||
_cairo_win32_scaled_font_map_glyphs_to_unicode,
|
||||
};
|
||||
|
||||
/* cairo_win32_font_face_t */
|
||||
/* #cairo_win32_font_face_t */
|
||||
|
||||
typedef struct _cairo_win32_font_face cairo_win32_font_face_t;
|
||||
|
||||
/* If hfont is non-NULL then logfont->lfHeight must be -S for some S,
|
||||
/* If hfont is non-%NULL then logfont->lfHeight must be -S for some S,
|
||||
* logfont->lfWidth, logfont->lfEscapement, logfont->lfOrientation must
|
||||
* all be 0, and hfont is the result of calling CreateFontIndirectW on
|
||||
* logfont.
|
||||
|
|
|
@ -205,7 +205,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
|
|||
* break if we do, especially if we don't set up an image
|
||||
* fallback. It could be a bug with using a 24bpp pixman image
|
||||
* (and creating one with masks). So treat them like 32bpp.
|
||||
* NOTE: This causes problems when using BitBlt/AlphaBlend/etc!
|
||||
* Note: This causes problems when using BitBlt/AlphaBlend/etc!
|
||||
* see end of file.
|
||||
*/
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
|
@ -1261,7 +1261,7 @@ UNSUPPORTED:
|
|||
/* This big function tells us how to optimize operators for the
|
||||
* case of solid destination and constant-alpha source
|
||||
*
|
||||
* NOTE: This function needs revisiting if we add support for
|
||||
* Note: This function needs revisiting if we add support for
|
||||
* super-luminescent colors (a == 0, r,g,b > 0)
|
||||
*/
|
||||
static enum { DO_CLEAR, DO_SOURCE, DO_NOTHING, DO_UNSUPPORTED }
|
||||
|
@ -1844,10 +1844,10 @@ _cairo_surface_is_win32 (cairo_surface_t *surface)
|
|||
* cairo_win32_surface_get_dc
|
||||
* @surface: a #cairo_surface_t
|
||||
*
|
||||
* Returns the HDC associated with this surface, or NULL if none.
|
||||
* Also returns NULL if the surface is not a win32 surface.
|
||||
* Returns the HDC associated with this surface, or %NULL if none.
|
||||
* Also returns %NULL if the surface is not a win32 surface.
|
||||
*
|
||||
* Return value: HDC or NULL if no HDC available.
|
||||
* Return value: HDC or %NULL if no HDC available.
|
||||
*
|
||||
* Since: 1.2
|
||||
**/
|
||||
|
@ -1871,10 +1871,10 @@ cairo_win32_surface_get_dc (cairo_surface_t *surface)
|
|||
*
|
||||
* Returns a #cairo_surface_t image surface that refers to the same bits
|
||||
* as the DIB of the Win32 surface. If the passed-in win32 surface
|
||||
* is not a DIB surface, NULL is returned.
|
||||
* is not a DIB surface, %NULL is returned.
|
||||
*
|
||||
* Return value: a #cairo_surface_t (owned by the win32 cairo_surface_t),
|
||||
* or NULL if the win32 surface is not a DIB.
|
||||
* Return value: a #cairo_surface_t (owned by the win32 #cairo_surface_t),
|
||||
* or %NULL if the win32 surface is not a DIB.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
|
@ -2036,7 +2036,6 @@ _cairo_win32_save_initial_clip (HDC hdc, cairo_win32_surface_t *surface)
|
|||
if (clipBoxType == COMPLEXREGION) {
|
||||
surface->initial_clip_rgn = CreateRectRgn (0, 0, 0, 0);
|
||||
if (GetClipRgn (hdc, surface->initial_clip_rgn) <= 0) {
|
||||
/* this should never happen */
|
||||
DeleteObject(surface->initial_clip_rgn);
|
||||
surface->initial_clip_rgn = NULL;
|
||||
}
|
||||
|
|
|
@ -1854,7 +1854,7 @@ _cairo_xcb_screen_from_visual (xcb_connection_t *c, xcb_visualtype_t *visual)
|
|||
* The way that colors are represented in the drawable is specified
|
||||
* by the provided visual.
|
||||
*
|
||||
* NOTE: If @drawable is a window, then the function
|
||||
* Note: If @drawable is a window, then the function
|
||||
* cairo_xcb_surface_set_size must be called whenever the size of the
|
||||
* window changes.
|
||||
*
|
||||
|
@ -1886,7 +1886,7 @@ cairo_xcb_surface_create (xcb_connection_t *c,
|
|||
* @height: the current height of @bitmap
|
||||
*
|
||||
* Creates an XCB surface that draws to the given bitmap.
|
||||
* This will be drawn to as a CAIRO_FORMAT_A1 object.
|
||||
* This will be drawn to as a %CAIRO_FORMAT_A1 object.
|
||||
*
|
||||
* Return value: the newly created surface
|
||||
**/
|
||||
|
@ -1916,7 +1916,7 @@ cairo_xcb_surface_create_for_bitmap (xcb_connection_t *c,
|
|||
* The way that colors are represented in the drawable is specified
|
||||
* by the provided picture format.
|
||||
*
|
||||
* NOTE: If @drawable is a Window, then the function
|
||||
* Note: If @drawable is a Window, then the function
|
||||
* cairo_xcb_surface_set_size must be called whenever the size of the
|
||||
* window changes.
|
||||
*
|
||||
|
|
|
@ -168,7 +168,7 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pix = XCreatePixmap (dpy, RootWindowOfScreen (src->screen),
|
||||
pix = XCreatePixmap (dpy, src->drawable,
|
||||
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
|
||||
depth);
|
||||
|
||||
|
@ -246,7 +246,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
|
|||
/* We've got a compatible XRenderFormat now, which means the
|
||||
* similar surface will match the existing surface as closely in
|
||||
* visual/depth etc. as possible. */
|
||||
pix = XCreatePixmap (src->dpy, RootWindowOfScreen (src->screen),
|
||||
pix = XCreatePixmap (src->dpy, src->drawable,
|
||||
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
|
||||
xrender_format->depth);
|
||||
|
||||
|
@ -2070,7 +2070,7 @@ _cairo_xlib_screen_from_visual (Display *dpy, Visual *visual)
|
|||
* The way that colors are represented in the drawable is specified
|
||||
* by the provided visual.
|
||||
*
|
||||
* NOTE: If @drawable is a Window, then the function
|
||||
* Note: If @drawable is a Window, then the function
|
||||
* cairo_xlib_surface_set_size must be called whenever the size of the
|
||||
* window changes.
|
||||
*
|
||||
|
@ -2108,7 +2108,7 @@ cairo_xlib_surface_create (Display *dpy,
|
|||
* @height: the current height of @bitmap.
|
||||
*
|
||||
* Creates an Xlib surface that draws to the given bitmap.
|
||||
* This will be drawn to as a CAIRO_FORMAT_A1 object.
|
||||
* This will be drawn to as a %CAIRO_FORMAT_A1 object.
|
||||
*
|
||||
* Return value: the newly created surface
|
||||
**/
|
||||
|
@ -2140,7 +2140,7 @@ cairo_xlib_surface_create_for_bitmap (Display *dpy,
|
|||
* The way that colors are represented in the drawable is specified
|
||||
* by the provided picture format.
|
||||
*
|
||||
* NOTE: If @drawable is a Window, then the function
|
||||
* Note: If @drawable is a Window, then the function
|
||||
* cairo_xlib_surface_set_size must be called whenever the size of the
|
||||
* window changes.
|
||||
*
|
||||
|
@ -2160,6 +2160,35 @@ cairo_xlib_surface_create_with_xrender_format (Display *dpy,
|
|||
NULL, format, width, height, 0);
|
||||
}
|
||||
slim_hidden_def (cairo_xlib_surface_create_with_xrender_format);
|
||||
|
||||
/**
|
||||
* cairo_xlib_surface_get_xrender_format:
|
||||
* @surface: an xlib surface
|
||||
*
|
||||
* Gets the X Render picture format that @surface uses for rendering with the
|
||||
* X Render extension. If the surface was created by
|
||||
* cairo_xlib_surface_create_with_xrender_format() originally, the return
|
||||
* value is the format passed to that constructor.
|
||||
*
|
||||
* Return value: the XRenderPictFormat* associated with @surface,
|
||||
* or %NULL if the surface is not an xlib surface
|
||||
* or if the X Render extension is not available.
|
||||
*
|
||||
* Since: 1.6
|
||||
**/
|
||||
XRenderPictFormat *
|
||||
cairo_xlib_surface_get_xrender_format (cairo_surface_t *surface)
|
||||
{
|
||||
cairo_xlib_surface_t *xlib_surface = (cairo_xlib_surface_t *) surface;
|
||||
|
||||
/* Throw an error for a non-xlib surface */
|
||||
if (! _cairo_surface_is_xlib (surface)) {
|
||||
_cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return xlib_surface->xrender_format;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -2834,7 +2863,7 @@ typedef void (*cairo_xrender_composite_text_func_t)
|
|||
_Xconst XGlyphElt8 *elts,
|
||||
int nelt);
|
||||
|
||||
/* Build a struct of the same size of cairo_glyph_t that can be used both as
|
||||
/* Build a struct of the same size of #cairo_glyph_t that can be used both as
|
||||
* an input glyph with double coordinates, and as "working" glyph with
|
||||
* integer from-current-point offsets. */
|
||||
typedef struct {
|
||||
|
@ -2851,7 +2880,7 @@ typedef struct {
|
|||
} p;
|
||||
} cairo_xlib_glyph_t;
|
||||
|
||||
/* compile-time assert that cairo_xlib_glyph_t is the same size as cairo_glyph_t */
|
||||
/* compile-time assert that #cairo_xlib_glyph_t is the same size as #cairo_glyph_t */
|
||||
typedef int cairo_xlib_glyph_t_size_assertion [sizeof (cairo_xlib_glyph_t) == sizeof (cairo_glyph_t) ? 1 : -1];
|
||||
|
||||
#define GLYPH_INDEX_SKIP ((unsigned long) -1)
|
||||
|
|
|
@ -54,6 +54,9 @@ cairo_xlib_surface_create_with_xrender_format (Display *dpy,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
cairo_public XRenderPictFormat *
|
||||
cairo_xlib_surface_get_xrender_format (cairo_surface_t *surface);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#else /* CAIRO_HAS_XLIB_XRENDER_SURFACE */
|
||||
|
|
|
@ -63,11 +63,11 @@ static const cairo_t _cairo_nil = {
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
/* This has to be updated whenever cairo_status_t is extended. That's
|
||||
/* This has to be updated whenever #cairo_status_t is extended. That's
|
||||
* a bit of a pain, but it should be easy to always catch as long as
|
||||
* one adds a new test case to test a trigger of the new status value.
|
||||
*/
|
||||
#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_TEMP_FILE_ERROR
|
||||
#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_INVALID_STRIDE
|
||||
|
||||
/**
|
||||
* _cairo_error:
|
||||
|
@ -125,7 +125,7 @@ _cairo_set_error (cairo_t *cr, cairo_status_t status)
|
|||
* cairo_version:
|
||||
*
|
||||
* Returns the version of the cairo library encoded in a single
|
||||
* integer as per CAIRO_VERSION_ENCODE. The encoding ensures that
|
||||
* integer as per %CAIRO_VERSION_ENCODE. The encoding ensures that
|
||||
* later versions compare greater than earlier versions.
|
||||
*
|
||||
* A run-time comparison to check that cairo's version is greater than
|
||||
|
@ -172,7 +172,7 @@ slim_hidden_def (cairo_version_string);
|
|||
* default values and with @target as a target surface. The target
|
||||
* surface should be constructed with a backend-specific function such
|
||||
* as cairo_image_surface_create() (or any other
|
||||
* <literal>cairo_<backend>_surface_create</literal> variant).
|
||||
* cairo_<emphasis>backend</emphasis>_surface_create variant).
|
||||
*
|
||||
* This function references @target, so you can immediately
|
||||
* call cairo_surface_destroy() on it if you don't need to
|
||||
|
@ -461,7 +461,7 @@ slim_hidden_def(cairo_push_group);
|
|||
/**
|
||||
* cairo_push_group_with_content:
|
||||
* @cr: a cairo context
|
||||
* @content: a %cairo_content_t indicating the type of group that
|
||||
* @content: a %#cairo_content_t indicating the type of group that
|
||||
* will be created
|
||||
*
|
||||
* Temporarily redirects drawing to an intermediate surface known as a
|
||||
|
@ -605,7 +605,7 @@ slim_hidden_def(cairo_pop_group);
|
|||
* operations:
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* cairo_pattern_t *group = cairo_pop_group (cr);
|
||||
* #cairo_pattern_t *group = cairo_pop_group (cr);
|
||||
* cairo_set_source (cr, group);
|
||||
* cairo_pattern_destroy (group);
|
||||
* </programlisting></informalexample>
|
||||
|
@ -1021,7 +1021,7 @@ cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
|
|||
*
|
||||
* Each "on" segment will have caps applied as if the segment were a
|
||||
* separate sub-path. In particular, it is valid to use an "on" length
|
||||
* of 0.0 with CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE in order
|
||||
* of 0.0 with %CAIRO_LINE_CAP_ROUND or %CAIRO_LINE_CAP_SQUARE in order
|
||||
* to distributed dots or squares along a path.
|
||||
*
|
||||
* Note: The length values are in user-space units as evaluated at the
|
||||
|
@ -1035,8 +1035,8 @@ cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
|
|||
* @dashes.
|
||||
*
|
||||
* If any value in @dashes is negative, or if all values are 0, then
|
||||
* @cairo_t will be put into an error state with a status of
|
||||
* #CAIRO_STATUS_INVALID_DASH.
|
||||
* @cr will be put into an error state with a status of
|
||||
* #%CAIRO_STATUS_INVALID_DASH.
|
||||
**/
|
||||
void
|
||||
cairo_set_dash (cairo_t *cr,
|
||||
|
@ -1145,7 +1145,7 @@ cairo_set_miter_limit (cairo_t *cr, double limit)
|
|||
* Modifies the current transformation matrix (CTM) by translating the
|
||||
* user-space origin by (@tx, @ty). This offset is interpreted as a
|
||||
* user-space coordinate according to the CTM in place before the new
|
||||
* call to cairo_translate. In other words, the translation of the
|
||||
* call to cairo_translate(). In other words, the translation of the
|
||||
* user-space origin takes place after any existing transformation.
|
||||
**/
|
||||
void
|
||||
|
@ -1844,10 +1844,10 @@ cairo_stroke_to_path (cairo_t *cr)
|
|||
* the ends of the sub-path. Instead, there is a line join connecting
|
||||
* the final and initial segments of the sub-path.
|
||||
*
|
||||
* If there is no current point before the call to cairo_close_path,
|
||||
* If there is no current point before the call to cairo_close_path(),
|
||||
* this function will have no effect.
|
||||
*
|
||||
* Note: As of cairo version 1.2.4 any call to cairo_close_path will
|
||||
* Note: As of cairo version 1.2.4 any call to cairo_close_path() will
|
||||
* place an explicit MOVE_TO element into the path immediately after
|
||||
* the CLOSE_PATH element, (which can be seen in cairo_copy_path() for
|
||||
* example). This can simplify path processing in some cases as it may
|
||||
|
@ -1887,7 +1887,7 @@ slim_hidden_def(cairo_close_path);
|
|||
* the corresponding drawing operations.
|
||||
*
|
||||
* The result of cairo_path_extents() is defined as equivalent to the
|
||||
* limit of cairo_stroke_extents() with CAIRO_LINE_CAP_ROUND as the
|
||||
* limit of cairo_stroke_extents() with %CAIRO_LINE_CAP_ROUND as the
|
||||
* line width approaches 0.0, (but never reaching the empty-rectangle
|
||||
* returned by cairo_stroke_extents() for a line width of 0.0).
|
||||
*
|
||||
|
@ -1904,8 +1904,18 @@ void
|
|||
cairo_path_extents (cairo_t *cr,
|
||||
double *x1, double *y1, double *x2, double *y2)
|
||||
{
|
||||
if (cr->status)
|
||||
if (cr->status) {
|
||||
if (x1)
|
||||
*x1 = 0.0;
|
||||
if (y1)
|
||||
*y1 = 0.0;
|
||||
if (x2)
|
||||
*x2 = 0.0;
|
||||
if (y2)
|
||||
*y2 = 0.0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_cairo_gstate_path_extents (cr->gstate,
|
||||
cr->path,
|
||||
|
@ -2059,20 +2069,20 @@ cairo_mask_surface (cairo_t *cr,
|
|||
* situations:
|
||||
*
|
||||
* 1. Zero-length "on" segments set in cairo_set_dash(). If the cap
|
||||
* style is CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE then these
|
||||
* style is %CAIRO_LINE_CAP_ROUND or %CAIRO_LINE_CAP_SQUARE then these
|
||||
* segments will be drawn as circular dots or squares respectively. In
|
||||
* the case of CAIRO_LINE_CAP_SQUARE, the orientation of the squares
|
||||
* the case of %CAIRO_LINE_CAP_SQUARE, the orientation of the squares
|
||||
* is determined by the direction of the underlying path.
|
||||
*
|
||||
* 2. A sub-path created by cairo_move_to() followed by either a
|
||||
* cairo_close_path() or one or more calls to cairo_line_to() to the
|
||||
* same coordinate as the cairo_move_to(). If the cap style is
|
||||
* CAIRO_LINE_CAP_ROUND then these sub-paths will be drawn as circular
|
||||
* dots. Note that in the case of CAIRO_LINE_CAP_SQUARE a degenerate
|
||||
* dots. Note that in the case of %CAIRO_LINE_CAP_SQUARE a degenerate
|
||||
* sub-path will not be drawn at all, (since the correct orientation
|
||||
* is indeterminate).
|
||||
*
|
||||
* In no case will a cap style of CAIRO_LINE_CAP_BUTT cause anything
|
||||
* In no case will a cap style of %CAIRO_LINE_CAP_BUTT cause anything
|
||||
* to be drawn in the case of either degenerate segments or sub-paths.
|
||||
**/
|
||||
void
|
||||
|
@ -2089,7 +2099,7 @@ cairo_stroke (cairo_t *cr)
|
|||
*
|
||||
* A drawing operator that strokes the current path according to the
|
||||
* current line width, line join, line cap, and dash settings. Unlike
|
||||
* cairo_stroke(), cairo_stroke_preserve preserves the path within the
|
||||
* cairo_stroke(), cairo_stroke_preserve() preserves the path within the
|
||||
* cairo context.
|
||||
*
|
||||
* See cairo_set_line_width(), cairo_set_line_join(),
|
||||
|
@ -2116,7 +2126,7 @@ slim_hidden_def(cairo_stroke_preserve);
|
|||
*
|
||||
* A drawing operator that fills the current path according to the
|
||||
* current fill rule, (each sub-path is implicitly closed before being
|
||||
* filled). After cairo_fill, the current path will be cleared from
|
||||
* filled). After cairo_fill(), the current path will be cleared from
|
||||
* the cairo context. See cairo_set_fill_rule() and
|
||||
* cairo_fill_preserve().
|
||||
**/
|
||||
|
@ -2134,7 +2144,7 @@ cairo_fill (cairo_t *cr)
|
|||
*
|
||||
* A drawing operator that fills the current path according to the
|
||||
* current fill rule, (each sub-path is implicitly closed before being
|
||||
* filled). Unlike cairo_fill(), cairo_fill_preserve preserves the
|
||||
* filled). Unlike cairo_fill(), cairo_fill_preserve() preserves the
|
||||
* path within the cairo context.
|
||||
*
|
||||
* See cairo_set_fill_rule() and cairo_fill().
|
||||
|
@ -2301,8 +2311,18 @@ cairo_stroke_extents (cairo_t *cr,
|
|||
{
|
||||
cairo_status_t status;
|
||||
|
||||
if (cr->status)
|
||||
if (cr->status) {
|
||||
if (x1)
|
||||
*x1 = 0.0;
|
||||
if (y1)
|
||||
*y1 = 0.0;
|
||||
if (x2)
|
||||
*x2 = 0.0;
|
||||
if (y2)
|
||||
*y2 = 0.0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
status = _cairo_gstate_stroke_extents (cr->gstate,
|
||||
cr->path,
|
||||
|
@ -2337,8 +2357,18 @@ cairo_fill_extents (cairo_t *cr,
|
|||
{
|
||||
cairo_status_t status;
|
||||
|
||||
if (cr->status)
|
||||
if (cr->status) {
|
||||
if (x1)
|
||||
*x1 = 0.0;
|
||||
if (y1)
|
||||
*y1 = 0.0;
|
||||
if (x2)
|
||||
*x2 = 0.0;
|
||||
if (y2)
|
||||
*y2 = 0.0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
status = _cairo_gstate_fill_extents (cr->gstate,
|
||||
cr->path,
|
||||
|
@ -2355,7 +2385,7 @@ cairo_fill_extents (cairo_t *cr,
|
|||
* region with the current path as it would be filled by cairo_fill()
|
||||
* and according to the current fill rule (see cairo_set_fill_rule()).
|
||||
*
|
||||
* After cairo_clip, the current path will be cleared from the cairo
|
||||
* After cairo_clip(), the current path will be cleared from the cairo
|
||||
* context.
|
||||
*
|
||||
* The current clip region affects all drawing operations by
|
||||
|
@ -2385,7 +2415,7 @@ cairo_clip (cairo_t *cr)
|
|||
* region with the current path as it would be filled by cairo_fill()
|
||||
* and according to the current fill rule (see cairo_set_fill_rule()).
|
||||
*
|
||||
* Unlike cairo_clip(), cairo_clip_preserve preserves the path within
|
||||
* Unlike cairo_clip(), cairo_clip_preserve() preserves the path within
|
||||
* the cairo context.
|
||||
*
|
||||
* The current clip region affects all drawing operations by
|
||||
|
@ -2462,8 +2492,18 @@ cairo_clip_extents (cairo_t *cr,
|
|||
{
|
||||
cairo_status_t status;
|
||||
|
||||
if (cr->status)
|
||||
if (cr->status) {
|
||||
if (x1)
|
||||
*x1 = 0.0;
|
||||
if (y1)
|
||||
*y1 = 0.0;
|
||||
if (x2)
|
||||
*x2 = 0.0;
|
||||
if (y2)
|
||||
*y2 = 0.0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
status = _cairo_gstate_clip_extents (cr->gstate, x1, y1, x2, y2);
|
||||
if (status)
|
||||
|
@ -2497,15 +2537,13 @@ _cairo_rectangle_list_create_in_error (cairo_status_t status)
|
|||
* Gets the current clip region as a list of rectangles in user coordinates.
|
||||
* Never returns %NULL.
|
||||
*
|
||||
* The status in the list may be CAIRO_STATUS_CLIP_NOT_REPRESENTABLE to
|
||||
* The status in the list may be %CAIRO_STATUS_CLIP_NOT_REPRESENTABLE to
|
||||
* indicate that the clip region cannot be represented as a list of
|
||||
* user-space rectangles. The status may have other values to indicate
|
||||
* other errors.
|
||||
*
|
||||
* The caller must always call cairo_rectangle_list_destroy on the result of
|
||||
* this function.
|
||||
*
|
||||
* Returns: the current clip region as a list of rectangles in user coordinates.
|
||||
* Returns: the current clip region as a list of rectangles in user coordinates,
|
||||
* which should be destroyed using cairo_rectangle_list_destroy().
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
|
@ -2563,6 +2601,12 @@ cairo_font_extents (cairo_t *cr,
|
|||
{
|
||||
cairo_status_t status;
|
||||
|
||||
extents->ascent = 0.0;
|
||||
extents->descent = 0.0;
|
||||
extents->height = 0.0;
|
||||
extents->max_x_advance = 0.0;
|
||||
extents->max_y_advance = 0.0;
|
||||
|
||||
if (cr->status)
|
||||
return;
|
||||
|
||||
|
@ -2610,7 +2654,7 @@ cairo_set_font_face (cairo_t *cr,
|
|||
* this nil object will cause its error state to propagate to other
|
||||
* objects it is passed to, (for example, calling
|
||||
* cairo_set_font_face() with a nil font will trigger an error that
|
||||
* will shutdown the cairo_t object).
|
||||
* will shutdown the #cairo_t object).
|
||||
**/
|
||||
cairo_font_face_t *
|
||||
cairo_get_font_face (cairo_t *cr)
|
||||
|
@ -2816,7 +2860,7 @@ BAIL:
|
|||
* this nil object will cause its error state to propagate to other
|
||||
* objects it is passed to, (for example, calling
|
||||
* cairo_set_scaled_font() with a nil font will trigger an error that
|
||||
* will shutdown the cairo_t object).
|
||||
* will shutdown the #cairo_t object).
|
||||
*
|
||||
* Since: 1.4
|
||||
**/
|
||||
|
@ -2961,7 +3005,7 @@ cairo_glyph_extents (cairo_t *cr,
|
|||
* by its advance values. This allows for easy display of a single
|
||||
* logical string with multiple calls to cairo_show_text().
|
||||
*
|
||||
* NOTE: The cairo_show_text() function call is part of what the cairo
|
||||
* Note: The cairo_show_text() function call is part of what the cairo
|
||||
* designers call the "toy" text API. It is convenient for short demos
|
||||
* and simple programs, but it is not expected to be adequate for
|
||||
* serious text-using applications. See cairo_show_glyphs() for the
|
||||
|
@ -3060,7 +3104,7 @@ cairo_show_glyphs (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs)
|
|||
* This allows for chaining multiple calls to to cairo_text_path()
|
||||
* without having to set current point in between.
|
||||
*
|
||||
* NOTE: The cairo_text_path() function call is part of what the cairo
|
||||
* Note: The cairo_text_path() function call is part of what the cairo
|
||||
* designers call the "toy" text API. It is convenient for short demos
|
||||
* and simple programs, but it is not expected to be adequate for
|
||||
* serious text-using applications. See cairo_glyph_path() for the
|
||||
|
@ -3200,6 +3244,26 @@ cairo_get_antialias (cairo_t *cr)
|
|||
return _cairo_gstate_get_antialias (cr->gstate);
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_has_current_point:
|
||||
* @cr: a cairo context
|
||||
*
|
||||
* Returns whether a current point is defined on the current path.
|
||||
* See cairo_get_current_point() for details on the current point.
|
||||
*
|
||||
* Return value: whether a current point is defined.
|
||||
*
|
||||
* Since: 1.6
|
||||
**/
|
||||
cairo_bool_t
|
||||
cairo_has_current_point (cairo_t *cr)
|
||||
{
|
||||
if (cr->status)
|
||||
return FALSE;
|
||||
|
||||
return cr->path->has_current_point;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_get_current_point:
|
||||
* @cr: a cairo context
|
||||
|
@ -3210,8 +3274,9 @@ cairo_get_antialias (cairo_t *cr)
|
|||
* conceptually the final point reached by the path so far.
|
||||
*
|
||||
* The current point is returned in the user-space coordinate
|
||||
* system. If there is no defined current point then @x and @y will
|
||||
* both be set to 0.0.
|
||||
* system. If there is no defined current point or if @cr is in an
|
||||
* error status, @x and @y will both be set to 0.0. It is possible to
|
||||
* check this in advance with cairo_has_current_point().
|
||||
*
|
||||
* Most path construction functions alter the current point. See the
|
||||
* following for details on how they affect the current point:
|
||||
|
@ -3425,7 +3490,7 @@ cairo_get_group_target (cairo_t *cr)
|
|||
* over the returned data structure.
|
||||
*
|
||||
* This function will always return a valid pointer, but the result
|
||||
* will have no data (<literal>data==NULL</literal> and
|
||||
* will have no data (<literal>data==%NULL</literal> and
|
||||
* <literal>num_data==0</literal>), if either of the following
|
||||
* conditions hold:
|
||||
*
|
||||
|
@ -3471,7 +3536,7 @@ cairo_copy_path (cairo_t *cr)
|
|||
* series of %CAIRO_PATH_LINE_TO elements.
|
||||
*
|
||||
* This function will always return a valid pointer, but the result
|
||||
* will have no data (<literal>data==NULL</literal> and
|
||||
* will have no data (<literal>data==%NULL</literal> and
|
||||
* <literal>num_data==0</literal>), if either of the following
|
||||
* conditions hold:
|
||||
*
|
||||
|
@ -3551,7 +3616,7 @@ cairo_append_path (cairo_t *cr,
|
|||
*
|
||||
* Checks whether an error has previously occurred for this context.
|
||||
*
|
||||
* Returns the current status of this context, see #cairo_status_t
|
||||
* Returns: the current status of this context, see #cairo_status_t
|
||||
**/
|
||||
cairo_status_t
|
||||
cairo_status (cairo_t *cr)
|
||||
|
@ -3566,7 +3631,7 @@ slim_hidden_def (cairo_status);
|
|||
*
|
||||
* Provides a human-readable description of a #cairo_status_t.
|
||||
*
|
||||
* Returns a string representation of the status
|
||||
* Returns: a string representation of the status
|
||||
*/
|
||||
const char *
|
||||
cairo_status_to_string (cairo_status_t status)
|
||||
|
@ -3620,6 +3685,8 @@ cairo_status_to_string (cairo_status_t status)
|
|||
return "clip region not representable in desired format";
|
||||
case CAIRO_STATUS_TEMP_FILE_ERROR:
|
||||
return "error creating or writing to a temporary file";
|
||||
case CAIRO_STATUS_INVALID_STRIDE:
|
||||
return "invalid value for stride";
|
||||
}
|
||||
|
||||
return "<unknown error status>";
|
||||
|
|
|
@ -140,9 +140,9 @@ typedef struct _cairo_matrix {
|
|||
* cairo_pattern_create_rgb() creates a pattern for a solid
|
||||
* opaque color.
|
||||
*
|
||||
* Other than various cairo_pattern_create_<emphasis>type</emphasis>
|
||||
* Other than various cairo_pattern_create_<emphasis>type</emphasis>()
|
||||
* functions, some of the pattern types can be implicitly created
|
||||
* using vairous cairo_set_source_<emphasis>type</emphasis> functions;
|
||||
* using various cairo_set_source_<emphasis>type</emphasis>() functions;
|
||||
* for example cairo_set_source_rgb().
|
||||
*
|
||||
* The type of a pattern can be queried with cairo_pattern_get_type().
|
||||
|
@ -177,15 +177,15 @@ typedef struct _cairo_user_data_key {
|
|||
} cairo_user_data_key_t;
|
||||
|
||||
/**
|
||||
* cairo_status_t
|
||||
* cairo_status_t:
|
||||
* @CAIRO_STATUS_SUCCESS: no error has occurred
|
||||
* @CAIRO_STATUS_NO_MEMORY: out of memory
|
||||
* @CAIRO_STATUS_INVALID_RESTORE: cairo_restore without matching cairo_save
|
||||
* @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save()
|
||||
* @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop
|
||||
* @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined
|
||||
* @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible)
|
||||
* @CAIRO_STATUS_INVALID_STATUS: invalid value for an input cairo_status_t
|
||||
* @CAIRO_STATUS_NULL_POINTER: NULL pointer
|
||||
* @CAIRO_STATUS_INVALID_STATUS: invalid value for an input #cairo_status_t
|
||||
* @CAIRO_STATUS_NULL_POINTER: %NULL pointer
|
||||
* @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8
|
||||
* @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid
|
||||
* @CAIRO_STATUS_READ_ERROR: error while reading from input stream
|
||||
|
@ -193,8 +193,8 @@ typedef struct _cairo_user_data_key {
|
|||
* @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished
|
||||
* @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation
|
||||
* @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation
|
||||
* @CAIRO_STATUS_INVALID_CONTENT: invalid value for an input cairo_content_t
|
||||
* @CAIRO_STATUS_INVALID_FORMAT: invalid value for an input cairo_format_t
|
||||
* @CAIRO_STATUS_INVALID_CONTENT: invalid value for an input #cairo_content_t
|
||||
* @CAIRO_STATUS_INVALID_FORMAT: invalid value for an input #cairo_format_t
|
||||
* @CAIRO_STATUS_INVALID_VISUAL: invalid value for an input Visual*
|
||||
* @CAIRO_STATUS_FILE_NOT_FOUND: file not found
|
||||
* @CAIRO_STATUS_INVALID_DASH: invalid value for a dash setting
|
||||
|
@ -202,6 +202,7 @@ typedef struct _cairo_user_data_key {
|
|||
* @CAIRO_STATUS_INVALID_INDEX: invalid index passed to getter (Since 1.4)
|
||||
* @CAIRO_STATUS_CLIP_NOT_REPRESENTABLE: clip region not representable in desired format (Since 1.4)
|
||||
* @CAIRO_STATUS_TEMP_FILE_ERROR: error creating or writing to a temporary file (Since 1.6)
|
||||
* @CAIRO_STATUS_INVALID_STRIDE: invalid value for stride (Since 1.6)
|
||||
*
|
||||
* #cairo_status_t is used to indicate errors that can occur when
|
||||
* using Cairo. In some cases it is returned directly by functions.
|
||||
|
@ -235,12 +236,13 @@ typedef enum _cairo_status {
|
|||
CAIRO_STATUS_INVALID_DSC_COMMENT,
|
||||
CAIRO_STATUS_INVALID_INDEX,
|
||||
CAIRO_STATUS_CLIP_NOT_REPRESENTABLE,
|
||||
CAIRO_STATUS_TEMP_FILE_ERROR
|
||||
CAIRO_STATUS_TEMP_FILE_ERROR,
|
||||
CAIRO_STATUS_INVALID_STRIDE
|
||||
/* after adding a new error: update CAIRO_STATUS_LAST_STATUS in cairo.c */
|
||||
} cairo_status_t;
|
||||
|
||||
/**
|
||||
* cairo_content_t
|
||||
* cairo_content_t:
|
||||
* @CAIRO_CONTENT_COLOR: The surface will hold color content only.
|
||||
* @CAIRO_CONTENT_ALPHA: The surface will hold alpha content only.
|
||||
* @CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha content.
|
||||
|
@ -249,8 +251,8 @@ typedef enum _cairo_status {
|
|||
* contain, whether color information, alpha information (translucence
|
||||
* vs. opacity), or both.
|
||||
*
|
||||
* Note: The large values here are designed to keep cairo_content_t
|
||||
* values distinct from cairo_format_t values so that the
|
||||
* Note: The large values here are designed to keep #cairo_content_t
|
||||
* values distinct from #cairo_format_t values so that the
|
||||
* implementation can detect the error if users confuse the two types.
|
||||
**/
|
||||
typedef enum _cairo_content {
|
||||
|
@ -286,7 +288,7 @@ typedef cairo_status_t (*cairo_write_func_t) (void *closure,
|
|||
* @length: the amount of data to read
|
||||
*
|
||||
* #cairo_read_func_t is the type of function which is called when a
|
||||
* backend needs to read data from an intput stream. It is passed the
|
||||
* backend needs to read data from an input stream. It is passed the
|
||||
* closure which was specified by the user at the time the read
|
||||
* function was registered, the buffer to read the data into and the
|
||||
* length of the data in bytes. The read function should return
|
||||
|
@ -342,6 +344,48 @@ cairo_pop_group_to_source (cairo_t *cr);
|
|||
|
||||
/* Modify state */
|
||||
|
||||
/**
|
||||
* cairo_operator_t:
|
||||
* @CAIRO_OPERATOR_CLEAR: clear destination layer (bounded)
|
||||
* @CAIRO_OPERATOR_SOURCE: replace destination layer (bounded)
|
||||
* @CAIRO_OPERATOR_OVER: draw source layer on top of destination layer
|
||||
* (bounded)
|
||||
* @CAIRO_OPERATOR_IN: draw source where there was destination content
|
||||
* (unbounded)
|
||||
* @CAIRO_OPERATOR_OUT: draw source where there was no destination
|
||||
* content (unbounded)
|
||||
* @CAIRO_OPERATOR_ATOP: draw source on top of destination content and
|
||||
* only there
|
||||
* @CAIRO_OPERATOR_DEST: ignore the source
|
||||
* @CAIRO_OPERATOR_DEST_OVER: draw destination on top of source
|
||||
* @CAIRO_OPERATOR_DEST_IN: leave destination only where there was
|
||||
* source content (unbounded)
|
||||
* @CAIRO_OPERATOR_DEST_OUT: leave destination only where there was no
|
||||
* source content
|
||||
* @CAIRO_OPERATOR_DEST_ATOP: leave destination on top of source content
|
||||
* and only there (unbounded)
|
||||
* @CAIRO_OPERATOR_XOR: source and destination are shown where there is only
|
||||
* one of them
|
||||
* @CAIRO_OPERATOR_ADD: source and destination layers are accumulated
|
||||
* @CAIRO_OPERATOR_SATURATE: like over, but assuming source and dest are
|
||||
* disjoint geometries
|
||||
*
|
||||
* #cairo_operator_t is used to set the compositing operator for all cairo
|
||||
* drawing operations.
|
||||
*
|
||||
* The operators marked as <firstterm>unbounded</firstterm> modify their
|
||||
* destination even outside of the mask layer (that is, their effect is not
|
||||
* bound by the mask layer). However, their effect can still be limited by
|
||||
* way of clipping.
|
||||
*
|
||||
* To keep things simple, the operator descriptions here
|
||||
* document the behavior for when both source and destination are either fully
|
||||
* transparent or fully opaque. The actual implementation works for
|
||||
* translucent layers too.
|
||||
* For a more detailed explanation of the effects of each operator, including
|
||||
* the mathematical definitions, see
|
||||
* <ulink url="http://cairographics.org/operators/">http://cairographics.org/operators/</ulink>.
|
||||
**/
|
||||
typedef enum _cairo_operator {
|
||||
CAIRO_OPERATOR_CLEAR,
|
||||
|
||||
|
@ -409,7 +453,7 @@ cairo_public void
|
|||
cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
|
||||
|
||||
/**
|
||||
* cairo_fill_rule_t
|
||||
* cairo_fill_rule_t:
|
||||
* @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from
|
||||
* left-to-right, counts +1. If the path crosses the ray
|
||||
* from right to left, counts -1. (Left and right are determined
|
||||
|
@ -443,7 +487,7 @@ cairo_public void
|
|||
cairo_set_line_width (cairo_t *cr, double width);
|
||||
|
||||
/**
|
||||
* cairo_line_cap_t
|
||||
* cairo_line_cap_t:
|
||||
* @CAIRO_LINE_CAP_BUTT: start(stop) the line exactly at the start(end) point
|
||||
* @CAIRO_LINE_CAP_ROUND: use a round ending, the center of the circle is the end point
|
||||
* @CAIRO_LINE_CAP_SQUARE: use squared ending, the center of the square is the end point
|
||||
|
@ -460,7 +504,7 @@ cairo_public void
|
|||
cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
|
||||
|
||||
/**
|
||||
* cairo_line_join_t
|
||||
* cairo_line_join_t:
|
||||
* @CAIRO_LINE_JOIN_MITER: use a sharp (angled) corner, see
|
||||
* cairo_set_miter_limit()
|
||||
* @CAIRO_LINE_JOIN_ROUND: use a rounded join, the center of the circle is the
|
||||
|
@ -702,7 +746,7 @@ cairo_rectangle_list_destroy (cairo_rectangle_list_t *rectangle_list);
|
|||
* cairo_scaled_font_t:
|
||||
*
|
||||
* A #cairo_scaled_font_t is a font scaled to a particular size and device
|
||||
* resolution. A cairo_scaled_font_t is most useful for low-level font
|
||||
* resolution. A #cairo_scaled_font_t is most useful for low-level font
|
||||
* usage where a library or application wants to cache a reference
|
||||
* to a scaled font to speed up the computation of metrics.
|
||||
*
|
||||
|
@ -1100,7 +1144,7 @@ cairo_public cairo_status_t
|
|||
cairo_font_face_status (cairo_font_face_t *font_face);
|
||||
|
||||
/**
|
||||
* cairo_font_type_t
|
||||
* cairo_font_type_t:
|
||||
* @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api
|
||||
* @CAIRO_FONT_TYPE_FT: The font is of type FreeType
|
||||
* @CAIRO_FONT_TYPE_WIN32: The font is of type Win32
|
||||
|
@ -1115,18 +1159,18 @@ cairo_font_face_status (cairo_font_face_t *font_face);
|
|||
* cairo_<emphasis>type</emphasis>_font_face_create. The font face type can be queried
|
||||
* with cairo_font_face_get_type()
|
||||
*
|
||||
* The various cairo_font_face functions can be used with a font face
|
||||
* The various #cairo_font_face_t functions can be used with a font face
|
||||
* of any type.
|
||||
*
|
||||
* The type of a scaled font is determined by the type of the font
|
||||
* face passed to cairo_scaled_font_create. The scaled font type can
|
||||
* face passed to cairo_scaled_font_create(). The scaled font type can
|
||||
* be queried with cairo_scaled_font_get_type()
|
||||
*
|
||||
* The various cairo_scaled_font functions can be used with scaled
|
||||
* The various #cairo_scaled_font_t functions can be used with scaled
|
||||
* fonts of any type, but some font backends also provide
|
||||
* type-specific functions that must only be called with a scaled font
|
||||
* of the appropriate type. These functions have names that begin with
|
||||
* cairo_<emphasis>type</emphasis>_scaled_font such as cairo_ft_scaled_font_lock_face.
|
||||
* cairo_<emphasis>type</emphasis>_scaled_font such as cairo_ft_scaled_font_lock_face().
|
||||
*
|
||||
* The behavior of calling a type-specific function with a scaled font
|
||||
* of the wrong type is undefined.
|
||||
|
@ -1232,6 +1276,9 @@ cairo_get_tolerance (cairo_t *cr);
|
|||
cairo_public cairo_antialias_t
|
||||
cairo_get_antialias (cairo_t *cr);
|
||||
|
||||
cairo_public cairo_bool_t
|
||||
cairo_has_current_point (cairo_t *cr);
|
||||
|
||||
cairo_public void
|
||||
cairo_get_current_point (cairo_t *cr, double *x, double *y);
|
||||
|
||||
|
@ -1314,26 +1361,26 @@ typedef enum _cairo_path_data_type {
|
|||
*
|
||||
* <informalexample><programlisting>
|
||||
* int i;
|
||||
* cairo_path_t *path;
|
||||
* cairo_path_data_t *data;
|
||||
* #cairo_path_t *path;
|
||||
* #cairo_path_data_t *data;
|
||||
*
|
||||
* path = cairo_copy_path (cr);
|
||||
*
|
||||
* for (i=0; i < path->num_data; i += path->data[i].header.length) {
|
||||
* data = &path->data[i];
|
||||
* switch (data->header.type) {
|
||||
* case CAIRO_PATH_MOVE_TO:
|
||||
* case %CAIRO_PATH_MOVE_TO:
|
||||
* do_move_to_things (data[1].point.x, data[1].point.y);
|
||||
* break;
|
||||
* case CAIRO_PATH_LINE_TO:
|
||||
* case %CAIRO_PATH_LINE_TO:
|
||||
* do_line_to_things (data[1].point.x, data[1].point.y);
|
||||
* break;
|
||||
* case CAIRO_PATH_CURVE_TO:
|
||||
* case %CAIRO_PATH_CURVE_TO:
|
||||
* do_curve_to_things (data[1].point.x, data[1].point.y,
|
||||
* data[2].point.x, data[2].point.y,
|
||||
* data[3].point.x, data[3].point.y);
|
||||
* break;
|
||||
* case CAIRO_PATH_CLOSE_PATH:
|
||||
* case %CAIRO_PATH_CLOSE_PATH:
|
||||
* do_close_path_things ();
|
||||
* break;
|
||||
* }
|
||||
|
@ -1430,7 +1477,7 @@ cairo_public cairo_status_t
|
|||
cairo_surface_status (cairo_surface_t *surface);
|
||||
|
||||
/**
|
||||
* cairo_surface_type_t
|
||||
* cairo_surface_type_t:
|
||||
* @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image
|
||||
* @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf
|
||||
* @CAIRO_SURFACE_TYPE_PS: The surface is of type ps
|
||||
|
@ -1450,12 +1497,12 @@ cairo_surface_status (cairo_surface_t *surface);
|
|||
* backends" within cairo.
|
||||
*
|
||||
* The type of a surface is determined by the function used to create
|
||||
* it, which will generally be of the form cairo_<emphasis>type</emphasis>_surface_create,
|
||||
* (though see cairo_surface_create_similar as well).
|
||||
* it, which will generally be of the form cairo_<emphasis>type</emphasis>_surface_create(),
|
||||
* (though see cairo_surface_create_similar() as well).
|
||||
*
|
||||
* The surface type can be queried with cairo_surface_get_type()
|
||||
*
|
||||
* The various cairo_surface functions can be used with surfaces of
|
||||
* The various #cairo_surface_t functions can be used with surfaces of
|
||||
* any type, but some backends also provide type-specific functions
|
||||
* that must only be called with a surface of the appropriate
|
||||
* type. These functions have names that begin with
|
||||
|
@ -1546,16 +1593,16 @@ cairo_surface_set_fallback_resolution (cairo_surface_t *surface,
|
|||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch);
|
||||
|
||||
cairo_public cairo_status_t
|
||||
cairo_public void
|
||||
cairo_surface_copy_page (cairo_surface_t *surface);
|
||||
|
||||
cairo_public cairo_status_t
|
||||
cairo_public void
|
||||
cairo_surface_show_page (cairo_surface_t *surface);
|
||||
|
||||
/* Image-surface functions */
|
||||
|
||||
/**
|
||||
* cairo_format_t
|
||||
* cairo_format_t:
|
||||
* @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
|
||||
* alpha in the upper 8 bits, then red, then green, then blue.
|
||||
* The 32-bit quantities are stored native-endian. Pre-multiplied
|
||||
|
@ -1597,6 +1644,10 @@ cairo_image_surface_create (cairo_format_t format,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
cairo_public int
|
||||
cairo_format_stride_for_width (cairo_format_t format,
|
||||
int width);
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_image_surface_create_for_data (unsigned char *data,
|
||||
cairo_format_t format,
|
||||
|
@ -1673,7 +1724,7 @@ cairo_pattern_set_user_data (cairo_pattern_t *pattern,
|
|||
cairo_destroy_func_t destroy);
|
||||
|
||||
/**
|
||||
* cairo_pattern_type_t
|
||||
* cairo_pattern_type_t:
|
||||
* @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
|
||||
* color. It may be opaque or translucent.
|
||||
* @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image).
|
||||
|
@ -1690,7 +1741,7 @@ cairo_pattern_set_user_data (cairo_pattern_t *pattern,
|
|||
*
|
||||
* The pattern type can be queried with cairo_pattern_get_type()
|
||||
*
|
||||
* Most cairo_pattern functions can be called with a pattern of any
|
||||
* Most #cairo_pattern_t functions can be called with a pattern of any
|
||||
* type, (though trying to change the extend or filter for a solid
|
||||
* pattern will have no effect). A notable exception is
|
||||
* cairo_pattern_add_color_stop_rgb() and
|
||||
|
@ -1732,7 +1783,7 @@ cairo_pattern_get_matrix (cairo_pattern_t *pattern,
|
|||
cairo_matrix_t *matrix);
|
||||
|
||||
/**
|
||||
* cairo_extend_t
|
||||
* cairo_extend_t:
|
||||
* @CAIRO_EXTEND_NONE: pixels outside of the source pattern
|
||||
* are fully transparent
|
||||
* @CAIRO_EXTEND_REPEAT: the pattern is tiled by repeating
|
||||
|
@ -1760,6 +1811,24 @@ cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
|
|||
cairo_public cairo_extend_t
|
||||
cairo_pattern_get_extend (cairo_pattern_t *pattern);
|
||||
|
||||
/**
|
||||
* cairo_filter_t:
|
||||
* @CAIRO_FILTER_FAST: A high-performance filter, with quality similar
|
||||
* to %CAIRO_FILTER_NEAREST
|
||||
* @CAIRO_FILTER_GOOD: A reasonable-performance filter, with quality
|
||||
* similar to %CAIRO_FILTER_BILINEAR
|
||||
* @CAIRO_FILTER_BEST: The highest-quality available, performance may
|
||||
* not be suitable for interactive use.
|
||||
* @CAIRO_FILTER_NEAREST: Nearest-neighbor filtering
|
||||
* @CAIRO_FILTER_BILINEAR: Linear interpolation in two dimensions
|
||||
* @CAIRO_FILTER_GAUSSIAN: This filter value is currently
|
||||
* unimplemented, and should not be used in current code.
|
||||
*
|
||||
* #cairo_filter_t is used to indicate what filtering should be
|
||||
* applied when reading pixel values from patterns. See
|
||||
* cairo_pattern_set_source() for indicating the desired filter to be
|
||||
* used with a particular pattern.
|
||||
*/
|
||||
typedef enum _cairo_filter {
|
||||
CAIRO_FILTER_FAST,
|
||||
CAIRO_FILTER_GOOD,
|
||||
|
|
|
@ -105,6 +105,10 @@ _cairo_win32_tmpfile (void);
|
|||
#define M_SQRT2 1.41421356237309504880
|
||||
#endif
|
||||
|
||||
#ifndef M_SQRT1_2
|
||||
#define M_SQRT1_2 0.707106781186547524400844362104849039
|
||||
#endif
|
||||
|
||||
#undef ARRAY_LENGTH
|
||||
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
|
||||
|
||||
|
@ -186,6 +190,12 @@ _cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_int_t *rectangl
|
|||
cairo_private void
|
||||
_cairo_rectangle_intersect (cairo_rectangle_int_t *dest, cairo_rectangle_int_t *src);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point);
|
||||
|
||||
/* cairo_array.c structures and functions */
|
||||
|
||||
cairo_private void
|
||||
|
@ -251,7 +261,7 @@ _cairo_hash_string (const char *c);
|
|||
typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t;
|
||||
|
||||
/*
|
||||
* A cairo_unscaled_font_t is just an opaque handle we use in the
|
||||
* A #cairo_unscaled_font_t is just an opaque handle we use in the
|
||||
* glyph cache.
|
||||
*/
|
||||
typedef struct _cairo_unscaled_font {
|
||||
|
@ -298,7 +308,7 @@ struct _cairo_unscaled_font_backend {
|
|||
void (*destroy) (void *unscaled_font);
|
||||
};
|
||||
|
||||
/* cairo_toy_font_face_t - simple family/slant/weight font faces used for
|
||||
/* #cairo_toy_font_face_t - simple family/slant/weight font faces used for
|
||||
* the built-in font API
|
||||
*/
|
||||
|
||||
|
@ -708,7 +718,7 @@ struct _cairo_image_surface {
|
|||
|
||||
extern const cairo_private cairo_surface_backend_t cairo_image_surface_backend;
|
||||
|
||||
/* XXX: Right now, the cairo_color structure puts unpremultiplied
|
||||
/* XXX: Right now, the _cairo_color structure puts unpremultiplied
|
||||
color in the doubles and premultiplied color in the shorts. Yes,
|
||||
this is crazy insane, (but at least we don't export this
|
||||
madness). I'm still working on a cleaner API, but in the meantime,
|
||||
|
@ -1402,7 +1412,7 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
|
|||
const cairo_font_options_t *options,
|
||||
const cairo_scaled_font_backend_t *backend);
|
||||
|
||||
cairo_private void
|
||||
cairo_private cairo_status_t
|
||||
_cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
|
||||
cairo_font_extents_t *fs_metrics);
|
||||
|
||||
|
@ -1483,6 +1493,11 @@ _cairo_stroke_style_init_copy (cairo_stroke_style_t *style,
|
|||
cairo_private void
|
||||
_cairo_stroke_style_fini (cairo_stroke_style_t *style);
|
||||
|
||||
cairo_private void
|
||||
_cairo_stroke_style_max_distance_from_path (const cairo_stroke_style_t *style,
|
||||
const cairo_matrix_t *ctm,
|
||||
double *dx, double *dy);
|
||||
|
||||
/* cairo-surface.c */
|
||||
|
||||
cairo_private cairo_surface_t *
|
||||
|
@ -1763,24 +1778,24 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface);
|
|||
|
||||
/* cairo_image_surface.c */
|
||||
|
||||
/* XXX: In cairo 1.2.0 we added a new CAIRO_FORMAT_RGB16_565 but
|
||||
/* XXX: In cairo 1.2.0 we added a new %CAIRO_FORMAT_RGB16_565 but
|
||||
* neglected to adjust this macro. The net effect is that it's
|
||||
* impossible to externally create an image surface with this
|
||||
* format. This is perhaps a good thing since we also neglected to fix
|
||||
* up things like cairo_surface_write_to_png for the new format
|
||||
* up things like cairo_surface_write_to_png() for the new format
|
||||
* (-Wswitch-enum will tell you where). Is it obvious that format was
|
||||
* added in haste?
|
||||
*
|
||||
* The reason for the new format was to allow the xlib backend to be
|
||||
* used on X servers with a 565 visual. So the new format did its job
|
||||
* for that, even without being considered "valid" for the sake of
|
||||
* things like cairo_image_surface_create.
|
||||
* things like cairo_image_surface_create().
|
||||
*
|
||||
* Since 1.2.0 we ran into the same situtation with X servers with BGR
|
||||
* visuals. This time we invented cairo_internal_format_t instead,
|
||||
* visuals. This time we invented #cairo_internal_format_t instead,
|
||||
* (see it for more discussion).
|
||||
*
|
||||
* The punchline is that CAIRO_FORMAT_VALID must not conside any
|
||||
* The punchline is that %CAIRO_FORMAT_VALID must not conside any
|
||||
* internal format to be valid. Also we need to decide if the
|
||||
* RGB16_565 should be moved to instead be an internal format. If so,
|
||||
* this macro need not change for it. (We probably will need to leave
|
||||
|
@ -1788,9 +1803,9 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface);
|
|||
* might have that value in it.)
|
||||
*
|
||||
* If we do decide to start fully supporting RGB16_565 as an external
|
||||
* format, then CAIRO_FORMAT_VALID needs to be adjusted to include
|
||||
* format, then %CAIRO_FORMAT_VALID needs to be adjusted to include
|
||||
* it. But that should not happen before all necessary code is fixed
|
||||
* to support it (at least cairo_surface_write_to_png and a few spots
|
||||
* to support it (at least cairo_surface_write_to_png() and a few spots
|
||||
* in cairo-xlib-surface.c--again see -Wswitch-enum).
|
||||
*/
|
||||
#define CAIRO_FORMAT_INVALID ((unsigned int) -1)
|
||||
|
@ -1802,8 +1817,8 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface);
|
|||
CAIRO_CONTENT_COLOR_ALPHA))\
|
||||
== 0))
|
||||
|
||||
cairo_private cairo_format_t
|
||||
_cairo_format_width (cairo_format_t format);
|
||||
cairo_private int
|
||||
_cairo_format_bits_per_pixel (cairo_format_t format);
|
||||
|
||||
cairo_private cairo_format_t
|
||||
_cairo_format_from_content (cairo_content_t content);
|
||||
|
@ -1818,7 +1833,7 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
|
|||
cairo_private pixman_format_code_t
|
||||
_pixman_format_from_masks (cairo_format_masks_t *masks);
|
||||
|
||||
void
|
||||
cairo_private void
|
||||
_pixman_format_to_masks (pixman_format_code_t pixman_format,
|
||||
uint32_t *bpp,
|
||||
uint32_t *red,
|
||||
|
@ -1974,7 +1989,7 @@ _cairo_matrix_is_invertible (const cairo_matrix_t *matrix);
|
|||
cairo_private void
|
||||
_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix, double *det);
|
||||
|
||||
cairo_private void
|
||||
cairo_private cairo_status_t
|
||||
_cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
|
||||
double *sx, double *sy, int x_major);
|
||||
|
||||
|
@ -2003,6 +2018,10 @@ cairo_private void
|
|||
_cairo_traps_limit (cairo_traps_t *traps,
|
||||
cairo_box_t *limits);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_traps_get_limit (cairo_traps_t *traps,
|
||||
cairo_box_t *limits);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_traps_init_box (cairo_traps_t *traps,
|
||||
cairo_box_t *box);
|
||||
|
|
Загрузка…
Ссылка в новой задаче