1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
| // 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<int> (xx);
| int y= static_cast<int> (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;
| }
|
|