Пример #1
0
        internal override void PushGuidelineY2(
            Double leadingCoordinate,
            Double offsetToDrivenCoordinate)
        {
            VerifyApiNonstructuralChange();



        #if DEBUG
            MediaTrace.DrawingContextOp.Trace("PushGuidelineY2(const)");
        #endif

            unsafe
            {
                EnsureRenderData();



                MILCMD_PUSH_GUIDELINE_Y2 record =
                    new MILCMD_PUSH_GUIDELINE_Y2 (
                        leadingCoordinate,
                        offsetToDrivenCoordinate
                        );

                // Assert that the calculated packet size is the same as the size returned by sizeof().
                Debug.Assert(sizeof(MILCMD_PUSH_GUIDELINE_Y2) == 16);

                _renderData.WriteDataRecord(MILCMD.MilPushGuidelineY2,
                                            (byte*)&record,
                                            16 /* sizeof(MILCMD_PUSH_GUIDELINE_Y2) */);
            }                           

            _stackDepth++;                            

        }
Пример #2
0
        public override void PushGuidelineSet(
            GuidelineSet guidelines)
        {
            VerifyApiNonstructuralChange();



        #if DEBUG
            MediaTrace.DrawingContextOp.Trace("PushGuidelineSet(const)");
        #endif

            unsafe
            {
                EnsureRenderData();

                if (guidelines != null && guidelines.IsFrozen && guidelines.IsDynamic)
                {
                    DoubleCollection guidelinesX = guidelines.GuidelinesX;
                    DoubleCollection guidelinesY = guidelines.GuidelinesY;
                    int countX = guidelinesX == null ? 0 : guidelinesX.Count;
                    int countY = guidelinesY == null ? 0 : guidelinesY.Count;

                    if (countX == 0 && (countY == 1 || countY == 2)
                        )
                    {
                        if (countY == 1)
                        {
                            MILCMD_PUSH_GUIDELINE_Y1 record =
                                new MILCMD_PUSH_GUIDELINE_Y1(
                                    guidelinesY[0]
                                    );

                            _renderData.WriteDataRecord(
                                MILCMD.MilPushGuidelineY1,
                                (byte*)&record,
                                sizeof(MILCMD_PUSH_GUIDELINE_Y1)
                                );
                        }
                        else
                        {
                            MILCMD_PUSH_GUIDELINE_Y2 record =
                                new MILCMD_PUSH_GUIDELINE_Y2(
                                    guidelinesY[0],
                                    guidelinesY[1] - guidelinesY[0]
                                    );

                            _renderData.WriteDataRecord(
                                MILCMD.MilPushGuidelineY2,
                                (byte*)&record,
                                sizeof(MILCMD_PUSH_GUIDELINE_Y2)
                                );
                        }
                    }
                }
                else
                {


                    MILCMD_PUSH_GUIDELINE_SET record =
                        new MILCMD_PUSH_GUIDELINE_SET (
                            _renderData.AddDependentResource(guidelines)
                            );

                    // Assert that the calculated packet size is the same as the size returned by sizeof().
                    Debug.Assert(sizeof(MILCMD_PUSH_GUIDELINE_SET) == 8);

                    _renderData.WriteDataRecord(MILCMD.MilPushGuidelineSet,
                                                (byte*)&record,
                                                8 /* sizeof(MILCMD_PUSH_GUIDELINE_SET) */);
                }
            }

            _stackDepth++;
        }