From 364eb4d1b1f3fa7569c16c216df873f70d675ba5 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 28 Apr 2015 07:33:58 +0000 Subject: use common m_skin_eng.h git-svn-id: http://svn.miranda-ng.org/main/trunk@13220 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ExternalAPI/m_skin_eng.h | 56 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h index b677b22df8..fa91f624e2 100644 --- a/plugins/ExternalAPI/m_skin_eng.h +++ b/plugins/ExternalAPI/m_skin_eng.h @@ -187,16 +187,12 @@ int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT * rcClip, char * obje return CallService(MS_SKIN_DRAWGLYPH,(WPARAM)&rq,0); } - - //Register object with predefined style int __inline CreateGlyphedObjectDefStyle(char * ObjID,BYTE defStyle); int __inline CreateGlyphedObjectDefColor(char * ObjID,DWORD defColor); //Register default object int __inline CreateGlyphedObject(char * ObjID); - - //// Creating and registering objects //int __inline CreateGlyphedObject(char * ObjID) //{ @@ -346,6 +342,7 @@ int __inline SkinInvalidateFrame(HWND hWnd, CONST RECT* lpRect) { return SkinEngInvalidateImageFrame(hWnd, lpRect, 0, 0); } +// Alpha channel GDI replacements/helpers // // Paints text with correct alpha channel @@ -374,6 +371,57 @@ int __inline AlphaText(HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRect, UIN return CallService(MS_SKINENG_ALPHATEXTOUT,(WPARAM)&ap,0); } +//////////////////////////////////////////////////////////////////////////////// +// Paints text with correct alpha channel and effect, alternative to DrawText +// wParam - pointer to DrawTextWithEffectParam + +typedef struct MODERNFONTEFFECT_tag +{ + BYTE effectIndex; + DWORD baseColour; // ARGB + DWORD secondaryColour; // ARGB +} +MODERNFONTEFFECT; + +typedef struct DrawTextWithEffectParam_tag +{ + int cbSize; + HDC hdc; // handle to DC + LPCTSTR lpchText; // text to draw + int cchText; // length of text to draw + LPRECT lprc; // rectangle coordinates + UINT dwDTFormat; // formatting options + MODERNFONTEFFECT * pEffect; // effect to be drawn on +} DrawTextWithEffectParam; + +#define MS_DRAW_TEXT_WITH_EFFECTA "Modern/SkinEngine/DrawTextWithEffectA" +#define MS_DRAW_TEXT_WITH_EFFECTW "Modern/SkinEngine/DrawTextWithEffectW" + +#ifdef UNICODE + #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW +#else + #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTA +#endif + +// Helper +int __inline DrawTextWithEffect( HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, MODERNFONTEFFECT * pEffect ) +{ + DrawTextWithEffectParam params; + static BYTE bIfServiceExists = ServiceExists( MS_DRAW_TEXT_WITH_EFFECT ) ? 1 : 0; + if ( bIfServiceExists == 0 ) return DrawText ( hdc, lpchText, cchText, lprc, dwDTFormat ); + + // else + params.cbSize = sizeof( DrawTextWithEffectParam ); + params.hdc = hdc; + params.lpchText = lpchText; + params.cchText = cchText; + params.lprc = lprc; + params.dwDTFormat = dwDTFormat; + params.pEffect = pEffect; + return CallService( MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0 ); +} + + typedef struct _ImageListFixParam { HIMAGELIST himl; -- cgit v1.2.3