Ver Mensaje Individual
  #3  
Antiguo 28-08-2012
lisette lisette is offline
Miembro
NULL
 
Registrado: feb 2012
Posts: 16
Reputación: 0
lisette Va por buen camino
Zoom de Imagen

Dengo el siquiente codigo perteneciente a al cpp
Código Delphi [-]
//-------------------------------------------------------------------------- 
- 

#include  
#pragma hdrstop 

#include "Unit1.h" 
//-------------------------------------------------------------------------- 
- 
#pragma package(smart_init) 
#pragma resource "*.dfm" 
TfrmMain *frmMain; 
//-------------------------------------------------------------------------- 
- 
Graphics::TBitmap* bmpSource = NULL; 
TRect rctZoom; 
TRect rctOldZoom; 
__fastcall TfrmMain::TfrmMain(TComponent* Owner) 
: TForm(Owner) 
{ 
img1->Width = 100; 
img1->Height = 100; 
img1->Left = 0; 
img1->Top = 0; 
img1->Stretch = false; 

bmpSource = new Graphics::TBitmap(); 
bmpSource->LoadFromFile("C:\Program Files\Common Files\Borland 
Shared\Images\Splash\256Color\factory.bmp"); 
ZoomAllTheWayOut(); 
} 
//-------------------------------------------------------------------------- 
- 
__fastcall TfrmMain::~TfrmMain() 
{ 
if(bmpSource) 
delete bmpSource; 
} 
//-------------------------------------------------------------------------- 
- 
void __fastcall TfrmMain::ZoomAllTheWayOut() 
{ 
rctZoom.Left = 0; 
rctZoom.Top = 0; 
rctZoom.Right = bmpSource->Width -1; 
rctZoom.Bottom = bmpSource->Height -1; 
rctOldZoom = rctZoom; 
RedrawImage(); 
} 
//-------------------------------------------------------------------------- 
- 
void __fastcall TfrmMain::btnZoomAllTheWayOutClick(TObject *Sender) 
{ 
ZoomAllTheWayOut(); 
} 
//-------------------------------------------------------------------------- 
- 
void __fastcall TfrmMain::RedrawImage() 
{ 
HDC hdcDest = img1->Canvas->Handle; 
HDC hdcSrc = bmpSource->Canvas->Handle; 

StretchBlt(hdcDest, 0, 0, img1->Width -1, img1->Height -1, 
hdcSrc, rctZoom.Left, rctZoom.Top, rctZoom.Right, 
rctZoom.Bottom, 
SRCCOPY); 
img1->Invalidate(); 
} 
//-------------------------------------------------------------------------- 
- 
void __fastcall TfrmMain::img1MouseDown(TObject *Sender, 
TMouseButton Button, TShiftState Shift, int X, int Y) 
{ 
rctZoom.Left = X; 
rctZoom.Top = Y; 
} 
//-------------------------------------------------------------------------- 
- 
void __fastcall TfrmMain::img1MouseUp(TObject *Sender, TMouseButton Button, 
TShiftState Shift, int X, int Y) 
{ 
rctZoom.Right = X; 
rctZoom.Bottom = Y; 

rctZoom.Left = (rctOldZoom.Right - rctOldZoom.Left) / (double)img1->Width 
* rctZoom.Left + rctOldZoom.Left; 
rctZoom.Right = (rctOldZoom.Right - rctOldZoom.Left) / (double)img1->Width 
* rctZoom.Right + rctOldZoom.Left; 
rctZoom.Top = (rctOldZoom.Bottom - rctOldZoom.Top) / (double)img1->Height 
* rctZoom.Top + rctOldZoom.Top; 
rctZoom.Bottom = (rctOldZoom.Bottom - rctOldZoom.Top) / 
(double)img1->Height * rctZoom.Bottom + rctOldZoom.Top; 

rctOldZoom = rctZoom; 

RedrawImage(); 
} 
//--------------------------------------------------------------------------

Pero no tengo la .h que es donde se encuentra la declaracion de estas dos funciones ZoomAllTheWayOut() y RedrawImage().

Alguna idea de como declarar estas funciones?
Responder Con Cita