| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1447 人关注过本帖
标题:[求助]怎么样让图片出现翻转
只看楼主 加入收藏
lzhp040424
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-3-29
收藏
 问题点数:0 回复次数:1 
[求助]怎么样让图片出现翻转
各位大虾:
请问一下,怎么样用C++ Builder6.0实现图片旋转90度和180度.

[此贴子已经被作者于2007-7-18 0:12:26编辑过]

搜索更多相关主题的帖子: 翻转 
2007-07-18 00:11
热情依然
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:22
帖 子:715
专家分:0
注 册:2005-4-5
收藏
得分:0 

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *bufferbitmap = new Graphics::TBitmap();
bufferbitmap->Width = Image1->Height;
bufferbitmap->Height = Image1->Width;

static TRect sourcepix,destpix, fullbufferimage, fulldestimage;
fullbufferimage.left = 0;
fullbufferimage.Top = bufferbitmap->Height;
fullbufferimage.Right = bufferbitmap->Width;
fullbufferimage.Bottom = 0;

for( int y=0; y < Image1->Height; ++y)
{
for( int x =0; x < Image1->Width; ++x)
{
sourcepix.Left = x;
sourcepix.Top = y+1;
sourcepix.Right = x+1;
sourcepix.Bottom = y;
destpix.Left = y;
destpix.Top = bufferbitmap->Height - x;
destpix.Right = y + 1;
destpix.Bottom = bufferbitmap->Height - x -1;
bufferbitmap->Canvas->CopyRect(destpix,Image1->Canvas,sourcepix);
}
}
Image1->Width = bufferbitmap->Width;
Image1->Height = bufferbitmap->Height;
Image1->Picture->Bitmap->Width = bufferbitmap->Width;
Image1->Picture->Bitmap->Height = bufferbitmap->Height;
Image1->Canvas->CopyRect(fullbufferimage,bufferbitmap->Canvas,fullbufferimage);

}
//---------------------------------------------------------------------------


c++/C + 汇编 = 天下无敌
2007-07-29 16:59
快速回复:[求助]怎么样让图片出现翻转
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.057703 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved