ARCed.Controls.ImageSelectXnaPanel.Draw C# (CSharp) Метод

Draw() защищенный Метод

Performs painting of the control
protected Draw ( ) : void
Результат void
        protected override void Draw()
        {
            GraphicsDevice.Clear(XnaColor.DarkGray);
            if (this._texture != null)
            {
                GraphicsDevice.Clear(_backColor);
                if (this.AdvancedEnabled)
                {
                    this._batch.Begin(SpriteSortMode.Immediate, this.CurrentBlendState,
                        SamplerState.LinearWrap, null, null);
                    int zw = this._texture.Width;
                    int zh = this._texture.Height;
                    XnaRect destRect, srcRect;
                    if (this._zoom > 100)
                    {
                        float factor = this._zoom / 100.0f;
                        zw = (int)(zw * factor);
                        zh = (int)(zh * factor);
                    }
                    for (int x = 0; x < Width + zw; x += zw)
                    {
                        for (int y = 0; y < Height + zh; y += zh)
                        {
                            destRect = new XnaRect(x, y, zw, zh);
                            srcRect = new XnaRect(
                                Convert.ToInt32((-this._cx - this.planeSx) / 4),
                                Convert.ToInt32((-this._cy - this.planeSy) / 4),
                                this._texture.Width, this._texture.Height);
                            this._batch.Draw(this._texture, destRect, srcRect, _blendColor);
                        }
                    }
                    this._cx %= this._texture.Width * 8;
                    this._cy %= this._texture.Height * 8;
                }
                else
                {
                    this._batch.Begin();
                    this._batch.FillRectangle(0, 0, this._texture.Width, this._texture.Height, _backColor);
                    this._batch.End();
                    this._batch.Begin(SpriteSortMode.Immediate, this.CurrentBlendState);
                    this._batch.Draw(this._texture, new Vector2(0, 0), _blendColor);
                }

                if (this._originPoint != this._endPoint)
                    this._batch.DrawSelectionRect(this.SelectionRectangle, XnaColor.White, 2);
                this._batch.End();
            }
        }