以下程序错在哪?C高手请帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/10 20:39:19
biliner(double x,double y)
{
int ix = (int)x;
int iy = (int)y;

double px = x - ix;
double py = y - iy;

int nRowByteCount = ISimg.GetPitch();
BYTE *pImageData = (BYTE *)ISimg.GetBits();
BYTE r1,r2,r3,r4;
BYTE g1,g2,g3,g4;
BYTE b1,b2,b3,b4;

b1 = *(pImageData + (ix) * nRowByteCount + (iy) * 3);
g1 = *(pImageData + (ix) * nRowByteCount + (iy)* 3 + 1);
r1 = *(pImageData + (ix) * nRowByteCount + (iy)* 3 + 2);

b2 = *(pImageData + (ix + 1) * nRowByteCount + (iy)* 3);//运行中断的地方
g2 = *(pImageData + (ix + 1) * nRowByteCount + (iy)* 3 + 1);
r2 = *(pImageData + (ix + 1) * nRowByteCount + (iy)* 3 + 2);

b3 = *(pImageData + (ix) * nRowByteCount + (iy + 1)* 3);
g3 = *(pImageData + (ix) * nRowByteCount + (iy + 1)* 3 + 1);
r3 = *(pImageData + (ix) * nRowByteCount + (iy + 1)* 3 + 2);

b4 = *(pImageData + (ix + 1) * nRowByteCount + (iy

你有检查过biliner(x,y)传入的x和y在图像大小范围内么;假如你的宽是w,高是h,那么
0<=x<w-1
0<=y<h-1

不然的话就可能会出现你说的那种情况了