/// <summary> /// Draws a Rectangle. /// </summary> /// <param name="pen">The Pen.</param> /// <param name="rectangle">The Rectangle.</param> public void DrawRectangle(Pen pen, Rectangle rectangle) { var dxPen = pen.Instance as DirectXPen; if (dxPen == null) { throw new ArgumentException("DirectX10 expects a DirectXPen as resource."); } _renderTarget.DrawRectangle(dxPen.GetPen(), DirectXHelper.ConvertRectangle(rectangle)); }
/// <summary> /// Draws a Texture. /// </summary> /// <param name="texture">The Texture.</param> /// <param name="rectangle">The Rectangle.</param> /// <param name="opacity">The Opacity.</param> /// <param name="color">The Color.</param> public void DrawTexture(Texture2D texture, Rectangle rectangle, Color color, float opacity = 1) { var dxTexture = texture as DirectXTexture; if (dxTexture == null) { throw new ArgumentException("DirectX10 expects a DirectXTexture as resource."); } Bitmap dxBmp = dxTexture.GetBitmap(); _renderTarget.DrawBitmap(dxBmp, DirectXHelper.ConvertRectangle(rectangle), opacity, InterpolationMode == InterpolationMode.Linear ? SlimDX.Direct2D.InterpolationMode.Linear : SlimDX.Direct2D.InterpolationMode.NearestNeighbor); }
/// <summary> /// Fills a Rectangle. /// </summary> /// <param name="color">The Color.</param> /// <param name="rectangle">The Rectangle.</param> public void FillRectangle(Color color, Rectangle rectangle) { _renderTarget.FillRectangle(new SolidColorBrush(_renderTarget, DirectXHelper.ConvertColor(color)), DirectXHelper.ConvertRectangle(rectangle)); }