move win32 font support in a new directory, and use Imager::Probe
[imager.git] / TIFF / TIFF.xs
CommitLineData
e5ee047b
TC
1#define PERL_NO_GET_CONTEXT
2#ifdef __cplusplus
3extern "C" {
4#endif
5#include "EXTERN.h"
6#include "perl.h"
7#include "XSUB.h"
8#include "imext.h"
9#include "imperl.h"
10#include "imtiff.h"
11
12DEFINE_IMAGER_CALLBACKS;
13
14MODULE = Imager::File::TIFF PACKAGE = Imager::File::TIFF
15
16Imager::ImgRaw
17i_readtiff_wiol(ig, allow_incomplete=0, page=0)
18 Imager::IO ig
19 int allow_incomplete
20 int page
21
22void
23i_readtiff_multi_wiol(ig)
24 Imager::IO ig
25 PREINIT:
26 i_img **imgs;
27 int count;
28 int i;
29 PPCODE:
30 imgs = i_readtiff_multi_wiol(ig, &count);
31 if (imgs) {
32 EXTEND(SP, count);
33 for (i = 0; i < count; ++i) {
34 SV *sv = sv_newmortal();
35 sv_setref_pv(sv, "Imager::ImgRaw", (void *)imgs[i]);
36 PUSHs(sv);
37 }
38 myfree(imgs);
39 }
40
41
42undef_int
43i_writetiff_wiol(im, ig)
44 Imager::ImgRaw im
45 Imager::IO ig
46
47undef_int
48i_writetiff_multi_wiol(ig, ...)
49 Imager::IO ig
50 PREINIT:
51 int i;
52 int img_count;
53 i_img **imgs;
54 CODE:
55 if (items < 2)
56 croak("Usage: i_writetiff_multi_wiol(ig, images...)");
57 img_count = items - 1;
58 RETVAL = 1;
59 if (img_count < 1) {
60 RETVAL = 0;
61 i_clear_error();
62 i_push_error(0, "You need to specify images to save");
63 }
64 else {
65 imgs = mymalloc(sizeof(i_img *) * img_count);
66 for (i = 0; i < img_count; ++i) {
67 SV *sv = ST(1+i);
68 imgs[i] = NULL;
69 if (SvROK(sv) && sv_derived_from(sv, "Imager::ImgRaw")) {
70 imgs[i] = INT2PTR(i_img *, SvIV((SV*)SvRV(sv)));
71 }
72 else {
73 i_clear_error();
74 i_push_error(0, "Only images can be saved");
75 myfree(imgs);
76 RETVAL = 0;
77 break;
78 }
79 }
80 if (RETVAL) {
81 RETVAL = i_writetiff_multi_wiol(ig, imgs, img_count);
82 }
83 myfree(imgs);
84 }
85 OUTPUT:
86 RETVAL
87
88undef_int
89i_writetiff_wiol_faxable(im, ig, fine)
90 Imager::ImgRaw im
91 Imager::IO ig
92 int fine
93
94undef_int
95i_writetiff_multi_wiol_faxable(ig, fine, ...)
96 Imager::IO ig
97 int fine
98 PREINIT:
99 int i;
100 int img_count;
101 i_img **imgs;
102 CODE:
103 if (items < 3)
104 croak("Usage: i_writetiff_multi_wiol_faxable(ig, fine, images...)");
105 img_count = items - 2;
106 RETVAL = 1;
107 if (img_count < 1) {
108 RETVAL = 0;
109 i_clear_error();
110 i_push_error(0, "You need to specify images to save");
111 }
112 else {
113 imgs = mymalloc(sizeof(i_img *) * img_count);
114 for (i = 0; i < img_count; ++i) {
115 SV *sv = ST(2+i);
116 imgs[i] = NULL;
117 if (SvROK(sv) && sv_derived_from(sv, "Imager::ImgRaw")) {
118 imgs[i] = INT2PTR(i_img *, SvIV((SV*)SvRV(sv)));
119 }
120 else {
121 i_clear_error();
122 i_push_error(0, "Only images can be saved");
123 myfree(imgs);
124 RETVAL = 0;
125 break;
126 }
127 }
128 if (RETVAL) {
129 RETVAL = i_writetiff_multi_wiol_faxable(ig, imgs, img_count, fine);
130 }
131 myfree(imgs);
132 }
133 OUTPUT:
134 RETVAL
135
136const char *
137i_tiff_libversion()
138
139bool
140i_tiff_has_compression(name)
141 const char *name
142
143
144BOOT:
145 PERL_INITIALIZE_IMAGER_CALLBACKS;