/// <summary>
        /// WalkContent - method which walks the content (if present) and calls out to the
        /// supplied DrawingContextWalker.
        /// </summary>
        /// <param name="walker">
        ///   DrawingContextWalker - the target of the calls which occur during
        ///   the content walk.
        /// </param>
        internal void WalkContent(DrawingContextWalker walker)
        {
            VerifyAPIReadOnly();

            if (_content != null)
            {
                _content.WalkContent(walker);
            }
        }
Example #2
0
 /// <summary>
 /// Calls methods on the DrawingContext that are equivalent to the
 /// Drawing with the Drawing's current value.
 /// </summary>        
 internal override void WalkCurrentValue(DrawingContextWalker ctx)
 {     
     // We avoid unneccessary ShouldStopWalking checks based on assumptions
     // about when ShouldStopWalking is set.  Guard that assumption with an
     // assertion.  See DrawingGroup.WalkCurrentValue comment for more details.
    
     ctx.DrawImage(
         ImageSource,
         Rect
         );                      
 }
        /// <summary>
        /// Calls methods on the DrawingContext that are equivalent to the
        /// Drawing with the Drawing's current value.
        /// </summary>
        internal override void WalkCurrentValue(DrawingContextWalker ctx)
        {
            // We avoid unneccessary ShouldStopWalking checks based on assumptions
            // about when ShouldStopWalking is set.  Guard that assumption with an
            // assertion.  See DrawingGroup.WalkCurrentValue comment for more details.

            ctx.DrawImage(
                ImageSource,
                Rect
                );
        }
Example #4
0
 /// <summary>
 /// Calls methods on the DrawingContext that are equivalent to the
 /// Drawing with the Drawing's current value.
 /// </summary>        
 internal override void WalkCurrentValue(DrawingContextWalker ctx)
 {
     // We avoid unneccessary ShouldStopWalking checks based on assumptions
     // about when ShouldStopWalking is set.  Guard that assumption with an
     // assertion.  See DrawingGroup.WalkCurrentValue comment for more details.
     Debug.Assert(!ctx.ShouldStopWalking);
     
     ctx.DrawVideo(
         Player,
         Rect
         );            
 }      
Example #5
0
        /// <summary>
        /// Calls methods on the DrawingContext that are equivalent to the
        /// Drawing with the Drawing's current value.
        /// </summary>
        internal override void WalkCurrentValue(DrawingContextWalker ctx)
        {
            // We avoid unneccessary ShouldStopWalking checks based on assumptions
            // about when ShouldStopWalking is set.  Guard that assumption with an
            // assertion.  See DrawingGroup.WalkCurrentValue comment for more details.
            Debug.Assert(!ctx.ShouldStopWalking);

            ctx.DrawGlyphRun(
                ForegroundBrush,
                GlyphRun
                );
        }
Example #6
0
        /// <summary>
        /// Calls methods on the DrawingContext that are equivalent to the
        /// Drawing with the Drawing's current value.
        /// </summary>
        internal override void WalkCurrentValue(DrawingContextWalker ctx)
        {
            int popCount = 0;

            // We avoid unneccessary ShouldStopWalking checks based on assumptions
            // about when ShouldStopWalking is set.  Guard that assumption with an
            // assertion.
            //
            // ShouldStopWalking is currently only set during a hit-test walk after
            // an object has been hit.  Because a DrawingGroup can't be hit until after
            // the first Drawing is tested, this method doesn't check ShouldStopWalking
            // until after the first child.
            //
            // We don't need to add this check to other Drawing subclasses for
            // the same reason -- if the Drawing being tested isn't a DrawingGroup,
            // they are always the 'first child'.
            //
            // If this assumption is ever broken then the ShouldStopWalking
            // check should be done on the first child -- including in the
            // WalkCurrentValue method of other Drawing subclasses.
            Debug.Assert(!ctx.ShouldStopWalking);

            //
            // Draw the transform property
            //

            // Avoid calling PushTransform if the base value is set to the default and
            // no animations have been set on the property.
            if (!IsBaseValueDefault(DrawingGroup.TransformProperty) ||
                (null != AnimationStorage.GetStorage(this, DrawingGroup.TransformProperty)))
            {
                ctx.PushTransform(Transform);

                popCount++;
            }

            //
            // Draw the clip property
            //

            // Avoid calling PushClip if the base value is set to the default and
            // no animations have been set on the property.
            if (!IsBaseValueDefault(DrawingGroup.ClipGeometryProperty) ||
                (null != AnimationStorage.GetStorage(this, DrawingGroup.ClipGeometryProperty)))
            {
                ctx.PushClip(ClipGeometry);

                popCount++;
            }

            //
            // Draw the opacity property
            //

            // Avoid calling PushOpacity if the base value is set to the default and
            // no animations have been set on the property.
            if (!IsBaseValueDefault(DrawingGroup.OpacityProperty) ||
                (null != AnimationStorage.GetStorage(this, DrawingGroup.OpacityProperty)))
            {
                // Push the current value of the opacity property, which
                // is what Opacity returns.
                ctx.PushOpacity(Opacity);

                popCount++;
            }

            // Draw the opacity mask property
            //
            if (OpacityMask != null)
            {
                ctx.PushOpacityMask(OpacityMask);
                popCount++;
            }

            //
            // Draw the effect property
            //

            // Push the current value of the effect property, which
            // is what BitmapEffect returns.
            if (BitmapEffect != null)
            {
                // Disable warning about obsolete method.  This code must remain active
                // until we can remove the public BitmapEffect APIs.
                #pragma warning disable 0618
                ctx.PushEffect(BitmapEffect, BitmapEffectInput);
                #pragma warning restore 0618
                popCount++;
            }

            //
            // Draw the Children collection
            //

            // Get the current value of the children collection
            DrawingCollection collection = Children;

            // Call Walk on each child
            if (collection != null)
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    Drawing drawing = collection.Internal_GetItem(i);
                    if (drawing != null)
                    {
                        drawing.WalkCurrentValue(ctx);

                        // Don't visit the remaining children if the previous
                        // child caused us to stop walking.
                        if (ctx.ShouldStopWalking)
                        {
                            break;
                        }
                    }
                }
            }

            //
            // Call Pop() for every Push
            //
            // Avoid placing this logic in a finally block because if an exception is
            // thrown, the Walk is simply aborted.  There is no requirement to Walk
            // through Pop instructions when an exception is thrown.
            //

            for (int i = 0; i < popCount; i++)
            {
                ctx.Pop();
            }
        }
Example #7
0
 /// <summary>
 /// Forward the current value of the content to the DrawingContextWalker
 /// methods.
 /// </summary>
 /// <param name="walker"> DrawingContextWalker to forward content to. </param>
 public void WalkContent(DrawingContextWalker walker)
 {
     DrawingContextWalk(walker);
 }
Example #8
0
        public void BaseValueDrawingContextWalk(DrawingContextWalker ctx) 
        {
            // We shouldn't have any dependent resources if _curOffset is 0 
            // (_curOffset == 0) -> (renderData._dependentResources.Count == 0)
            Debug.Assert((_curOffset > 0) || (_dependentResources.Count == 0));

            // The buffer being null implies that _curOffset must be 0. 
            // (_buffer == null) -> (_curOffset == 0)
            Debug.Assert((_buffer != null) || (_curOffset == 0)); 
 
            // The _curOffset must be less than the length, if there is a buffer.
            Debug.Assert((_buffer == null) || (_curOffset <= _buffer.Length)); 

            if (_curOffset > 0)
            {
                unsafe 
                {
                    fixed (byte* pByte = this._buffer) 
                    { 
                        // This pointer points to the current read point in the
                        // instruction stream. 
                        byte* pCur = pByte;

                        // This points to the first byte past the end of the
                        // instruction stream (i.e. when to stop) 
                        byte* pEndOfInstructions = pByte + _curOffset;
 
                        // Iterate across the entire list of instructions, stopping at the 
                        // end or when the DrawingContextWalker has signalled a stop.
                        while ((pCur < pEndOfInstructions) && !ctx.ShouldStopWalking) 
                        {
                            RecordHeader* pCurRecord = (RecordHeader*)pCur;

                            switch (pCurRecord->Id) 
                            {
                                case MILCMD.MilDrawLine: 
                                { 
                                    MILCMD_DRAW_LINE* data = (MILCMD_DRAW_LINE*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawLine(
                                        (Pen)DependentLookup(data->hPen),
                                        data->point0, 
                                        data->point1
                                        ); 
                                } 
                                break;
                                case MILCMD.MilDrawLineAnimate: 
                                {
                                    MILCMD_DRAW_LINE_ANIMATE* data = (MILCMD_DRAW_LINE_ANIMATE*)(pCur + sizeof(RecordHeader));

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawLine(
                                        (Pen)DependentLookup(data->hPen), 
                                        data->point0, 
                                        ((PointAnimationClockResource)DependentLookup(data->hPoint0Animations)).AnimationClock,
                                        data->point1, 
                                        ((PointAnimationClockResource)DependentLookup(data->hPoint1Animations)).AnimationClock
                                        );
                                }
                                break; 
                                case MILCMD.MilDrawRectangle:
                                { 
                                    MILCMD_DRAW_RECTANGLE* data = (MILCMD_DRAW_RECTANGLE*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawRectangle(
                                        (Brush)DependentLookup(data->hBrush),
                                        (Pen)DependentLookup(data->hPen),
                                        data->rectangle 
                                        );
                                } 
                                break; 
                                case MILCMD.MilDrawRectangleAnimate:
                                { 
                                    MILCMD_DRAW_RECTANGLE_ANIMATE* data = (MILCMD_DRAW_RECTANGLE_ANIMATE*)(pCur + sizeof(RecordHeader));

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawRectangle( 
                                        (Brush)DependentLookup(data->hBrush),
                                        (Pen)DependentLookup(data->hPen), 
                                        data->rectangle, 
                                        ((RectAnimationClockResource)DependentLookup(data->hRectangleAnimations)).AnimationClock
                                        ); 
                                }
                                break;
                                case MILCMD.MilDrawRoundedRectangle:
                                { 
                                    MILCMD_DRAW_ROUNDED_RECTANGLE* data = (MILCMD_DRAW_ROUNDED_RECTANGLE*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawRoundedRectangle(
                                        (Brush)DependentLookup(data->hBrush), 
                                        (Pen)DependentLookup(data->hPen),
                                        data->rectangle,
                                        data->radiusX,
                                        data->radiusY 
                                        );
                                } 
                                break; 
                                case MILCMD.MilDrawRoundedRectangleAnimate:
                                { 
                                    MILCMD_DRAW_ROUNDED_RECTANGLE_ANIMATE* data = (MILCMD_DRAW_ROUNDED_RECTANGLE_ANIMATE*)(pCur + sizeof(RecordHeader));

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawRoundedRectangle( 
                                        (Brush)DependentLookup(data->hBrush),
                                        (Pen)DependentLookup(data->hPen), 
                                        data->rectangle, 
                                        ((RectAnimationClockResource)DependentLookup(data->hRectangleAnimations)).AnimationClock,
                                        data->radiusX, 
                                        ((DoubleAnimationClockResource)DependentLookup(data->hRadiusXAnimations)).AnimationClock,
                                        data->radiusY,
                                        ((DoubleAnimationClockResource)DependentLookup(data->hRadiusYAnimations)).AnimationClock
                                        ); 
                                }
                                break; 
                                case MILCMD.MilDrawEllipse: 
                                {
                                    MILCMD_DRAW_ELLIPSE* data = (MILCMD_DRAW_ELLIPSE*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawEllipse(
                                        (Brush)DependentLookup(data->hBrush), 
                                        (Pen)DependentLookup(data->hPen),
                                        data->center, 
                                        data->radiusX, 
                                        data->radiusY
                                        ); 
                                }
                                break;
                                case MILCMD.MilDrawEllipseAnimate:
                                { 
                                    MILCMD_DRAW_ELLIPSE_ANIMATE* data = (MILCMD_DRAW_ELLIPSE_ANIMATE*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawEllipse(
                                        (Brush)DependentLookup(data->hBrush), 
                                        (Pen)DependentLookup(data->hPen),
                                        data->center,
                                        ((PointAnimationClockResource)DependentLookup(data->hCenterAnimations)).AnimationClock,
                                        data->radiusX, 
                                        ((DoubleAnimationClockResource)DependentLookup(data->hRadiusXAnimations)).AnimationClock,
                                        data->radiusY, 
                                        ((DoubleAnimationClockResource)DependentLookup(data->hRadiusYAnimations)).AnimationClock 
                                        );
                                } 
                                break;
                                case MILCMD.MilDrawGeometry:
                                {
                                    MILCMD_DRAW_GEOMETRY* data = (MILCMD_DRAW_GEOMETRY*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawGeometry( 
                                        (Brush)DependentLookup(data->hBrush),
                                        (Pen)DependentLookup(data->hPen), 
                                        (Geometry)DependentLookup(data->hGeometry)
                                        );
                                }
                                break; 
                                case MILCMD.MilDrawImage:
                                { 
                                    MILCMD_DRAW_IMAGE* data = (MILCMD_DRAW_IMAGE*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawImage(
                                        (ImageSource)DependentLookup(data->hImageSource),
                                        data->rectangle
                                        ); 
                                }
                                break; 
                                case MILCMD.MilDrawImageAnimate: 
                                {
                                    MILCMD_DRAW_IMAGE_ANIMATE* data = (MILCMD_DRAW_IMAGE_ANIMATE*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawImage(
                                        (ImageSource)DependentLookup(data->hImageSource), 
                                        data->rectangle,
                                        ((RectAnimationClockResource)DependentLookup(data->hRectangleAnimations)).AnimationClock 
                                        ); 
                                }
                                break; 
                                case MILCMD.MilDrawGlyphRun:
                                {
                                    MILCMD_DRAW_GLYPH_RUN* data = (MILCMD_DRAW_GLYPH_RUN*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawGlyphRun( 
                                        (Brush)DependentLookup(data->hForegroundBrush), 
                                        (GlyphRun)DependentLookup(data->hGlyphRun)
                                        ); 
                                }
                                break;
                                case MILCMD.MilDrawDrawing:
                                { 
                                    MILCMD_DRAW_DRAWING* data = (MILCMD_DRAW_DRAWING*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.DrawDrawing(
                                        (Drawing)DependentLookup(data->hDrawing) 
                                        );
                                }
                                break;
                                case MILCMD.MilDrawVideo: 
                                {
                                    MILCMD_DRAW_VIDEO* data = (MILCMD_DRAW_VIDEO*)(pCur + sizeof(RecordHeader)); 
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawVideo( 
                                        (MediaPlayer)DependentLookup(data->hPlayer),
                                        data->rectangle
                                        );
                                } 
                                break;
                                case MILCMD.MilDrawVideoAnimate: 
                                { 
                                    MILCMD_DRAW_VIDEO_ANIMATE* data = (MILCMD_DRAW_VIDEO_ANIMATE*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.DrawVideo(
                                        (MediaPlayer)DependentLookup(data->hPlayer),
                                        data->rectangle, 
                                        ((RectAnimationClockResource)DependentLookup(data->hRectangleAnimations)).AnimationClock
                                        ); 
                                } 
                                break;
                                case MILCMD.MilPushClip: 
                                {
                                    MILCMD_PUSH_CLIP* data = (MILCMD_PUSH_CLIP*)(pCur + sizeof(RecordHeader));

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.PushClip(
                                        (Geometry)DependentLookup(data->hClipGeometry) 
                                        ); 
                                }
                                break; 
                                case MILCMD.MilPushOpacityMask:
                                {
                                    MILCMD_PUSH_OPACITY_MASK* data = (MILCMD_PUSH_OPACITY_MASK*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.PushOpacityMask( 
                                        (Brush)DependentLookup(data->hOpacityMask) 
                                        );
                                } 
                                break;
                                case MILCMD.MilPushOpacity:
                                {
                                    MILCMD_PUSH_OPACITY* data = (MILCMD_PUSH_OPACITY*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.PushOpacity( 
                                        data->opacity
                                        ); 
                                }
                                break;
                                case MILCMD.MilPushOpacityAnimate:
                                { 
                                    MILCMD_PUSH_OPACITY_ANIMATE* data = (MILCMD_PUSH_OPACITY_ANIMATE*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.PushOpacity(
                                        data->opacity, 
                                        ((DoubleAnimationClockResource)DependentLookup(data->hOpacityAnimations)).AnimationClock
                                        );
                                }
                                break; 
                                case MILCMD.MilPushTransform:
                                { 
                                    MILCMD_PUSH_TRANSFORM* data = (MILCMD_PUSH_TRANSFORM*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context. 
                                    ctx.PushTransform(
                                        (Transform)DependentLookup(data->hTransform)
                                        );
                                } 
                                break;
                                case MILCMD.MilPushGuidelineSet: 
                                { 
                                    MILCMD_PUSH_GUIDELINE_SET* data = (MILCMD_PUSH_GUIDELINE_SET*)(pCur + sizeof(RecordHeader));
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.PushGuidelineSet(
                                        (GuidelineSet)DependentLookup(data->hGuidelines)
                                        ); 
                                }
                                break; 
                                case MILCMD.MilPushGuidelineY1: 
                                {
                                    MILCMD_PUSH_GUIDELINE_Y1* data = (MILCMD_PUSH_GUIDELINE_Y1*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.PushGuidelineY1(
                                        data->coordinate 
                                        );
                                } 
                                break; 
                                case MILCMD.MilPushGuidelineY2:
                                { 
                                    MILCMD_PUSH_GUIDELINE_Y2* data = (MILCMD_PUSH_GUIDELINE_Y2*)(pCur + sizeof(RecordHeader));

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.PushGuidelineY2( 
                                        data->leadingCoordinate,
                                        data->offsetToDrivenCoordinate 
                                        ); 
                                }
                                break; 
                                // Disable warning about obsolete method.  This code must remain active
                                // until we can remove the public BitmapEffect APIs.
                                #pragma warning disable 0618
                                case MILCMD.MilPushEffect: 
                                {
                                    MILCMD_PUSH_EFFECT* data = (MILCMD_PUSH_EFFECT*)(pCur + sizeof(RecordHeader)); 
 
                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.PushEffect( 
                                        (BitmapEffect)DependentLookup(data->hEffect),
                                        (BitmapEffectInput)DependentLookup(data->hEffectInput)
                                        );
                                } 
                                break;
                                #pragma warning restore 0618 
                                case MILCMD.MilPop: 
                                {
                                    MILCMD_POP* data = (MILCMD_POP*)(pCur + sizeof(RecordHeader)); 

                                    // Retrieve the resources for the dependents and call the context.
                                    ctx.Pop(
 
                                        );
                                } 
                                break; 
                                default:
                                { 
                                    Debug.Assert(false);
                                }
                                break;
                            } 

                            pCur += pCurRecord->Size; 
                        } 
                    }
                } 
            }
        }
Example #9
0
        /// <summary>
        /// Calls methods on the DrawingContext that are equivalent to the 
        /// Drawing with the Drawing's current value.
        /// </summary>
        internal override void WalkCurrentValue(DrawingContextWalker ctx)
        { 
            int popCount = 0;
 
            // We avoid unneccessary ShouldStopWalking checks based on assumptions 
            // about when ShouldStopWalking is set.  Guard that assumption with an
            // assertion. 
            //
            // ShouldStopWalking is currently only set during a hit-test walk after
            // an object has been hit.  Because a DrawingGroup can't be hit until after
            // the first Drawing is tested, this method doesn't check ShouldStopWalking 
            // until after the first child.
            // 
            // We don't need to add this check to other Drawing subclasses for 
            // the same reason -- if the Drawing being tested isn't a DrawingGroup,
            // they are always the 'first child'. 
            //
            // If this assumption is ever broken then the ShouldStopWalking
            // check should be done on the first child -- including in the
            // WalkCurrentValue method of other Drawing subclasses. 
            Debug.Assert(!ctx.ShouldStopWalking);
 
            // 
            // Draw the transform property
            // 

            // Avoid calling PushTransform if the base value is set to the default and
            // no animations have been set on the property.
            if (!IsBaseValueDefault(DrawingGroup.TransformProperty) || 
                (null != AnimationStorage.GetStorage(this, DrawingGroup.TransformProperty)))
            { 
                ctx.PushTransform(Transform); 

                popCount++; 
            }

            //
            // Draw the clip property 
            //
 
            // Avoid calling PushClip if the base value is set to the default and 
            // no animations have been set on the property.
            if (!IsBaseValueDefault(DrawingGroup.ClipGeometryProperty) || 
                (null != AnimationStorage.GetStorage(this, DrawingGroup.ClipGeometryProperty)))
            {
                ctx.PushClip(ClipGeometry);
 
                popCount++;
            } 
 
            //
            // Draw the opacity property 
            //

            // Avoid calling PushOpacity if the base value is set to the default and
            // no animations have been set on the property. 
            if (!IsBaseValueDefault(DrawingGroup.OpacityProperty) ||
                (null != AnimationStorage.GetStorage(this, DrawingGroup.OpacityProperty))) 
            { 
                // Push the current value of the opacity property, which
                // is what Opacity returns. 
                ctx.PushOpacity(Opacity);

                popCount++;
            } 

            // Draw the opacity mask property 
            // 
            if (OpacityMask != null)
            { 
                ctx.PushOpacityMask(OpacityMask);
                popCount++;
            }
 
            //
            // Draw the effect property 
            // 

            // Push the current value of the effect property, which 
            // is what BitmapEffect returns.
            if (BitmapEffect != null)
            {
                // Disable warning about obsolete method.  This code must remain active 
                // until we can remove the public BitmapEffect APIs.
                #pragma warning disable 0618 
                ctx.PushEffect(BitmapEffect, BitmapEffectInput); 
                #pragma warning restore 0618
                popCount++; 
            }

            //
            // Draw the Children collection 
            //
 
            // Get the current value of the children collection 
            DrawingCollection collection = Children;
 
            // Call Walk on each child
            if (collection != null)
            {
                for (int i = 0; i < collection.Count; i++) 
                {
                    Drawing drawing = collection.Internal_GetItem(i); 
                    if (drawing != null) 
                    {
                        drawing.WalkCurrentValue(ctx); 

                        // Don't visit the remaining children if the previous
                        // child caused us to stop walking.
                        if (ctx.ShouldStopWalking) 
                        {
                            break; 
                        } 
                    }
                } 
            }

            //
            // Call Pop() for every Push 
            //
            // Avoid placing this logic in a finally block because if an exception is 
            // thrown, the Walk is simply aborted.  There is no requirement to Walk 
            // through Pop instructions when an exception is thrown.
            // 

            for (int i = 0; i < popCount; i++)
            {
                ctx.Pop(); 
            }
        } 
Example #10
0
 /// <summary>
 /// Forward the current value of the content to the DrawingContextWalker
 /// methods.
 /// </summary>
 /// <param name="walker"> DrawingContextWalker to forward content to. </param>
 public void WalkContent(DrawingContextWalker walker)
 {
     DrawingContextWalk(walker);
 }
Example #11
0
 /// <summary>
 /// Calls methods on the DrawingContext that are equivalent to the
 /// Drawing with the Drawing's current value.
 /// </summary>
 internal abstract void WalkCurrentValue(DrawingContextWalker ctx);
Example #12
0
 /// <summary>
 /// Forward the current value of the content to the DrawingContextWalker
 /// methods.
 /// </summary>
 /// <param name="ctx"> DrawingContextWalker to forward content to. </param>
 void IDrawingContent.WalkContent(DrawingContextWalker ctx)
 {
     ((Drawing)this).WalkCurrentValue(ctx);
 }
Example #13
0
        /// <summary>
        /// WalkContent - method which walks the content (if present) and calls out to the
        /// supplied DrawingContextWalker.
        /// </summary>
        /// <param name="walker">
        ///   DrawingContextWalker - the target of the calls which occur during
        ///   the content walk.
        /// </param>
        internal void WalkContent(DrawingContextWalker walker)
        {
            VerifyAPIReadOnly();

            if (_content != null)
            {
                _content.WalkContent(walker);
            }
        }
Example #14
0
 /// <summary>
 /// Calls methods on the DrawingContext that are equivalent to the
 /// Drawing with the Drawing's current value.
 /// </summary>
 internal abstract void WalkCurrentValue(DrawingContextWalker ctx);
Example #15
0
 /// <summary>
 /// Forward the current value of the content to the DrawingContextWalker
 /// methods.
 /// </summary>      
 /// <param name="ctx"> DrawingContextWalker to forward content to. </param>        
 void IDrawingContent.WalkContent(DrawingContextWalker ctx)
 {
     ((Drawing)this).WalkCurrentValue(ctx);
 }