Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   C++ Builder (https://www.clubdelphi.com/foros/forumdisplay.php?f=13)
-   -   Imagen con efecto zoom (https://www.clubdelphi.com/foros/showthread.php?t=79989)

lisette 27-08-2012 02:43:44

Imagen con efecto zoom
 
necesito que la imagen tenga un efecto de acercamiento. Tiene que ser en BCB

ecfisa 27-08-2012 05:17:14

Hola lisette.

Revisa esto: Zoom on an Image

Saludos.

lisette 28-08-2012 23:52:08

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?


La franja horaria es GMT +2. Ahora son las 01:31:59.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi