Example #1
0
 /// <summary>
 /// Pushes an effect that translates the coordinate space by the specified amount.
 /// </summary>
 public void PushTranslate(Point Offset)
 {
     GL.Translate(Offset.X, Offset.Y, 0.0);
     if (this._TopTranslate != null)
     {
         Offset += this._TopTranslate.Offset;
     }
     _TranslateEffect te = new _TranslateEffect()
     {
         Offset = Offset,
         Previous = this._TopTranslate
     };
     this._Effects.Push(this._TopTranslate = te);
 }
Example #2
0
        /// <summary>
        /// Undoes the most recent command/effect given to the context.
        /// </summary>
        public void Pop()
        {
            _Effect e = this._Effects.Pop();

            // Remove clip effect
            _ClipEffect ce = e as _ClipEffect;
            if (ce != null)
            {
                this._TopClip = ce.Previous;
                if (this._TopClip == null)
                {
                    GL.Disable(EnableCap.ScissorTest);
                }
                else
                {
                    this._TopClip.Apply(this._ViewSize.Y);
                }
            }

            // Remove translate effect
            _TranslateEffect te = e as _TranslateEffect;
            if (te != null)
            {
                this._TopTranslate = te.Previous;
                if (this._TopTranslate != null)
                {
                    Point noffset = this._TopTranslate.Offset - te.Offset;
                    GL.Translate(noffset.X, noffset.Y, 0.0);
                }
                else
                {
                    GL.Translate(-te.Offset.X, -te.Offset.Y, 0.0);
                }
            }
        }