-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGif.h
56 lines (51 loc) · 1.97 KB
/
Gif.h
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
52
53
54
55
56
#pragma once
#include "gifski.h"
#include <windows.h>
typedef gifski* (*GifskiNewFunc)(const GifskiSettings* settings);
typedef GifskiError(*GifskiAddFrameRgbFunc)(gifski* handle, uint32_t frame_number, uint32_t width, uint32_t bytes_per_row, uint32_t height, const unsigned char* pixels, double presentation_timestamp);
typedef GifskiError(*GifskiSetFileOutputFunc)(gifski* handle, const char* destination_path);
typedef GifskiError(*GifskiFinishFunc)(gifski* handle);
GifskiNewFunc gifski_new2;
GifskiAddFrameRgbFunc gifski_add_frame_rgb2;
GifskiSetFileOutputFunc gifski_set_file_output2;
GifskiFinishFunc gifski_finish2;
HINSTANCE hGIFDLL = NULL;
bool Load_GIFski_DLL(void)
{
hGIFDLL = LoadLibraryA("gifski.dll");
if (hGIFDLL == NULL)
{
// Handle error
OutputDebugStringA("Unable to open the gifski.dll file");
return false;
}
gifski_new2 = (GifskiNewFunc)GetProcAddress(hGIFDLL, "gifski_new");
if (gifski_new2 == NULL)
{
OutputDebugStringA("Unable to import the gifski_new function");
FreeLibrary(hGIFDLL);
return false;
}
gifski_set_file_output2 = (GifskiSetFileOutputFunc)GetProcAddress(hGIFDLL, "gifski_set_file_output");
if (gifski_set_file_output2 == NULL)
{
OutputDebugStringA("Unable to import the gifski_set_file_output function");
FreeLibrary(hGIFDLL);
return false;
}
gifski_add_frame_rgb2 = (GifskiAddFrameRgbFunc)GetProcAddress(hGIFDLL, "gifski_add_frame_rgb");
if (gifski_add_frame_rgb2 == NULL)
{
OutputDebugStringA("Unable to import the gifski_addframe_rgb function");
FreeLibrary(hGIFDLL);
return false;
}
gifski_finish2 = (GifskiFinishFunc)GetProcAddress(hGIFDLL, "gifski_finish");
if (gifski_finish2 == NULL)
{
OutputDebugStringA("Unable to import the gifski_finish function");
FreeLibrary(hGIFDLL);
return false;
}
return true;
}