Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
7f8e942d
Commit
7f8e942d
authored
Oct 07, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug #32822. Fixed an issue with saving grayscale jpeg images in pdf.
parent
a9509852
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
PdfWriter/PdfRenderer.cpp
PdfWriter/PdfRenderer.cpp
+2
-2
PdfWriter/Src/Image.cpp
PdfWriter/Src/Image.cpp
+16
-6
PdfWriter/Src/Image.h
PdfWriter/Src/Image.h
+3
-3
No files found.
PdfWriter/PdfRenderer.cpp
View file @
7f8e942d
...
...
@@ -1470,7 +1470,7 @@ PdfWriter::CImageDict* CPdfRenderer::LoadImage(Aggplus::CImage* pImage, const BY
pPdfImage
->
LoadSMask
(
pData
,
nImageW
,
nImageH
,
nAlpha
,
(
pImage
->
GetStride
()
>=
0
)
?
false
:
true
);
if
(
bJpeg
)
pPdfImage
->
LoadJpeg
(
pBuffer
,
nBufferSize
,
nImageW
,
nImageH
);
pPdfImage
->
LoadJpeg
(
pBuffer
,
nBufferSize
,
nImageW
,
nImageH
);
else
pPdfImage
->
LoadJpx
(
pBuffer
,
nBufferSize
,
nImageW
,
nImageH
);
...
...
@@ -1663,7 +1663,7 @@ void CPdfRenderer::UpdateBrush()
if
(
pImage
)
{
if
(
_CXIMAGE_FORMAT_JPG
==
oImageFormat
.
eFileType
)
pImage
->
LoadJpeg
(
wsTexturePath
.
c_str
(),
nImageW
,
nImageH
);
pImage
->
LoadJpeg
(
wsTexturePath
.
c_str
(),
nImageW
,
nImageH
,
oFrame
.
IsGrayScale
()
);
else
pImage
->
LoadJpx
(
wsTexturePath
.
c_str
(),
nImageW
,
nImageH
);
}
...
...
PdfWriter/Src/Image.cpp
View file @
7f8e942d
...
...
@@ -46,7 +46,7 @@ namespace PdfWriter
m_pXref
=
pXref
;
m_pDocument
=
pDocument
;
}
void
CImageDict
::
LoadJpeg
(
const
wchar_t
*
wsFilePath
,
unsigned
int
unWidth
,
unsigned
int
unHeight
)
void
CImageDict
::
LoadJpeg
(
const
wchar_t
*
wsFilePath
,
unsigned
int
unWidth
,
unsigned
int
unHeight
,
bool
bGrayScale
)
{
CImageFileStream
*
pStream
=
new
CImageFileStream
();
if
(
!
pStream
)
...
...
@@ -58,11 +58,16 @@ namespace PdfWriter
Add
(
"Subtype"
,
"Image"
);
Add
(
"Height"
,
unHeight
);
Add
(
"Width"
,
unWidth
);
Add
(
"ColorSpace"
,
"DeviceRGB"
);
if
(
bGrayScale
)
Add
(
"ColorSpace"
,
"DeviceGray"
);
else
Add
(
"ColorSpace"
,
"DeviceRGB"
);
Add
(
"BitsPerComponent"
,
8
);
SetFilter
(
STREAM_FILTER_DCT_DECODE
);
}
void
CImageDict
::
LoadJpeg
(
BYTE
*
pBuffer
,
int
nBufferSize
,
unsigned
int
unWidth
,
unsigned
int
unHeight
)
void
CImageDict
::
LoadJpeg
(
BYTE
*
pBuffer
,
int
nBufferSize
,
unsigned
int
unWidth
,
unsigned
int
unHeight
,
bool
bGrayScale
)
{
CMemoryStream
*
pStream
=
new
CMemoryStream
();
if
(
!
pStream
)
...
...
@@ -74,8 +79,13 @@ namespace PdfWriter
Add
(
"Subtype"
,
"Image"
);
Add
(
"Height"
,
unHeight
);
Add
(
"Width"
,
unWidth
);
Add
(
"ColorSpace"
,
"DeviceRGB"
);
Add
(
"BitsPerComponent"
,
8
);
if
(
bGrayScale
)
Add
(
"ColorSpace"
,
"DeviceGray"
);
else
Add
(
"ColorSpace"
,
"DeviceRGB"
);
Add
(
"BitsPerComponent"
,
8
);
SetFilter
(
STREAM_FILTER_DCT_DECODE
);
}
void
CImageDict
::
LoadJpx
(
const
wchar_t
*
wsFilePath
,
unsigned
int
unWidth
,
unsigned
int
unHeight
)
...
...
@@ -437,4 +447,4 @@ namespace PdfWriter
{
return
m_vImages
.
size
();
}
}
\ No newline at end of file
}
PdfWriter/Src/Image.h
View file @
7f8e942d
...
...
@@ -57,8 +57,8 @@ namespace PdfWriter
CImageDict
(
CXref
*
pXref
,
CDocument
*
pDocument
);
void
LoadJpeg
(
const
wchar_t
*
wsTempFile
,
unsigned
int
unWidth
,
unsigned
int
unHeight
);
void
LoadJpeg
(
BYTE
*
pBuffer
,
int
nBufferSize
,
unsigned
int
unWidth
,
unsigned
int
unHeight
);
void
LoadJpeg
(
const
wchar_t
*
wsTempFile
,
unsigned
int
unWidth
,
unsigned
int
unHeight
,
bool
bGrayScale
=
false
);
void
LoadJpeg
(
BYTE
*
pBuffer
,
int
nBufferSize
,
unsigned
int
unWidth
,
unsigned
int
unHeight
,
bool
bGrayScale
=
false
);
void
LoadJpx
(
const
wchar_t
*
wsTempFile
,
unsigned
int
unWidth
,
unsigned
int
unHeight
);
void
LoadJpx
(
BYTE
*
pBuffer
,
int
nBufferSize
,
unsigned
int
unWidth
,
unsigned
int
unHeight
);
void
LoadJb2
(
const
wchar_t
*
wsTempFile
,
unsigned
int
unWidth
,
unsigned
int
unHeight
);
...
...
@@ -98,4 +98,4 @@ namespace PdfWriter
};
}
#endif // _PDF_WRITER_SRC_IMAGE_H
\ No newline at end of file
#endif // _PDF_WRITER_SRC_IMAGE_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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