1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
|
/*
* Copyright (c) 2004-2005 by the cairo perl team (see the file README)
*
* Licensed under the LGPL, see LICENSE file for more information.
*
* $Id$
*
*/
#include <cairo-perl.h>
#include <cairo-perl-private.h>
#define NEED_newRV_noinc_GLOBAL
#include "ppport.h"
/* ------------------------------------------------------------------------- */
static void
call_xs (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
{
dSP;
PUSHMARK (mark);
(*subaddr) (aTHX_ cv);
PUTBACK; /* forget return values */
}
#define CAIRO_PERL_CALL_BOOT(name) \
{ \
extern XS(name); \
call_xs (aTHX_ name, cv, mark); \
}
/* ------------------------------------------------------------------------- */
/* Copied from Glib/Glib.xs. */
void *
cairo_perl_alloc_temp (int nbytes)
{
dTHR;
SV * s;
if (nbytes <= 0) return NULL;
s = sv_2mortal (NEWSV (0, nbytes));
memset (SvPVX (s), 0, nbytes);
return SvPVX (s);
}
/* Copied from Glib/GType.xs. */
void
cairo_perl_set_isa (const char *child_package,
const char *parent_package)
{
char *child_isa_full;
AV *isa;
New (0, child_isa_full, strlen(child_package) + 5 + 1, char);
child_isa_full = strcpy (child_isa_full, child_package);
child_isa_full = strcat (child_isa_full, "::ISA");
isa = get_av (child_isa_full, TRUE); /* create on demand */
Safefree (child_isa_full);
av_push (isa, newSVpv (parent_package, 0));
}
/* ------------------------------------------------------------------------- */
void *
cairo_object_from_sv (SV *sv, const char *package)
{
if (!SvOK (sv) || !SvROK (sv) || !sv_derived_from (sv, package))
croak("Cannot convert scalar %p to an object of type %s",
sv, package);
return INT2PTR (void *, SvIV ((SV *) SvRV (sv)));
}
SV *
cairo_object_to_sv (void *object, const char *package)
{
SV *sv = newSV (0);
sv_setref_pv(sv, package, object);
return sv;
}
/* ------------------------------------------------------------------------- */
void *
cairo_struct_from_sv (SV *sv, const char *package)
{
if (!SvOK (sv) || !SvROK (sv) || !sv_derived_from (sv, package))
croak("Cannot convert scalar %p to a struct of type %s",
sv, package);
return INT2PTR (void *, SvIV ((SV *) SvRV (sv)));
}
SV *
cairo_struct_to_sv (void *object, const char *package)
{
SV *sv = newSV (0);
sv_setref_pv(sv, package, object);
return sv;
}
/* ------------------------------------------------------------------------- */
SV *
newSVCairoFontExtents (cairo_font_extents_t *extents)
{
HV *hv;
double value;
if (!extents)
return &PL_sv_undef;
hv = newHV ();
value = extents->ascent;
hv_store (hv, "ascent", 6, newSVnv (value), 0);
value = extents->descent;
hv_store (hv, "descent", 7, newSVnv (value), 0);
value = extents->height;
hv_store (hv, "height", 6, newSVnv (value), 0);
value = extents->max_x_advance;
hv_store (hv, "max_x_advance", 13, newSVnv (value), 0);
value = extents->max_y_advance;
hv_store (hv, "max_y_advance", 13, newSVnv (value), 0);
return newRV_noinc ((SV *) hv);
}
/* ------------------------------------------------------------------------- */
SV *
newSVCairoTextExtents (cairo_text_extents_t *extents)
{
HV *hv;
double value;
if (!extents)
return &PL_sv_undef;
hv = newHV ();
value = extents->x_bearing;
hv_store (hv, "x_bearing", 9, newSVnv (value), 0);
value = extents->y_bearing;
hv_store (hv, "y_bearing", 9, newSVnv (value), 0);
value = extents->width;
hv_store (hv, "width", 5, newSVnv (value), 0);
value = extents->height;
hv_store (hv, "height", 6, newSVnv (value), 0);
value = extents->x_advance;
hv_store (hv, "x_advance", 9, newSVnv (value), 0);
value = extents->y_advance;
hv_store (hv, "y_advance", 9, newSVnv (value), 0);
return newRV_noinc ((SV *) hv);
}
/* ------------------------------------------------------------------------- */
SV *
newSVCairoGlyph (cairo_glyph_t *glyph)
{
HV *hv;
unsigned long index;
double value;
if (!glyph)
return &PL_sv_undef;
hv = newHV ();
index = glyph->index;
hv_store (hv, "index", 5, newSVuv (index), 0);
value = glyph->x;
hv_store (hv, "x", 1, newSVnv (value), 0);
value = glyph->y;
hv_store (hv, "y", 1, newSVnv (value), 0);
return newRV_noinc ((SV *) hv);
}
cairo_glyph_t *
SvCairoGlyph (SV *sv)
{
HV *hv;
SV **value;
cairo_glyph_t *glyph;
if (!cairo_perl_sv_is_hash_ref (sv))
croak ("cairo_glyph_t must be a hash reference");
hv = (HV *) SvRV (sv);
glyph = cairo_perl_alloc_temp (sizeof (cairo_glyph_t));
value = hv_fetch (hv, "index", 5, 0);
if (value && SvOK (*value))
glyph->index = SvUV (*value);
value = hv_fetch (hv, "x", 1, 0);
if (value && SvOK (*value))
glyph->x = SvNV (*value);
value = hv_fetch (hv, "y", 1, 0);
if (value && SvOK (*value))
glyph->y = SvNV (*value);
return glyph;
}
/* ------------------------------------------------------------------------- */
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
SV *
newSVCairoRectangle (cairo_rectangle_t *rectangle)
{
HV *hv;
if (!rectangle)
return &PL_sv_undef;
hv = newHV ();
hv_store (hv, "x", 1, newSVnv (rectangle->x), 0);
hv_store (hv, "y", 1, newSVnv (rectangle->y), 0);
hv_store (hv, "width", 5, newSVnv (rectangle->width), 0);
hv_store (hv, "height", 6, newSVnv (rectangle->height), 0);
return newRV_noinc ((SV *) hv);
}
#endif
/* ------------------------------------------------------------------------- */
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
SV *
newSVCairoTextCluster (cairo_text_cluster_t *cluster)
{
HV *hv;
if (!cluster)
return &PL_sv_undef;
hv = newHV ();
hv_store (hv, "num_bytes", 9, newSViv (cluster->num_bytes), 0);
hv_store (hv, "num_glyphs", 10, newSVnv (cluster->num_glyphs), 0);
return newRV_noinc ((SV *) hv);
}
cairo_text_cluster_t *
SvCairoTextCluster (SV *sv)
{
HV *hv;
SV **value;
cairo_text_cluster_t *cluster;
if (!cairo_perl_sv_is_hash_ref (sv))
croak ("cairo_text_cluster_t must be a hash reference");
hv = (HV *) SvRV (sv);
cluster = cairo_perl_alloc_temp (sizeof (cairo_text_cluster_t));
value = hv_fetch (hv, "num_bytes", 9, 0);
if (value && SvOK (*value))
cluster->num_bytes = SvIV (*value);
value = hv_fetch (hv, "num_glyphs", 10, 0);
if (value && SvOK (*value))
cluster->num_glyphs = SvIV (*value);
return cluster;
}
#endif
/* ------------------------------------------------------------------------- */
MODULE = Cairo PACKAGE = Cairo PREFIX = cairo_
BOOT:
#include "cairo-perl-boot.xsh"
#if CAIRO_PERL_DEBUG
call_atexit ((ATEXIT_t) cairo_debug_reset_static_data, NULL);
#endif
int VERSION (class=NULL)
CODE:
RETVAL = CAIRO_VERSION;
OUTPUT:
RETVAL
int VERSION_ENCODE (...)
PREINIT:
int major, minor, micro;
CODE:
if (items == 3) {
major = SvIV (ST (0));
minor = SvIV (ST (1));
micro = SvIV (ST (2));
} else if (items == 4) {
major = SvIV (ST (1));
minor = SvIV (ST (2));
micro = SvIV (ST (3));
} else {
croak ("Usage: Cairo::VERSION_ENCODE (major, minor, micro) or Cairo->VERSION_ENCODE (major, minor, micro)");
}
RETVAL = CAIRO_VERSION_ENCODE (major, minor, micro);
OUTPUT:
RETVAL
# int cairo_version ();
int cairo_version (class=NULL)
C_ARGS:
/* void */
# const char* cairo_version_string ();
const char* cairo_version_string (class=NULL)
C_ARGS:
/* void */
# ---------------------------------------------------------------------------- #
MODULE = Cairo PACKAGE = Cairo::Context PREFIX = cairo_
cairo_t_noinc * cairo_create (class, cairo_surface_t * target);
C_ARGS:
target
void DESTROY (cairo_t * cr);
CODE:
cairo_destroy (cr);
void cairo_save (cairo_t * cr);
void cairo_restore (cairo_t * cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
void cairo_push_group (cairo_t *cr);
void cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
cairo_pattern_t * cairo_pop_group (cairo_t *cr);
void cairo_pop_group_to_source (cairo_t *cr);
#endif
void cairo_set_operator (cairo_t * cr, cairo_operator_t op);
void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
void cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha);
void cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y);
void cairo_set_tolerance (cairo_t * cr, double tolerance);
void cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
void cairo_set_fill_rule (cairo_t * cr, cairo_fill_rule_t fill_rule);
void cairo_set_line_width (cairo_t * cr, double width);
void cairo_set_line_cap (cairo_t * cr, cairo_line_cap_t line_cap);
void cairo_set_line_join (cairo_t * cr, cairo_line_join_t line_join);
##void cairo_set_dash (cairo_t * cr, double * dashes, int ndash, double offset);
void cairo_set_dash (cairo_t * cr, double offset, ...)
PREINIT:
int i, n;
double *pts;
CODE:
#define FIRST 2
n = (items - FIRST);
if (n == 0) {
pts = NULL;
} else {
New (0, pts, n, double);
if (!pts)
croak ("malloc failure for (%d) elements", n);
for (i = FIRST ; i < items ; i++)
pts[i - FIRST] = SvNV (ST (i));
}
#undef FIRST
cairo_set_dash (cr, pts, n, offset);
CLEANUP:
if (pts)
Safefree (pts);
void cairo_set_miter_limit (cairo_t * cr, double limit);
void cairo_translate (cairo_t * cr, double tx, double ty);
void cairo_scale (cairo_t * cr, double sx, double sy);
void cairo_rotate (cairo_t * cr, double angle);
void cairo_transform (cairo_t *cr, const cairo_matrix_t *matrix);
void cairo_set_matrix (cairo_t * cr, const cairo_matrix_t * matrix);
void cairo_identity_matrix (cairo_t * cr);
void cairo_user_to_device (cairo_t *cr, IN_OUTLIST double x, IN_OUTLIST double y);
void cairo_user_to_device_distance (cairo_t *cr, IN_OUTLIST double dx, IN_OUTLIST double dy);
void cairo_device_to_user (cairo_t *cr, IN_OUTLIST double x, IN_OUTLIST double y);
void cairo_device_to_user_distance (cairo_t *cr, IN_OUTLIST double dx, IN_OUTLIST double dy);
void cairo_new_path (cairo_t * cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
void cairo_new_sub_path (cairo_t *cr);
#endif
void cairo_move_to (cairo_t * cr, double x, double y);
void cairo_line_to (cairo_t * cr, double x, double y);
void cairo_curve_to (cairo_t * cr, double x1, double y1, double x2, double y2, double x3, double y3);
void cairo_arc (cairo_t * cr, double xc, double yc, double radius, double angle1, double angle2);
void cairo_arc_negative (cairo_t * cr, double xc, double yc, double radius, double angle1, double angle2);
void cairo_rel_move_to (cairo_t * cr, double dx, double dy);
void cairo_rel_line_to (cairo_t * cr, double dx, double dy);
void cairo_rel_curve_to (cairo_t * cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
void cairo_rectangle (cairo_t * cr, double x, double y, double width, double height);
void cairo_close_path (cairo_t * cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
void cairo_path_extents (cairo_t *cr, OUTLIST double x1, OUTLIST double y1, OUTLIST double x2, OUTLIST double y2);
#endif
void cairo_paint (cairo_t *cr);
void cairo_paint_with_alpha (cairo_t *cr, double alpha);
void cairo_mask (cairo_t *cr, cairo_pattern_t *pattern);
void cairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y);
void cairo_stroke (cairo_t * cr);
void cairo_stroke_preserve (cairo_t *cr);
void cairo_fill (cairo_t * cr);
void cairo_fill_preserve (cairo_t *cr);
void cairo_copy_page (cairo_t * cr);
void cairo_show_page (cairo_t * cr);
int cairo_in_stroke (cairo_t * cr, double x, double y);
int cairo_in_fill (cairo_t * cr, double x, double y);
void cairo_stroke_extents (cairo_t * cr, OUTLIST double x1, OUTLIST double y1, OUTLIST double x2, OUTLIST double y2);
void cairo_fill_extents (cairo_t * cr, OUTLIST double x1, OUTLIST double y1, OUTLIST double x2, OUTLIST double y2);
void cairo_clip (cairo_t * cr);
void cairo_clip_preserve (cairo_t *cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
##cairo_rectangle_list_t * cairo_copy_clip_rectangle_list (cairo_t *cr);
void cairo_copy_clip_rectangle_list (cairo_t *cr)
PREINIT:
cairo_rectangle_list_t *list;
int i;
PPCODE:
list = cairo_copy_clip_rectangle_list (cr);
CAIRO_PERL_CHECK_STATUS (list->status);
EXTEND (sp, list->num_rectangles);
for (i = 0; i < list->num_rectangles; i++)
PUSHs (sv_2mortal (newSVCairoRectangle (&(list->rectangles[i]))));
cairo_rectangle_list_destroy (list);
void cairo_clip_extents (cairo_t *cr, OUTLIST double x1, OUTLIST double y1, OUTLIST double x2, OUTLIST double y2);
#endif
void cairo_reset_clip (cairo_t *cr);
void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight);
void cairo_set_font_size (cairo_t *cr, double size);
void cairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix);
##void cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix);
cairo_matrix_t * cairo_get_font_matrix (cairo_t *cr)
PREINIT:
cairo_matrix_t matrix;
CODE:
cairo_get_font_matrix (cr, &matrix);
RETVAL = cairo_perl_copy_matrix (&matrix);
OUTPUT:
RETVAL
void cairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options);
##void cairo_get_font_options (cairo_t *cr, cairo_font_options_t *options);
cairo_font_options_t * cairo_get_font_options (cairo_t *cr)
CODE:
RETVAL = cairo_font_options_create ();
cairo_get_font_options (cr, RETVAL);
OUTPUT:
RETVAL
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
void cairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font);
#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
cairo_scaled_font_t * cairo_get_scaled_font (cairo_t *cr);
#endif
void cairo_show_text (cairo_t * cr, const char * utf8);
##void cairo_show_glyphs (cairo_t * cr, cairo_glyph_t * glyphs, int num_glyphs);
void cairo_show_glyphs (cairo_t * cr, ...)
PREINIT:
cairo_glyph_t * glyphs = NULL;
int num_glyphs, i;
CODE:
num_glyphs = items - 1;
Newz (0, glyphs, num_glyphs, cairo_glyph_t);
for (i = 1; i < items; i++)
glyphs[i - 1] = *SvCairoGlyph (ST (i));
cairo_show_glyphs (cr, glyphs, num_glyphs);
Safefree (glyphs);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
##void cairo_show_text_glyphs (cairo_t *cr, const char *utf8, int utf8_len, const cairo_glyph_t *glyphs, int num_glyphs, const cairo_text_cluster_t *clusters, int num_clusters, cairo_text_cluster_flags_t cluster_flags);
void
cairo_show_text_glyphs (cairo_t *cr, SV *utf8_sv, SV *glyphs_sv, SV *clusters_sv, cairo_text_cluster_flags_t cluster_flags)
PREINIT:
const char *utf8 = NULL;
STRLEN utf8_len = 0;
cairo_glyph_t * glyphs = NULL;
cairo_text_cluster_t * clusters = NULL;
int i, num_glyphs, num_clusters;
AV *glyphs_av, *clusters_av;
CODE:
if (!cairo_perl_sv_is_array_ref (glyphs_sv))
croak ("glyphs must be an array ref");
if (!cairo_perl_sv_is_array_ref (clusters_sv))
croak ("text clusters must be an array ref");
utf8 = SvPV (utf8_sv, utf8_len);
glyphs_av = (AV *) SvRV (glyphs_sv);
num_glyphs = av_len (glyphs_av) + 1;
glyphs = cairo_glyph_allocate (num_glyphs);
for (i = 0; i < num_glyphs; i++) {
SV **value = av_fetch (glyphs_av, i, 0);
if (value)
glyphs[i] = *SvCairoGlyph (*value);
}
clusters_av = (AV *) SvRV (clusters_sv);
num_clusters = av_len (clusters_av) + 1;
clusters = cairo_text_cluster_allocate (num_clusters);
for (i = 0; i < num_clusters; i++) {
SV **value = av_fetch (clusters_av, i, 0);
if (value)
clusters[i] = *SvCairoTextCluster (*value);
}
cairo_show_text_glyphs (cr,
utf8, (int) utf8_len,
glyphs, num_glyphs,
clusters, num_clusters, cluster_flags);
cairo_text_cluster_free (clusters);
cairo_glyph_free (glyphs);
#endif
cairo_font_face_t * cairo_get_font_face (cairo_t *cr);
##void cairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents);
cairo_font_extents_t * cairo_font_extents (cairo_t *cr)
PREINIT:
cairo_font_extents_t extents;
CODE:
cairo_font_extents (cr, &extents);
RETVAL = &extents;
OUTPUT:
RETVAL
void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
##void cairo_text_extents (cairo_t * cr, const unsigned char * utf8, cairo_text_extents_t * extents);
cairo_text_extents_t * cairo_text_extents (cairo_t * cr, const char * utf8)
PREINIT:
cairo_text_extents_t extents;
CODE:
cairo_text_extents (cr, utf8, &extents);
RETVAL = &extents;
OUTPUT:
RETVAL
##void cairo_glyph_extents (cairo_t * cr, cairo_glyph_t * glyphs, int num_glyphs, cairo_text_extents_t * extents);
cairo_text_extents_t * cairo_glyph_extents (cairo_t * cr, ...)
PREINIT:
cairo_text_extents_t extents;
cairo_glyph_t * glyphs = NULL;
int num_glyphs, i;
CODE:
num_glyphs = items - 1;
Newz (0, glyphs, num_glyphs, cairo_glyph_t);
for (i = 1; i < items; i++)
glyphs[i - 1] = *SvCairoGlyph (ST (i));
cairo_glyph_extents (cr, glyphs, num_glyphs, &extents);
RETVAL = &extents;
Safefree (glyphs);
OUTPUT:
RETVAL
void cairo_text_path (cairo_t * cr, const char * utf8);
##void cairo_glyph_path (cairo_t * cr, cairo_glyph_t * glyphs, int num_glyphs);
void cairo_glyph_path (cairo_t * cr, ...)
PREINIT:
cairo_glyph_t * glyphs = NULL;
int num_glyphs, i;
CODE:
num_glyphs = items - 1;
Newz (0, glyphs, num_glyphs, cairo_glyph_t);
for (i = 1; i < items; i++)
glyphs[i - 1] = *SvCairoGlyph (ST (i));
cairo_glyph_path (cr, glyphs, num_glyphs);
Safefree (glyphs);
cairo_operator_t cairo_get_operator (cairo_t *cr);
cairo_pattern_t * cairo_get_source (cairo_t *cr);
double cairo_get_tolerance (cairo_t *cr);
cairo_antialias_t cairo_get_antialias (cairo_t *cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
cairo_bool_t cairo_has_current_point (cairo_t *cr);
#endif
void cairo_get_current_point (cairo_t *cr, OUTLIST double x, OUTLIST double y);
cairo_fill_rule_t cairo_get_fill_rule (cairo_t *cr);
double cairo_get_line_width (cairo_t *cr);
cairo_line_cap_t cairo_get_line_cap (cairo_t *cr);
cairo_line_join_t cairo_get_line_join (cairo_t *cr);
double cairo_get_miter_limit (cairo_t *cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
## int cairo_get_dash_count (cairo_t *cr);
## void cairo_get_dash (cairo_t *cr, double *dashes, double *offset);
void cairo_get_dash (cairo_t *cr)
PREINIT:
int count, i;
double *dashes, offset;
PPCODE:
count = cairo_get_dash_count (cr);
if (count == 0) {
dashes = NULL;
} else {
New (0, dashes, count, double);
if (!dashes)
croak ("malloc failure for (%d) elements", count);
}
cairo_get_dash (cr, dashes, &offset);
EXTEND (sp, count + 1);
PUSHs (sv_2mortal (newSVnv (offset)));
for (i = 0; i < count; i++)
PUSHs (sv_2mortal (newSVnv (dashes[i])));
Safefree (dashes);
#endif
##void cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
cairo_matrix_t * cairo_get_matrix (cairo_t *cr)
PREINIT:
cairo_matrix_t matrix;
CODE:
cairo_get_matrix (cr, &matrix);
RETVAL = cairo_perl_copy_matrix (&matrix);
OUTPUT:
RETVAL
cairo_surface_t * cairo_get_target (cairo_t *cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
cairo_surface_t * cairo_get_group_target (cairo_t *cr);
#endif
cairo_path_t * cairo_copy_path (cairo_t *cr);
cairo_path_t * cairo_copy_path_flat (cairo_t *cr);
void cairo_append_path (cairo_t *cr, cairo_path_t *path);
cairo_status_t cairo_status (cairo_t *cr);
# --------------------------------------------------------------------------- #
MODULE = Cairo PACKAGE = Cairo PREFIX = cairo_
bool
HAS_PS_SURFACE ()
CODE:
#ifdef CAIRO_HAS_PS_SURFACE
RETVAL = TRUE;
#else
RETVAL = FALSE;
#endif
OUTPUT:
RETVAL
bool
HAS_PDF_SURFACE ()
CODE:
#ifdef CAIRO_HAS_PDF_SURFACE
RETVAL = TRUE;
#else
RETVAL = FALSE;
#endif
OUTPUT:
RETVAL
bool
HAS_SVG_SURFACE ()
CODE:
#ifdef CAIRO_HAS_SVG_SURFACE
RETVAL = TRUE;
#else
RETVAL = FALSE;
#endif
OUTPUT:
RETVAL
bool
HAS_FT_FONT ()
CODE:
#ifdef CAIRO_HAS_FT_FONT
RETVAL = TRUE;
#else
RETVAL = FALSE;
#endif
OUTPUT:
RETVAL
bool
HAS_PNG_FUNCTIONS ()
CODE:
#ifdef CAIRO_HAS_PNG_FUNCTIONS
RETVAL = TRUE;
#else
RETVAL = FALSE;
#endif
OUTPUT:
RETVAL
|