Commit 1364b9d2 authored by Volker Krause's avatar Volker Krause
Browse files

Implement PDF image mask loading

parent b1b1777a
Pipeline #266848 passed with stage
in 4 minutes and 25 seconds
......@@ -80,6 +80,22 @@ static inline bool isColor(GfxRGB rgb)
QImage PdfImagePrivate::load(Stream* str, GfxImageColorMap* colorMap)
{
if (m_format == QImage::Format_Mono) { // bitmasks are not stored as image streams
auto img = QImage(m_sourceWidth, m_sourceHeight, QImage::Format_Mono); // TODO implicit Format_Grayscale8 conversion
str->reset();
const int rowSize = (m_sourceWidth + 7) / 8;
for (int y = 0; y < m_sourceHeight; ++y) {
auto imgData = img.scanLine(y);
for (int x = 0; x < rowSize; x++) {
const auto c = str->getChar();
*imgData++ = c ^ 0xff;
}
}
m_page->m_doc->m_imageData[m_ref] = img;
return img;
}
auto img = QImage(m_sourceWidth, m_sourceHeight, (m_loadingHints & PdfImage::ConvertToGrayscaleHint) ? QImage::Format_Grayscale8 : m_format);
const auto bytesPerPixel = colorMap->getNumPixelComps();
std::unique_ptr<ImageStream> imgStream(new ImageStream(str, m_sourceWidth, bytesPerPixel, colorMap->getBits()));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment