Ver Mensaje Individual
  #5  
Antiguo 15-12-2014
aposi aposi is offline
Miembro
 
Registrado: dic 2006
Posts: 160
Reputación: 20
aposi Va por buen camino
El codigo tiene que quedar así:

Código PHP:
int ContarDivisionesImagen( AnsiString ruta, int maxWidth, int maxHeight)
{
   
//Solicito memoria para el bitmap que contendrá el concatenado de imagenes
   
Graphics::TBitmap *bmp = new (nothrow) Graphics::TBitmap();
   
int divisiones = 0;
   
int divisionesWidth = 0;
   
int divisionesHeight = 0;
   if(
bmp != NULL)
   {
      
bmp->LoadFromFile(ruta);

      
int TotalWidth = bmp->Width - maxWidth;
      
int TotalHeight = bmp->Height - maxHeight;

      while( 
TotalWidth > 0)
      {
         
TotalWidth -= maxWidth;
         
divisionesWidth++;
      }
      while( 
TotalHeight > 0)
      {
         
TotalHeight -= maxHeight;
         
divisionesHeight++;
      }
      
delete bmp;
      if 
divisionesHeight != 0 {
           if 
divisionesWidth != 0 {
              
divisiones = divisionesHeight * divisionesWidth;
          }else {
             
divisiones =  divisionesHeight;  
          }
      }else { 
             
divisiones = divisionesWidth;
     }
    
   }else{
      
divisiones = -1;
   }
   return 
divisiones;
} 
Responder Con Cita