====== PC_LockOverlay import ====== Plugin can use this function together with [[plugin_sdk:imports:pc_unlockoverlay|PC_UnlockOverlay]] to draw overlay in [[plugin_sdk:exports:pluginupdateoverlay|PluginUpdateOverlay]] callback. Function locks system memory buffer which will be used to update overlay texture. ==== Syntax ==== <code> PLUGIN_IMPORT BOOL PC_LockOverlay( [in] DWORD dwPluginID, [in] OverlayLockStruct *map_desc ); </code> ==== Parameters ==== dwPluginID [in]\\ Unique plugin ID, see more here: [[plugin_sdk:exports:plugininit|PluginInit]]. map_desc [in]\\ Not NULL address of [[plugin_sdk:structures:overlaylockstruct|OverlayLockStruct]] which receives information about locked memory area, which represents overlay image buffer (only for writing by plugin). Buffer has format RGB32 (DWORD: 0xAABBGGRR). Plugin should fill this buffer with graphics and then unlock it. ==== Return value ==== TRUE is lock operation is successful. FALSE if it isn't. ==== Sample code ==== <code> // global variable to store plugin id DWORD m_dwPluginID = -1; PLUGIN_EXPORT void PluginUpdateOverlay() { // lock overlay image OverlayLockStruct pLock; if (!PC_LockOverlay(m_dwPluginID, &pLock)) // lock overlay buffer and get its size return; // copy rgb24 to rgba32, pImageFrame - pointer to rgb24 buffer for (DWORD y = 0; y < pLock.dwHeight; y++) { BYTE *pSrc = pImageFrame + y * pLock.dwWidth * 3; BYTE *pDst = pLock.pBuffer + y * pLock.dwPitch; for (DWORD x = 0; x < pLock.dwWidth; x++) { *pDst++ = *pSrc++; *pDst++ = *pSrc++; *pDst++ = *pSrc++; *pDst++ = 0xff; // alpha } } // fill overlay image PC_UnlockOverlay(m_dwPluginID, true); } </code> ==== See also ==== [[plugin_sdk:imports:pc_unlockoverlay|PC_UnlockOverlay]]\\ [[plugin_sdk:imports:start|PlayClaw plugin imports]]\\