/// <summary> /// DrawRoundedRectangle - /// Draw a rounded rectangle with the provided Brush and/or Pen. /// If both the Brush and Pen are null this call is a no-op. /// </summary> /// <param name="brush"> /// The Brush with which to fill the rectangle. /// This is optional, and can be null, in which case no fill is performed. /// </param> /// <param name="pen"> /// The Pen with which to stroke the rectangle. /// This is optional, and can be null, in which case no stroke is performed. /// </param> /// <param name="rectangle"> The Rect to fill and/or stroke. </param> /// <param name="rectangleAnimations"> Optional AnimationClock for rectangle. </param> /// <param name="radiusX"> /// The radius in the X dimension of the rounded corners of this /// rounded Rect. This value will be clamped to the range [0..rectangle.Width/2] /// </param> /// <param name="radiusXAnimations"> Optional AnimationClock for radiusX. </param> /// <param name="radiusY"> /// The radius in the Y dimension of the rounded corners of this /// rounded Rect. This value will be clamped to the range [0..rectangle.Height/2]. /// </param> /// <param name="radiusYAnimations"> Optional AnimationClock for radiusY. </param> public override void DrawRoundedRectangle( Brush brush, Pen pen, Rect rectangle, AnimationClock rectangleAnimations, Double radiusX, AnimationClock radiusXAnimations, Double radiusY, AnimationClock radiusYAnimations) { #if DEBUG MediaTrace.DrawingContextOp.Trace("DrawRoundedRectangle(animate)"); #endif // // Verify that parameters & state are valid // VerifyApiNonstructuralChange(); if ((brush == null) && (pen == null)) { return; } // // Create a geometry & add animations if they exist // // Instantiate the geometry RectangleGeometry geometry = new RectangleGeometry(rectangle, radiusX, radiusY); // // We may need to opt-out of inheritance through the new Freezable. // This is controlled by this.CanBeInheritanceContext. // geometry.CanBeInheritanceContext = CanBeInheritanceContext; // Setup the geometries freezable-related state SetupNewFreezable( geometry, (rectangleAnimations == null) && // Freeze if animations are null (radiusXAnimations == null) && (radiusYAnimations == null) ); // Add animations to the geometry if (rectangleAnimations != null) { geometry.ApplyAnimationClock(RectangleGeometry.RectProperty, rectangleAnimations); } if (radiusXAnimations != null) { geometry.ApplyAnimationClock(RectangleGeometry.RadiusXProperty, radiusXAnimations); } if (radiusYAnimations != null) { geometry.ApplyAnimationClock(RectangleGeometry.RadiusYProperty, radiusYAnimations); } // // Add Drawing to the Drawing graph // AddNewGeometryDrawing(brush, pen, geometry); }