protected override void OnLift(MouseEventArgs e) { PdnGraphicsPath liftPath = Selection.CreatePath(); PdnRegion liftRegion = Selection.CreateRegion(); this.ourContext.LiftedPixels = new MaskedSurface(activeLayer.Surface, liftPath); HistoryMemento bitmapAction = new BitmapHistoryMemento( Name, Image, DocumentWorkspace, ActiveLayerIndex, this.ourContext.poLiftedPixelsGuid); this.currentHistoryMementos.Add(bitmapAction); // If the user is holding down the control key, we want to *copy* the pixels // and not "lift and erase" if ((ModifierKeys & Keys.Control) == Keys.None) { ColorBgra fill = AppEnvironment.SecondaryColor; fill.A = 0; UnaryPixelOp op = new UnaryPixelOps.Constant(fill); op.Apply(this.renderArgs.Surface, liftRegion); } liftRegion.Dispose(); liftRegion = null; liftPath.Dispose(); liftPath = null; }