如何动态旋转图片?
我的程序中有一个资源(*.bmp 图像)。当我启动计时器时,我的图像应该旋转,直到我单击“暂停”。我需要一个示例来解释我如何做到这一点。
目前我使用此代码:
void rotatewaiticon()
{
Graphics::TBitmap *bmpOriginal = new Graphics::TBitmap();
//bmpOriginal->LoadFromResourceName(0,"bmpcrug");
bmpOriginal->LoadFromFile("degrees.bmp");
FormMain->Image65->Picture->Assign(bmpOriginal);
Graphics::TBitmap *bmpCopy = new Graphics::TBitmap();
bmpCopy->Width = bmpOriginal->Height;
bmpCopy->Height = bmpOriginal->Width;
int wOr = bmpOriginal->Width, hOr = bmpOriginal->Height;
for(int x = 0; x < wOr; x++)
{
for(int y = 0; y < hOr; y++)
{
bmpCopy->Canvas->Pixels[hOr - y][x] = bmpOriginal->Canvas->Pixels[x][y];
}
}
/**/FormMain->Image65->Picture->Assign(bmpCopy);
bmpCopy->SaveToFile("degrees.bmp");
delete bmpOriginal, bmpCopy;
}
但我没有找到一种方法来使用此文件而不将其保存在磁盘上。
I have a resource in my prog (*.bmp image). When I start a timer, my image should rotate until I click "pause". I need a sample which explain me how I could to do this.
Currently I use this code:
void rotatewaiticon()
{
Graphics::TBitmap *bmpOriginal = new Graphics::TBitmap();
//bmpOriginal->LoadFromResourceName(0,"bmpcrug");
bmpOriginal->LoadFromFile("degrees.bmp");
FormMain->Image65->Picture->Assign(bmpOriginal);
Graphics::TBitmap *bmpCopy = new Graphics::TBitmap();
bmpCopy->Width = bmpOriginal->Height;
bmpCopy->Height = bmpOriginal->Width;
int wOr = bmpOriginal->Width, hOr = bmpOriginal->Height;
for(int x = 0; x < wOr; x++)
{
for(int y = 0; y < hOr; y++)
{
bmpCopy->Canvas->Pixels[hOr - y][x] = bmpOriginal->Canvas->Pixels[x][y];
}
}
/**/FormMain->Image65->Picture->Assign(bmpCopy);
bmpCopy->SaveToFile("degrees.bmp");
delete bmpOriginal, bmpCopy;
}
But I don't see a way to work with this file without saving it on a disk.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论