Axiom.RenderSystems.Xna.XnaHelper.ToRectangle C# (CSharp) Method

ToRectangle() public static method

public static ToRectangle ( BasicBox rectangle ) : Rectangle
rectangle BasicBox
return Microsoft.Xna.Framework.Rectangle
		public static Rectangle ToRectangle( BasicBox rectangle )
		{
			Rectangle retVal = new Rectangle();
			retVal.X = (int)rectangle.Left;
			retVal.Y = (int)rectangle.Top;
			retVal.Width = (int)rectangle.Width;
			retVal.Height = (int)rectangle.Height;
			return retVal;
		}

Same methods

XnaHelper::ToRectangle ( Core rectangle ) : Rectangle

Usage Example

        ///<summary>
        ///    Internal implementation of <see cref="HardwareBuffer.Lock"/>.
        ///</summary>
        protected override PixelBox LockImpl(BasicBox lockBox, BufferLocking options)
        {
            _lockedBox = lockBox;
            // Set extents and format
            var rval        = new PixelBox(lockBox, Format);
            var sizeInBytes = PixelUtil.GetMemorySize(lockBox.Width, lockBox.Height, lockBox.Depth,
                                                      XnaHelper.Convert(surface.Format));

            if (_bufferBytes == null || _bufferBytes.Length != sizeInBytes)
            {
                _bufferBytes = new byte[sizeInBytes];
#if !SILVERLIGHT
                if (surface != null)
                {
                    surface.GetData(mipLevel, XnaHelper.ToRectangle(lockBox), _bufferBytes, 0, _bufferBytes.Length);
                }
                else if (cube != null)
                {
                    cube.GetData(face, mipLevel, XnaHelper.ToRectangle(lockBox), _bufferBytes, 0, _bufferBytes.Length);
                }
                else
                {
                    volume.GetData(mipLevel, lockBox.Left, lockBox.Top, lockBox.Right, lockBox.Bottom,
                                   lockBox.Front, lockBox.Back, _bufferBytes, 0, _bufferBytes.Length);
                }
#endif
            }

            rval.Data = BufferBase.Wrap(_bufferBytes);

            return(rval);
        }
All Usage Examples Of Axiom.RenderSystems.Xna.XnaHelper::ToRectangle