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
665783a6
Commit
665783a6
authored
Aug 07, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
palette alpha
parent
0b15c314
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
24 deletions
+48
-24
DesktopEditor/raster/BgraFrame.cpp
DesktopEditor/raster/BgraFrame.cpp
+38
-22
HtmlRenderer/test/main.cpp
HtmlRenderer/test/main.cpp
+10
-2
No files found.
DesktopEditor/raster/BgraFrame.cpp
View file @
665783a6
...
@@ -179,7 +179,7 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
...
@@ -179,7 +179,7 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
int
nStride
=
img
.
GetEffWidth
();
int
nStride
=
img
.
GetEffWidth
();
BYTE
*
pBuffer
=
img
.
GetBits
();
BYTE
*
pBuffer
=
img
.
GetBits
();
RGBQUAD
*
pPalette
=
img
.
GetPalette
();
RGBQUAD
*
pPalette
=
img
.
GetPalette
();
bool
bIsAlphaPalettePresent
=
false
;
//img.GetPaletteAlpha
Enabled();
bool
bIsAlphaPalettePresent
=
img
.
AlphaPaletteIs
Enabled
();
bool
bIsAlphaApplied
=
false
;
bool
bIsAlphaApplied
=
false
;
if
(
1
==
nBitsPerPixel
)
if
(
1
==
nBitsPerPixel
)
...
@@ -263,6 +263,10 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
...
@@ -263,6 +263,10 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
BYTE
*
src
=
pBuffer
;
BYTE
*
src
=
pBuffer
;
BYTE
*
dst
=
pPixels
;
BYTE
*
dst
=
pPixels
;
int
nTransIndex
=
img
.
GetTransIndex
();
if
(
bIsAlphaApplied
)
nTransIndex
=
-
1
;
for
(
int
nRow
=
0
;
nRow
<
nHeight
;
++
nRow
,
src
+=
nStride
)
for
(
int
nRow
=
0
;
nRow
<
nHeight
;
++
nRow
,
src
+=
nStride
)
{
{
for
(
int
nPos
=
0
;
nPos
<
nWidth
;
++
nPos
,
dst
+=
4
)
for
(
int
nPos
=
0
;
nPos
<
nWidth
;
++
nPos
,
dst
+=
4
)
...
@@ -271,8 +275,21 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
...
@@ -271,8 +275,21 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
dst
[
0
]
=
pPalette
[
index
].
rgbBlue
;
dst
[
0
]
=
pPalette
[
index
].
rgbBlue
;
dst
[
1
]
=
pPalette
[
index
].
rgbGreen
;
dst
[
1
]
=
pPalette
[
index
].
rgbGreen
;
dst
[
2
]
=
pPalette
[
index
].
rgbRed
;
dst
[
2
]
=
pPalette
[
index
].
rgbRed
;
if
(
bIsAlphaPalettePresent
)
dst
[
3
]
=
pPalette
[
index
].
rgbReserved
;
else
if
(
-
1
!=
nTransIndex
)
{
if
(
index
==
nTransIndex
)
dst
[
3
]
=
pPalette
[
index
].
rgbReserved
;
else
dst
[
3
]
=
255
;
}
}
}
}
}
if
(
-
1
!=
nTransIndex
||
bIsAlphaPalettePresent
)
bIsAlphaApplied
=
true
;
}
}
else
else
if
(
8
==
nBitsPerPixel
)
if
(
8
==
nBitsPerPixel
)
...
@@ -282,36 +299,35 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
...
@@ -282,36 +299,35 @@ void CBgraFrame::CxImageToMediaFrame( CxImage& img )
nStride
-=
nWidth
;
nStride
-=
nWidth
;
int
nTransIndex
=
img
.
GetTransIndex
();
if
(
bIsAlphaApplied
)
nTransIndex
=
-
1
;
if
(
pPalette
)
if
(
pPalette
)
{
{
if
(
bIsAlphaPalettePresent
)
for
(
int
nRow
=
0
;
nRow
<
nHeight
;
++
nRow
,
src
+=
nStride
)
{
{
for
(
int
n
Row
=
0
;
nRow
<
nHeight
;
++
nRow
,
src
+=
nStride
)
for
(
int
n
Pos
=
0
;
nPos
<
nWidth
;
++
nPos
,
src
+=
1
,
dst
+=
4
)
{
{
for
(
int
nPos
=
0
;
nPos
<
nWidth
;
++
nPos
,
src
+=
1
,
dst
+=
4
)
int
index
=
src
[
0
];
{
dst
[
0
]
=
pPalette
[
index
].
rgbBlue
;
int
index
=
src
[
0
]
;
dst
[
1
]
=
pPalette
[
index
].
rgbGreen
;
dst
[
0
]
=
pPalette
[
index
].
rgbBlue
;
dst
[
2
]
=
pPalette
[
index
].
rgbRed
;
dst
[
1
]
=
pPalette
[
index
].
rgbGreen
;
dst
[
2
]
=
pPalette
[
index
].
rgbRed
;
if
(
bIsAlphaPalettePresent
)
dst
[
3
]
=
pPalette
[
index
].
rgbReserved
;
dst
[
3
]
=
pPalette
[
index
].
rgbReserved
;
}
else
if
(
-
1
!=
nTransIndex
)
}
bIsAlphaApplied
=
true
;
}
else
{
for
(
int
nRow
=
0
;
nRow
<
nHeight
;
++
nRow
,
src
+=
nStride
)
{
for
(
int
nPos
=
0
;
nPos
<
nWidth
;
++
nPos
,
src
+=
1
,
dst
+=
4
)
{
{
i
nt
index
=
src
[
0
];
i
f
(
index
==
nTransIndex
)
dst
[
0
]
=
pPalette
[
index
].
rgbBlue
;
dst
[
3
]
=
pPalette
[
index
].
rgbReserved
;
dst
[
1
]
=
pPalette
[
index
].
rgbGreen
;
else
dst
[
2
]
=
pPalette
[
index
].
rgbRed
;
dst
[
3
]
=
255
;
}
}
}
}
}
}
if
(
-
1
!=
nTransIndex
||
bIsAlphaPalettePresent
)
bIsAlphaApplied
=
true
;
}
}
else
else
{
{
...
...
HtmlRenderer/test/main.cpp
View file @
665783a6
...
@@ -41,15 +41,23 @@
...
@@ -41,15 +41,23 @@
#include "../include/ASCSVGWriter.h"
#include "../include/ASCSVGWriter.h"
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#define RASTER_TEST
//#define METAFILE_TEST
//#define METAFILE_TEST
//#define ONLINE_WORD_TO_PDF
//#define ONLINE_WORD_TO_PDF
//#define TO_PDF
//#define TO_PDF//#define TO_HTML_RENDERER
#define TO_HTML_RENDERER
//#define ONLY_TEXT
//#define ONLY_TEXT
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
#ifdef RASTER_TEST
CBgraFrame
oFrame
;
oFrame
.
OpenFile
(
L"D:
\\
22.png"
);
oFrame
.
SaveFile
(
L"D:
\\
oleg.png"
,
4
);
return
0
;
#endif
CApplicationFonts
oFonts
;
CApplicationFonts
oFonts
;
oFonts
.
Initialize
();
oFonts
.
Initialize
();
...
...
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