2004-08-02 13:13:28 +00:00
|
|
|
/* cairo - a vector graphics library with display and print output
|
|
|
|
|
*
|
2004-10-21 18:40:50 +00:00
|
|
|
* Copyright © 2002 University of Southern California
|
2003-07-18 11:34:19 +00:00
|
|
|
*
|
2004-08-02 13:13:28 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
2004-09-04 06:38:34 +00:00
|
|
|
* modify it either under the terms of the GNU Lesser General Public
|
|
|
|
|
* License version 2.1 as published by the Free Software Foundation
|
|
|
|
|
* (the "LGPL") or, at your option, under the terms of the Mozilla
|
|
|
|
|
* Public License Version 1.1 (the "MPL"). If you do not alter this
|
|
|
|
|
* notice, a recipient may use your version of this file under either
|
|
|
|
|
* the MPL or the LGPL.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the LGPL along with this library
|
|
|
|
|
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
* You should have received a copy of the MPL along with this library
|
|
|
|
|
* in the file COPYING-MPL-1.1
|
|
|
|
|
*
|
|
|
|
|
* The contents of this file are subject to the Mozilla Public License
|
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
|
|
|
|
* 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 the cairo graphics library.
|
|
|
|
|
*
|
|
|
|
|
* The Initial Developer of the Original Code is University of Southern
|
|
|
|
|
* California.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
|
|
|
|
* Carl D. Worth <cworth@isi.edu>
|
2003-07-18 11:34:19 +00:00
|
|
|
*/
|
|
|
|
|
|
2004-09-04 06:38:34 +00:00
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
#include "cairoint.h"
|
|
|
|
|
|
|
|
|
|
#define CAIRO_TOLERANCE_MINIMUM 0.0002 /* We're limited by 16 bits of sub-pixel precision */
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
|
|
|
|
|
#ifdef CAIRO_DO_SANITY_CHECKING
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
static int
|
|
|
|
|
cairo_sane_state (cairo_t *cr)
|
|
|
|
|
{
|
|
|
|
|
switch (cr->status) {
|
|
|
|
|
case CAIRO_STATUS_SUCCESS:
|
|
|
|
|
case CAIRO_STATUS_NO_MEMORY:
|
|
|
|
|
case CAIRO_STATUS_INVALID_RESTORE:
|
|
|
|
|
case CAIRO_STATUS_INVALID_POP_GROUP:
|
|
|
|
|
case CAIRO_STATUS_NO_CURRENT_POINT:
|
|
|
|
|
case CAIRO_STATUS_INVALID_MATRIX:
|
|
|
|
|
case CAIRO_STATUS_NO_TARGET_SURFACE:
|
|
|
|
|
case CAIRO_STATUS_NULL_POINTER:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf ("cairo status is bad: %d\n", cr->status);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2004-07-05 09:17:22 +00:00
|
|
|
#define CAIRO_CHECK_SANITY(cr) assert(cairo_sane_state ((cr)))
|
2004-05-20 16:42:56 +00:00
|
|
|
#else
|
|
|
|
|
#define CAIRO_CHECK_SANITY(cr)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
cairo_t *
|
|
|
|
|
cairo_create (void)
|
|
|
|
|
{
|
|
|
|
|
cairo_t *cr;
|
|
|
|
|
|
|
|
|
|
cr = malloc (sizeof (cairo_t));
|
2003-09-05 08:35:08 +00:00
|
|
|
if (cr == NULL)
|
|
|
|
|
return NULL;
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
cr->status = CAIRO_STATUS_SUCCESS;
|
2003-09-16 06:45:19 +00:00
|
|
|
cr->ref_count = 1;
|
2003-07-18 11:34:19 +00:00
|
|
|
|
2003-09-05 08:35:08 +00:00
|
|
|
cr->gstate = _cairo_gstate_create ();
|
|
|
|
|
if (cr->gstate == NULL)
|
|
|
|
|
cr->status = CAIRO_STATUS_NO_MEMORY;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-05 08:35:08 +00:00
|
|
|
return cr;
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-16 06:45:19 +00:00
|
|
|
void
|
|
|
|
|
cairo_reference (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-16 06:45:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->ref_count++;
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-16 06:45:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_destroy (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-16 06:45:19 +00:00
|
|
|
cr->ref_count--;
|
|
|
|
|
if (cr->ref_count)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
while (cr->gstate) {
|
2003-10-04 09:06:15 +00:00
|
|
|
cairo_gstate_t *tmp = cr->gstate;
|
|
|
|
|
cr->gstate = tmp->next;
|
|
|
|
|
|
|
|
|
|
_cairo_gstate_destroy (tmp);
|
2003-09-16 06:45:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free (cr);
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
void
|
|
|
|
|
cairo_save (cairo_t *cr)
|
|
|
|
|
{
|
|
|
|
|
cairo_gstate_t *top;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (cr->gstate) {
|
2003-09-25 15:01:28 +00:00
|
|
|
top = _cairo_gstate_clone (cr->gstate);
|
2003-07-18 11:34:19 +00:00
|
|
|
} else {
|
|
|
|
|
top = _cairo_gstate_create ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (top == NULL) {
|
|
|
|
|
cr->status = CAIRO_STATUS_NO_MEMORY;
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
top->next = cr->gstate;
|
|
|
|
|
cr->gstate = top;
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-09 17:38:10 +00:00
|
|
|
slim_hidden_def(cairo_save);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_restore (cairo_t *cr)
|
|
|
|
|
{
|
|
|
|
|
cairo_gstate_t *top;
|
|
|
|
|
|
2004-05-24 02:44:59 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
top = cr->gstate;
|
|
|
|
|
cr->gstate = top->next;
|
|
|
|
|
|
|
|
|
|
_cairo_gstate_destroy (top);
|
2003-09-15 07:55:10 +00:00
|
|
|
|
|
|
|
|
if (cr->gstate == NULL)
|
|
|
|
|
cr->status = CAIRO_STATUS_INVALID_RESTORE;
|
2004-12-20 09:43:59 +00:00
|
|
|
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_restore_external_state (cr->gstate);
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-09 17:38:10 +00:00
|
|
|
slim_hidden_def(cairo_restore);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
2003-09-30 11:39:07 +00:00
|
|
|
void
|
|
|
|
|
cairo_copy (cairo_t *dest, cairo_t *src)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (src);
|
|
|
|
|
CAIRO_CHECK_SANITY (dest);
|
2003-09-30 13:15:09 +00:00
|
|
|
if (dest->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-09-30 14:15:28 +00:00
|
|
|
if (src->status) {
|
2003-09-30 13:15:09 +00:00
|
|
|
dest->status = src->status;
|
2003-09-30 14:15:28 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2003-09-30 11:39:07 +00:00
|
|
|
|
2003-09-30 13:15:09 +00:00
|
|
|
dest->status = _cairo_gstate_copy (dest->gstate, src->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (src);
|
|
|
|
|
CAIRO_CHECK_SANITY (dest);
|
2003-09-30 11:39:07 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
/* XXX: I want to rethink this API
|
|
|
|
|
void
|
|
|
|
|
cairo_push_group (cairo_t *cr)
|
|
|
|
|
{
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = cairoPush (cr);
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_begin_group (cr->gstate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_pop_group (cairo_t *cr)
|
|
|
|
|
{
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_end_group (cr->gstate);
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = cairoPop (cr);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_target_surface (cairo_t *cr, cairo_surface_t *surface)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-04 09:06:15 +00:00
|
|
|
if (cr->status)
|
2003-07-18 11:34:19 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_target_surface (cr->gstate, surface);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-09 17:38:10 +00:00
|
|
|
slim_hidden_def(cairo_set_target_surface);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_target_image (cairo_t *cr,
|
|
|
|
|
char *data,
|
|
|
|
|
cairo_format_t format,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
int stride)
|
|
|
|
|
{
|
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-04 09:06:15 +00:00
|
|
|
if (cr->status)
|
2003-07-18 11:34:19 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface = cairo_surface_create_for_image (data,
|
2003-10-31 10:41:37 +00:00
|
|
|
format,
|
|
|
|
|
width, height, stride);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (surface == NULL) {
|
|
|
|
|
cr->status = CAIRO_STATUS_NO_MEMORY;
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cairo_set_target_surface (cr, surface);
|
|
|
|
|
|
|
|
|
|
cairo_surface_destroy (surface);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_operator (cairo_t *cr, cairo_operator_t op)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_operator (cr->gstate, op);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_rgb_color (cairo_t *cr, double red, double green, double blue)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_cairo_restrict_value (&red, 0.0, 1.0);
|
|
|
|
|
_cairo_restrict_value (&green, 0.0, 1.0);
|
|
|
|
|
_cairo_restrict_value (&blue, 0.0, 1.0);
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_rgb_color (cr->gstate, red, green, blue);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2004-04-06 09:36:12 +00:00
|
|
|
cairo_set_pattern (cairo_t *cr, cairo_pattern_t *pattern)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_pattern (cr->gstate, pattern);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-06 09:36:12 +00:00
|
|
|
cairo_pattern_t *
|
|
|
|
|
cairo_current_pattern (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-04-06 09:36:12 +00:00
|
|
|
return _cairo_gstate_current_pattern (cr->gstate);
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
void
|
|
|
|
|
cairo_set_tolerance (cairo_t *cr, double tolerance)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_cairo_restrict_value (&tolerance, CAIRO_TOLERANCE_MINIMUM, tolerance);
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_tolerance (cr->gstate, tolerance);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_alpha (cairo_t *cr, double alpha)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_cairo_restrict_value (&alpha, 0.0, 1.0);
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_alpha (cr->gstate, alpha);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_fill_rule (cr->gstate, fill_rule);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_line_width (cairo_t *cr, double width)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-11-17 07:04:15 +00:00
|
|
|
_cairo_restrict_value (&width, 0.0, width);
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
cr->status = _cairo_gstate_set_line_width (cr->gstate, width);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_line_cap (cr->gstate, line_cap);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_line_join (cr->gstate, line_join);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_dash (cairo_t *cr, double *dashes, int ndash, double offset)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_dash (cr->gstate, dashes, ndash, offset);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_miter_limit (cairo_t *cr, double limit)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_miter_limit (cr->gstate, limit);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_translate (cairo_t *cr, double tx, double ty)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-07-30 10:48:27 +00:00
|
|
|
cr->status = _cairo_gstate_translate (cr->gstate, tx, ty);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_scale (cairo_t *cr, double sx, double sy)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_scale (cr->gstate, sx, sy);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_rotate (cairo_t *cr, double angle)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_rotate (cr->gstate, angle);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_concat_matrix (cairo_t *cr,
|
|
|
|
|
cairo_matrix_t *matrix)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_concat_matrix (cr->gstate, matrix);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_matrix (cairo_t *cr,
|
|
|
|
|
cairo_matrix_t *matrix)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_matrix (cr->gstate, matrix);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_default_matrix (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_default_matrix (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_identity_matrix (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_identity_matrix (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_transform_point (cairo_t *cr, double *x, double *y)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-07-30 10:48:27 +00:00
|
|
|
cr->status = _cairo_gstate_transform_point (cr->gstate, x, y);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_transform_distance (cairo_t *cr, double *dx, double *dy)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-07-30 10:48:27 +00:00
|
|
|
cr->status = _cairo_gstate_transform_distance (cr->gstate, dx, dy);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_inverse_transform_point (cairo_t *cr, double *x, double *y)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_inverse_transform_point (cr->gstate, x, y);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_inverse_transform_distance (cairo_t *cr, double *dx, double *dy)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_inverse_transform_distance (cr->gstate, dx, dy);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_new_path (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_new_path (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_move_to (cairo_t *cr, double x, double y)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_move_to (cr->gstate, x, y);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-09 17:38:10 +00:00
|
|
|
slim_hidden_def(cairo_move_to);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_line_to (cairo_t *cr, double x, double y)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_line_to (cr->gstate, x, y);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_curve_to (cairo_t *cr,
|
|
|
|
|
double x1, double y1,
|
|
|
|
|
double x2, double y2,
|
|
|
|
|
double x3, double y3)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_curve_to (cr->gstate,
|
2003-07-30 08:30:50 +00:00
|
|
|
x1, y1,
|
|
|
|
|
x2, y2,
|
|
|
|
|
x3, y3);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-29 08:36:29 +00:00
|
|
|
void
|
|
|
|
|
cairo_arc (cairo_t *cr,
|
|
|
|
|
double xc, double yc,
|
|
|
|
|
double radius,
|
|
|
|
|
double angle1, double angle2)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-29 08:36:29 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_arc (cr->gstate,
|
|
|
|
|
xc, yc,
|
|
|
|
|
radius,
|
|
|
|
|
angle1, angle2);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-29 08:36:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_arc_negative (cairo_t *cr,
|
|
|
|
|
double xc, double yc,
|
|
|
|
|
double radius,
|
|
|
|
|
double angle1, double angle2)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-29 08:36:29 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_arc_negative (cr->gstate,
|
|
|
|
|
xc, yc,
|
|
|
|
|
radius,
|
|
|
|
|
angle1, angle2);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-29 08:36:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* XXX: NYI
|
|
|
|
|
void
|
|
|
|
|
cairo_arc_to (cairo_t *cr,
|
|
|
|
|
double x1, double y1,
|
|
|
|
|
double x2, double y2,
|
|
|
|
|
double radius)
|
|
|
|
|
{
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_arc_to (cr->gstate,
|
|
|
|
|
x1, y1,
|
|
|
|
|
x2, y2,
|
|
|
|
|
radius);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
void
|
|
|
|
|
cairo_rel_move_to (cairo_t *cr, double dx, double dy)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_rel_move_to (cr->gstate, dx, dy);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_rel_line_to (cairo_t *cr, double dx, double dy)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_rel_line_to (cr->gstate, dx, dy);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-09 17:38:10 +00:00
|
|
|
slim_hidden_def(cairo_rel_line_to);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_rel_curve_to (cairo_t *cr,
|
|
|
|
|
double dx1, double dy1,
|
|
|
|
|
double dx2, double dy2,
|
|
|
|
|
double dx3, double dy3)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_rel_curve_to (cr->gstate,
|
2003-07-30 08:30:50 +00:00
|
|
|
dx1, dy1,
|
|
|
|
|
dx2, dy2,
|
|
|
|
|
dx3, dy3);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_rectangle (cairo_t *cr,
|
|
|
|
|
double x, double y,
|
|
|
|
|
double width, double height)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cairo_move_to (cr, x, y);
|
|
|
|
|
cairo_rel_line_to (cr, width, 0);
|
|
|
|
|
cairo_rel_line_to (cr, 0, height);
|
|
|
|
|
cairo_rel_line_to (cr, -width, 0);
|
|
|
|
|
cairo_close_path (cr);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-30 08:30:50 +00:00
|
|
|
/* XXX: NYI
|
2003-07-18 11:34:19 +00:00
|
|
|
void
|
2003-07-30 08:30:50 +00:00
|
|
|
cairo_stroke_path (cairo_t *cr)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
|
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-07-30 08:30:50 +00:00
|
|
|
cr->status = _cairo_gstate_stroke_path (cr->gstate);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-07-30 08:30:50 +00:00
|
|
|
*/
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
void
|
2003-07-30 08:30:50 +00:00
|
|
|
cairo_close_path (cairo_t *cr)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-07-30 08:30:50 +00:00
|
|
|
cr->status = _cairo_gstate_close_path (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-09 17:38:10 +00:00
|
|
|
slim_hidden_def(cairo_close_path);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_stroke (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_stroke (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_fill (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_fill (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-03 19:17:31 +00:00
|
|
|
void
|
|
|
|
|
cairo_copy_page (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-11-03 19:17:31 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_copy_page (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-11-03 19:17:31 +00:00
|
|
|
}
|
|
|
|
|
|
2003-10-31 21:30:35 +00:00
|
|
|
void
|
|
|
|
|
cairo_show_page (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-31 21:30:35 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_show_page (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-31 21:30:35 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-06 18:33:28 +00:00
|
|
|
int
|
|
|
|
|
cairo_in_stroke (cairo_t *cr, double x, double y)
|
|
|
|
|
{
|
|
|
|
|
int inside;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-11-06 18:33:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_in_stroke (cr->gstate, x, y, &inside);
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
|
|
|
|
|
2003-11-06 18:33:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return inside;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
cairo_in_fill (cairo_t *cr, double x, double y)
|
|
|
|
|
{
|
|
|
|
|
int inside;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-11-06 18:33:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_in_fill (cr->gstate, x, y, &inside);
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
|
|
|
|
|
2003-11-06 18:33:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return inside;
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-06 09:36:12 +00:00
|
|
|
void
|
|
|
|
|
cairo_stroke_extents (cairo_t *cr,
|
|
|
|
|
double *x1, double *y1, double *x2, double *y2)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-04-06 09:36:12 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_stroke_extents (cr->gstate, x1, y1, x2, y2);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-04-06 09:36:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_fill_extents (cairo_t *cr,
|
|
|
|
|
double *x1, double *y1, double *x2, double *y2)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-04-06 09:36:12 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_fill_extents (cr->gstate, x1, y1, x2, y2);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-04-06 09:36:12 +00:00
|
|
|
}
|
|
|
|
|
|
2004-03-19 15:47:25 +00:00
|
|
|
void
|
|
|
|
|
cairo_init_clip (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-03-19 15:47:25 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_init_clip (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-03-19 15:47:25 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
void
|
|
|
|
|
cairo_clip (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_clip (cr->gstate);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2003-10-23 15:22:28 +00:00
|
|
|
cairo_select_font (cairo_t *cr,
|
2003-12-11 11:12:59 +00:00
|
|
|
const char *family,
|
2003-10-23 15:22:28 +00:00
|
|
|
cairo_font_slant_t slant,
|
|
|
|
|
cairo_font_weight_t weight)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-10-23 15:22:28 +00:00
|
|
|
cr->status = _cairo_gstate_select_font (cr->gstate, family, slant, weight);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cairo_font_t *
|
|
|
|
|
cairo_current_font (cairo_t *cr)
|
|
|
|
|
{
|
2004-05-24 02:44:59 +00:00
|
|
|
cairo_font_t *ret;
|
2003-11-06 13:32:15 +00:00
|
|
|
|
2004-05-24 02:44:59 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
if (cr->status)
|
2003-10-24 11:01:37 +00:00
|
|
|
return NULL;
|
2003-10-23 15:22:28 +00:00
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_current_font (cr->gstate, &ret);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2004-05-20 16:42:56 +00:00
|
|
|
cairo_current_font_extents (cairo_t *cr,
|
2003-10-23 15:22:28 +00:00
|
|
|
cairo_font_extents_t *extents)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
|
|
|
|
if (cr->status)
|
2003-10-23 15:22:28 +00:00
|
|
|
return;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
cr->status = _cairo_gstate_current_font_extents (cr->gstate, extents);
|
|
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_set_font (cairo_t *cr, cairo_font_t *font)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_set_font (cr->gstate, font);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_scale_font (cairo_t *cr, double scale)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_scale_font (cr->gstate, scale);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2003-10-23 15:22:28 +00:00
|
|
|
cairo_transform_font (cairo_t *cr, cairo_matrix_t *matrix)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-10-23 15:22:28 +00:00
|
|
|
cr->status = _cairo_gstate_transform_font (cr->gstate, matrix);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2003-10-23 15:22:28 +00:00
|
|
|
cairo_text_extents (cairo_t *cr,
|
|
|
|
|
const unsigned char *utf8,
|
|
|
|
|
cairo_text_extents_t *extents)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
cairo_glyph_t *glyphs = NULL;
|
|
|
|
|
int nglyphs;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
|
|
|
|
|
if (cr->status) {
|
|
|
|
|
if (glyphs)
|
|
|
|
|
free (glyphs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, nglyphs, extents);
|
|
|
|
|
CAIRO_CHECK_SANITY (cr);
|
|
|
|
|
|
|
|
|
|
if (glyphs)
|
|
|
|
|
free (glyphs);
|
2003-10-23 15:22:28 +00:00
|
|
|
}
|
2003-07-18 11:34:19 +00:00
|
|
|
|
2003-10-23 15:22:28 +00:00
|
|
|
void
|
|
|
|
|
cairo_glyph_extents (cairo_t *cr,
|
|
|
|
|
cairo_glyph_t *glyphs,
|
|
|
|
|
int num_glyphs,
|
|
|
|
|
cairo_text_extents_t *extents)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs,
|
|
|
|
|
extents);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_show_text (cairo_t *cr, const unsigned char *utf8)
|
|
|
|
|
{
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
cairo_glyph_t *glyphs = NULL;
|
|
|
|
|
int nglyphs;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
2004-05-17 08:03:17 +00:00
|
|
|
if (utf8 == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
|
|
|
|
|
CAIRO_CHECK_SANITY (cr);
|
|
|
|
|
|
|
|
|
|
if (cr->status) {
|
|
|
|
|
if (glyphs)
|
|
|
|
|
free (glyphs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, nglyphs);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
|
|
|
|
|
if (glyphs)
|
|
|
|
|
free (glyphs);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-10-23 15:22:28 +00:00
|
|
|
void
|
|
|
|
|
cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_text_path (cairo_t *cr, const unsigned char *utf8)
|
|
|
|
|
{
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
cairo_glyph_t *glyphs = NULL;
|
|
|
|
|
int nglyphs;
|
|
|
|
|
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
Add cairo_cache.c
Rewrite using temporary glyph arrays
New file.
Remove old glyph cache code. (_cairo_font_scale) (_cairo_font_transform): Remove font-transforming code. (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_cache_key_t): New structure type. (_font_cache_hash) (_font_cache_keys_equal) (_font_cache_create_entry) (_font_cache_destroy_entry) (_font_cache_destroy_cache): New font cache code. (_global_font_cache) (_lock_global_font_cache) (_unlock_global_font_cache) (_get_global_font_cache): New global font cache. (_cairo_font_text_to_glyphs) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal) (_image_glyph_cache_create_entry) (_image_glyph_cache_destroy_entry) (_image_glyph_cache_destroy_cache): New glyph cache code. (_global_image_glyph_cache) (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache): New global glyph cache. (_cairo_font_cache_backend): New structure. (_cairo_image_cache_backend): Likewise. (_cairo_font_create): Reimplement in terms of font cache. (_cairo_font_init): Remove matrix and glyph cache related code. (_cairo_font_copy): Likewise. (_cairo_font_show_glyphs): Delegate to surface when possible. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Rename to as cairo_unscaled_font_XXX, and add scale parameter.
New structure types. (_create_from_face) (_reference_font_val) (_destroy_font_val) (_create_from_library_and_pattern): New functions. (_ft_font_cache_hash) (_ft_font_cache_keys_equal) (_ft_font_cache_create_entry) (_ft_font_cache_destroy_entry) (_ft_font_cache_destroy_cache): New ft font cache code. (_global_ft_cache) (_lock_global_ft_cache) (_unlock_global_ft_cache) (_get_global_ft_cache): New global ft font cache. (_ft_font_cache_backend): New structure. (_cairo_ft_font_create): Rewrite to use cache. (_cairo_ft_font_destroy): Likewise. (_cairo_ft_font_copy): Remove. (_install_font_matrix): Rename as _install_font_scale. (_utf8_to_glyphs): Rename as _cairo_ft_font_text_to_glyphs. (_cairo_ft_font_text_to_glyphs): Use cache for metrics. (_cairo_ft_font_extents): Accept size, use scaled metrics. (_cairo_ft_font_glyph_extents) (_cairo_ft_font_glyph_bbox) (_cairo_ft_font_show_glyphs) (_cairo_ft_font_glyph_path): Modify to use size, cache. (_cairo_ft_font_text_extents) (_cairo_ft_font_text_bbox) (_cairo_ft_font_show_text) (_cairo_ft_font_text_path): Remove text-API code. (cairo_ft_font_create) (cairo_ft_font_create_for_ft_face) (cairo_ft_font_face) (cairo_ft_font_pattern): Rewrite using ft_font_val_t.
Just reference font. (_cairo_gstate_fini): Finalize font matrix. (_cairo_gstate_default_matrix): Initialize font matrix. (_cairo_gstate_clip): Re-enable clipping rectangle. (_cairo_gstate_select_font) (_cairo_gstate_set_font): Set font matrix to identity. (_cairo_gstate_scale_font): Scale font matrix, not font. (_cairo_gstate_transform_font): Transform font matrix, not font. (_cairo_gstate_set_font_transform): Install as font matrix, not in font. (_build_font_scale): New helper function. (_cairo_gstate_text_to_glyphs): New function. (_cairo_gstate_current_font_extents) (_cairo_gstate_glyph_extents) (_cairo_gstate_show_glyphs) (_cairo_gstate_glyph_path): Rewrite using font matrix and size. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text): Remove text-API code.
Minor bug fix. (_cairo_xlib_surface_show_glyphs): New function. (_cairo_xlib_surface_backend): Add reference to new function. (glyphset_cache_t) (glyphset_cache_entry_t): New structure types. (_next_xlib_glyph): New helper function. (_xlib_glyphset_cache_create_value) (_xlib_glyphset_cache_destroy_cache) (_xlib_glyphset_cache_destroy_value) (_xlib_glyphset_cache_backend): New glyphset cache code. (_xlib_glyphset_caches) (_lock_xlib_glyphset_caches) (_unlock_xlib_glyphset_caches) (_get_glyphset_cache): New global glyphset cache.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
Add NULL entry for show_glyphs.
New structure type. (cairo_cache_entry_base_t) (cairo_cache_arrangement_t) (cairo_cache_t): New structure types. (_cairo_cache_init) (_cairo_cache_reference) (_cairo_cache_destroy) (_cairo_cache_lookup) (_cairo_hash_string): New cache functions. (CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT) (CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT) (CAIRO_FT_CACHE_NUM_FONTS_DEFAULT): New constants. (cairo_font_scale_t) (cairo_glyph_cache_key_t) (cairo_image_glyph_cache_entry_t): New structure types. (_cairo_lock_global_image_glyph_cache) (_cairo_unlock_global_image_glyph_cache) (_cairo_get_global_image_glyph_cache) (_cairo_glyph_cache_hash) (_cairo_glyph_cache_keys_equal): New functions for glyph caches. (cairo_font_backend_t): Remove text-API calls, add scale params, remove copy call. (cairo_surface_backend_t): Add show_glyphs entry. (cairo_glyph_surface_t) (cairo_glyph_surface_node_t): Remove old glyph cache structures. (cairo_unscaled_font_t): New structure type. (cairo_font): Remove glyph cache member, add pointer to unscaled. (cairo_gstate): Add font_matrix member, change to hold unscaled. (_cairo_gstate_set_font_transform) (_cairo_gstate_current_font_transform) (_cairo_gstate_text_to_glyphs): New functions. (_cairo_gstate_text_path (_cairo_gstate_text_extents) (_cairo_gstate_show_text) (_cairo_font_text_extents) (_cairo_font_text_bbox) (_cairo_font_show_text) (_cairo_font_text_path): Remove text-API code. (_cairo_font_glyph_extents) (_cairo_font_glyph_bbox) (_cairo_font_glyph_path) (_cairo_font_font_extents) (_cairo_font_show_glyphs): Add scale parameter.
2004-10-08 12:09:49 +00:00
|
|
|
|
|
|
|
|
if (cr->status) {
|
|
|
|
|
if (glyphs)
|
|
|
|
|
free (glyphs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_glyph_path (cr->gstate, glyphs, nglyphs);
|
|
|
|
|
CAIRO_CHECK_SANITY (cr);
|
|
|
|
|
|
|
|
|
|
if (glyphs)
|
|
|
|
|
free (glyphs);
|
2003-10-23 15:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_glyph_path (cr->gstate, glyphs, num_glyphs);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-10-23 15:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
void
|
|
|
|
|
cairo_show_surface (cairo_t *cr,
|
2003-07-23 21:20:24 +00:00
|
|
|
cairo_surface_t *surface,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_show_surface (cr->gstate,
|
2003-07-23 21:20:24 +00:00
|
|
|
surface, width, height);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-30 08:30:50 +00:00
|
|
|
cairo_operator_t
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_operator (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_operator (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_operator, cairo_current_operator);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
void
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_rgb_color (cairo_t *cr, double *red, double *green, double *blue)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
_cairo_gstate_current_rgb_color (cr->gstate, red, green, blue);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_rgb_color, cairo_current_rgb_color);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
double
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_alpha (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_alpha (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_alpha, cairo_current_alpha);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
double
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_tolerance (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_tolerance (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_tolerance, cairo_current_tolerance);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
void
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_point (cairo_t *cr, double *x, double *y)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
_cairo_gstate_current_point (cr->gstate, x, y);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_current_point, cairo_current_point);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
cairo_fill_rule_t
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_fill_rule (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_fill_rule (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_fill_rule, cairo_current_fill_rule);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
double
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_line_width (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_line_width (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_line_width, cairo_current_line_width);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
cairo_line_cap_t
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_line_cap (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_line_cap (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_line_cap, cairo_current_line_cap);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
cairo_line_join_t
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_line_join (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_line_join (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_line_join, cairo_current_line_join);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
|
|
|
|
double
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_miter_limit (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_miter_limit (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_miter_limit, cairo_current_miter_limit);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
2003-09-03 07:14:18 +00:00
|
|
|
void
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_matrix (cairo_t *cr, cairo_matrix_t *matrix)
|
2003-09-03 07:14:18 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
_cairo_gstate_current_matrix (cr->gstate, matrix);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-03 07:14:18 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_matrix, cairo_current_matrix);
|
2003-09-03 07:14:18 +00:00
|
|
|
|
2003-07-30 08:30:50 +00:00
|
|
|
cairo_surface_t *
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_current_target_surface (cairo_t *cr)
|
2003-07-30 08:30:50 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-09-04 06:52:01 +00:00
|
|
|
return _cairo_gstate_current_target_surface (cr->gstate);
|
2003-07-30 08:30:50 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_target_surface, cairo_current_target_surface);
|
2003-07-30 08:30:50 +00:00
|
|
|
|
2004-02-17 18:38:23 +00:00
|
|
|
void
|
|
|
|
|
cairo_current_path (cairo_t *cr,
|
|
|
|
|
cairo_move_to_func_t *move_to,
|
|
|
|
|
cairo_line_to_func_t *line_to,
|
|
|
|
|
cairo_curve_to_func_t *curve_to,
|
|
|
|
|
cairo_close_path_func_t *close_path,
|
|
|
|
|
void *closure)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-02-17 18:38:23 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_interpret_path (cr->gstate,
|
|
|
|
|
move_to,
|
|
|
|
|
line_to,
|
|
|
|
|
curve_to,
|
|
|
|
|
close_path,
|
|
|
|
|
closure);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-02-17 18:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cairo_current_path_flat (cairo_t *cr,
|
|
|
|
|
cairo_move_to_func_t *move_to,
|
|
|
|
|
cairo_line_to_func_t *line_to,
|
|
|
|
|
cairo_close_path_func_t *close_path,
|
|
|
|
|
void *closure)
|
|
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-02-17 18:38:23 +00:00
|
|
|
if (cr->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cr->status = _cairo_gstate_interpret_path (cr->gstate,
|
|
|
|
|
move_to,
|
|
|
|
|
line_to,
|
|
|
|
|
NULL,
|
|
|
|
|
close_path,
|
|
|
|
|
closure);
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2004-02-17 18:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
cairo_status_t
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_status (cairo_t *cr)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2004-05-20 16:42:56 +00:00
|
|
|
CAIRO_CHECK_SANITY (cr);
|
2003-07-18 11:34:19 +00:00
|
|
|
return cr->status;
|
|
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_status, cairo_status);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
const char *
|
2003-09-04 06:52:01 +00:00
|
|
|
cairo_status_string (cairo_t *cr)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
|
|
|
|
switch (cr->status) {
|
|
|
|
|
case CAIRO_STATUS_SUCCESS:
|
|
|
|
|
return "success";
|
|
|
|
|
case CAIRO_STATUS_NO_MEMORY:
|
|
|
|
|
return "out of memory";
|
|
|
|
|
case CAIRO_STATUS_INVALID_RESTORE:
|
|
|
|
|
return "cairo_restore without matching cairo_save";
|
|
|
|
|
case CAIRO_STATUS_INVALID_POP_GROUP:
|
|
|
|
|
return "cairo_pop_group without matching cairo_push_group";
|
|
|
|
|
case CAIRO_STATUS_NO_CURRENT_POINT:
|
|
|
|
|
return "no current point defined";
|
|
|
|
|
case CAIRO_STATUS_INVALID_MATRIX:
|
|
|
|
|
return "invalid matrix (not invertible)";
|
2003-09-04 16:27:34 +00:00
|
|
|
case CAIRO_STATUS_NO_TARGET_SURFACE:
|
|
|
|
|
return "no target surface has been set";
|
2003-10-31 10:41:37 +00:00
|
|
|
case CAIRO_STATUS_NULL_POINTER:
|
|
|
|
|
return "NULL pointer";
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
2003-10-04 09:06:15 +00:00
|
|
|
return "<unknown error status>";
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|
2003-09-04 06:52:01 +00:00
|
|
|
DEPRECATE (cairo_get_status_string, cairo_status_string);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
2004-04-06 09:36:12 +00:00
|
|
|
void
|
2003-07-18 11:34:19 +00:00
|
|
|
_cairo_restrict_value (double *value, double min, double max)
|
|
|
|
|
{
|
|
|
|
|
if (*value < min)
|
|
|
|
|
*value = min;
|
|
|
|
|
else if (*value > max)
|
|
|
|
|
*value = max;
|
|
|
|
|
}
|