Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
1364b9d2
Commit
1364b9d2
authored
Nov 13, 2022
by
Volker Krause
Browse files
Implement PDF image mask loading
parent
b1b1777a
Pipeline
#266848
passed with stage
in 4 minutes and 25 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/pdf/pdfimage.cpp
View file @
1364b9d2
...
...
@@ -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
()));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment