|
X-Direction
HSrcStepInt = SrcWidth / TgtWidth;
HSrcStepRem = SrcWidth % TgtWidth;
for( CurrentReadLine = 0; CurrentReadLine < SrcHeight; CurrentReadLine++ ) {
CurrentWriteLine = CurrentReadLine;
HTotStepInt = 2; // pre-load first two pixels
while (NumPixels < HActiveStop) {
if ( HTotStepInt != 0 ) {
SourcePix1 = SourcePix2;
SourcePix2 = SourceImage[CurrentReadLine][HSrcPosInt];
HSrcPosInt++;
HTotStepInt--;
}
else if ( NumPixels < TgtWidth ) {
if ( NumPixels >= HActiveStart && NumPixels < HActiveStop ) {
coeff1 = ( TgtWidth - HSrcPosRem ) * 65536 / TgtWidth;
coeff2 = HSrcPosRem * 65536/TgtWidth;
TargetLine[CurrentWriteLine][PixelCount] =
( coeff1 * SourcePix1 + coeff2 * SourcePix2 ) >> 16;
PixelCount++;
}
HSrcPosRem += HSrcStepRem;
HTotStepInt = HSrcStepInt;
if ( HSrcPosRem >= TgtWidth ) {
HSrcPosRem -= TgtWidth;
HTotStepInt++;
}
NumPixels++;
if ( HTotStepInt != 0 ) {
SourcePix1 = SourcePix2;
SourcePix2 = SourceImage[CurrentReadLine][HSrcPosInt];
HSrcPosInt++;
HTotStepInt--;
}
}
} // While NumPixels
} // For CurrentReadLine
|