summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-26 17:38:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-26 17:38:31 +0300
commitdea9c030340e50324eba97c72a27c151bed12e1c (patch)
tree6fc156f40f52a9fc6e6b29e60001959477ee1a5e /plugins/SendScreenshotPlus
parentc6e8f8223cab9d799593b7b2cfa22134aa9745d6 (diff)
AdvaImg:
- freeimage extracted to the separate library; - FI_INTERFACE removed, all references to it are replaced with direct calls of FreeImage_* functions; - unified project for AdvaImg
Diffstat (limited to 'plugins/SendScreenshotPlus')
-rw-r--r--plugins/SendScreenshotPlus/SendSS.vcxproj5
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp6
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.cpp46
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.h2
-rw-r--r--plugins/SendScreenshotPlus/src/Utils.cpp24
-rw-r--r--plugins/SendScreenshotPlus/src/Utils.h2
6 files changed, 40 insertions, 45 deletions
diff --git a/plugins/SendScreenshotPlus/SendSS.vcxproj b/plugins/SendScreenshotPlus/SendSS.vcxproj
index 79e87a4cd4..988a4e57b9 100644
--- a/plugins/SendScreenshotPlus/SendSS.vcxproj
+++ b/plugins/SendScreenshotPlus/SendSS.vcxproj
@@ -25,6 +25,11 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\libs\freeimage\freeimage.vcxproj">
+ <Project>{5D14CFF3-0D17-4528-99EA-DE9DCA47CC2E}</Project>
+ </ProjectReference>
+ </ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<DisableSpecificWarnings>4458;%(DisableSpecificWarnings)</DisableSpecificWarnings>
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index 468bc8c95f..eab1fa0850 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -35,7 +35,6 @@ CLIST_INTERFACE *pcli;
HINSTANCE g_hSendSS;
MGLOBAL g_myGlobals;
HNETLIBUSER g_hNetlibUser=nullptr;//!< Netlib Register User
-FI_INTERFACE *FIP=nullptr;
int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP()
IconItem ICONS[ICO_END_] =
@@ -270,11 +269,6 @@ DLL_EXPORT int Load(void)
pci = Chat_GetInterface();
pcli = Clist_GetInterface();
- INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
- if (FIP == nullptr || result != S_OK) {
- MessageBox(nullptr, TranslateT("Image services (AdvaImg plugin) not found.\nSendSS disabled."), TranslateT("SendSS"), MB_OK | MB_ICONERROR | MB_APPLMODAL);
- return 1;
- }
/// hook events
HookEvent(ME_SYSTEM_MODULESLOADED, hook_ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, hook_SystemPreShutdown);
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp
index 188ea42459..fed9c0a4c1 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp
@@ -578,7 +578,7 @@ void TfrmMain::wmTimer(WPARAM wParam, LPARAM)
#endif
if (!m_bCapture) { //only start once
if (m_Screenshot) {
- FIP->FI_Unload(m_Screenshot);
+ FreeImage_Unload(m_Screenshot);
m_Screenshot = nullptr;
}
m_bCapture = true;
@@ -673,7 +673,7 @@ void TfrmMain::UMevent(WPARAM, LPARAM lParam)
case EVT_CheckOpenAgain:
if (m_opt_chkOpenAgain) {
if (m_Screenshot) {
- FIP->FI_Unload(m_Screenshot);
+ FreeImage_Unload(m_Screenshot);
m_Screenshot = nullptr;
}
Show();
@@ -720,7 +720,7 @@ TfrmMain::~TfrmMain()
mir_free(m_pszFile);
mir_free(m_FDestFolder);
mir_free(m_Monitors);
- if (m_Screenshot) FIP->FI_Unload(m_Screenshot);
+ if (m_Screenshot) FreeImage_Unload(m_Screenshot);
if (m_cSend) delete m_cSend;
if (m_hTargetHighlighter) {
DestroyWindow(m_hTargetHighlighter), m_hTargetHighlighter = nullptr;
@@ -1006,48 +1006,48 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib)
}
// convert to 32Bits (make sure it is 32bit)
- FIBITMAP *dib_new = FIP->FI_ConvertTo32Bits(dib);
- FIP->FI_SetTransparent(dib_new, TRUE);
+ FIBITMAP *dib_new = FreeImage_ConvertTo32Bits(dib);
+ FreeImage_SetTransparent(dib_new, TRUE);
BOOL ret = FALSE;
HWND hwndCombo = GetDlgItem(m_hWnd, ID_cboxFormat);
switch (ComboBox_GetItemData(hwndCombo, ComboBox_GetCurSel(hwndCombo))) {
case 0: // PNG
wszFileName.Append(L".png");
- ret = FIP->FI_SaveU(FIF_PNG, dib_new, wszFileName, 0);
+ ret = FreeImage_SaveU(FIF_PNG, dib_new, wszFileName, 0);
break;
case 1: // JPG
wszFileName.Append(L".jpg");
{
- FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr);
- FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32);
- FIP->FI_Unload(dib32);
- ret = FIP->FI_SaveU(FIF_JPEG, dib24, wszFileName, 0);
- FIP->FI_Unload(dib24);
+ FIBITMAP *dib32 = FreeImage_Composite(dib_new, FALSE, &m_AlphaColor, nullptr);
+ FIBITMAP *dib24 = FreeImage_ConvertTo24Bits(dib32);
+ FreeImage_Unload(dib32);
+ ret = FreeImage_SaveU(FIF_JPEG, dib24, wszFileName, 0);
+ FreeImage_Unload(dib24);
}
break;
case 2: // BMP
wszFileName.Append(L".bmp");
{
- FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr);
- FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32);
- FIP->FI_Unload(dib32);
- ret = FIP->FI_SaveU(FIF_BMP, dib24, wszFileName, 0);
- FIP->FI_Unload(dib24);
+ FIBITMAP *dib32 = FreeImage_Composite(dib_new, FALSE, &m_AlphaColor, nullptr);
+ FIBITMAP *dib24 = FreeImage_ConvertTo24Bits(dib32);
+ FreeImage_Unload(dib32);
+ ret = FreeImage_SaveU(FIF_BMP, dib24, wszFileName, 0);
+ FreeImage_Unload(dib24);
}
break;
case 3: //TIFF (miranda freeimage interface do not support save tiff, we udse GDI+)
wszFileName.Append(L".tif");
{
- FIBITMAP *dib32 = FIP->FI_Composite(dib_new, FALSE, &m_AlphaColor, nullptr);
- FIBITMAP *dib24 = FIP->FI_ConvertTo24Bits(dib32);
- FIP->FI_Unload(dib32);
+ FIBITMAP *dib32 = FreeImage_Composite(dib_new, FALSE, &m_AlphaColor, nullptr);
+ FIBITMAP *dib24 = FreeImage_ConvertTo24Bits(dib32);
+ FreeImage_Unload(dib32);
- HBITMAP hBmp = FIP->FI_CreateHBITMAPFromDIB(dib24);
- FIP->FI_Unload(dib24);
+ HBITMAP hBmp = FreeImage_CreateHBITMAPFromDIB(dib24);
+ FreeImage_Unload(dib24);
SaveTIF(hBmp, wszFileName);
DeleteObject(hBmp);
}
@@ -1057,7 +1057,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib)
case 4: //GIF
wszFileName.Append(L".gif");
{
- HBITMAP hBmp = FIP->FI_CreateHBITMAPFromDIB(dib_new);
+ HBITMAP hBmp = FreeImage_CreateHBITMAPFromDIB(dib_new);
SaveGIF(hBmp, wszFileName);
DeleteObject(hBmp);
}
@@ -1065,7 +1065,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib)
break;
}
- FIP->FI_Unload(dib_new);
+ FreeImage_Unload(dib_new);
if (!ret)
return 1; // error
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h
index ee77a95c43..cc43ed7da5 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.h
+++ b/plugins/SendScreenshotPlus/src/UMainForm.h
@@ -49,8 +49,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EVT_SendFileDone 2
#define EVT_CheckOpenAgain 3
-extern FI_INTERFACE *FIP;
-
struct TAB_INFO
{
TCITEMHEADER tcih;
diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp
index da3b0dd8f0..95307269b9 100644
--- a/plugins/SendScreenshotPlus/src/Utils.cpp
+++ b/plugins/SendScreenshotPlus/src/Utils.cpp
@@ -77,7 +77,7 @@ size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen)
FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture = nullptr);
/////////////////////////////////////////////////////////////////////////////////////////
-// capture window as FIBITMAP - caller must FIP->FI_Unload(dib)
+// capture window as FIBITMAP - caller must FreeImage_Unload(dib)
FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture)
{
@@ -132,8 +132,8 @@ FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture)
rectCA.top = ABS(rectCA.top - rect.top);
rectCA.right += rectCA.left; rectCA.bottom += rectCA.top;
/// crop the window to ClientArea
- FIBITMAP* dibClient = FIP->FI_Copy(dib, rectCA.left, rectCA.top, rectCA.right, rectCA.bottom);
- FIP->FI_Unload(dib);
+ FIBITMAP* dibClient = FreeImage_Copy(dib, rectCA.left, rectCA.top, rectCA.right, rectCA.bottom);
+ FreeImage_Unload(dib);
dib = dibClient;
}
}
@@ -196,7 +196,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
else // bitblt screen DC to memory DC
BitBlt(hMemDC, 0, 0, width, height, hScrDC, rect->left, rect->top, CAPTUREBLT | SRCCOPY);
- FIBITMAP *dib = FIP->FI_CreateDIBFromHBITMAP(hBitmap);
+ FIBITMAP *dib = FreeImage_CreateDIBFromHBITMAP(hBitmap);
// alpha channel from window is always wrong and sometimes even for desktop (Win7, no aero)
// coz GDI do not draw all in alpha mode.
@@ -239,13 +239,13 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
}
DeleteObject(hRgn);
if (bFixAlpha) {
- FIBITMAP* dibMask = FIP->FI_CreateDIBFromHBITMAP(hMask);
- if (bInvert) FIP->FI_Invert(dibMask);
- FIBITMAP* dib8 = FIP->FI_ConvertTo8Bits(dibMask);
+ FIBITMAP* dibMask = FreeImage_CreateDIBFromHBITMAP(hMask);
+ if (bInvert) FreeImage_Invert(dibMask);
+ FIBITMAP* dib8 = FreeImage_ConvertTo8Bits(dibMask);
// copy the dib8 alpha mask to dib32 main bitmap
- FIP->FI_SetChannel(dib, dib8, FICC_ALPHA);
- FIP->FI_Unload(dibMask);
- FIP->FI_Unload(dib8);
+ FreeImage_SetChannel(dib, dib8, FICC_ALPHA);
+ FreeImage_Unload(dibMask);
+ FreeImage_Unload(dib8);
}
DeleteDC(hMaskDC);
DeleteObject(hMask);
@@ -257,7 +257,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
ReleaseDC(nullptr, hScrDC);
#ifdef _DEBUG
- switch (FIP->FI_GetImageType(dib)) {
+ switch (FreeImage_GetImageType(dib)) {
case FIT_UNKNOWN:
OutputDebugStringA("FIBITMAP Type: FIT_UNKNOWN\r\n");
break;
@@ -301,7 +301,7 @@ FIBITMAP* CreateDIBFromDC(HDC hDC, const RECT* rect, HWND hCapture/*=NULL*/)
OutputDebugStringA("FIBITMAP Type: non detectable image type (error)\r\n");
break;
}
- BOOL inf = FIP->FI_IsTransparent(dib);
+ BOOL inf = FreeImage_IsTransparent(dib);
OutputDebugStringA(inf ? "FIBITMAP Transparent: true\r\n" : "FIBITMAP Transparent: false\r\n");
#endif
return dib;
diff --git a/plugins/SendScreenshotPlus/src/Utils.h b/plugins/SendScreenshotPlus/src/Utils.h
index 8cf8b678b6..bd2d38f240 100644
--- a/plugins/SendScreenshotPlus/src/Utils.h
+++ b/plugins/SendScreenshotPlus/src/Utils.h
@@ -31,8 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SPP_USERPANE 1
-extern FI_INTERFACE* FIP;
-
#define ABS(x) ((x)<0?-(x):(x))
struct MONITORS