Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:26:10

0001 //========================================================================
0002 //
0003 // PNGWriter.h
0004 //
0005 // This file is licensed under the GPLv2 or later
0006 //
0007 // Copyright (C) 2009 Warren Toomey <wkt@tuhs.org>
0008 // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com>
0009 // Copyright (C) 2009, 2011-2013, 2021, 2022 Albert Astals Cid <aacid@kde.org>
0010 // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
0011 // Copyright (C) 2010, 2011, 2013, 2017 Adrian Johnson <ajohnson@redneon.com>
0012 // Copyright (C) 2012 Pino Toscano <pino@kde.org>
0013 //
0014 //========================================================================
0015 
0016 #ifndef PNGWRITER_H
0017 #define PNGWRITER_H
0018 
0019 #include "poppler-config.h"
0020 #include "poppler_private_export.h"
0021 
0022 #ifdef ENABLE_LIBPNG
0023 
0024 #    include "ImgWriter.h"
0025 
0026 struct PNGWriterPrivate;
0027 
0028 class POPPLER_PRIVATE_EXPORT PNGWriter : public ImgWriter
0029 {
0030 public:
0031     /* RGB        - 3 bytes/pixel
0032      * RGBA       - 4 bytes/pixel
0033      * GRAY       - 1 byte/pixel
0034      * MONOCHROME - 8 pixels/byte
0035      * RGB48      - 6 bytes/pixel
0036      */
0037     enum Format
0038     {
0039         RGB,
0040         RGBA,
0041         GRAY,
0042         MONOCHROME,
0043         RGB48
0044     };
0045 
0046     explicit PNGWriter(Format format = RGB);
0047     ~PNGWriter() override;
0048 
0049     PNGWriter(const PNGWriter &other) = delete;
0050     PNGWriter &operator=(const PNGWriter &other) = delete;
0051 
0052     void setICCProfile(const char *name, unsigned char *data, int size);
0053     void setSRGBProfile();
0054 
0055     bool init(FILE *f, int width, int height, double hDPI, double vDPI) override;
0056 
0057     bool writePointers(unsigned char **rowPointers, int rowCount) override;
0058     bool writeRow(unsigned char **row) override;
0059 
0060     bool close() override;
0061 
0062 private:
0063     PNGWriterPrivate *priv;
0064 };
0065 
0066 #endif
0067 
0068 #endif