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做一下颜色过滤就可以了