当前位置: 代码迷 >> Brew >> Transform旋转之后的背景如何设置透明色
  详细解决方案

Transform旋转之后的背景如何设置透明色

热度:722   发布时间:2013-02-26 00:00:00.0
Transform旋转之后的背景怎么设置透明色。
代码如下:
void CGameScreen::PaintTransform(IBitmap * pBitMap, int nAngle, int nX, int nY)
{
AEEBitmapInfo BitmapInfo;
IBITMAP_GetInfo(pBitMap, &BitmapInfo, sizeof(AEEBitmapInfo));
AEETransformMatrix pMatrixTransform;
pMatrixTransform.A = ((256 * GetCos(nAngle)) >> 16);
pMatrixTransform.B = ((256 * GetSin(nAngle)) >> 16);
pMatrixTransform.C = ((-256 * GetSin(nAngle)) >> 16);
pMatrixTransform.D = ((256 * GetCos(nAngle)) >> 16);

IBitmap* dst = NULL;
ITransform* pTransform = NULL;
IBITMAP_CreateCompatibleBitmap(pBitMap,&dst,BitmapInfo.cx,BitmapInfo.cy);
int neeor = IBITMAP_QueryInterface(dst,AEECLSID_TRANSFORM,(void**)&pTransform);
ITRANSFORM_TransformBltComplex(pTransform, nX, nY, pBitMap, 0, 0, BitmapInfo.cx, BitmapInfo.cy, &pMatrixTransform, COMPOSITE_OPAQUE);
IDISPLAY_BitBlt(m_pAppCtx->GetDisplay(),nX, nY, BitmapInfo.cx, BitmapInfo.cy, dst,0,0,AEE_RO_COPY);
IBITMAP_Release(dst);
ITRANSFORM_Release(pTransform);
}


------解决方案--------------------------------------------------------
在IDISPLAY_BitBlt之前,做个透过色处理应该就可行了。
------解决方案--------------------------------------------------------
得到当前的的位图的IBitmap接口,然后有IBitMap_SetTransparentColor做一下颜色过滤就可以了