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
41140a95
Commit
41140a95
authored
Sep 23, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Sep 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement GdipBitmapGetPixel.
parent
e1cb4417
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
170 additions
and
16 deletions
+170
-16
image.c
dlls/gdiplus/image.c
+160
-6
image.c
dlls/gdiplus/tests/image.c
+10
-10
No files found.
dlls/gdiplus/image.c
View file @
41140a95
...
...
@@ -94,21 +94,175 @@ GpStatus WINGDIPAPI GdipBitmapCreateApplyEffect(GpBitmap** inputBitmaps,
return
NotImplemented
;
}
static
inline
void
getpixel_16bppGrayScale
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
r
=
*
g
=
*
b
=
row
[
x
*
2
+
1
];
*
a
=
255
;
}
static
inline
void
getpixel_16bppRGB555
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
WORD
pixel
=
*
((
WORD
*
)(
row
)
+
x
);
*
r
=
(
pixel
>>
7
&
0xf8
)
|
(
pixel
>>
12
&
0x7
);
*
g
=
(
pixel
>>
2
&
0xf8
)
|
(
pixel
>>
6
&
0x7
);
*
b
=
(
pixel
<<
3
&
0xf8
)
|
(
pixel
>>
2
&
0x7
);
*
a
=
255
;
}
static
inline
void
getpixel_16bppRGB565
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
WORD
pixel
=
*
((
WORD
*
)(
row
)
+
x
);
*
r
=
(
pixel
>>
8
&
0xf8
)
|
(
pixel
>>
13
&
0x7
);
*
g
=
(
pixel
>>
3
&
0xfc
)
|
(
pixel
>>
9
&
0x3
);
*
b
=
(
pixel
<<
3
&
0xf8
)
|
(
pixel
>>
2
&
0x7
);
*
a
=
255
;
}
static
inline
void
getpixel_16bppARGB1555
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
WORD
pixel
=
*
((
WORD
*
)(
row
)
+
x
);
*
r
=
(
pixel
>>
7
&
0xf8
)
|
(
pixel
>>
12
&
0x7
);
*
g
=
(
pixel
>>
2
&
0xf8
)
|
(
pixel
>>
6
&
0x7
);
*
b
=
(
pixel
<<
3
&
0xf8
)
|
(
pixel
>>
2
&
0x7
);
if
((
pixel
&
0x8000
)
==
0x8000
)
*
a
=
255
;
else
*
a
=
0
;
}
static
inline
void
getpixel_24bppRGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
r
=
row
[
x
*
3
+
2
];
*
g
=
row
[
x
*
3
+
1
];
*
b
=
row
[
x
*
3
];
*
a
=
255
;
}
static
inline
void
getpixel_32bppRGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
r
=
row
[
x
*
4
+
2
];
*
g
=
row
[
x
*
4
+
1
];
*
b
=
row
[
x
*
4
];
*
a
=
255
;
}
static
inline
void
getpixel_32bppARGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
r
=
row
[
x
*
4
+
2
];
*
g
=
row
[
x
*
4
+
1
];
*
b
=
row
[
x
*
4
];
*
a
=
row
[
x
*
4
+
3
];
}
static
inline
void
getpixel_32bppPARGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
a
=
row
[
x
*
4
+
3
];
if
(
*
a
==
0
)
*
r
=
*
g
=
*
b
=
0
;
else
{
*
r
=
row
[
x
*
4
+
2
]
*
255
/
*
a
;
*
g
=
row
[
x
*
4
+
1
]
*
255
/
*
a
;
*
b
=
row
[
x
*
4
]
*
255
/
*
a
;
}
}
static
inline
void
getpixel_48bppRGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
r
=
row
[
x
*
6
+
5
];
*
g
=
row
[
x
*
6
+
3
];
*
b
=
row
[
x
*
6
+
1
];
*
a
=
255
;
}
static
inline
void
getpixel_64bppARGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
r
=
row
[
x
*
8
+
5
];
*
g
=
row
[
x
*
8
+
3
];
*
b
=
row
[
x
*
8
+
1
];
*
a
=
row
[
x
*
8
+
7
];
}
static
inline
void
getpixel_64bppPARGB
(
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
,
BYTE
*
a
,
const
BYTE
*
row
,
UINT
x
)
{
*
a
=
row
[
x
*
8
+
7
];
if
(
*
a
==
0
)
*
r
=
*
g
=
*
b
=
0
;
else
{
*
r
=
row
[
x
*
8
+
5
]
*
255
/
*
a
;
*
g
=
row
[
x
*
8
+
3
]
*
255
/
*
a
;
*
b
=
row
[
x
*
8
+
1
]
*
255
/
*
a
;
}
}
GpStatus
WINGDIPAPI
GdipBitmapGetPixel
(
GpBitmap
*
bitmap
,
INT
x
,
INT
y
,
ARGB
*
color
)
{
static
int
calls
;
BYTE
r
,
g
,
b
,
a
;
BYTE
*
row
;
TRACE
(
"%p %d %d %p
\n
"
,
bitmap
,
x
,
y
,
color
);
if
(
!
bitmap
||
!
color
)
if
(
!
bitmap
||
!
color
||
x
<
0
||
y
<
0
||
x
>=
bitmap
->
width
||
y
>=
bitmap
->
height
)
return
InvalidParameter
;
if
(
!
(
calls
++
))
FIXME
(
"not implemented
\n
"
);
row
=
bitmap
->
bits
+
bitmap
->
stride
*
y
;
switch
(
bitmap
->
format
)
{
case
PixelFormat16bppGrayScale
:
getpixel_16bppGrayScale
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat16bppRGB555
:
getpixel_16bppRGB555
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat16bppRGB565
:
getpixel_16bppRGB565
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat16bppARGB1555
:
getpixel_16bppARGB1555
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat24bppRGB
:
getpixel_24bppRGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat32bppRGB
:
getpixel_32bppRGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat32bppARGB
:
getpixel_32bppARGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat32bppPARGB
:
getpixel_32bppPARGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat48bppRGB
:
getpixel_48bppRGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat64bppARGB
:
getpixel_64bppARGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
case
PixelFormat64bppPARGB
:
getpixel_64bppPARGB
(
&
r
,
&
g
,
&
b
,
&
a
,
row
,
x
);
break
;
default:
FIXME
(
"not implemented for format 0x%x
\n
"
,
bitmap
->
format
);
return
NotImplemented
;
}
*
color
=
0xdeadbeef
;
*
color
=
a
<<
24
|
r
<<
16
|
g
<<
8
|
b
;
return
NotImplemented
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipBitmapSetPixel
(
GpBitmap
*
bitmap
,
INT
x
,
INT
y
,
...
...
dlls/gdiplus/tests/image.c
View file @
41140a95
...
...
@@ -822,37 +822,37 @@ static void test_getsetpixel(void)
/* out of bounds */
stat
=
GdipBitmapGetPixel
(
bitmap
,
-
1
,
1
,
&
color
);
todo_wine
expect
(
InvalidParameter
,
stat
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap
,
-
1
,
1
,
0
);
todo_wine
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
1
,
-
1
,
&
color
);
todo_wine
expect
(
InvalidParameter
,
stat
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap
,
1
,
-
1
,
0
);
todo_wine
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
2
,
1
,
&
color
);
todo_wine
expect
(
InvalidParameter
,
stat
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap
,
2
,
1
,
0
);
todo_wine
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
1
,
2
,
&
color
);
todo_wine
expect
(
InvalidParameter
,
stat
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipBitmapSetPixel
(
bitmap
,
1
,
2
,
0
);
todo_wine
expect
(
InvalidParameter
,
stat
);
/* valid use */
stat
=
GdipBitmapGetPixel
(
bitmap
,
1
,
1
,
&
color
);
todo_wine
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xffffffff
,
color
);
expect
(
Ok
,
stat
);
expect
(
0xffffffff
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
0
,
1
,
&
color
);
todo_wine
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xff0000ff
,
color
);
expect
(
Ok
,
stat
);
expect
(
0xff0000ff
,
color
);
stat
=
GdipBitmapSetPixel
(
bitmap
,
1
,
1
,
0xff676869
);
todo_wine
expect
(
Ok
,
stat
);
...
...
@@ -861,11 +861,11 @@ static void test_getsetpixel(void)
todo_wine
expect
(
Ok
,
stat
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
1
,
1
,
&
color
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xff676869
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
0
,
0
,
&
color
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xff474849
,
color
);
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
...
...
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