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
dce93479
Commit
dce93479
authored
Jul 18, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Retrieve image palette from WIC.
parent
894d1618
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
2 deletions
+53
-2
image.c
dlls/gdiplus/image.c
+53
-2
No files found.
dlls/gdiplus/image.c
View file @
dce93479
/*
* Copyright (C) 2007 Google (Evan Stade)
* Copyright (C) 2012 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -41,6 +42,46 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
#define PIXELFORMATBPP(x) ((x) ? ((x) >> 8) & 255 : 24)
static
ColorPalette
*
get_palette
(
IWICBitmapFrameDecode
*
frame
)
{
HRESULT
hr
;
IWICImagingFactory
*
factory
;
IWICPalette
*
wic_palette
;
ColorPalette
*
palette
=
NULL
;
hr
=
CoCreateInstance
(
&
CLSID_WICImagingFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICImagingFactory
,
(
void
**
)
&
factory
);
if
(
hr
!=
S_OK
)
return
NULL
;
hr
=
IWICImagingFactory_CreatePalette
(
factory
,
&
wic_palette
);
if
(
hr
==
S_OK
)
{
hr
=
IWICBitmapFrameDecode_CopyPalette
(
frame
,
wic_palette
);
if
(
hr
==
S_OK
)
{
UINT
count
;
BOOL
mono
,
gray
;
IWICPalette_IsBlackWhite
(
wic_palette
,
&
mono
);
IWICPalette_IsGrayscale
(
wic_palette
,
&
gray
);
IWICPalette_GetColorCount
(
wic_palette
,
&
count
);
palette
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
UINT
)
+
count
*
sizeof
(
ARGB
));
IWICPalette_GetColors
(
wic_palette
,
count
,
palette
->
Entries
,
&
palette
->
Count
);
if
(
mono
)
palette
->
Flags
=
0
;
else
if
(
gray
)
palette
->
Flags
=
PaletteFlagsGrayScale
;
else
palette
->
Flags
=
PaletteFlagsHalftone
;
}
IWICPalette_Release
(
wic_palette
);
}
IWICImagingFactory_Release
(
factory
);
return
palette
;
}
static
INT
ipicture_pixel_height
(
IPicture
*
pic
)
{
HDC
hdcref
;
...
...
@@ -2994,6 +3035,7 @@ static GpStatus decode_image_wic(IStream* stream, REFCLSID clsid, UINT active_fr
IWICMetadataBlockReader
*
block_reader
;
WICPixelFormatGUID
wic_format
;
PixelFormat
gdip_format
=
0
;
ColorPalette
*
palette
=
NULL
;
int
i
;
UINT
width
,
height
,
frame_count
;
BitmapData
lockeddata
;
...
...
@@ -3102,6 +3144,7 @@ static GpStatus decode_image_wic(IStream* stream, REFCLSID clsid, UINT active_fr
IWICMetadataBlockReader_Release
(
block_reader
);
}
palette
=
get_palette
(
frame
);
IWICBitmapFrameDecode_Release
(
frame
);
}
...
...
@@ -3119,8 +3162,16 @@ end:
bitmap
->
image
.
frame_count
=
frame_count
;
bitmap
->
image
.
current_frame
=
active_frame
;
bitmap
->
image
.
stream
=
stream
;
if
(
IsEqualGUID
(
&
wic_format
,
&
GUID_WICPixelFormatBlackWhite
))
bitmap
->
image
.
palette
->
Flags
=
0
;
if
(
palette
)
{
GdipFree
(
bitmap
->
image
.
palette
);
bitmap
->
image
.
palette
=
palette
;
}
else
{
if
(
IsEqualGUID
(
&
wic_format
,
&
GUID_WICPixelFormatBlackWhite
))
bitmap
->
image
.
palette
->
Flags
=
0
;
}
/* Pin the source stream */
IStream_AddRef
(
stream
);
}
...
...
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