// CopyBuffer.cpp: implementation of the CCopyBuffer class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "InspectionBuffer.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// BOOL CCopyBuffer::FillBuffer(CSISBuffer &buffer, double xx, double yy) { int x= static_cast (xx); int y= static_cast (yy); if(yy < 0) { y--; } double x2= xx- x; double x1= 1.0- x2; double y2= yy- y; double y1= 1.0- y2; double xy= x1*y1; double xxy= x2*y1; double xyy= x1*y2; double xxyy= x2*y2; BYTE val; int tx, ty; // FILE pFile; // pFile= fopen("buffer.txt", "w"); for(int iy= 0; iy < m_Height; iy++) { ty= y+ iy; for(int ix= 0; ix < m_Width; ix++) { tx= x+ ix; val= (BYTE) (xy*buffer.GetPixel(tx, ty) + xxy*buffer.GetPixel(tx+ 1, ty)+ xyy*buffer.GetPixel(tx, ty+ 1)+ xxyy*buffer.GetPixel(tx+1, ty+1)); SetPixel(ix, iy, val); // fprintf(pFile, "%d, %d, %d, %d, %d", val, buffer.GetPixel(tx, ty), buffer.GetPixel(tx+ 1, ty), buffer.GetPixel(tx+ 1, ty), buffer.GetPixel(tx+ 1, ty+ 1)); // SetPixel(ix, iy, 0); } } return TRUE; }