Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
5572fc57
Commit
5572fc57
authored
May 26, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/imagelist: Add support for 25% and 50% blending when using an alpha channel.
parent
7ea98f68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
imagelist.c
dlls/comctl32/imagelist.c
+36
-4
No files found.
dlls/comctl32/imagelist.c
View file @
5572fc57
...
...
@@ -1157,7 +1157,8 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
static
BOOL
alpha_blend_image
(
HIMAGELIST
himl
,
HDC
dest_dc
,
int
dest_x
,
int
dest_y
,
int
src_x
,
int
src_y
,
int
cx
,
int
cy
,
BLENDFUNCTION
func
)
int
src_x
,
int
src_y
,
int
cx
,
int
cy
,
BLENDFUNCTION
func
,
UINT
style
,
COLORREF
blend_col
)
{
BOOL
ret
=
FALSE
;
HDC
hdc
;
...
...
@@ -1184,6 +1185,30 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
SelectObject
(
hdc
,
bmp
);
BitBlt
(
hdc
,
0
,
0
,
cx
,
cy
,
himl
->
hdcImage
,
src_x
,
src_y
,
SRCCOPY
);
if
(
blend_col
!=
CLR_NONE
)
{
BYTE
r
=
GetRValue
(
blend_col
);
BYTE
g
=
GetGValue
(
blend_col
);
BYTE
b
=
GetBValue
(
blend_col
);
if
(
style
&
ILD_BLEND25
)
{
for
(
i
=
0
,
ptr
=
bits
;
i
<
cx
*
cy
;
i
++
,
ptr
++
)
*
ptr
=
((
*
ptr
&
0xff000000
)
|
((((
*
ptr
&
0x00ff0000
)
*
3
+
(
r
<<
16
))
/
4
)
&
0x00ff0000
)
|
((((
*
ptr
&
0x0000ff00
)
*
3
+
(
g
<<
8
))
/
4
)
&
0x0000ff00
)
|
((((
*
ptr
&
0x000000ff
)
*
3
+
(
b
<<
0
))
/
4
)
&
0x000000ff
));
}
else
if
(
style
&
ILD_BLEND50
)
{
for
(
i
=
0
,
ptr
=
bits
;
i
<
cx
*
cy
;
i
++
,
ptr
++
)
*
ptr
=
((
*
ptr
&
0xff000000
)
|
((((
*
ptr
&
0x00ff0000
)
+
(
r
<<
16
))
/
2
)
&
0x00ff0000
)
|
((((
*
ptr
&
0x0000ff00
)
+
(
g
<<
8
))
/
2
)
&
0x0000ff00
)
|
((((
*
ptr
&
0x000000ff
)
+
(
b
<<
0
))
/
2
)
&
0x000000ff
));
}
}
if
(
himl
->
uBitsPixel
==
32
)
/* we already have an alpha channel in this case */
{
/* pre-multiply by the alpha channel */
...
...
@@ -1302,9 +1327,16 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
has_alpha
=
(
himl
->
has_alpha
&&
himl
->
has_alpha
[
pimldp
->
i
]);
if
(
!
bMask
&&
(
has_alpha
||
(
fState
&
ILS_ALPHA
)))
{
COLORREF
colour
;
COLORREF
colour
,
blend_col
=
CLR_NONE
;
BLENDFUNCTION
func
;
if
(
bBlend
)
{
blend_col
=
pimldp
->
rgbFg
;
if
(
blend_col
==
CLR_DEFAULT
)
blend_col
=
GetSysColor
(
COLOR_HIGHLIGHT
);
else
if
(
blend_col
==
CLR_NONE
)
blend_col
=
GetTextColor
(
pimldp
->
hdcDst
);
}
func
.
BlendOp
=
AC_SRC_OVER
;
func
.
BlendFlags
=
0
;
func
.
SourceConstantAlpha
=
(
fState
&
ILS_ALPHA
)
?
pimldp
->
Frame
:
255
;
...
...
@@ -1313,7 +1345,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
if
(
bIsTransparent
)
{
bResult
=
alpha_blend_image
(
himl
,
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
);
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
,
fStyle
,
blend_col
);
goto
end
;
}
colour
=
pimldp
->
rgbBk
;
...
...
@@ -1322,7 +1354,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
hOldBrush
=
SelectObject
(
hImageDC
,
CreateSolidBrush
(
colour
));
PatBlt
(
hImageDC
,
0
,
0
,
cx
,
cy
,
PATCOPY
);
alpha_blend_image
(
himl
,
hImageDC
,
0
,
0
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
);
alpha_blend_image
(
himl
,
hImageDC
,
0
,
0
,
pt
.
x
,
pt
.
y
,
cx
,
cy
,
func
,
fStyle
,
blend_col
);
DeleteObject
(
SelectObject
(
hImageDC
,
hOldBrush
));
bResult
=
BitBlt
(
pimldp
->
hdcDst
,
pimldp
->
x
,
pimldp
->
y
,
cx
,
cy
,
hImageDC
,
0
,
0
,
SRCCOPY
);
goto
end
;
...
...
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