JBIG2 file viewer

This commit is contained in:
Jakub Melka
2019-10-29 19:34:22 +01:00
parent 489033c4ce
commit a60b13c3a0
8 changed files with 340 additions and 3 deletions

View File

@ -608,6 +608,11 @@ PDFJBIG2SegmentHeader PDFJBIG2SegmentHeader::read(PDFBitReader* reader)
return header;
}
PDFJBIG2Decoder::~PDFJBIG2Decoder()
{
}
PDFImageData PDFJBIG2Decoder::decode(PDFImageData::MaskingType maskingType)
{
for (const QByteArray* data : { &m_globalData, &m_data })
@ -1341,6 +1346,11 @@ PDFJBIG2Bitmap::PDFJBIG2Bitmap(int width, int height, uint8_t fill) :
m_data.resize(width * height, fill);
}
PDFJBIG2Bitmap::~PDFJBIG2Bitmap()
{
}
void PDFJBIG2Bitmap::paint(const PDFJBIG2Bitmap& bitmap, int offsetX, int offsetY, PDFJBIG2BitOperation operation, bool expandY, const uint8_t expandPixel)
{
if (!bitmap.isValid())
@ -1475,4 +1485,9 @@ uint32_t PDFJBIG2ArithmeticDecoderState::getQe(size_t context) const
return JBIG2_ARITHMETIC_DECODER_QE_VALUES[getQeRowIndex(context)].Qe;
}
PDFJBIG2Segment::~PDFJBIG2Segment()
{
}
} // namespace pdf

View File

@ -213,7 +213,7 @@ class PDFJBIG2Segment
{
public:
explicit inline PDFJBIG2Segment() = default;
virtual ~PDFJBIG2Segment() = default;
virtual ~PDFJBIG2Segment();
virtual const PDFJBIG2Bitmap* asBitmap() const { return nullptr; }
virtual PDFJBIG2Bitmap* asBitmap() { return nullptr; }
@ -243,12 +243,13 @@ private:
std::vector<PDFJBIG2HuffmanTableEntry> m_entries;
};
class PDFJBIG2Bitmap : public PDFJBIG2Segment
class PDFFORQTLIBSHARED_EXPORT PDFJBIG2Bitmap : public PDFJBIG2Segment
{
public:
explicit PDFJBIG2Bitmap();
explicit PDFJBIG2Bitmap(int width, int height);
explicit PDFJBIG2Bitmap(int width, int height, uint8_t fill);
virtual ~PDFJBIG2Bitmap() override;
virtual const PDFJBIG2Bitmap* asBitmap() const override { return this; }
virtual PDFJBIG2Bitmap* asBitmap() override { return this; }
@ -351,7 +352,7 @@ struct PDFJBIG2BitmapDecodingParameters
/// Decoder of JBIG2 data streams. Decodes the black/white monochrome image.
/// Handles also global segments. Decoder decodes data using the specification
/// ISO/IEC 14492:2001, T.88.
class PDFJBIG2Decoder
class PDFFORQTLIBSHARED_EXPORT PDFJBIG2Decoder
{
public:
explicit inline PDFJBIG2Decoder(QByteArray data, QByteArray globalData, PDFRenderErrorReporter* errorReporter) :
@ -368,6 +369,14 @@ public:
}
PDFJBIG2Decoder(const PDFJBIG2Decoder&) = delete;
PDFJBIG2Decoder(PDFJBIG2Decoder&&) = default;
PDFJBIG2Decoder& operator=(const PDFJBIG2Decoder&) = delete;
PDFJBIG2Decoder& operator=(PDFJBIG2Decoder&&) = default;
~PDFJBIG2Decoder();
/// Decodes image interpreting the data as JBIG2 data stream. If image cannot
/// be decoded, exception is thrown (or invalid PDFImageData is returned).
/// \param maskingType Image masking type