|
상구야 답변 고맙다..
그런데 이상하게 Transform(img32Dst->Bitmap, img32Src->Bitmap, pT); 에서 Acsess violation
에러가 나는구나.. 혹시 graphics32 버전 때문인가??(최신버전- 패패루님이 올려놓은...^^)
여기 포럼에서도 나하고 같은 질문을 한 사람이 있더라구.... 그런데 답변이 없어서 내가 여기다 올렸지...
원인이 뭔지 모르겠다... 넌 잘되니까 올렸겠지???
답변주시면 감사하겠습다.....
내 소스도 올릴께....
void __fastcall TMainForm::rotate2Click(TObject *Sender)
{
TImage32* pIM = ((TMDIChild *)ActiveMDIChild)->Image321;
int bw, bh;
bw = int(pIM->Bitmap->Width ) ;
bh = int(pIM->Bitmap->Height) ;
double seta=0,pi=3.1415926535;
TAffineTransformation* atr= new TAffineTransformation();
((TMDIChild *)ActiveMDIChild)->Image322->Bitmap->Width =bw;
((TMDIChild *)ActiveMDIChild)->Image322->Bitmap->Height=bh;
seta=pi/2;
atr->Clear();
atr->SrcRect = FloatRect(0, 0, bw - 1, bh - 1);
atr->Rotate( bw/2,bh/2,seta);
((TMDIChild *)ActiveMDIChild)->Image322->BeginUpdate();
((TMDIChild *)ActiveMDIChild)->Image322->Bitmap->Clear(clGray32);
Transform(((TMDIChild *)ActiveMDIChild)->Image322->Bitmap,pIM->Bitmap, atr);
((TMDIChild *)ActiveMDIChild)->Image322->EndUpdate();
((TMDIChild *)ActiveMDIChild)->Image322->Repaint();
delete atr;
)
//여기까지..//
김상구.패패루 님이 쓰신 글 :
: 질문 내용을 보다 상세하게 적으시면 아마 답변이 더 많을 것 같군요.
: 일단, 저도 오늘 처음 제대로 한 번 만들어봤는데 의외로 간단하군요.
:
: 먼저 빈 폼에 2개의 TImage32 컨트롤을 넣습니다. 하나는 img32Src라고 이름을 바꾸고 또 하나는
: img32Dst라고 이름을 바꾸고, img32Src를 더블클릭해서 임의의 이미지를 박아 넣습니다.
: TTrackBar를 하나 박아 넣고 OnChange 이벤트를 작성합니다.
:
: //---------------------------------------------------------------------------
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: #include "GR32_Transforms.hpp" // << 이거 추가해 줘야하죠
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma link "GR32_Image"
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
: : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::TrackBar1Change(TObject *Sender)
: {
: int nWidth = img32Src->Width;
: int nHeight = img32Src->Height;
:
: img32Dst->Bitmap->Width = nWidth;
: img32Dst->Bitmap->Height = nHeight;
:
: TAffineTransformation* pT = new TAffineTransformation();
: pT->SrcRect = FloatRect(0,0,nWidth,nHeight);
: pT->Rotate(nWidth/2, nHeight/2, TrackBar1->Position);
:
: img32Dst->BeginUpdate();
: img32Dst->Bitmap->Clear(clGray32);
: Transform(img32Dst->Bitmap, img32Src->Bitmap, pT);
: img32Dst->EndUpdate();
: img32Dst->Repaint();
: delete pT;
: }
: //---------------------------------------------------------------------------
:
: 해 보시면 잘 될겁니다.
:
: 이상훈 님이 쓰신 글 :
: : graphics32에서 비트맵회전시켜보신분 계십니까?
: :
: : TTransformation 과 TAffineTransformation 을 어떻게 연결시켜야할지 모르겠습니다.
: :
: : 누가 좀 도와주세요...
|