APlayer 叠图是允许有 Alpha 通道的,普通位图 Alpha 通道为 0,就会看不到,所以对于普通位图要设置 ColorKey 为 0x00FFFFFF,忽略位图的 Alpha 通道, Color Key 参数号为 609,
下面是 APlayer3Test 中叠图相关代码,注意红色部分:
void OpenPictureFile(void)
{
// Get all format list
TCHAR szAllFormat[MAX_PATH];
lstrcpy(szAllFormat, _T("*.bmp;*.png;*.swf;"));
// Build filter
TCHAR szFilter[512];
TCHAR * pFilter = szFilter;
wsprintf(pFilter, _T("支持的叠加图片文件(%s)"), szAllFormat);
pFilter += (lstrlen(pFilter) + 1);
lstrcpy(pFilter, szAllFormat);
pFilter += (lstrlen(pFilter) + 1);
lstrcpy(pFilter, _T("所有文件(*.*)"));
pFilter += (lstrlen(pFilter) + 1);
lstrcpy(pFilter, _T("*.*"));
pFilter += (lstrlen(pFilter) + 1);
*pFilter = 0; pFilter++;
// The file path
TCHAR szFileName[MAX_PATH];
memset(szFileName, 0, sizeof(szFileName));
// Select file
BOOL bResult = SelectFileDlg(g_hWnd, FALSE, _T("选择叠加图片文件"), szFilter,
szFileName, countof(szFileName), NULL, 0);
if(bResult)
{
g_Player.SetConfigInt(CONFIGID_PICTUREENABLE, 1);
lstrlwr(szFileName);
if(lstrstr(szFileName, _T(".bmp")) != NULL)
{
g_Player.SetConfigStr(CONFIGID_PICTUREBMPFILENAME, szFileName);
g_Player.SetConfigInt(CONFIGID_PICTURECOLORKEY, 0x00FFFFFF);
}
else if(lstrstr(szFileName, _T(".png")) != NULL)
{
g_Player.SetConfigStr(CONFIGID_PICTUREPNGFILENAME, szFileName);
g_Player.SetConfigInt(CONFIGID_PICTURECOLORKEY, 0xFFFFFFFF);
}
else if(lstrstr(szFileName, _T(".swf")) != NULL)
{
const TCHAR * str = g_Player.GetConfigStr(CONFIGID_PICTURESWFSIZE);
g_Player.SetConfigStr(CONFIGID_PICTURESWFSIZE, _T("300;300"));
g_Player.SetConfigStr(CONFIGID_PICTURESWFFILENAME, szFileName);
g_Player.SetConfigInt(CONFIGID_PICTURECOLORKEY, 0xFFFFFFFF);
}
}
}