use non-deprecated encoding ids for freetype 2
[imager.git] / JPEG / JPEG.xs
1 #define PERL_NO_GET_CONTEXT
2 #ifdef __cplusplus
3 extern "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 "imjpeg.h"
11
12 DEFINE_IMAGER_CALLBACKS;
13
14 MODULE = Imager::File::JPEG  PACKAGE = Imager::File::JPEG
15
16 const char *
17 i_libjpeg_version()
18
19 undef_int
20 i_writejpeg_wiol(im, ig, qfactor)
21     Imager::ImgRaw     im
22         Imager::IO     ig
23                int     qfactor
24
25
26 void
27 i_readjpeg_wiol(ig)
28         Imager::IO     ig
29              PREINIT:
30               char*    iptc_itext;
31                int     tlength;
32              i_img*    rimg;
33                 SV*    r;
34              PPCODE:
35               iptc_itext = NULL;
36               rimg = i_readjpeg_wiol(ig,-1,&iptc_itext,&tlength);
37               if (iptc_itext == NULL) {
38                     r = sv_newmortal();
39                     EXTEND(SP,1);
40                     sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
41                     PUSHs(r);
42               } else {
43                     r = sv_newmortal();
44                     EXTEND(SP,2);
45                     sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
46                     PUSHs(r);
47                     PUSHs(sv_2mortal(newSVpv(iptc_itext,tlength)));
48                     myfree(iptc_itext);
49               }
50
51 BOOT:
52         PERL_INITIALIZE_IMAGER_CALLBACKS;