1Imager::Inline(3) User Contributed Perl Documentation Imager::Inline(3)
2
3
4
6 Imager::Inline - using Imager with Inline::C.
7
9 use Inline with => 'Imager';
10 use Inline C => <<'EOS';
11 Imager some_func(Imager::Color c, Imager::Fill f) {
12 Imager img = i_img_8_new(200, 200, 3);
13 /* fill with color */
14 i_box_filled(img, 0, 0, 199, 199, c);
15 /* inner area with fill */
16 i_box_cfill(img, 50, 50, 149, 149, f);
17
18 return img;
19 }
20 EOS
21
23 Imager hooks into Inline's "with" syntax to make it easier to write
24 Inline::C code that works with Imager, you can call Imager functions
25 without having to include headers or perform initialization.
26
27 Imager's Inline "with" support does the following:
28
29 · add the installed Imager include directory to INC
30
31 · add the Imager typemap to TYPEMAPS
32
33 · include the headers needed by Imager C extension modules.
34
35 · declare and initialize the Imager API function table pointer
36
37 · filter the supplied code to replace Imager's class names with those
38 that Inline::C can handle.
39
41 The filtering mechanism is global, it will replace the class names even
42 inside string constants. If you need a string matching the name of one
43 of Imager's classes, like "Imager::Color" you will need to split it
44 into 2 to use C's string pasting mechanism, for example: "Imager:"
45 ":Color".
46
48 Tony Cook <tonyc@cpan.org>
49
51 $Revision$
52
54 Imager, Imager::ExtUtils, Imager::API, Imager::APIRef,
55 samples/inline_replace_color.pl
56
57
58
59perl v5.32.0 2020-07-28 Imager::Inline(3)