File: GdkCairo.xs

package info (click to toggle)
libgtk2-perl 2:1.2499-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,668 kB
  • ctags: 594
  • sloc: perl: 22,100; ansic: 122; makefile: 17
file content (140 lines) | stat: -rw-r--r-- 4,351 bytes parent folder | download | duplicates (5)
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
/*
 * Copyright (c) 2005, 2011 by the gtk2-perl team (see the file AUTHORS)
 *
 * Licensed under the LGPL, see LICENSE file for more information.
 *
 * $Id$
 */

#include "gtk2perl.h"
#include <cairo-perl.h>

MODULE = Gtk2::Gdk::Cairo	PACKAGE = Gtk2::Gdk::Cairo::Context	PREFIX = gdk_cairo_

=for position SYNOPSIS

=head1 HIERARCHY

    Cairo::Context
    +---- Gtk2::Gdk::Cairo::Context   (Perl subclass)

=head1 DESCRIPTION

This is some inter-operation between Cairo (see L<Cairo>) and Gdk
things.

A C<Gtk2::Gdk::Cairo::Context> lets Cairo draw on a Gdk drawable
(window or pixmap).  It's a Perl-level subclass of C<Cairo::Context>
and the various functions below can be used as methods on it.

The methods can also be used on other C<Cairo::Context> as plain
functions.  For example C<set_source_pixbuf> can setup to draw from a
C<Gtk2::Gdk::Pixbuf> to any Cairo context,

    my $cr = Cairo::Context->create ($surface);
    Gtk2::Gdk::Cairo::Context::set_source_pixbuf ($cr, $pixbuf, $x,$y);
    $cr->paint;

=cut

BOOT:
	gperl_set_isa ("Gtk2::Gdk::Cairo::Context", "Cairo::Context");

# cairo_t *gdk_cairo_create (GdkDrawable *drawable);
=for signature gdkcr = Gtk2::Gdk::Cairo::Context->create ($drawable)
=cut
SV *
gdk_cairo_create (class, GdkDrawable *drawable)
    PREINIT:
	cairo_t *cr;
    CODE:
	/* We own cr. */
	cr = gdk_cairo_create (drawable);
	RETVAL = newSV (0);
	sv_setref_pv (RETVAL, "Gtk2::Gdk::Cairo::Context", (void *) cr);
    OUTPUT:
	RETVAL

=for signature $gdkcr->set_source_color ($color)
=for signature Gtk2::Gdk::Cairo::Context::set_source_color ($anycr, $color)
=cut
void gdk_cairo_set_source_color (cairo_t *cr, GdkColor *color);

=for signature $gdkcr->set_source_pixbuf ($pixbuf, $pixbuf_x, $pixbuf_y)
=for signature Gtk2::Gdk::Cairo::Context::set_source_pixbuf ($anycr, $pixbuf, $pixbuf_x, $pixbuf_y)
=cut
void gdk_cairo_set_source_pixbuf (cairo_t *cr, GdkPixbuf *pixbuf, double pixbuf_x, double pixbuf_y);

# void gdk_cairo_rectangle (cairo_t *cr, GdkRectangle *rectangle);
=for apidoc
=for signature $gdkcr->rectangle ($rectangle)
=for signature $gdkcr->rectangle ($x, $y, $width, $height)
=for signature Gtk2::Gdk::Cairo::Context::rectangle ($anycr, $rectangle)
=for arg rectangle (Gtk2::Gdk::Rectangle)
=for arg cr (__hide__)
=for arg ... (__hide__)
The 4-argument x,y,width,height is the base L<Cairo::Context> style.  This
extends to also take a C<Gtk2::Gdk::Rectangle>.
=cut
void
gdk_cairo_rectangle (cairo_t *cr, ...)
    CODE:
	if (items == 2) {
		GdkRectangle *rect = SvGdkRectangle (ST (1));
		gdk_cairo_rectangle (cr, rect);
	} else if (items == 5) {
		double x = SvNV (ST(1));
		double y = SvNV (ST(2));
		double width = SvNV (ST(3));
		double height = SvNV (ST(4));
		cairo_rectangle (cr, x, y, width, height);
	} else {
		croak ("Usage: Gtk2::Gdk::Cairo::Context::rectangle (cr, rectangle)");
	}

=for signature $gdkcr->region ($region)
=for signature Gtk2::Gdk::Cairo::Context::region ($anycr, $region)
=cut
void gdk_cairo_region (cairo_t *cr, GdkRegion *region);

#if GTK_CHECK_VERSION (2, 10, 0)

=for signature $gdkcr->set_source_pixmap ($pixmap, $pixmap_x, $pixmap_y)
=for signature Gtk2::Gdk::Cairo::Context::set_source_pixmap ($anycr, $pixmap, $pixmap_x, $pixmap_y)
=cut
void gdk_cairo_set_source_pixmap (cairo_t *cr, GdkPixmap *pixmap, double pixmap_x, double pixmap_y);

#endif

#if GTK_CHECK_VERSION (2, 18, 0)

=for signature $gdkcr->reset_clip ($drawable)
=for signature Gtk2::Gdk::Cairo::Context::reset_clip ($anycr, $drawable)
=cut
void gdk_cairo_reset_clip (cairo_t *cr, GdkDrawable *drawable);

#endif

# ---------------------------------------------------------------------------- #

#if GTK_CHECK_VERSION (2, 10, 0)

MODULE = Gtk2::Gdk::Cairo	PACKAGE = Gtk2::Gdk::Screen	PREFIX = gdk_screen_

const cairo_font_options_t_ornull* gdk_screen_get_font_options (GdkScreen *screen);

void gdk_screen_set_font_options (GdkScreen *screen, const cairo_font_options_t_ornull *options);

#endif

# ---------------------------------------------------------------------------- #

MODULE = Gtk2::Gdk::Cairo	PACKAGE = Gtk2::Gdk::Window	PREFIX = gdk_window_

#if GTK_CHECK_VERSION (2, 22, 0)

cairo_surface_t * gdk_window_create_similar_surface (GdkWindow *window, cairo_content_t content, int width, int height);

cairo_pattern_t * gdk_window_get_background_pattern (GdkWindow *window);

#endif