summaryrefslogtreecommitdiff
path: root/plugins/AVS/src/image_utils.h
blob: 77ff831719b06376c1e3d68cc62a9269a97e14ed (plain)
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
#ifndef __IMAGE_UTILS_H__
# define __IMAGE_UTILS_H__

#define _WIN32_WINNT 0x0501
#include <windows.h>

#include <m_avatars.h>


// Load an image
// wParam = NULL
// lParam = filename
INT_PTR BmpFilterLoadBitmap32(WPARAM wParam,LPARAM lParam);

// Save an HBITMAP to an image
// wParam = HBITMAP
// lParam = full path of filename
INT_PTR BmpFilterSaveBitmap(WPARAM wParam,LPARAM lParam);
INT_PTR BmpFilterSaveBitmapW(WPARAM wParam,LPARAM lParam);
#define BmpFilterSaveBitmapT BmpFilterSaveBitmapW

// Returns != 0 if can save that type of image, = 0 if cant
// wParam = 0
// lParam = PA_FORMAT_*   // image format
INT_PTR BmpFilterCanSaveBitmap(WPARAM wParam,LPARAM lParam);

// Returns a copy of the bitmap with the size especified or the original bitmap if nothing has to be changed
// wParam = ResizeBitmap *
// lParam = NULL
INT_PTR BmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam);


int BmpFilterSaveBitmap(HBITMAP hBmp, char *szFile, int flags);
int BmpFilterSaveBitmapW(HBITMAP hBmp, wchar_t *wszFile, int flags);
#define BmpFilterSaveBitmapT BmpFilterSaveBitmapW

HBITMAP CopyBitmapTo32(HBITMAP hBitmap);

BOOL PreMultiply(HBITMAP hBitmap);
BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap);
HBITMAP MakeGrayscale(MCONTACT hContact, HBITMAP hBitmap);
DWORD GetImgHash(HBITMAP hBitmap);

int AVS_pathIsAbsolute(const TCHAR *path);
size_t AVS_pathToRelative(const TCHAR *sPrc, TCHAR *pOut);
size_t AVS_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut);

int SaveAvatar( const char* protocol, const TCHAR* tszFileName );

#endif // __IMAGE_UTILS_H__