| 1 | /** |
| 2 | * SPDX-FileCopyrightText: (C) 2010 Dominik Seichter <[email protected]> |
| 3 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | */ |
| 5 | |
| 6 | #ifndef _ICONVERTER_H_ |
| 7 | #define _ICONVERTER_H_ |
| 8 | |
| 9 | #include <podofo/podofo.h> |
| 10 | |
| 11 | /** |
| 12 | * Interface for a converter that can be used |
| 13 | * together with a ColorChanger object |
| 14 | * to convert colors in a PDF file. |
| 15 | */ |
| 16 | class IConverter { |
| 17 | |
| 18 | public: |
| 19 | IConverter(); |
| 20 | virtual ~IConverter(); |
| 21 | |
| 22 | /** |
| 23 | * A helper method that is called to inform the converter |
| 24 | * when a new page is analyzed. |
| 25 | * |
| 26 | * @param page page object |
| 27 | * @param nPageIndex index of the page in the document |
| 28 | */ |
| 29 | virtual void StartPage(PoDoFo::PdfPage& page, int pageIndex) = 0; |
| 30 | |
| 31 | /** |
| 32 | * A helper method that is called to inform the converter |
| 33 | * when a new page has been analyzed completely. |
| 34 | * |
| 35 | * @param page page object |
| 36 | * @param nPageIndex index of the page in the document |
| 37 | */ |
| 38 | virtual void EndPage(PoDoFo::PdfPage& page, int pageIndex) = 0; |
| 39 | |
| 40 | /** |
| 41 | * A helper method that is called to inform the converter |
| 42 | * when a new xobjext is analyzed. |
| 43 | * |
| 44 | * @param obj the xobject |
| 45 | */ |
| 46 | virtual void StartXObject(PoDoFo::PdfXObject& obj) = 0; |
| 47 | |
| 48 | /** |
| 49 | * A helper method that is called to inform the converter |
| 50 | * when a xobjext has been analyzed. |
| 51 | * |
| 52 | * @param obj the xobject |
| 53 | */ |
| 54 | virtual void EndXObject(PoDoFo::PdfXObject& obj) = 0; |
| 55 | |
| 56 | /** |
| 57 | * This method is called whenever a gray stroking color is set |
| 58 | * using the 'G' PDF command. |
| 59 | * |
| 60 | * @param a grayscale color object |
| 61 | * @returns a new color which should be set instead (any colorspace) |
| 62 | */ |
| 63 | virtual PoDoFo::PdfColor SetStrokingColorGray(const PoDoFo::PdfColor& color) = 0; |
| 64 | |
| 65 | /** |
| 66 | * This method is called whenever a RGB stroking color is set |
| 67 | * using the 'RG' PDF command. |
| 68 | * |
| 69 | * @param a RGB color object |
| 70 | * @returns a new color which should be set instead (any colorspace) |
| 71 | */ |
| 72 | virtual PoDoFo::PdfColor SetStrokingColorRGB(const PoDoFo::PdfColor& color) = 0; |
| 73 | |
| 74 | /** |
| 75 | * This method is called whenever a CMYK stroking color is set |
| 76 | * using the 'K' PDF command. |
| 77 | * |
| 78 | * @param a CMYK color object |
| 79 | * @returns a new color which should be set instead (any colorspace) |
| 80 | */ |
| 81 | virtual PoDoFo::PdfColor SetStrokingColorCMYK(const PoDoFo::PdfColor& color) = 0; |
| 82 | |
| 83 | /** |
| 84 | * This method is called whenever a gray non-stroking color is set |
| 85 | * using the 'g' PDF command. |
| 86 | * |
| 87 | * @param a grayscale color object |
| 88 | * @returns a new color which should be set instead (any colorspace) |
| 89 | */ |
| 90 | virtual PoDoFo::PdfColor SetNonStrokingColorGray(const PoDoFo::PdfColor& color) = 0; |
| 91 | |
| 92 | /** |
| 93 | * This method is called whenever a RGB non-stroking color is set |
| 94 | * using the 'rg' PDF command. |
| 95 | * |
| 96 | * @param a RGB color object |
| 97 | * @returns a new color which should be set instead (any colorspace) |
| 98 | */ |
| 99 | virtual PoDoFo::PdfColor SetNonStrokingColorRGB(const PoDoFo::PdfColor& color) = 0; |
| 100 | |
| 101 | /** |
| 102 | * This method is called whenever a CMYK non-stroking color is set |
| 103 | * using the 'k' PDF command. |
| 104 | * |
| 105 | * @param a CMYK color object |
| 106 | * @returns a new color which should be set instead (any colorspace) |
| 107 | */ |
| 108 | virtual PoDoFo::PdfColor SetNonStrokingColorCMYK(const PoDoFo::PdfColor& color) = 0; |
| 109 | |
| 110 | }; |
| 111 | |
| 112 | #endif // _ICONVERTER_H_ |