MCPcopy Create free account
hub / github.com/TeXworks/texworks / toColor

Function toColor

modules/QtPDF/src/backends/MuPDFBackend.cpp:47–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47QColor toColor(fz_obj * o)
48{
49 if (!fz_is_array(o))
50 return QColor();
51
52 // No color = transparent
53 if (fz_array_len(o) == 0)
54 return QColor(0, 0, 0, 0);
55
56 // DeviceGray
57 if (fz_array_len(o) == 1)
58 return QColor::fromRgbF(fz_to_real(fz_array_get(o, 0)), fz_to_real(fz_array_get(o, 0)), fz_to_real(fz_array_get(o, 0)));
59
60 // DeviceRGB
61 if (fz_array_len(o) == 3)
62 return QColor::fromRgbF(fz_to_real(fz_array_get(o, 0)), fz_to_real(fz_array_get(o, 1)), fz_to_real(fz_array_get(o, 2)));
63
64 // DeviceCMYK
65 if (fz_array_len(o) == 4)
66 return QColor::fromCmykF(fz_to_real(fz_array_get(o, 0)), fz_to_real(fz_array_get(o, 1)), fz_to_real(fz_array_get(o, 2)), fz_to_real(fz_array_get(o, 3)));
67
68 return QColor();
69}
70
71// TODO: Find a better place to put this
72PDFDestination toPDFDestination(pdf_xref * xref, fz_obj * dest)

Callers 1

initPDFAnnotationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected