Exemplo n.º 1
0
 public virtual void End (DrawBatch drawBatch)
 {
     drawBatch.End();
 }
Exemplo n.º 2
0
 private void EndDrawInner(DrawBatch drawBatch)
 {
     drawBatch.End();
 }
Exemplo n.º 3
0
        private void DrawObjectAction(DrawBatch drawBatch)
        {
            if (_sourceImage == null)
                return;

            drawBatch.GraphicsDevice.ScissorRectangle = Xna.Rectangle.Empty;

            if (_objectBrush == null)
                _objectBrush = new TextureBrush(_sourceImage.CreateTexture(_drawControl.GraphicsDevice)) { OwnsTexture = true };
            if (_maskPen == null)
                _maskPen = new Pen(new CheckerBrush(_drawControl.GraphicsDevice, Xna.Color.Black, Xna.Color.White, 4, .75f), true);

            int originX = (_drawControl.Width - _sourceImage.Width) / 2;
            int originY = (_drawControl.Height - _sourceImage.Height) / 2;

            _objectBrush.Transform = Xna.Matrix.CreateTranslation(-(float)originX / _sourceImage.Width, -(float)originY / _sourceImage.Height, 0);

            drawBatch.Begin();

            drawBatch.FillRectangle(_objectBrush, new Xna.Rectangle(originX, originY, _sourceImage.Width, _sourceImage.Height));
            drawBatch.DrawRectangle(_maskPen, new Microsoft.Xna.Framework.Rectangle(
                originX - 1 + (_maskLeft ?? 0) + (_originX ?? 0),
                originY - 1 + (_maskTop ?? 0) + (_originY ?? 0),
                1 + (_maskRight - _maskLeft) ?? 0,
                1 + (_maskBottom - _maskTop) ?? 0));

            drawBatch.FillCircle(Brush.White, new Xna.Vector2(originX + _originX ?? 0, originY + _originY ?? 0), 4, 12);
            drawBatch.FillCircle(Brush.Black, new Xna.Vector2(originX + _originX ?? 0, originY + _originY ?? 0), 3, 12);

            drawBatch.End();
        }