Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
75841d83
Commit
75841d83
authored
Mar 10, 2008
by
Nathan Beckmann
Committed by
Alexandre Julliard
Mar 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement BMP encoding.
Implement the encoding function for GDI+ images so that GdipSaveImageToStream can encode images as BMP files.
parent
9475e3f5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
3 deletions
+45
-3
image.c
dlls/gdiplus/image.c
+45
-1
image.c
dlls/gdiplus/tests/image.c
+0
-2
No files found.
dlls/gdiplus/image.c
View file @
75841d83
...
...
@@ -838,10 +838,54 @@ GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filenam
* Encoding functions -
* These functions encode an image in different image file formats.
*/
#define BITMAP_FORMAT_BMP 0x4d42
/* "BM" */
#define BITMAP_FORMAT_JPEG 0xd8ff
#define BITMAP_FORMAT_GIF 0x4947
#define BITMAP_FORMAT_PNG 0x5089
#define BITMAP_FORMAT_APM 0xcdd7
static
GpStatus
encode_image_BMP
(
LPVOID
bitmap_bits
,
LPBITMAPINFO
bitmap_info
,
void
**
output
,
unsigned
int
*
output_size
)
{
return
NotImplemented
;
int
num_palette_entries
;
BITMAPFILEHEADER
*
bmp_file_hdr
;
BITMAPINFO
*
bmp_info_hdr
;
if
(
bitmap_info
->
bmiHeader
.
biClrUsed
)
{
num_palette_entries
=
bitmap_info
->
bmiHeader
.
biClrUsed
;
if
(
num_palette_entries
>
256
)
num_palette_entries
=
256
;
}
else
{
if
(
bitmap_info
->
bmiHeader
.
biBitCount
<=
8
)
num_palette_entries
=
1
<<
bitmap_info
->
bmiHeader
.
biBitCount
;
else
num_palette_entries
=
0
;
}
*
output_size
=
sizeof
(
BITMAPFILEHEADER
)
+
sizeof
(
BITMAPINFOHEADER
)
+
num_palette_entries
*
sizeof
(
RGBQUAD
)
+
bitmap_info
->
bmiHeader
.
biSizeImage
;
*
output
=
GdipAlloc
(
*
output_size
);
bmp_file_hdr
=
(
BITMAPFILEHEADER
*
)
*
output
;
bmp_file_hdr
->
bfType
=
BITMAP_FORMAT_BMP
;
bmp_file_hdr
->
bfSize
=
*
output_size
;
bmp_file_hdr
->
bfOffBits
=
sizeof
(
BITMAPFILEHEADER
)
+
sizeof
(
BITMAPINFOHEADER
)
+
num_palette_entries
*
sizeof
(
RGBQUAD
);
bmp_info_hdr
=
(
BITMAPINFO
*
)
((
unsigned
char
*
)(
*
output
)
+
sizeof
(
BITMAPFILEHEADER
));
memcpy
(
bmp_info_hdr
,
bitmap_info
,
sizeof
(
BITMAPINFOHEADER
)
+
num_palette_entries
*
sizeof
(
RGBQUAD
));
memcpy
((
unsigned
char
*
)(
*
output
)
+
sizeof
(
BITMAPFILEHEADER
)
+
sizeof
(
BITMAPINFOHEADER
)
+
num_palette_entries
*
sizeof
(
RGBQUAD
),
bitmap_bits
,
bitmap_info
->
bmiHeader
.
biSizeImage
);
return
Ok
;
}
typedef
GpStatus
encode_image_func
(
LPVOID
bitmap_bits
,
LPBITMAPINFO
bitmap_info
,
...
...
dlls/gdiplus/tests/image.c
View file @
75841d83
...
...
@@ -159,10 +159,8 @@ static void test_SavingImages(void)
stat
=
GdipGetImageEncoders
(
n
,
s
,
codecs
);
if
(
stat
!=
Ok
)
goto
cleanup
;
todo_wine
{
stat
=
GdipSaveImageToFile
((
GpImage
*
)
bm
,
filename
,
&
codecs
[
0
].
Clsid
,
0
);
expect
(
stat
,
Ok
);
}
cleanup:
if
(
codecs
)
...
...
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