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
15ebd84d
Commit
15ebd84d
authored
May 08, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
May 10, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement bitmap color keying.
parent
d2a01883
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
3 deletions
+101
-3
graphics.c
dlls/gdiplus/graphics.c
+30
-3
image.c
dlls/gdiplus/tests/image.c
+71
-0
No files found.
dlls/gdiplus/graphics.c
View file @
15ebd84d
...
...
@@ -2083,9 +2083,36 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if
(
imageAttributes
->
colorkeys
[
ColorAdjustTypeBitmap
].
enabled
||
imageAttributes
->
colorkeys
[
ColorAdjustTypeDefault
].
enabled
)
{
static
int
fixme
;
if
(
!
fixme
++
)
FIXME
(
"Color keying not implemented
\n
"
);
const
struct
color_key
*
key
;
BYTE
min_blue
,
min_green
,
min_red
;
BYTE
max_blue
,
max_green
,
max_red
;
if
(
imageAttributes
->
colorkeys
[
ColorAdjustTypeBitmap
].
enabled
)
key
=
&
imageAttributes
->
colorkeys
[
ColorAdjustTypeBitmap
];
else
key
=
&
imageAttributes
->
colorkeys
[
ColorAdjustTypeDefault
];
min_blue
=
key
->
low
&
0xff
;
min_green
=
(
key
->
low
>>
8
)
&
0xff
;
min_red
=
(
key
->
low
>>
16
)
&
0xff
;
max_blue
=
key
->
high
&
0xff
;
max_green
=
(
key
->
high
>>
8
)
&
0xff
;
max_red
=
(
key
->
high
>>
16
)
&
0xff
;
for
(
x
=
dst_area
.
left
;
x
<
dst_area
.
right
;
x
++
)
for
(
y
=
dst_area
.
top
;
y
<
dst_area
.
bottom
;
y
++
)
{
ARGB
*
src_color
;
BYTE
blue
,
green
,
red
;
src_color
=
(
ARGB
*
)(
data
+
stride
*
(
y
-
dst_area
.
top
)
+
sizeof
(
ARGB
)
*
(
x
-
dst_area
.
left
));
blue
=
*
src_color
&
0xff
;
green
=
(
*
src_color
>>
8
)
&
0xff
;
red
=
(
*
src_color
>>
16
)
&
0xff
;
if
(
blue
>=
min_blue
&&
green
>=
min_green
&&
red
>=
min_red
&&
blue
<=
max_blue
&&
green
<=
max_green
&&
red
<=
max_red
)
*
src_color
=
0x00000000
;
}
}
if
(
imageAttributes
->
colorremaptables
[
ColorAdjustTypeBitmap
].
enabled
||
...
...
dlls/gdiplus/tests/image.c
View file @
15ebd84d
...
...
@@ -1999,6 +1999,76 @@ static void test_remaptable(void)
GdipFree
(
map
);
}
static
void
test_colorkey
(
void
)
{
GpStatus
stat
;
GpImageAttributes
*
imageattr
;
GpBitmap
*
bitmap1
,
*
bitmap2
;
GpGraphics
*
graphics
;
ARGB
color
;
stat
=
GdipSetImageAttributesColorKeys
(
NULL
,
ColorAdjustTypeDefault
,
TRUE
,
0xff405060
,
0xff708090
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipCreateImageAttributes
(
&
imageattr
);
expect
(
Ok
,
stat
);
stat
=
GdipSetImageAttributesColorKeys
(
imageattr
,
ColorAdjustTypeCount
,
TRUE
,
0xff405060
,
0xff708090
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipSetImageAttributesColorKeys
(
imageattr
,
ColorAdjustTypeAny
,
TRUE
,
0xff405060
,
0xff708090
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipSetImageAttributesColorKeys
(
imageattr
,
ColorAdjustTypeDefault
,
TRUE
,
0xff405060
,
0xff708090
);
expect
(
Ok
,
stat
);
stat
=
GdipCreateBitmapFromScan0
(
2
,
2
,
0
,
PixelFormat32bppARGB
,
NULL
,
&
bitmap1
);
expect
(
Ok
,
stat
);
stat
=
GdipCreateBitmapFromScan0
(
2
,
2
,
0
,
PixelFormat32bppARGB
,
NULL
,
&
bitmap2
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap1
,
0
,
0
,
0x20405060
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap1
,
0
,
1
,
0x40506070
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap1
,
1
,
0
,
0x60708090
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap1
,
1
,
1
,
0xffffffff
);
expect
(
Ok
,
stat
);
stat
=
GdipGetImageGraphicsContext
((
GpImage
*
)
bitmap2
,
&
graphics
);
expect
(
Ok
,
stat
);
stat
=
GdipDrawImageRectRectI
(
graphics
,
(
GpImage
*
)
bitmap1
,
0
,
0
,
2
,
2
,
0
,
0
,
2
,
2
,
UnitPixel
,
imageattr
,
NULL
,
NULL
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapGetPixel
(
bitmap2
,
0
,
0
,
&
color
);
expect
(
Ok
,
stat
);
ok
(
color_match
(
0x00000000
,
color
,
1
),
"Expected ffff00ff, got %.8x
\n
"
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap2
,
0
,
1
,
&
color
);
expect
(
Ok
,
stat
);
ok
(
color_match
(
0x00000000
,
color
,
1
),
"Expected ffff00ff, got %.8x
\n
"
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap2
,
1
,
0
,
&
color
);
expect
(
Ok
,
stat
);
ok
(
color_match
(
0x00000000
,
color
,
1
),
"Expected ffff00ff, got %.8x
\n
"
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap2
,
1
,
1
,
&
color
);
expect
(
Ok
,
stat
);
ok
(
color_match
(
0xffffffff
,
color
,
1
),
"Expected ffff00ff, got %.8x
\n
"
,
color
);
GdipDeleteGraphics
(
graphics
);
GdipDisposeImage
((
GpImage
*
)
bitmap1
);
GdipDisposeImage
((
GpImage
*
)
bitmap2
);
GdipDisposeImageAttributes
(
imageattr
);
}
START_TEST
(
image
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -2036,6 +2106,7 @@ START_TEST(image)
test_multiframegif
();
test_rotateflip
();
test_remaptable
();
test_colorkey
();
GdiplusShutdown
(
gdiplusToken
);
}
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