Home      Affiliated Colleges      Course content      First Sem     Second Sem     Third Sem     Fourth Sem     Fifth Sem     Sixth Sem     Seventh Sem     Eighth Sem     Lab report 4th sem     Contact    

Thursday, February 4, 2010

Computer Graphics:shearing along x-axis and y-axis


//---------------------------------------------------------------------------
#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)
{
int i,j;
int ht=Image1->Height;
int wt=Image1->Width;
int Shx=StrToInt(Edit1->Text);
for(i=0;i<ht;i++)
{
for(j=0;j<wt;j++)
{
Image2->Canvas->Pixels[i+(Shx*j)][j]=Image1->Canvas->Pixels[i][j];
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int i,j;
int ht=Image1->Height;
int wt=Image1->Width;
int Shy=StrToInt(Edit2->Text);
for(i=0;i<ht;i++)
{
for(j=0;j<wt;j++)
{
Image3->Canvas->Pixels[i][(Shy*i)+j]=Image1->Canvas->Pixels[i][j];
}
}
}
//---------------------------------------------------------------------------


No comments:

Post a Comment

^ Scroll to Top Related Posts with Thumbnails ^ Go to Top