-
Notifications
You must be signed in to change notification settings - Fork 0
/
ColorSpace.xsi
45 lines (35 loc) · 1.15 KB
/
ColorSpace.xsi
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
MODULE = Graphics::MuPDF PACKAGE = Graphics::MuPDF::ColorSpace PREFIX = fz_
PROTOTYPES: DISABLE
NO_OUTPUT fz_colorspace* interface_ColorSpace_device( SV* self, Graphics__MuPDF__Context* context)
C_ARGS:
ctx
INIT:
fz_context* ctx = context->ctx;
fz_try( ctx ) {
INTERFACE:
fz_device_gray
fz_device_rgb
fz_device_bgr
fz_device_cmyk
fz_device_lab
POSTCALL:
} fz_catch( ctx ) {
MUPDF_CROAK(ctx);
}
fz_colorspace* cs = RETVAL;
Graphics__MuPDF__Internal* cs_internal;
Newx(cs_internal, 1, Graphics__MuPDF__Internal);
cs_internal->kind = ColorSpace;
Newx(cs_internal->colorspace, 1, Graphics__MuPDF__ColorSpace);
cs_internal->colorspace->ctx = ctx;
cs_internal->colorspace->cs = cs;
cs_internal->colorspace->ctx_sv = SvREFCNT_inc_simple_NN(context->ctx_sv);
_mupdf_attach_mg(self, cs_internal);
void DESTROY(SV* self)
CODE:
Graphics__MuPDF__Internal* internal = mupdf_get_object(self);
if( ColorSpace != internal->kind ) croak("Wrong magic: expected ColorSpace");
SvREFCNT_dec_NN(internal->colorspace->ctx_sv);
fz_drop_colorspace(internal->colorspace->ctx, internal->colorspace->cs);
Safefree(internal->colorspace);
Safefree(internal);