关于CxImage图像操作类库中Crop函数不能连续截取的问题

猫牌铅笔 猫牌铅笔 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我想实现一张png图片(4个动作)连续按帧播放的动画,每次截取整张图片的一部分显示出来。我使用cximg->Crop(rect)函数改变rect的left和right来截取。可是不能连续播放。请问是什么问题啊?

BOOL Role::Draw(HDC m_hdc)
{
static TCHAR temp[100];

static UINT frameCount = 0;
if (frameCount == 4)
frameCount = 0;

CRect rect;
rect.bottom = 103*3;
rect.left = 133*frameCount;
rect.right = 133*(frameCount+1);
rect.top = 103*(2);

cximg->Crop(rect);
cximg->Draw(m_hdc,0,400);

frameCount++;

swprintf_s(temp,L"framecount: %d ,left: %d ,right: %d ", frameCount, rect.left, rect.right);
TextOut(m_hdc, 0, 100, temp, wcslen(temp));

//BitBlt(m_hdc, 0, 400, 133, 103, m_hImgDC, 133*frameCount, 103*3, SRCCOPY);

return TRUE;
}
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
猫牌铅笔
C++ 语言 65,214 成员 250,514 内容