-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathGdiPlusInterop.h
More file actions
51 lines (43 loc) · 1.95 KB
/
GdiPlusInterop.h
File metadata and controls
51 lines (43 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// GdiPlusInterop.h
// Author: Joseph Ryan Ries, 2017
// The snip.exe that comes bundled with Microsoft Windows is *almost* good enough. So I made one just a little better.
// I want to use some bits from GDI+, especially for convenient saving of PNG format images.
// But GDI+ is a C++ API, and this is a purely C project, so... some hacking is required.
#pragma once
DEFINE_GUID(gEncoderCompressionGuid, 0xe09d739d, 0xccd4, 0x44ee, 0x8e, 0xba, 0x3f, 0xbf, 0x8b, 0xe4, 0xfc, 0x58);
typedef enum EncoderParameterValueType
{
EncoderParameterValueTypeByte = 1,
EncoderParameterValueTypeASCII = 2,
EncoderParameterValueTypeShort = 3,
EncoderParameterValueTypeLong = 4,
EncoderParameterValueTypeRational = 5,
EncoderParameterValueTypeLongRange = 6,
EncoderParameterValueTypeUndefined = 7,
EncoderParameterValueTypeRationalRange = 8,
EncoderParameterValueTypePointer = 9
} EncoderParameterValueType;
typedef struct EncoderParameter
{
GUID Guid; // GUID of the parameter
ULONG NumberOfValues; // Number of the parameter values
ULONG Type; // Value type, like ValueTypeLONG etc.
VOID* Value; // A pointer to the parameter values
} EncoderParameter;
typedef struct EncoderParameters
{
UINT Count; // Number of parameters in this structure
EncoderParameter Parameter[1]; // Parameter values
} EncoderParameters;
typedef struct GdiplusStartupInput
{
UINT32 GdiplusVersion;
void* DebugEventCallback;
BOOL SuppressBackgroundThread;
BOOL SuppressExternalCodecs;
} GdiplusStartupInput;
int (WINAPI* GdiplusStartup)(ULONG_PTR* Token, struct GdiplusStartupInput* Size, void*);
int (WINAPI* GdiplusShutdown)(ULONG_PTR Token);
int (WINAPI* GdipCreateBitmapFromHBITMAP)(HBITMAP hBitmap, HPALETTE hPalette, ULONG** Bitmap);
int (WINAPI* GdipDisposeImage)(ULONG* Bitmap);
int (WINAPI* GdipSaveImageToFile)(ULONG* Image, const WCHAR* Filename, const CLSID* clsidEncoder, const EncoderParameters* EncoderParams);