PasteOn:
PUBLIC
PROC[context: Context, viewPort: Rectangle, action:
PROC[Context]] ~ {
Stores pixels underlying viewPort and saves them on context.props to RipOff the area later, if something is already stored on context.props it is RippedOff before action is executed. Action is executed within context using supplied viewPort.
};
RipOff:
PUBLIC
PROC[ context: Context ] ~ {
Undoes the last PasteOn
srcExtent, dstExtent: Pixels.Extent;
srcBuf: REF PixelBuffer ← NARROW[ Atom.GetPropFromList[context.props, $PasteOnBuffer] ];
IF srcBuf = NIL THEN RETURN[];
srcExtent ← Pixels.GetExtent[srcBuf^]; dstExtent ← Pixels.GetExtent[context.display];
Pixels.Clip[context.display, srcExtent];
Pixels.Transfer[context.display, srcBuf^];
Pixels.Clip[context.display, dstExtent]; -- restore buffer size
context.props ← Atom.RemPropFromList[context.props, $PasteOnBuffer];
};