Try to transparentize but crash | developer.brewmp.com Try to transparentize but crash | developer.brewmp.com

Developer

Try to transparentize but crash

Forums:

IDISPLAY_SetColor(g_pApp->m_pIDisplay, CLR_USER_BACKGROUND, RGB_WHITE);
IDISPLAY_SetColor(g_pApp->m_pIDisplay, CLR_USER_TEXT, RGB_BLACK);

if(!m_pStatic) return;
AEERect grc;
SETAEERECT(&grc, 0, 0, g_pApp->m_pAppUi->m_env.m_cxScreen, g_pApp->m_pAppUi->m_env.m_cyScreen);

if(m_pBackGroundBitmap)
{
IDISPLAY_BitBlt(g_pApp->m_pIDisplay,rc.x,rc.y,rc.dx,rc.dy,m_pBackGroundBitmap,0,0,AEE_RO_COPY);
}

IBitmap* pBitmap = IDISPLAY_GetDestination(g_pApp->m_pIDisplay);

NativeColor color;
color = IBITMAP_RGBToNative(pBitmap,RGB_WHITE);
IBitmap * pNewBitmap;
IBITMAP_CreateCompatibleBitmap(pBitmap, &pNewBitmap,grc.dx,grc.dy);

IDISPLAY_SetDestination(g_pApp->m_pIDisplay, pNewBitmap);
IBITMAP_SetTransparencyColor(pNewBitmap, color);

IDISPLAY_SetColor(g_pApp->m_pIDisplay, CLR_USER_BACKGROUND, RGB_WHITE);
IDISPLAY_SetColor(g_pApp->m_pIDisplay, CLR_USER_TEXT, m_nFontcolor);

ISTATIC_Redraw(m_pStatic);

IDISPLAY_SetDestination(g_pApp->m_pIDisplay, NULL);
IDISPLAY_BitBlt(g_pApp->m_pIDisplay, rc.x, rc.y, rc.dx, rc.dy,
pNewBitmap, rc.x, rc.y, AEE_RO_TRANSPARENT);
IBITMAP_Release(pNewBitmap);
IBITMAP_Release(pBitmap);
IDISPLAY_SetColor(g_pApp->m_pIDisplay, CLR_USER_BACKGROUND, m_nBackground);

// the crash happened after use for a while.
// at the point IDISPALY_SetDestination, it is really strange , can anyone give any comment?