summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/avatars.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Toaster/src/avatars.h')
-rw-r--r--plugins/Toaster/src/avatars.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/Toaster/src/avatars.h b/plugins/Toaster/src/avatars.h
new file mode 100644
index 0000000000..9321b6bfbf
--- /dev/null
+++ b/plugins/Toaster/src/avatars.h
@@ -0,0 +1,28 @@
+class ToasterAvatar
+{
+ ptrW wszPath;
+ int iFormat;
+ MCONTACT hContact;
+ FIBITMAP *bitmap;
+
+public:
+ ToasterAvatar(PROTO_AVATAR_INFORMATION *pai) : wszPath(pai->filename), iFormat(pai->format), hContact(pai->hContact)
+ {
+ bitmap = (FIBITMAP*)CallService(MS_IMG_LOAD, (WPARAM)wszPath, IMGL_WCHAR | IMGL_RETURNDIB);
+ }
+
+ ~ToasterAvatar()
+ {
+ CallService(MS_IMG_UNLOAD, (WPARAM)bitmap);
+ }
+
+ INT_PTR Save(const wchar_t *wszSavePath)
+ {
+ IMGSRVC_INFO isi = { sizeof(isi) };
+ isi.wszName = mir_wstrdup(wszSavePath);
+ isi.dib = bitmap;
+ isi.dwMask = IMGI_FBITMAP;
+ isi.fif = FREE_IMAGE_FORMAT::FIF_PNG;
+ return CallService(MS_IMG_SAVE, (WPARAM)&isi, IMGL_WCHAR);
+ }
+}; \ No newline at end of file