THEN {
rWRef: AIS.WRef ← AIS.OpenWindow[rAis, aisY, aisY+aisH-1, aisX, aisX+aisW-1];
gWRef: AIS.WRef ← AIS.OpenWindow[gAis, aisY, aisY+aisH-1, aisX, aisX+aisW-1];
bWRef: AIS.WRef ← AIS.OpenWindow[bAis, aisY, aisY+aisH-1, aisX, aisX+aisW-1];
w: INTEGER ← rWRef.lastPixel-rWRef.firstPixel+1;
h: INTEGER ← rWRef.lastScan-rWRef.firstScan+1;
rSampleBuffer: SampleBuffer ← ImagerSample.ObtainScratchBuffer[1, w];
gSampleBuffer: SampleBuffer ← ImagerSample.ObtainScratchBuffer[1, w];
bSampleBuffer: SampleBuffer ← ImagerSample.ObtainScratchBuffer[1, w];
rgSampleBuffer: SampleBuffer ← ImagerSample.ObtainScratchBuffer[1, w];
rPm: PixelMap ← ImagerPixelMap.Create[3, [0, 0, 1, w]];
gPm: PixelMap ← ImagerPixelMap.Create[3, [0, 0, 1, w]];
bPm: PixelMap ← ImagerPixelMap.Create[3, [0, 0, 1, w]];
rgPm: PixelMap ← ImagerPixelMap.Create[4, [0, 0, 1, w]];
rBuf: AIS.Buffer ← [rPm.refRep.words, rPm.refRep.pointer];
gBuf: AIS.Buffer ← [gPm.refRep.words, gPm.refRep.pointer];
bBuf: AIS.Buffer ← [bPm.refRep.words, bPm.refRep.pointer];
IF center
THEN {
cd.rg ← ImagerPixelMap.ShiftMap[cd.rg, (h-cd.rg.sSize)/2, (w-cd.rg.fSize)/2];
cd.b ← ImagerPixelMap.ShiftMap[cd.b, (h-cd.b.sSize)/2, (w-cd.b.fSize)/2];
};
FOR i:
INT
IN [0..h)
DO
TRUSTED {AIS.UnsafeReadLine[rWRef, rBuf, i]};
TRUSTED {AIS.UnsafeReadLine[gWRef, gBuf, i]};
TRUSTED {AIS.UnsafeReadLine[bWRef, bBuf, i]};
PixelMapOps.GetF[rPm, 0, 0, rSampleBuffer, 0, 0, w];
PixelMapOps.GetF[gPm, 0, 0, gSampleBuffer, 0, 0, w];
PixelMapOps.GetF[bPm, 0, 0, bSampleBuffer, 0, 0, w];
TRUSTED {
rPtr: UnsafeSamples ~ ImagerSample.GetPointer[rSampleBuffer, 0, 0, w];
gPtr: UnsafeSamples ~ ImagerSample.GetPointer[gSampleBuffer, 0, 0, w];
rgPtr: UnsafeSamples ~ ImagerSample.GetPointer[rgSampleBuffer, 0, 0, w];
FOR j: INT IN [0..w) DO rgPtr[j] ← 256*rPtr[j]+gPtr[j]; ENDLOOP;
};
PixelMapOps.PutF[rgPm, 0, 0, rgSampleBuffer, 0, 0, w];
ImagerPixelMap.Transfer[
cd.rg,ImagerPixelMap.ShiftMap[rgPm, cd.rg.sMin+i, cd.rg.fMin]];
ImagerPixelMap.Transfer[
cd.b, ImagerPixelMap.ShiftMap[bPm, cd.b.sMin+i, cd.b.fMin]];
Process.CheckForAbort[];
ENDLOOP;
AIS.CloseWindow[rWRef];
AIS.CloseWindow[gWRef];
AIS.CloseWindow[bWRef];
}