summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AVS/src/image_utils.cpp7
-rw-r--r--plugins/AVS/src/services.cpp24
-rw-r--r--plugins/FloatingContacts/src/bitmap_funcs.cpp2
-rw-r--r--plugins/HistoryStats/src/canvas.cpp4
-rw-r--r--plugins/Popup/src/bitmap_funcs.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp8
-rw-r--r--plugins/TabSRMM/src/themes.cpp13
-rw-r--r--plugins/TipperYM/src/bitmap_func.cpp2
-rw-r--r--plugins/TipperYM/src/options.cpp8
-rw-r--r--plugins/TipperYM/src/popwin.cpp9
-rw-r--r--plugins/Toaster/src/utils.h28
-rw-r--r--plugins/Utils.pas/mirutils.pas12
-rw-r--r--plugins/Watrack/popup/pop_vars.inc1
-rw-r--r--plugins/Watrack/popup/popups.pas9
14 files changed, 34 insertions, 95 deletions
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp
index c34a998aa3..6ac47475b2 100644
--- a/plugins/AVS/src/image_utils.cpp
+++ b/plugins/AVS/src/image_utils.cpp
@@ -161,7 +161,7 @@ void SetHIMETRICtoDP(HDC hdc, SIZE* sz)
HBITMAP BmpFilterLoadBitmap(BOOL *bIsTransparent, const wchar_t *ptszFilename)
{
- FIBITMAP *dib = (FIBITMAP*)CallService(MS_IMG_LOAD, (WPARAM)ptszFilename, IMGL_RETURNDIB | IMGL_WCHAR);
+ FIBITMAP *dib = (FIBITMAP*)Image_Load(ptszFilename, IMGL_RETURNDIB | IMGL_WCHAR);
if (dib == nullptr)
return nullptr;
@@ -211,12 +211,11 @@ int BmpFilterSaveBitmap(HBITMAP hBmp, const wchar_t *ptszFile, int flags)
IMGSRVC_INFO i = { 0 };
i.cbSize = sizeof(IMGSRVC_INFO);
- i.wszName = tszFilename;
+ i.szName.w = tszFilename;
i.hbm = hBmp;
i.dwMask = IMGI_HBITMAP;
i.fif = FIF_UNKNOWN;
-
- return !CallService(MS_IMG_SAVE, (WPARAM)&i, MAKELONG(IMGL_WCHAR, flags));
+ return !Image_Save(&i, MAKELONG(IMGL_WCHAR, flags));
}
// Other utilities ////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp
index a0b445057a..691b84ee10 100644
--- a/plugins/AVS/src/services.cpp
+++ b/plugins/AVS/src/services.cpp
@@ -397,15 +397,8 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen
int num_tries = 0;
do {
// Lets do it
- ResizeBitmap rb;
- rb.size = sizeof(ResizeBitmap);
- rb.hBmp = hBmp;
- rb.max_height = d.height;
- rb.max_width = d.width;
- rb.fit = (grow ? 0 : RESIZEBITMAP_FLAG_DONT_GROW)
- | (square ? RESIZEBITMAP_MAKE_SQUARE : RESIZEBITMAP_KEEP_PROPORTIONS);
-
- d.hBmpProto = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0);
+ int fit = (grow ? 0 : RESIZEBITMAP_FLAG_DONT_GROW) | (square ? RESIZEBITMAP_MAKE_SQUARE : RESIZEBITMAP_KEEP_PROPORTIONS);
+ d.hBmpProto = Image_Resize(hBmp, fit, d.height, d.width);
if (d.hBmpProto == nullptr) {
if (d.temp_file[0] != '\0')
@@ -552,17 +545,8 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar
}
else {
// Resize (to avoid too big avatars)
- ResizeBitmap rb = { 0 };
- rb.size = sizeof(ResizeBitmap);
- rb.hBmp = hBmp;
- rb.max_height = 300;
- rb.max_width = 300;
- rb.fit = (data.grow ? 0 : RESIZEBITMAP_FLAG_DONT_GROW)
- | (data.square ? RESIZEBITMAP_MAKE_SQUARE : RESIZEBITMAP_KEEP_PROPORTIONS);
-
- HBITMAP hBmpTmp = (HBITMAP)CallService(MS_IMG_RESIZE, WPARAM(&rb), 0);
-
- // Check if need to resize
+ int fit = (data.grow ? 0 : RESIZEBITMAP_FLAG_DONT_GROW) | (data.square ? RESIZEBITMAP_MAKE_SQUARE : RESIZEBITMAP_KEEP_PROPORTIONS);
+ HBITMAP hBmpTmp = Image_Resize(hBmp, fit, 300, 300);
if (hBmpTmp == hBmp || hBmpTmp == nullptr) {
// Use original image
mir_snwprintf(globalFile, L"%s\\my_global_avatar%s", globalFile, ext);
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp
index 5cbf09bc9b..d81c2102ff 100644
--- a/plugins/FloatingContacts/src/bitmap_funcs.cpp
+++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp
@@ -935,7 +935,7 @@ bool MyBitmap::loadFromFile_gradient(const char *fn)
bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha)
{
SIZE sz;
- HBITMAP hBmpLoaded = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)fn, 0);
+ HBITMAP hBmpLoaded = Image_Load((const wchar_t*)fn, 0);
if (!hBmpLoaded)
return false;
diff --git a/plugins/HistoryStats/src/canvas.cpp b/plugins/HistoryStats/src/canvas.cpp
index 215f631104..1639521957 100644
--- a/plugins/HistoryStats/src/canvas.cpp
+++ b/plugins/HistoryStats/src/canvas.cpp
@@ -138,6 +138,6 @@ bool Canvas::writePNG(const wchar_t* szFileName)
img.dwMask = IMGI_HBITMAP;
img.hbm = m_hBmp;
img.fif = FIF_PNG;
- img.tszName = (wchar_t*)szFileName;
- return CallService(MS_IMG_SAVE, (WPARAM)&img, IMGL_WCHAR) == 0;
+ img.szName.w = (wchar_t*)szFileName;
+ return Image_Save(&img, IMGL_WCHAR) == 0;
}
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp
index cbce9cf707..0107441a57 100644
--- a/plugins/Popup/src/bitmap_funcs.cpp
+++ b/plugins/Popup/src/bitmap_funcs.cpp
@@ -730,7 +730,7 @@ bool MyBitmap::loadFromFile(const wchar_t *fn)
if (!wcsncmp(fn, L"gradient:", mir_wstrlen(L"gradient:")))
return loadFromFile_gradient(fn);
- HBITMAP hBmpLoaded = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)fn, IMGL_WCHAR);
+ HBITMAP hBmpLoaded = Image_Load(fn, IMGL_WCHAR);
if (!hBmpLoaded)
return false;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index fae16eb748..088a95636d 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -183,11 +183,11 @@ static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic)
IMGSRVC_INFO ii;
ii.cbSize = sizeof(ii);
- ii.wszName = szFinalFilename;
+ ii.szName.w = szFinalFilename;
ii.hbm = hbm;
ii.dwMask = IMGI_HBITMAP;
ii.fif = FIF_UNKNOWN; // get the format from the filename extension. png is default.
- CallService(MS_IMG_SAVE, (WPARAM)&ii, IMGL_WCHAR);
+ Image_Save(&ii, IMGL_WCHAR);
}
}
@@ -1813,10 +1813,10 @@ void CTabBaseDlg::SendHBitmapAsFile(HBITMAP hbmp) const
IMGSRVC_INFO ii;
ii.cbSize = sizeof(ii);
ii.hbm = hbmp;
- ii.wszName = filename;
+ ii.szName.w = filename;
ii.dwMask = IMGI_HBITMAP;
ii.fif = FIF_JPEG;
- CallService(MS_IMG_SAVE, (WPARAM)&ii, IMGL_WCHAR);
+ Image_Save(&ii, IMGL_WCHAR);
int totalCount = 0;
wchar_t **ppFiles = nullptr;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 1ef9533f8e..ec2390160a 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1722,7 +1722,7 @@ void CSkin::setupAeroSkins()
m_dwmColorRGB = RGB((BYTE)fr, (BYTE)fg, (BYTE)fb);
- FIBITMAP *fib = (FIBITMAP *)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_WCHAR | IMGL_RETURNDIB);
+ FIBITMAP *fib = (FIBITMAP *)Image_Load(tszFilename, IMGL_WCHAR | IMGL_RETURNDIB);
HBITMAP hbm = FreeImage_CreateHBITMAPFromDIB(fib);
@@ -1764,7 +1764,7 @@ void CSkin::setupAeroSkins()
if (!PathFileExists(tszFilename))
mir_snwprintf(tszFilename, L"%stabskin_aero_glow.png", tszBasePath);
- fib = (FIBITMAP *)CallService(MS_IMG_LOAD, (WPARAM)tszFilename, IMGL_WCHAR | IMGL_RETURNDIB);
+ fib = (FIBITMAP *)Image_Load(tszFilename, IMGL_WCHAR | IMGL_RETURNDIB);
COLORREF glowColor = M.GetDword(FONTMODULE, "aeroGlow", RGB(40, 40, 255));
hbm = FreeImage_CreateHBITMAPFromDIB(fib);
@@ -2078,14 +2078,7 @@ HBITMAP CSkin::ResizeBitmap(HBITMAP hBmpSrc, LONG width, LONG height, bool &must
GetObject(hBmpSrc, sizeof(bm), &bm);
if (bm.bmHeight != height || bm.bmWidth != width) {
- ::ResizeBitmap rb;
- rb.size = sizeof(rb);
- rb.fit = RESIZEBITMAP_STRETCH;
- rb.max_height = height;
- rb.max_width = width;
- rb.hBmp = hBmpSrc;
-
- HBITMAP hbmNew = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0);
+ HBITMAP hbmNew = Image_Resize(hBmpSrc, RESIZEBITMAP_STRETCH, height, width);
if (hbmNew != hBmpSrc)
mustFree = true;
return(hbmNew);
diff --git a/plugins/TipperYM/src/bitmap_func.cpp b/plugins/TipperYM/src/bitmap_func.cpp
index 1ec2a3696a..d2f7f561b5 100644
--- a/plugins/TipperYM/src/bitmap_func.cpp
+++ b/plugins/TipperYM/src/bitmap_func.cpp
@@ -154,7 +154,7 @@ void CreateFromBitmaps(bool bServiceTip)
if (tszFileName && *tszFileName != 0) {
FIBITMAP *fib = nullptr;
if (!skin.bCached) {
- FIBITMAP *fibLoad = (FIBITMAP *)CallService(MS_IMG_LOAD, (WPARAM)tszFileName, IMGL_WCHAR | IMGL_RETURNDIB);
+ FIBITMAP *fibLoad = (FIBITMAP *)Image_Load(tszFileName, IMGL_WCHAR | IMGL_RETURNDIB);
if (!fibLoad) continue;
if (FreeImage_GetBPP(fibLoad) != 32)
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index 17b3d0b310..15489d189c 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -1723,13 +1723,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
int iWidth = dis->rcItem.right - dis->rcItem.left;
int iHeight = dis->rcItem.bottom - dis->rcItem.top;
- ResizeBitmap rb = { 0 };
- rb.size = sizeof(rb);
- rb.hBmp = hbmpPreview;
- rb.max_width = iWidth;
- rb.max_height = iHeight;
- rb.fit = RESIZEBITMAP_KEEP_PROPORTIONS;
- HBITMAP hbmpRes = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0);
+ HBITMAP hbmpRes = Image_Resize(hbmpPreview, RESIZEBITMAP_KEEP_PROPORTIONS, iWidth, iHeight);
if (hbmpRes) {
BITMAP bmp;
GetObject(hbmpRes, sizeof(bmp), &bmp);
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp
index 0a5b82200e..7c97954284 100644
--- a/plugins/TipperYM/src/popwin.cpp
+++ b/plugins/TipperYM/src/popwin.cpp
@@ -498,14 +498,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)pwd->clcit.szProto);
if (ace && ace->hbmPic && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) {
- ResizeBitmap rb = { 0 };
- rb.size = sizeof(rb);
- rb.max_width = pwd->iRealAvatarWidth;
- rb.max_height = pwd->iRealAvatarHeight;
- rb.fit = RESIZEBITMAP_STRETCH | RESIZEBITMAP_KEEP_PROPORTIONS;
- rb.hBmp = ace->hbmPic;
- HBITMAP hbmpAvatar = (HBITMAP)CallService(MS_IMG_RESIZE, (WPARAM)&rb, 0);
-
+ HBITMAP hbmpAvatar = Image_Resize(ace->hbmPic, RESIZEBITMAP_STRETCH | RESIZEBITMAP_KEEP_PROPORTIONS, pwd->iRealAvatarWidth, pwd->iRealAvatarHeight);
if (hbmpAvatar) {
HRGN hrgnAvatar = nullptr;
if (opt.bAvatarRound) {
diff --git a/plugins/Toaster/src/utils.h b/plugins/Toaster/src/utils.h
index 2aa4802b8c..524a96730e 100644
--- a/plugins/Toaster/src/utils.h
+++ b/plugins/Toaster/src/utils.h
@@ -14,22 +14,19 @@ public:
__inline explicit ToasterImage(HICON hIcon) : _hBitmap(NULL), tszId(CMStringW(FORMAT, L"%p", hIcon).Detach())
{
ICONINFO icon = { 0 };
- if (GetIconInfo(hIcon, &icon))
- {
+ if (GetIconInfo(hIcon, &icon)) {
_hBitmap = icon.hbmColor;
DeleteObject(icon.hbmMask);
}
}
__inline explicit ToasterImage(HBITMAP bmp) : _hBitmap(bmp), tszId(CMStringW(FORMAT, L"%p", bmp).Detach())
- {
- }
+ {}
__inline explicit ToasterImage(const char *szProto) : _hBitmap(NULL), tszId(mir_a2u(szProto))
{
ICONINFO icon = { 0 };
- if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon))
- {
+ if (GetIconInfo(Skin_LoadProtoIcon(szProto, ID_STATUS_ONLINE, 1), &icon)) {
_hBitmap = icon.hbmColor;
DeleteObject(icon.hbmMask);
}
@@ -45,26 +42,19 @@ public:
wchar_t wszSavePath[MAX_PATH];
mir_snwprintf(wszSavePath, L"%s\\MirandaToaster.%s.png", wszTempDir, tszId);
- if (!(GetFileAttributes(wszSavePath) < 0xFFFFFFF))
- {
+ if (!(GetFileAttributes(wszSavePath) < 0xFFFFFFF)) {
IMGSRVC_INFO isi = { sizeof(isi) };
- isi.wszName = mir_wstrdup(wszSavePath);
+ isi.szName.w = wszSavePath;
isi.hbm = _hBitmap;
isi.dwMask = IMGI_HBITMAP;
isi.fif = FREE_IMAGE_FORMAT::FIF_PNG;
- __try
- {
- CallService(MS_IMG_SAVE, (WPARAM)&isi, IMGL_WCHAR);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- return nullptr;
- }
+ Image_Save(&isi, IMGL_WCHAR);
}
return mir_wstrdup(wszSavePath);
}
__inline operator wchar_t*()
- { return Save();
+ {
+ return Save();
}
-}; \ No newline at end of file
+};
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas
index f6ffad2c6a..47f28ea776 100644
--- a/plugins/Utils.pas/mirutils.pas
+++ b/plugins/Utils.pas/mirutils.pas
@@ -590,7 +590,6 @@ var
req :TNETLIBHTTPREQUEST;
resp:PNETLIBHTTPREQUEST;
hNetLib:THANDLE;
- im:TIMGSRVC_MEMIO;
begin
result:=0;
if (url=nil) or (url^=#0) then
@@ -611,15 +610,8 @@ begin
if resp<>nil then
begin
if resp^.resultCode=200 then
- begin
- im.iLen :=resp.dataLength;
- im.pBuf :=resp.pData;
- im.flags:=size shl 16;
- im.fif :=FIF_JPEG;
- result :=CallService(MS_IMG_LOADFROMMEM,wparam(@im),0);
-// if result<>0 then
-// DeleteObject(SendMessage(wnd,STM_SETIMAGE,IMAGE_BITMAP,result)); //!!
- end;
+ result := Image_LoadFromMem(resp.pData, resp.dataLength, FIF_JPEG);
+
Netlib_FreeHttpRequest(resp);
end;
Netlib_CloseHandle(hNetLib);
diff --git a/plugins/Watrack/popup/pop_vars.inc b/plugins/Watrack/popup/pop_vars.inc
index 61e7edb9f7..4c192af720 100644
--- a/plugins/Watrack/popup/pop_vars.inc
+++ b/plugins/Watrack/popup/pop_vars.inc
@@ -16,7 +16,6 @@ var
DisablePlugin:integer;
IsPopup2Present:boolean;
- IsFreeImagePresent:boolean;
var
hMenuInfo :THANDLE;
ssmi,
diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas
index 8e7782de69..f7b4b98da5 100644
--- a/plugins/Watrack/popup/popups.pas
+++ b/plugins/Watrack/popup/popups.pas
@@ -212,10 +212,7 @@ begin
if si.cover<>nil then
begin
- if IsFreeImagePresent then
- hbmAvatar:=CallService(MS_IMG_LOAD,wparam(si.cover),IMGL_WCHAR)
- else
- hbmAvatar:=0;
+ hbmAvatar:=Image_Load(si.cover, IMGL_WCHAR);
if hbmAvatar=0 then
begin
hbmAvatar:=CallService(MS_UTILS_LOADBITMAPW,0,lparam(si.cover));
@@ -397,7 +394,6 @@ begin
PopupPresent:=newstate;
if PopupPresent then
begin
- IsFreeImagePresent:=ServiceExists(MS_IMG_LOAD);
IsPopup2Present :=ServiceExists(MS_POPUP_ADDPOPUP2);
opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
@@ -481,8 +477,7 @@ begin
ActionList:=nil;
if ServiceExists(MS_POPUP_ADDPOPUPW) then
begin
- IsFreeImagePresent:=ServiceExists(MS_IMG_LOAD);
- IsPopup2Present :=ServiceExists(MS_POPUP_ADDPOPUP2);
+ IsPopup2Present := ServiceExists(MS_POPUP_ADDPOPUP2);
PopupPresent:=true;
opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
loadpopup;