idTech4.UI.idDeviceContext.DrawFilledRectangle C# (CSharp) Method

DrawFilledRectangle() public method

public DrawFilledRectangle ( float x, float y, float width, float height, Vector4 color ) : void
x float
y float
width float
height float
color Vector4
return void
		public void DrawFilledRectangle(float x, float y, float width, float height, Vector4 color)
		{
			if(color.W == 0.0f)
			{
				return;
			}

			idE.RenderSystem.Color = color;
	
			if(ClipCoordinates(ref x, ref y, ref width, ref height) == true)
			{
				return;
			}
						
			AdjustCoordinates(ref x, ref y, ref width, ref height);
			DrawStretchPicture(x, y, width, height, 0, 0, 0, 0, _whiteImage);
		}

Usage Example

示例#1
0
        private void DrawBackground(idRectangle drawRect)
        {
            if (_backColor.W > 0)
            {
                _context.DrawFilledRectangle(_drawRect.X, _drawRect.Y, _drawRect.Width, _drawRect.Height, _backColor);
            }

            if (_background != null)
            {
                if (_materialColor.W > 0)
                {
                    float scaleX, scaleY;

                    if ((_flags & WindowFlags.NaturalMaterial) == WindowFlags.NaturalMaterial)
                    {
                        scaleX = _drawRect.Width / _background.ImageWidth;
                        scaleY = _drawRect.Height / _background.ImageHeight;
                    }
                    else
                    {
                        scaleX = _materialScaleX;
                        scaleY = _materialScaleY;
                    }

                    _context.DrawMaterial(_drawRect.X, _drawRect.Y, _drawRect.Width, _drawRect.Height, _background, _materialColor, scaleX, scaleY);
                }
            }
        }