PicCropperRGB32Impl.cpp

Go to the documentation of this file.
00001 
00036 #ifdef _WINDOWS
00037 #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
00038 #include <windows.h>
00039 #else
00040 #include <stdio.h>
00041 #endif
00042 
00043 #include <string.h>
00044 #include <stdlib.h>
00045 
00046 #include "PicCropperRGB32Impl.h"
00047 
00048 /*
00049 ===========================================================================
00050         Interface Methods.
00051 ===========================================================================
00052 */
00062 int PicCropperRGB32Impl::Crop(void* pInImg, void* pImg)
00063 {
00064         if( (pImg == NULL) || (pInImg == NULL) )
00065                 return(0);
00066 
00068         int writeWidth = _widthIn - _byX1 - _byX2;
00069         int writeHeight = _heightIn - _byY1 - _byY2;
00070         if( (writeWidth < 0) || (writeHeight < 0) )
00071                 return(0);
00072         if(writeWidth > _widthOut) writeWidth = _widthOut;
00073         if(writeHeight > _heightOut) writeHeight = _heightOut;
00074 
00076         unsigned char*  pSrc    = (unsigned char*)pInImg + 4*((_byY1*_widthIn) + _byX1);
00077         unsigned char*  pDst    = (unsigned char*)pImg;
00078 
00079         for(int y = 0; y < writeHeight; y++)
00080         {
00081                 memcpy((void *)pDst, (const void *)pSrc, 4*writeWidth); 
00082                 pDst += (4*_widthOut);  
00083                 pSrc += (4*_widthIn);
00084         }//end for y...
00085 
00086         return(1);
00087 }//end Crop.
00088 

Generated on Fri Mar 13 14:12:38 2009 for RTVC by  doxygen 1.5.3