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
3266420a
Commit
3266420a
authored
Mar 21, 2008
by
Sean Huckins
Committed by
Alexandre Julliard
Mar 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implementation of GdipCreateBitmapFromHBITMAP.
parent
e7498257
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
2 deletions
+132
-2
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
+83
-0
gdiplusflat.h
include/gdiplusflat.h
+1
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
3266420a
...
...
@@ -75,7 +75,7 @@
@ stdcall GdipCreateBitmapFromFileICM(wstr ptr)
@ stub GdipCreateBitmapFromGdiDib
@ stdcall GdipCreateBitmapFromGraphics(long long ptr ptr)
@ st
ub GdipCreateBitmapFromHBITMAP
@ st
dcall GdipCreateBitmapFromHBITMAP(ptr ptr ptr)
@ stub GdipCreateBitmapFromHICON
@ stub GdipCreateBitmapFromResource
@ stdcall GdipCreateBitmapFromScan0(long long long long ptr ptr)
...
...
dlls/gdiplus/image.c
View file @
3266420a
...
...
@@ -1051,3 +1051,49 @@ GpStatus WINGDIPAPI GdipGetImageEncoders(UINT numEncoders, UINT size, ImageCodec
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipCreateBitmapFromHBITMAP
(
HBITMAP
hbm
,
HPALETTE
hpal
,
GpBitmap
**
bitmap
)
{
BITMAP
bm
;
GpStatus
retval
;
PixelFormat
format
;
if
(
!
hbm
||
!
bitmap
)
return
InvalidParameter
;
/* TODO: Support for device-dependent bitmaps */
if
(
hpal
){
FIXME
(
"no support for device-dependent bitmaps
\n
"
);
return
NotImplemented
;
}
if
(
GetObjectA
(
hbm
,
sizeof
(
bm
),
&
bm
)
!=
sizeof
(
bm
))
return
InvalidParameter
;
/* TODO: Figure out the correct format for 16, 32, 64 bpp */
switch
(
bm
.
bmBitsPixel
)
{
case
1
:
format
=
PixelFormat1bppIndexed
;
break
;
case
4
:
format
=
PixelFormat4bppIndexed
;
break
;
case
8
:
format
=
PixelFormat8bppIndexed
;
break
;
case
24
:
format
=
PixelFormat24bppRGB
;
break
;
case
48
:
format
=
PixelFormat48bppRGB
;
break
;
default:
FIXME
(
"don't know how to handle %d bpp
\n
"
,
bm
.
bmBitsPixel
);
return
InvalidParameter
;
break
;
}
retval
=
GdipCreateBitmapFromScan0
(
bm
.
bmWidth
,
bm
.
bmHeight
,
bm
.
bmWidthBytes
,
format
,
bm
.
bmBits
,
bitmap
);
return
retval
;
}
dlls/gdiplus/tests/Makefile.in
View file @
3266420a
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
gdiplus.dll
IMPORTS
=
gdiplus user32 kernel32
IMPORTS
=
gdiplus user32
gdi32
kernel32
CTESTS
=
\
brush.c
\
...
...
dlls/gdiplus/tests/image.c
View file @
3266420a
...
...
@@ -22,6 +22,7 @@
#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)
...
...
@@ -335,6 +336,87 @@ static void test_LockBits(void)
expect
(
Ok
,
stat
);
}
static
void
test_GdipCreateBitmapFromHBITMAP
(
void
)
{
GpBitmap
*
gpbm
=
NULL
;
HBITMAP
hbm
=
NULL
;
HPALETTE
hpal
=
NULL
;
GpStatus
stat
;
BYTE
buff
[
1000
];
LOGPALETTE
*
LogPal
=
NULL
;
REAL
width
,
height
;
const
REAL
WIDTH1
=
5
;
const
REAL
HEIGHT1
=
15
;
const
REAL
WIDTH2
=
10
;
const
REAL
HEIGHT2
=
20
;
HDC
hdc
;
BITMAPINFO
bmi
;
stat
=
GdipCreateBitmapFromHBITMAP
(
NULL
,
NULL
,
NULL
);
expect
(
InvalidParameter
,
stat
);
hbm
=
CreateBitmap
(
WIDTH1
,
HEIGHT1
,
1
,
1
,
NULL
);
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
NULL
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
expect
(
Ok
,
stat
);
expect
(
Ok
,
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
));
ok
(
fabs
(
WIDTH1
-
width
)
<
.
0001
,
"width wrong
\n
"
);
ok
(
fabs
(
HEIGHT1
-
height
)
<
.
0001
,
"height wrong
\n
"
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
GlobalFree
(
hbm
);
hbm
=
CreateBitmap
(
WIDTH2
,
HEIGHT2
,
1
,
1
,
&
buff
);
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
expect
(
Ok
,
stat
);
expect
(
Ok
,
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
));
ok
(
fabs
(
WIDTH2
-
width
)
<
.
0001
,
"width wrong
\n
"
);
ok
(
fabs
(
HEIGHT2
-
height
)
<
.
0001
,
"height wrong
\n
"
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
GlobalFree
(
hbm
);
hdc
=
CreateCompatibleDC
(
0
);
ok
(
hdc
!=
NULL
,
"CreateCompatibleDC failed
\n
"
);
bmi
.
bmiHeader
.
biSize
=
sizeof
(
bmi
.
bmiHeader
);
bmi
.
bmiHeader
.
biHeight
=
HEIGHT1
;
bmi
.
bmiHeader
.
biWidth
=
WIDTH1
;
bmi
.
bmiHeader
.
biBitCount
=
24
;
bmi
.
bmiHeader
.
biPlanes
=
1
;
bmi
.
bmiHeader
.
biCompression
=
BI_RGB
;
hbm
=
CreateDIBSection
(
hdc
,
&
bmi
,
DIB_RGB_COLORS
,
NULL
,
NULL
,
0
);
ok
(
hbm
!=
NULL
,
"CreateDIBSection failed
\n
"
);
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
expect
(
Ok
,
stat
);
expect
(
Ok
,
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
));
ok
(
fabs
(
WIDTH1
-
width
)
<
.
0001
,
"width wrong
\n
"
);
ok
(
fabs
(
HEIGHT1
-
height
)
<
.
0001
,
"height wrong
\n
"
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
LogPal
=
GdipAlloc
(
sizeof
(
LOGPALETTE
));
ok
(
LogPal
!=
NULL
,
"unable to allocate LOGPALETTE
\n
"
);
LogPal
->
palVersion
=
0x300
;
hpal
=
CreatePalette
((
const
LOGPALETTE
*
)
LogPal
);
ok
(
hpal
!=
NULL
,
"CreatePalette failed
\n
"
);
GdipFree
(
LogPal
);
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
hpal
,
&
gpbm
);
todo_wine
{
expect
(
Ok
,
stat
);
}
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
GlobalFree
(
hpal
);
GlobalFree
(
hbm
);
}
START_TEST
(
image
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -353,6 +435,7 @@ START_TEST(image)
test_SavingImages
();
test_encoders
();
test_LockBits
();
test_GdipCreateBitmapFromHBITMAP
();
GdiplusShutdown
(
gdiplusToken
);
}
include/gdiplusflat.h
View file @
3266420a
...
...
@@ -261,6 +261,7 @@ GpStatus WINGDIPAPI GdipFindFirstImageItem(GpImage*,ImageItemData*);
GpStatus
WINGDIPAPI
GdipFindNextImageItem
(
GpImage
*
,
ImageItemData
*
);
GpStatus
WINGDIPAPI
GdipGetImageEncodersSize
(
UINT
*
numEncoders
,
UINT
*
size
);
GpStatus
WINGDIPAPI
GdipGetImageEncoders
(
UINT
numEncoders
,
UINT
size
,
ImageCodecInfo
*
encoders
);
GpStatus
WINGDIPAPI
GdipCreateBitmapFromHBITMAP
(
HBITMAP
,
HPALETTE
,
GpBitmap
**
);
GpStatus
WINGDIPAPI
GdipGetImageItemData
(
GpImage
*
,
ImageItemData
*
);
GpStatus
WINGDIPAPI
GdipGetImageBounds
(
GpImage
*
,
GpRectF
*
,
GpUnit
*
);
GpStatus
WINGDIPAPI
GdipGetImageGraphicsContext
(
GpImage
*
,
GpGraphics
**
);
...
...
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