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
366854a7
Commit
366854a7
authored
Mar 06, 2008
by
Nathan Beckmann
Committed by
Alexandre Julliard
Mar 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement GdipGetImageEncoders.
parent
7f50e42b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
2 deletions
+162
-2
gdiplus.spec
dlls/gdiplus/gdiplus.spec
+2
-2
image.c
dlls/gdiplus/image.c
+60
-0
image.c
dlls/gdiplus/tests/image.c
+50
-0
gdiplusenums.h
include/gdiplusenums.h
+13
-0
gdiplusflat.h
include/gdiplusflat.h
+2
-0
gdiplusimaging.h
include/gdiplusimaging.h
+35
-0
No files found.
dlls/gdiplus/gdiplus.spec
View file @
366854a7
...
...
@@ -284,8 +284,8 @@
@ stub GdipGetImageDecoders
@ stub GdipGetImageDecodersSize
@ stdcall GdipGetImageDimension(ptr ptr ptr)
@ st
ub GdipGetImageEncoders
@ st
ub GdipGetImageEncodersSize
@ st
dcall GdipGetImageEncoders(long long ptr)
@ st
dcall GdipGetImageEncodersSize(ptr ptr)
@ stub GdipGetImageFlags
@ stdcall GdipGetImageGraphicsContext(ptr ptr)
@ stdcall GdipGetImageHeight(ptr ptr)
...
...
dlls/gdiplus/image.c
View file @
366854a7
...
...
@@ -836,3 +836,63 @@ GpStatus WINGDIPAPI GdipSetImagePalette(GpImage *image,
return
NotImplemented
;
}
/*************************************************************************
* Encoders -
* Structures that represent which formats we support for encoding.
*/
typedef
enum
{
BMP
,
NUM_ENCODERS_SUPPORTED
}
ImageFormat
;
/* ImageCodecInfo creation routines taken from libgdiplus */
static
const
WCHAR
bmp_codecname
[]
=
{
'B'
,
'u'
,
'i'
,
'l'
,
't'
,
'-'
,
'i'
,
'n'
,
' '
,
'B'
,
'M'
,
'P'
,
0
};
/* Built-in BMP */
static
const
WCHAR
bmp_extension
[]
=
{
'*'
,
'.'
,
'B'
,
'M'
,
'P'
,
';'
,
'*'
,
'.'
,
'D'
,
'I'
,
'B'
,
';'
,
'*'
,
'.'
,
'R'
,
'L'
,
'E'
,
0
};
/* *.BMP;*.DIB;*.RLE */
static
const
WCHAR
bmp_mimetype
[]
=
{
'i'
,
'm'
,
'a'
,
'g'
,
'e'
,
'/'
,
'b'
,
'm'
,
'p'
,
0
};
/* image/bmp */
static
const
WCHAR
bmp_format
[]
=
{
'B'
,
'M'
,
'P'
,
0
};
/* BMP */
static
const
BYTE
bmp_sig_pattern
[]
=
{
0x42
,
0x4D
};
static
const
BYTE
bmp_sig_mask
[]
=
{
0xFF
,
0xFF
};
static
const
ImageCodecInfo
codecs
[
NUM_ENCODERS_SUPPORTED
]
=
{
{
/* BMP */
/* Clsid */
{
0x557cf400
,
0x1a04
,
0x11d3
,
{
0x9a
,
0x73
,
0x0
,
0x0
,
0xf8
,
0x1e
,
0xf3
,
0x2e
}
},
/* FormatID */
{
0xb96b3cabU
,
0x0728U
,
0x11d3U
,
{
0x9d
,
0x7b
,
0x00
,
0x00
,
0xf8
,
0x1e
,
0xf3
,
0x2e
}
},
/* CodecName */
bmp_codecname
,
/* DllName */
NULL
,
/* FormatDescription */
bmp_format
,
/* FilenameExtension */
bmp_extension
,
/* MimeType */
bmp_mimetype
,
/* Flags */
ImageCodecFlagsEncoder
|
ImageCodecFlagsDecoder
|
ImageCodecFlagsSupportBitmap
|
ImageCodecFlagsBuiltin
,
/* Version */
1
,
/* SigCount */
1
,
/* SigSize */
2
,
/* SigPattern */
bmp_sig_pattern
,
/* SigMask */
bmp_sig_mask
,
},
};
GpStatus
WINGDIPAPI
GdipGetImageEncodersSize
(
UINT
*
numEncoders
,
UINT
*
size
)
{
if
(
!
numEncoders
||
!
size
)
return
InvalidParameter
;
*
numEncoders
=
NUM_ENCODERS_SUPPORTED
;
*
size
=
sizeof
(
codecs
);
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetImageEncoders
(
UINT
numEncoders
,
UINT
size
,
ImageCodecInfo
*
encoders
)
{
if
(
!
encoders
||
(
numEncoders
!=
NUM_ENCODERS_SUPPORTED
)
||
(
size
!=
sizeof
(
codecs
)))
return
GenericError
;
memcpy
(
encoders
,
codecs
,
sizeof
(
codecs
));
return
Ok
;
}
dlls/gdiplus/tests/image.c
View file @
366854a7
...
...
@@ -122,6 +122,55 @@ static void test_LoadingImages(void)
expect
(
InvalidParameter
,
stat
);
}
static
void
test_encoders
(
void
)
{
GpStatus
stat
;
UINT
n
;
UINT
s
;
ImageCodecInfo
*
codecs
;
int
i
;
int
bmp_found
;
static
const
WCHAR
bmp_format
[]
=
{
'B'
,
'M'
,
'P'
,
0
};
stat
=
GdipGetImageEncodersSize
(
&
n
,
&
s
);
expect
(
stat
,
Ok
);
codecs
=
GdipAlloc
(
s
);
if
(
!
codecs
)
return
;
stat
=
GdipGetImageEncoders
(
n
,
s
,
NULL
);
expect
(
GenericError
,
stat
);
stat
=
GdipGetImageEncoders
(
0
,
s
,
codecs
);
expect
(
GenericError
,
stat
);
stat
=
GdipGetImageEncoders
(
n
,
s
-
1
,
codecs
);
expect
(
GenericError
,
stat
);
stat
=
GdipGetImageEncoders
(
n
,
s
+
1
,
codecs
);
expect
(
GenericError
,
stat
);
stat
=
GdipGetImageEncoders
(
n
,
s
,
codecs
);
expect
(
stat
,
Ok
);
bmp_found
=
FALSE
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
0
,
codecs
[
i
].
FormatDescription
,
-
1
,
bmp_format
,
-
1
)
==
CSTR_EQUAL
)
{
bmp_found
=
TRUE
;
break
;
}
}
if
(
!
bmp_found
)
ok
(
FALSE
,
"No BMP codec found.
\n
"
);
GdipFree
(
codecs
);
}
START_TEST
(
image
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -137,6 +186,7 @@ START_TEST(image)
test_Scan0
();
test_GetImageDimension
();
test_LoadingImages
();
test_encoders
();
GdiplusShutdown
(
gdiplusToken
);
}
include/gdiplusenums.h
View file @
366854a7
...
...
@@ -257,6 +257,18 @@ enum HotkeyPrefix
HotkeyPrefixHide
=
2
};
enum
ImageCodecFlags
{
ImageCodecFlagsEncoder
=
1
,
ImageCodecFlagsDecoder
=
2
,
ImageCodecFlagsSupportBitmap
=
4
,
ImageCodecFlagsSupportVector
=
8
,
ImageCodecFlagsSeekableEncode
=
16
,
ImageCodecFlagsBlockingDecode
=
32
,
ImageCodecFlagsBuiltin
=
65536
,
ImageCodecFlagsSystem
=
131072
,
ImageCodecFlagsUser
=
262144
};
#ifndef __cplusplus
...
...
@@ -286,6 +298,7 @@ typedef enum StringTrimming StringTrimming;
typedef
enum
StringFormatFlags
StringFormatFlags
;
typedef
enum
HotkeyPrefix
HotkeyPrefix
;
typedef
enum
PenAlignment
GpPenAlignment
;
typedef
enum
ImageCodecFlags
ImageCodecFlags
;
#endif
/* end of c typedefs */
...
...
include/gdiplusflat.h
View file @
366854a7
...
...
@@ -258,6 +258,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromStreamICM(IStream*,GpBitmap**);
GpStatus
WINGDIPAPI
GdipDisposeImage
(
GpImage
*
);
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
GdipGetImageItemData
(
GpImage
*
,
ImageItemData
*
);
GpStatus
WINGDIPAPI
GdipGetImageBounds
(
GpImage
*
,
GpRectF
*
,
GpUnit
*
);
GpStatus
WINGDIPAPI
GdipGetImageGraphicsContext
(
GpImage
*
,
GpGraphics
**
);
...
...
include/gdiplusimaging.h
View file @
366854a7
...
...
@@ -43,6 +43,24 @@ public:
EncoderParameter
Parameter
[
1
];
};
class
ImageCodecInfo
{
public
:
CLSID
Clsid
;
GUID
FormatID
;
const
WCHAR
*
CodecName
;
const
WCHAR
*
DllName
;
const
WCHAR
*
FormatDescription
;
const
WCHAR
*
FilenameExtension
;
const
WCHAR
*
MimeType
;
DWORD
Flags
;
DWORD
Version
;
DWORD
SigCount
;
DWORD
SigSize
;
const
BYTE
*
SigPattern
;
const
BYTE
*
SigMask
;
};
class
BitmapData
{
public
:
...
...
@@ -84,6 +102,23 @@ typedef struct EncoderParameters
EncoderParameter
Parameter
[
1
];
}
EncoderParameters
;
typedef
struct
ImageCodecInfo
{
CLSID
Clsid
;
GUID
FormatID
;
const
WCHAR
*
CodecName
;
const
WCHAR
*
DllName
;
const
WCHAR
*
FormatDescription
;
const
WCHAR
*
FilenameExtension
;
const
WCHAR
*
MimeType
;
DWORD
Flags
;
DWORD
Version
;
DWORD
SigCount
;
DWORD
SigSize
;
const
BYTE
*
SigPattern
;
const
BYTE
*
SigMask
;
}
ImageCodecInfo
;
typedef
struct
BitmapData
{
UINT
Width
;
...
...
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