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
5bc54ed9
Commit
5bc54ed9
authored
Feb 02, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implemented GdipCreateBitmapFromHICON (with tests).
parent
8b9ce14f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
4 deletions
+158
-4
gdiplus.spec
dlls/gdiplus/gdiplus.spec
+1
-1
image.c
dlls/gdiplus/image.c
+46
-0
Makefile.in
dlls/gdiplus/tests/Makefile.in
+1
-1
image.c
dlls/gdiplus/tests/image.c
+109
-2
gdiplusflat.h
include/gdiplusflat.h
+1
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
5bc54ed9
...
...
@@ -76,7 +76,7 @@
@ stdcall GdipCreateBitmapFromGdiDib(ptr ptr ptr)
@ stdcall GdipCreateBitmapFromGraphics(long long ptr ptr)
@ stdcall GdipCreateBitmapFromHBITMAP(long long ptr)
@ st
ub GdipCreateBitmapFromHICON
@ st
dcall GdipCreateBitmapFromHICON(long ptr)
@ stdcall GdipCreateBitmapFromResource(long wstr ptr)
@ stdcall GdipCreateBitmapFromScan0(long long long long ptr ptr)
@ stdcall GdipCreateBitmapFromStream(ptr ptr)
...
...
dlls/gdiplus/image.c
View file @
5bc54ed9
...
...
@@ -18,6 +18,8 @@
#include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
...
...
@@ -429,6 +431,50 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT width, INT height,
return
ret
;
}
GpStatus
WINGDIPAPI
GdipCreateBitmapFromHICON
(
HICON
hicon
,
GpBitmap
**
bitmap
)
{
HICON
icon_copy
;
ICONINFO
iinfo
;
PICTDESC
desc
;
TRACE
(
"%p, %p
\n
"
,
hicon
,
bitmap
);
if
(
!
bitmap
||
!
GetIconInfo
(
hicon
,
&
iinfo
))
return
InvalidParameter
;
*
bitmap
=
GdipAlloc
(
sizeof
(
GpBitmap
));
if
(
!*
bitmap
)
return
OutOfMemory
;
icon_copy
=
CreateIconIndirect
(
&
iinfo
);
if
(
!
icon_copy
){
GdipFree
(
*
bitmap
);
return
InvalidParameter
;
}
desc
.
cbSizeofstruct
=
sizeof
(
PICTDESC
);
desc
.
picType
=
PICTYPE_ICON
;
desc
.
u
.
icon
.
hicon
=
icon_copy
;
if
(
OleCreatePictureIndirect
(
&
desc
,
&
IID_IPicture
,
TRUE
,
(
LPVOID
*
)
&
((
*
bitmap
)
->
image
.
picture
))
!=
S_OK
){
DestroyIcon
(
icon_copy
);
GdipFree
(
*
bitmap
);
return
GenericError
;
}
(
*
bitmap
)
->
format
=
PixelFormat32bppARGB
;
(
*
bitmap
)
->
image
.
type
=
ImageTypeBitmap
;
(
*
bitmap
)
->
image
.
flags
=
ImageFlagsNone
;
(
*
bitmap
)
->
width
=
ipicture_pixel_width
((
*
bitmap
)
->
image
.
picture
);
(
*
bitmap
)
->
height
=
ipicture_pixel_height
((
*
bitmap
)
->
image
.
picture
);
DeleteObject
(
iinfo
.
hbmColor
);
DeleteObject
(
iinfo
.
hbmMask
);
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipCreateBitmapFromScan0
(
INT
width
,
INT
height
,
INT
stride
,
PixelFormat
format
,
BYTE
*
scan0
,
GpBitmap
**
bitmap
)
{
...
...
dlls/gdiplus/tests/Makefile.in
View file @
5bc54ed9
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
gdiplus.dll
IMPORTS
=
gdiplus user32 gdi32 kernel32
IMPORTS
=
gdiplus
ole32
user32 gdi32 kernel32
CTESTS
=
\
brush.c
\
...
...
dlls/gdiplus/tests/image.c
View file @
5bc54ed9
...
...
@@ -18,11 +18,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <math.h>
#include "initguid.h"
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#include <math.h>
#include "wingdi.h"
#define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got)
...
...
@@ -530,6 +531,111 @@ static void test_testcontrol(void)
ok
(
param
!=
0
,
"Build number expected, got %u
\n
"
,
param
);
}
static
void
test_fromhicon
(
void
)
{
static
const
BYTE
bmp_bits
[
1024
];
HBITMAP
hbmMask
,
hbmColor
;
ICONINFO
info
;
HICON
hIcon
;
GpStatus
stat
;
GpBitmap
*
bitmap
=
NULL
;
UINT
dim
;
ImageType
type
;
PixelFormat
format
;
GUID
raw
;
WCHAR
bufferW
[
39
];
char
buffer
[
39
];
char
buffer2
[
39
];
/* NULL */
stat
=
GdipCreateBitmapFromHICON
(
NULL
,
NULL
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipCreateBitmapFromHICON
(
NULL
,
&
bitmap
);
expect
(
InvalidParameter
,
stat
);
/* color icon 1 bit */
hbmMask
=
CreateBitmap
(
16
,
16
,
1
,
1
,
bmp_bits
);
ok
(
hbmMask
!=
0
,
"CreateBitmap failed
\n
"
);
hbmColor
=
CreateBitmap
(
16
,
16
,
1
,
1
,
bmp_bits
);
ok
(
hbmColor
!=
0
,
"CreateBitmap failed
\n
"
);
info
.
fIcon
=
TRUE
;
info
.
xHotspot
=
8
;
info
.
yHotspot
=
8
;
info
.
hbmMask
=
hbmMask
;
info
.
hbmColor
=
hbmColor
;
hIcon
=
CreateIconIndirect
(
&
info
);
ok
(
hIcon
!=
0
,
"CreateIconIndirect failed
\n
"
);
DeleteObject
(
hbmMask
);
DeleteObject
(
hbmColor
);
stat
=
GdipCreateBitmapFromHICON
(
hIcon
,
&
bitmap
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
){
/* check attributes */
stat
=
GdipGetImageHeight
((
GpImage
*
)
bitmap
,
&
dim
);
expect
(
Ok
,
stat
);
expect
(
16
,
dim
);
stat
=
GdipGetImageWidth
((
GpImage
*
)
bitmap
,
&
dim
);
expect
(
Ok
,
stat
);
expect
(
16
,
dim
);
stat
=
GdipGetImageType
((
GpImage
*
)
bitmap
,
&
type
);
expect
(
Ok
,
stat
);
expect
(
ImageTypeBitmap
,
type
);
stat
=
GdipGetImagePixelFormat
((
GpImage
*
)
bitmap
,
&
format
);
expect
(
PixelFormat32bppARGB
,
format
);
/* raw format */
stat
=
GdipGetImageRawFormat
((
GpImage
*
)
bitmap
,
&
raw
);
StringFromGUID2
(
&
raw
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]));
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]),
buffer
,
sizeof
(
buffer
),
NULL
,
NULL
);
StringFromGUID2
(
&
ImageFormatMemoryBMP
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]));
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]),
buffer2
,
sizeof
(
buffer2
),
NULL
,
NULL
);
todo_wine
ok
(
IsEqualGUID
(
&
raw
,
&
ImageFormatMemoryBMP
),
"Expected format %s, got %s
\n
"
,
buffer2
,
buffer
);
GdipDisposeImage
((
GpImage
*
)
bitmap
);
}
DestroyIcon
(
hIcon
);
/* color icon 8 bpp */
hbmMask
=
CreateBitmap
(
16
,
16
,
1
,
8
,
bmp_bits
);
ok
(
hbmMask
!=
0
,
"CreateBitmap failed
\n
"
);
hbmColor
=
CreateBitmap
(
16
,
16
,
1
,
8
,
bmp_bits
);
ok
(
hbmColor
!=
0
,
"CreateBitmap failed
\n
"
);
info
.
fIcon
=
TRUE
;
info
.
xHotspot
=
8
;
info
.
yHotspot
=
8
;
info
.
hbmMask
=
hbmMask
;
info
.
hbmColor
=
hbmColor
;
hIcon
=
CreateIconIndirect
(
&
info
);
ok
(
hIcon
!=
0
,
"CreateIconIndirect failed
\n
"
);
DeleteObject
(
hbmMask
);
DeleteObject
(
hbmColor
);
stat
=
GdipCreateBitmapFromHICON
(
hIcon
,
&
bitmap
);
expect
(
Ok
,
stat
);
if
(
stat
==
Ok
){
/* check attributes */
stat
=
GdipGetImageHeight
((
GpImage
*
)
bitmap
,
&
dim
);
expect
(
Ok
,
stat
);
expect
(
16
,
dim
);
stat
=
GdipGetImageWidth
((
GpImage
*
)
bitmap
,
&
dim
);
expect
(
Ok
,
stat
);
expect
(
16
,
dim
);
stat
=
GdipGetImageType
((
GpImage
*
)
bitmap
,
&
type
);
expect
(
Ok
,
stat
);
expect
(
ImageTypeBitmap
,
type
);
stat
=
GdipGetImagePixelFormat
((
GpImage
*
)
bitmap
,
&
format
);
expect
(
PixelFormat32bppARGB
,
format
);
/* raw format */
stat
=
GdipGetImageRawFormat
((
GpImage
*
)
bitmap
,
&
raw
);
StringFromGUID2
(
&
raw
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]));
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]),
buffer
,
sizeof
(
buffer
),
NULL
,
NULL
);
StringFromGUID2
(
&
ImageFormatMemoryBMP
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]));
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
bufferW
[
0
]),
buffer2
,
sizeof
(
buffer2
),
NULL
,
NULL
);
todo_wine
ok
(
IsEqualGUID
(
&
raw
,
&
ImageFormatMemoryBMP
),
"Expected format %s, got %s
\n
"
,
buffer2
,
buffer
);
GdipDisposeImage
((
GpImage
*
)
bitmap
);
}
DestroyIcon
(
hIcon
);
}
START_TEST
(
image
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -553,6 +659,7 @@ START_TEST(image)
test_GdipGetImageFlags
();
test_GdipCloneImage
();
test_testcontrol
();
test_fromhicon
();
GdiplusShutdown
(
gdiplusToken
);
}
include/gdiplusflat.h
View file @
5bc54ed9
...
...
@@ -49,6 +49,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM(GDIPCONST WCHAR*,GpBitmap**);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromGdiDib
(
GDIPCONST
BITMAPINFO
*
,
VOID
*
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromGraphics
(
INT
,
INT
,
GpGraphics
*
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromHBITMAP
(
HBITMAP
,
HPALETTE
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromHICON
(
HICON
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromResource
(
HINSTANCE
,
GDIPCONST
WCHAR
*
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromScan0
(
INT
,
INT
,
INT
,
PixelFormat
,
BYTE
*
,
GpBitmap
**
);
...
...
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