Пример #1
0
        public State Clone()
        {
            var newState = new State
                               {
                                   BackgroundMode = this.BackgroundMode,
                                   CurrentBrush = this.CurrentBrush,
                                   CurrentClipRegion = this.CurrentClipRegion,
                                   CurrentPalette = this.CurrentPalette,
                                   CurrentPen = this.CurrentPen,
                                   CurrentPosition = this.CurrentPosition,
                                   DrawMode = this.DrawMode,
                                   PolyFillMode = this.PolyFillMode,
                                   MapMode = this.MapMode,
                                   StretchBltMode = this.StretchBltMode,
                                   TextAlign = this.TextAlign,
                                   TextColor = this.TextColor,
                                   ViewportExtX = this.ViewportExtX,
                                   ViewportExtY = this.ViewportExtY,
                                   ViewportOrigin = this.ViewportOrigin,
                                   WindowExtX = this.WindowExtX,
                                   WindowExtY = this.WindowExtY,
                                   WindowOrigin = this.WindowOrigin
                                   //RealizedPalette = this.RealizedPalette;
                               };

            return newState;
        }
Пример #2
0
        public void RestoreDC(int index)
        {
            if (index < 0)
            {
                // Relative restore
                index = _stateHistory.Count - 1 + index;
            }

            _currentState = _stateHistory[index];

            // Discard any newer DC's
            for (int i = _stateHistory.Count - 1; i > index; i--)
            {
                _stateHistory.RemoveAt(i);
            }
        }
Пример #3
0
 public void SaveDC()
 {
     _currentState = _currentState.Clone();
     _stateHistory.Add(_currentState);
 }
Пример #4
0
 public WpfGdi()
 {
     _currentState = new State();
     _stateHistory = new List<State> { _currentState };
     _objectTable = new ObjectTable();
 }