Ver Mensaje Individual
  #2  
Antiguo 20-03-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola aguml.

Código PHP:
#include <math>

void RotateBMP(Graphics::TBitmap *bmpfloat radsbool adjSizeTColor bkColor clNone) {
  
float C,S;
  
Graphics::TBitmap *tmp = new Graphics::TBitmap;
  
int ofsXofsY;
  
TPoint pts[2];

  
cos(rads);
  
sin(rads);
  
tmp->TransparentColor     bmp->TransparentColor;
  
tmp->TransparentMode      bmp->TransparentMode;
  
tmp->Canvas->Brush->Color bkColor;

  if(
adjSize) {
    
tmp->Width  = (int)bmp->Width abs(C) + bmp->Height abs(S);
    
tmp->Height = (int)bmp->Width abs(S) + bmp->Height abs(C);
    
ofsX        = (tmp->Width bmp->Width bmp->Height S) / 2.0;
    
ofsY        = (tmp->Height bmp->Width bmp->Height C) / 2.0;
  } else {
    
tmp->Width  bmp->Width;
    
tmp->Height bmp->Height;
    
ofsX        = (bmp->Width bmp->Width bmp->Height S) / 2.0;
    
ofsY        = (bmp->Height bmp->Width bmp->Height C) / 2.0;
  }
  
pts[0].floor(ofsX);
  
pts[0].floor(ofsY);
  
pts[1].floor(ofsX bmp->Width C);
  
pts[1].floor(ofsY bmp->Width S);
  
pts[2].floor(ofsX bmp->Height S);
  
pts[2].floor(ofsY bmp->Height C);
  
PlgBlt(tmp->Canvas->Handleptsbmp->Canvas->Handle00,
    
bmp->Widthbmp->Height000);

  
bmp->Assign(tmp);
  
delete tmp;

Ejemplo de uso:
Código PHP:
void __fastcall TForm1::btnRotateClick(TObject *Sender)
{
  
Graphics::TBitmap *bmp = new Graphics::TBitmap;
  
bmp->Assign(Image1->Picture->Bitmap);
  
RotateBMP(bmp0.5false);
  
Image2->Picture->Bitmap->Assign(bmp);
  
delete bmp;

Salida:



Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita