| 1 |
|
| MODULE = PDF::Make PACKAGE = PDF::Make::Color |
| 2 |
|
| PROTOTYPES: ENABLE |
| 3 |
|
| |
| 4 |
|
| SV * |
| 5 |
|
| srgb(class) |
| 6 |
|
| char *class |
| 7 |
|
| CODE: |
| 8 |
|
| PERL_UNUSED_VAR(class); |
| 9 |
7 |
| pdfmake_colorspace_t *cs = pdfmake_cs_srgb(NULL); |
| 10 |
7 |
▶ | if (!cs) croak("PDF::Make::Color: failed to create sRGB"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!cs) croak("PDF::Make::Color: failed to create sRGB"); |
0 |
7 |
7 |
|
| 11 |
7 |
| RETVAL = sv_newmortal(); |
| 12 |
7 |
| sv_setref_pv(RETVAL, "PDF::Make::Color", (void *)cs); |
| 13 |
7 |
| SvREFCNT_inc(RETVAL); |
| 14 |
|
| OUTPUT: |
| 15 |
|
| RETVAL |
| 16 |
|
| |
| 17 |
|
| SV * |
| 18 |
|
| separation(class, spot_name, c, m, y, k) |
| 19 |
|
| char *class |
| 20 |
|
| const char *spot_name |
| 21 |
|
| double c |
| 22 |
|
| double m |
| 23 |
|
| double y |
| 24 |
|
| double k |
| 25 |
|
| CODE: |
| 26 |
|
| PERL_UNUSED_VAR(class); |
| 27 |
6 |
| pdfmake_colorspace_t *cs = pdfmake_cs_separation(NULL, spot_name, c, m, y, k); |
| 28 |
6 |
▶ | if (!cs) croak("PDF::Make::Color: failed to create separation"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!cs) croak("PDF::Make::Color: failed to create separation"); |
0 |
6 |
6 |
|
| 29 |
6 |
| RETVAL = sv_newmortal(); |
| 30 |
6 |
| sv_setref_pv(RETVAL, "PDF::Make::Color", (void *)cs); |
| 31 |
6 |
| SvREFCNT_inc(RETVAL); |
| 32 |
|
| OUTPUT: |
| 33 |
|
| RETVAL |
| 34 |
|
| |
| 35 |
|
| const char * |
| 36 |
|
| name(self) |
| 37 |
|
| pdfmake_colorspace_t *self |
| 38 |
|
| CODE: |
| 39 |
5 |
| RETVAL = self->name; |
| 40 |
|
| OUTPUT: |
| 41 |
|
| RETVAL |
| 42 |
|
| |
| 43 |
|
| IV |
| 44 |
|
| components(self) |
| 45 |
|
| pdfmake_colorspace_t *self |
| 46 |
|
| CODE: |
| 47 |
6 |
▶ | RETVAL = self->components; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = self->components; |
2 |
4 |
6 |
|
| 48 |
|
| OUTPUT: |
| 49 |
|
| RETVAL |
| 50 |
|
| |
| 51 |
|
| UV |
| 52 |
|
| write_to_doc(self, doc) |
| 53 |
|
| pdfmake_colorspace_t *self |
| 54 |
|
| pdfmake_doc_t *doc |
| 55 |
|
| CODE: |
| 56 |
7 |
▶ | RETVAL = pdfmake_cs_write(self, doc); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pdfmake_cs_write(self, doc); |
3 |
4 |
7 |
|
| 57 |
|
| OUTPUT: |
| 58 |
|
| RETVAL |
| 59 |
|
| |
| 60 |
|
| void |
| 61 |
|
| rgb_to_cmyk(class, r, g, b) |
| 62 |
|
| char *class |
| 63 |
|
| double r |
| 64 |
|
| double g |
| 65 |
|
| double b |
| 66 |
|
| PREINIT: |
| 67 |
|
| double c, m, y, k; |
| 68 |
|
| PPCODE: |
| 69 |
|
| PERL_UNUSED_VAR(class); |
| 70 |
3 |
| pdfmake_rgb_to_cmyk(r, g, b, &c, &m, &y, &k); |
| 71 |
3 |
▶ | EXTEND(SP, 4); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 4); |
0 |
3 |
3 |
|
| 72 |
3 |
| PUSHs(sv_2mortal(newSVnv(c))); |
| 73 |
3 |
| PUSHs(sv_2mortal(newSVnv(m))); |
| 74 |
3 |
| PUSHs(sv_2mortal(newSVnv(y))); |
| 75 |
3 |
| PUSHs(sv_2mortal(newSVnv(k))); |
| 76 |
|
| |
| 77 |
|
| void |
| 78 |
|
| cmyk_to_rgb(class, c, m, y, k) |
| 79 |
|
| char *class |
| 80 |
|
| double c |
| 81 |
|
| double m |
| 82 |
|
| double y |
| 83 |
|
| double k |
| 84 |
|
| PREINIT: |
| 85 |
|
| double r, g, b; |
| 86 |
|
| PPCODE: |
| 87 |
|
| PERL_UNUSED_VAR(class); |
| 88 |
4 |
| pdfmake_cmyk_to_rgb(c, m, y, k, &r, &g, &b); |
| 89 |
4 |
▶ | EXTEND(SP, 3); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 3); |
0 |
4 |
4 |
|
| 90 |
4 |
| PUSHs(sv_2mortal(newSVnv(r))); |
| 91 |
4 |
| PUSHs(sv_2mortal(newSVnv(g))); |
| 92 |
4 |
| PUSHs(sv_2mortal(newSVnv(b))); |
| 93 |
|
| |
| 94 |
|
| void |
| 95 |
|
| hex_to_rgb(class, hex) |
| 96 |
|
| char *class |
| 97 |
|
| const char *hex |
| 98 |
|
| PREINIT: |
| 99 |
|
| double r, g, b; |
| 100 |
|
| PPCODE: |
| 101 |
|
| PERL_UNUSED_VAR(class); |
| 102 |
5 |
▶ | if (pdfmake_hex_to_rgb(hex, &r, &g, &b) != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (pdfmake_hex_to_rgb(hex, &r, &g, &b) != 0) |
1 |
4 |
5 |
|
| 103 |
1 |
| croak("PDF::Make::Color: invalid hex color '%s'", hex); |
| 104 |
4 |
▶ | EXTEND(SP, 3); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 3); |
0 |
4 |
4 |
|
| 105 |
4 |
| PUSHs(sv_2mortal(newSVnv(r))); |
| 106 |
4 |
| PUSHs(sv_2mortal(newSVnv(g))); |
| 107 |
4 |
| PUSHs(sv_2mortal(newSVnv(b))); |
| 108 |
|
| |
| 109 |
|
| void |
| 110 |
|
| DESTROY(self) |
| 111 |
|
| pdfmake_colorspace_t *self |
| 112 |
|
| CODE: |
| 113 |
13 |
| pdfmake_cs_free(self); |
| 114 |
|
| |
| 115 |
|
| BOOT: |
| 116 |
|
| { |
| 117 |
104 |
| HV *stash = gv_stashpv("PDF::Make::Color", GV_ADD); |
| 118 |
104 |
▶ | PDFMAKE_REGISTER_GETTER(stash, "name", pdfmake_colorspace_t, name, PDFMAKE_FIELD_STRING); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_GETTER(stash, "name", pdfmake_colorspace_t, name, PDFMAKE_FIELD_STRING); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_GETTER(stash, "name", pdfmake_colorspace_t, name, PDFMAKE_FIELD_STRING); |
104 |
0 |
104 |
|
| 119 |
104 |
▶ | PDFMAKE_REGISTER_GETTER(stash, "components", pdfmake_colorspace_t, components, PDFMAKE_FIELD_INT); |
Branch: 2 branches
| Branch | True | False | Total |
| PDFMAKE_REGISTER_GETTER(stash, "components", pdfmake_colorspace_t, components, PDFMAKE_FIELD_INT); |
104 |
0 |
104 |
| PDFMAKE_REGISTER_GETTER(stash, "components", pdfmake_colorspace_t, components, PDFMAKE_FIELD_INT); |
104 |
0 |
104 |
|
| 120 |
|
| } |