当前位置: 首页>>代码示例>>C#>>正文


C# DUCE.EndCommand方法代码示例

本文整理汇总了C#中System.Windows.Media.Composition.DUCE.EndCommand方法的典型用法代码示例。如果您正苦于以下问题:C# DUCE.EndCommand方法的具体用法?C# DUCE.EndCommand怎么用?C# DUCE.EndCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.Composition.DUCE的用法示例。


在下文中一共展示了DUCE.EndCommand方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ManualUpdateResource

        private void ManualUpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                Transform vTransform = Transform;
                Transform vRelativeTransform = RelativeTransform;
                GradientStopCollection vGradientStops = GradientStops;

                DUCE.ResourceHandle hTransform;
                if (vTransform == null ||
                    Object.ReferenceEquals(vTransform, Transform.Identity)
                    )
                {
                    hTransform = DUCE.ResourceHandle.Null;                                        
                }
                else
                {
                    hTransform = ((DUCE.IResource)vTransform).GetHandle(channel);
                }
                DUCE.ResourceHandle hRelativeTransform;
                if (vRelativeTransform == null ||
                    Object.ReferenceEquals(vRelativeTransform, Transform.Identity)
                    )
                {
                    hRelativeTransform = DUCE.ResourceHandle.Null;                                        
                }
                else
                {
                    hRelativeTransform = ((DUCE.IResource)vRelativeTransform).GetHandle(channel);
                }
                DUCE.ResourceHandle hOpacityAnimations = GetAnimationResourceHandle(OpacityProperty, channel);
                DUCE.ResourceHandle hCenterAnimations = GetAnimationResourceHandle(CenterProperty, channel);
                DUCE.ResourceHandle hRadiusXAnimations = GetAnimationResourceHandle(RadiusXProperty, channel);
                DUCE.ResourceHandle hRadiusYAnimations = GetAnimationResourceHandle(RadiusYProperty, channel);
                DUCE.ResourceHandle hGradientOriginAnimations = GetAnimationResourceHandle(GradientOriginProperty, channel);

                DUCE.MILCMD_RADIALGRADIENTBRUSH data;
                unsafe
                {
                    data.Type = MILCMD.MilCmdRadialGradientBrush;
                    data.Handle = _duceResource.GetHandle(channel);
                    double tempOpacity = Opacity;
                    DUCE.CopyBytes((byte*)&data.Opacity, (byte*)&tempOpacity, 8);
                    data.hOpacityAnimations = hOpacityAnimations;
                    data.hTransform = hTransform;
                    data.hRelativeTransform = hRelativeTransform;
                    data.ColorInterpolationMode = ColorInterpolationMode;
                    data.MappingMode = MappingMode;
                    data.SpreadMethod = SpreadMethod;

                    Point tempCenter = Center;
                    DUCE.CopyBytes((byte*)&data.Center, (byte*)&tempCenter, 16);
                    data.hCenterAnimations = hCenterAnimations;
                    double tempRadiusX = RadiusX;
                    DUCE.CopyBytes((byte*)&data.RadiusX, (byte*)&tempRadiusX, 8);
                    data.hRadiusXAnimations = hRadiusXAnimations;
                    double tempRadiusY = RadiusY;
                    DUCE.CopyBytes((byte*)&data.RadiusY, (byte*)&tempRadiusY, 8);
                    data.hRadiusYAnimations = hRadiusYAnimations;
                    Point tempGradientOrigin = GradientOrigin;
                    DUCE.CopyBytes((byte*)&data.GradientOrigin, (byte*)&tempGradientOrigin, 16);
                    data.hGradientOriginAnimations = hGradientOriginAnimations;

                    // NTRAID#Longhorn-1011154-2004/8/12-asecchia GradientStopCollection:  Need to enforce upper-limit of gradient stop capacity

                    int count = (vGradientStops == null) ? 0 : vGradientStops.Count;
                    data.GradientStopsSize = (UInt32)(sizeof(DUCE.MIL_GRADIENTSTOP)*count);

                    channel.BeginCommand(
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_RADIALGRADIENTBRUSH),
                        sizeof(DUCE.MIL_GRADIENTSTOP)*count
                        );
                    
                    for (int i=0; i<count; i++)
                    {
                        DUCE.MIL_GRADIENTSTOP stopCmd;
                        GradientStop gradStop = vGradientStops.Internal_GetItem(i);

                        double temp = gradStop.Offset;
                        DUCE.CopyBytes((byte*)&stopCmd.Position,(byte*)&temp, sizeof(double));
                        stopCmd.Color = CompositionResourceManager.ColorToMilColorF(gradStop.Color);
                        
                        channel.AppendCommandData(
                            (byte*)&stopCmd,
                            sizeof(DUCE.MIL_GRADIENTSTOP)
                            );
                    }
                    
                    channel.EndCommand();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:96,代码来源:RadialGradientBrush.cs

示例2: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Read values of properties into local variables
                MaterialCollection vChildren = Children;

                // Store the count of this resource's contained collections in local variables.
                int ChildrenCount = (vChildren == null) ? 0 : vChildren.Count;

                // Pack & send command packet
                DUCE.MILCMD_MATERIALGROUP data;
                unsafe
                {
                    data.Type = MILCMD.MilCmdMaterialGroup;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.ChildrenSize = (uint)(sizeof(DUCE.ResourceHandle) * ChildrenCount);

                    channel.BeginCommand(
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_MATERIALGROUP),
                        (int)(data.ChildrenSize)
                        );


                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < ChildrenCount; i++)
                    {
                        DUCE.ResourceHandle resource = ((DUCE.IResource)vChildren.Internal_GetItem(i)).GetHandle(channel);;
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(DUCE.ResourceHandle)
                            );
                    }

                    channel.EndCommand();
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:44,代码来源:MaterialGroup.cs

示例3: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                checked
                {
                    Transform vTransform = Transform;

                    // Obtain handles for properties that implement DUCE.IResource
                    DUCE.ResourceHandle hTransform;
                    if (vTransform == null ||
                        Object.ReferenceEquals(vTransform, Transform.Identity)
                       )
                    {
                        hTransform = DUCE.ResourceHandle.Null;
                    }
                    else
                    {
                        hTransform = ((DUCE.IResource)vTransform).GetHandle(channel);
                    }

                    DUCE.MILCMD_PATHGEOMETRY data;
                    data.Type = MILCMD.MilCmdPathGeometry;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.hTransform = hTransform;
                    data.FillRule = FillRule;

                    byte[] pathDataToMarshal = _data == null ?
                        Geometry.GetEmptyPathGeometryData().SerializedData :
                        _data;

                    unsafe
                    {
                        fixed (byte* pbPathData = pathDataToMarshal)
                        {
                            data.FiguresSize = (uint)GetFigureSize(pbPathData);

                            channel.BeginCommand(
                                (byte*)&data,
                                sizeof(DUCE.MILCMD_PATHGEOMETRY),
                                (int)data.FiguresSize
                                );

                            channel.AppendCommandData(pbPathData, (int)data.FiguresSize);
                        }

                        channel.EndCommand();
                    }
                }
            }

            base.UpdateResource(channel, skipOnChannelCheck);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:56,代码来源:StreamGeometry.cs

示例4: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck) 
        { 
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel)); 

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck); 

                // Read values of properties into local variables 
                Transform vTransform = Transform; 
                GeometryCollection vChildren = Children;
 
                // Obtain handles for properties that implement DUCE.IResource
                DUCE.ResourceHandle hTransform;
                if (vTransform == null ||
                    Object.ReferenceEquals(vTransform, Transform.Identity) 
                    )
                { 
                    hTransform = DUCE.ResourceHandle.Null; 
                }
                else 
                {
                    hTransform = ((DUCE.IResource)vTransform).GetHandle(channel);
                }
 
                // Store the count of this resource's contained collections in local variables.
                int ChildrenCount = (vChildren == null) ? 0 : vChildren.Count; 
 
                // Pack & send command packet
                DUCE.MILCMD_GEOMETRYGROUP data; 
                unsafe
                {
                    data.Type = MILCMD.MilCmdGeometryGroup;
                    data.Handle = _duceResource.GetHandle(channel); 
                    data.hTransform = hTransform;
                    data.FillRule = FillRule; 
                    data.ChildrenSize = (uint)(sizeof(DUCE.ResourceHandle) * ChildrenCount); 

                    channel.BeginCommand( 
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_GEOMETRYGROUP),
                        (int)(data.ChildrenSize)
                        ); 

 
                    // Copy this collection's elements (or their handles) to reserved data 
                    for(int i = 0; i < ChildrenCount; i++)
                    { 
                        DUCE.ResourceHandle resource = ((DUCE.IResource)vChildren.Internal_GetItem(i)).GetHandle(channel);;
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(DUCE.ResourceHandle) 
                            );
                    } 
 
                    channel.EndCommand();
                } 
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:60,代码来源:GeometryGroup.cs

示例5: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Read values of properties into local variables
                DoubleCollection vGuidelinesX = GuidelinesX;
                DoubleCollection vGuidelinesY = GuidelinesY;

                // Store the count of this resource's contained collections in local variables.
                int GuidelinesXCount = (vGuidelinesX == null) ? 0 : vGuidelinesX.Count;
                int GuidelinesYCount = (vGuidelinesY == null) ? 0 : vGuidelinesY.Count;

                // Pack & send command packet
                DUCE.MILCMD_GUIDELINESET data;
                unsafe
                {
                    data.Type = MILCMD.MilCmdGuidelineSet;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.GuidelinesXSize = (uint)(sizeof(Double) * GuidelinesXCount);
                    data.GuidelinesYSize = (uint)(sizeof(Double) * GuidelinesYCount);
                    data.IsDynamic = CompositionResourceManager.BooleanToUInt32(IsDynamic);

                    channel.BeginCommand(
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_GUIDELINESET),
                        (int)(data.GuidelinesXSize + 
                              data.GuidelinesYSize)
                        );


                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < GuidelinesXCount; i++)
                    {
                        Double resource = vGuidelinesX.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(Double)
                            );
                    }

                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < GuidelinesYCount; i++)
                    {
                        Double resource = vGuidelinesY.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(Double)
                            );
                    }

                    channel.EndCommand();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:59,代码来源:GuidelineSet.cs

示例6: MarshalToDUCE


//.........这里部分代码省略.........
                                    // Marshal the Handles for the dependents 

                                    if ( data.hTransform != 0 )
                                    {
                                        data.hTransform = (uint)(((DUCE.IResource)_dependentResources[ (int)( data.hTransform - 1)]).GetHandle(channel)); 
                                    }
 
                                    channel.AppendCommandData( 
                                        (byte*)&data,
                                        8 /* codegen'ed size of this instruction struct */ 
                                        );
                                }
                                break;
                                case MILCMD.MilPushGuidelineSet: 
                                {
                                    pushStack.Push(PushType.Other); 
                                    MILCMD_PUSH_GUIDELINE_SET data = *(MILCMD_PUSH_GUIDELINE_SET*)(pCur + sizeof(RecordHeader)); 

                                    // Marshal the Handles for the dependents 

                                    if ( data.hGuidelines != 0 )
                                    {
                                        data.hGuidelines = (uint)(((DUCE.IResource)_dependentResources[ (int)( data.hGuidelines - 1)]).GetHandle(channel)); 
                                    }
 
                                    channel.AppendCommandData( 
                                        (byte*)&data,
                                        8 /* codegen'ed size of this instruction struct */ 
                                        );
                                }
                                break;
                                case MILCMD.MilPushGuidelineY1: 
                                {
                                    pushStack.Push(PushType.Other); 
                                    MILCMD_PUSH_GUIDELINE_Y1 data = *(MILCMD_PUSH_GUIDELINE_Y1*)(pCur + sizeof(RecordHeader)); 

                                    channel.AppendCommandData( 
                                        (byte*)&data,
                                        8 /* codegen'ed size of this instruction struct */
                                        );
                                } 
                                break;
                                case MILCMD.MilPushGuidelineY2: 
                                { 
                                    pushStack.Push(PushType.Other);
                                    MILCMD_PUSH_GUIDELINE_Y2 data = *(MILCMD_PUSH_GUIDELINE_Y2*)(pCur + sizeof(RecordHeader)); 

                                    channel.AppendCommandData(
                                        (byte*)&data,
                                        16 /* codegen'ed size of this instruction struct */ 
                                        );
                                } 
                                break; 
                                case MILCMD.MilPushEffect:
                                { 
                                    pushStack.Push(PushType.BitmapEffect);
                                    pushedEffects++;
                                    MILCMD_PUSH_EFFECT data = *(MILCMD_PUSH_EFFECT*)(pCur + sizeof(RecordHeader));
 
                                    // Marshal the Handles for the dependents
 
                                    if ( data.hEffect != 0 ) 
                                    {
                                        data.hEffect = (uint)(((DUCE.IResource)_dependentResources[ (int)( data.hEffect - 1)]).GetHandle(channel)); 
                                    }

                                    if ( data.hEffectInput != 0 )
                                    { 
                                        data.hEffectInput = (uint)(((DUCE.IResource)_dependentResources[ (int)( data.hEffectInput - 1)]).GetHandle(channel));
                                    } 
 
                                    channel.AppendCommandData(
                                        (byte*)&data, 
                                        8 /* codegen'ed size of this instruction struct */
                                        );
                                }
                                break; 
                                case MILCMD.MilPop:
                                { 
                                    if (pushStack.Pop() == PushType.BitmapEffect) 
                                    {
                                        pushedEffects -= 1; 
                                    }
                                    /* instruction size is zero, do nothing */
                                }
                                break; 

                                default: 
                                { 
                                    Debug.Assert(false);
                                } 
                                break;
                             }
                            pCur += pCurRecord->Size;
                        } 
                    }
                } 
                channel.EndCommand(); 
            }
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:101,代码来源:RenderData.cs

示例7: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Read values of properties into local variables
                DoubleCollection vDashes = Dashes;

                // Obtain handles for animated properties
                DUCE.ResourceHandle hOffsetAnimations = GetAnimationResourceHandle(OffsetProperty, channel);

                // Store the count of this resource's contained collections in local variables.
                int DashesCount = (vDashes == null) ? 0 : vDashes.Count;

                // Pack & send command packet
                DUCE.MILCMD_DASHSTYLE data;
                unsafe
                {
                    data.Type = MILCMD.MilCmdDashStyle;
                    data.Handle = _duceResource.GetHandle(channel);
                    if (hOffsetAnimations.IsNull)
                    {
                        data.Offset = Offset;
                    }
                    data.hOffsetAnimations = hOffsetAnimations;
                    data.DashesSize = (uint)(sizeof(Double) * DashesCount);

                    channel.BeginCommand(
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_DASHSTYLE),
                        (int)(data.DashesSize)
                        );


                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < DashesCount; i++)
                    {
                        Double resource = vDashes.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(Double)
                            );
                    }

                    channel.EndCommand();
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:52,代码来源:DashStyle.cs

示例8: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Read values of properties into local variables
                DrawingCollection vChildren = Children;
                Geometry vClipGeometry = ClipGeometry;
                Brush vOpacityMask = OpacityMask;
                Transform vTransform = Transform;
                GuidelineSet vGuidelineSet = GuidelineSet;

                // Obtain handles for properties that implement DUCE.IResource
                DUCE.ResourceHandle hClipGeometry = vClipGeometry != null ? ((DUCE.IResource)vClipGeometry).GetHandle(channel) : DUCE.ResourceHandle.Null;
                DUCE.ResourceHandle hOpacityMask = vOpacityMask != null ? ((DUCE.IResource)vOpacityMask).GetHandle(channel) : DUCE.ResourceHandle.Null;
                DUCE.ResourceHandle hTransform;
                if (vTransform == null ||
                    Object.ReferenceEquals(vTransform, Transform.Identity)
                    )
                {
                    hTransform = DUCE.ResourceHandle.Null;
                }
                else
                {
                    hTransform = ((DUCE.IResource)vTransform).GetHandle(channel);
                }
                DUCE.ResourceHandle hGuidelineSet = vGuidelineSet != null ? ((DUCE.IResource)vGuidelineSet).GetHandle(channel) : DUCE.ResourceHandle.Null;

                // Obtain handles for animated properties
                DUCE.ResourceHandle hOpacityAnimations = GetAnimationResourceHandle(OpacityProperty, channel);

                // Store the count of this resource's contained collections in local variables.
                int ChildrenCount = (vChildren == null) ? 0 : vChildren.Count;

                // Pack & send command packet
                DUCE.MILCMD_DRAWINGGROUP data;
                unsafe
                {
                    data.Type = MILCMD.MilCmdDrawingGroup;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.ChildrenSize = (uint)(sizeof(DUCE.ResourceHandle) * ChildrenCount);
                    data.hClipGeometry = hClipGeometry;
                    if (hOpacityAnimations.IsNull)
                    {
                        data.Opacity = Opacity;
                    }
                    data.hOpacityAnimations = hOpacityAnimations;
                    data.hOpacityMask = hOpacityMask;
                    data.hTransform = hTransform;
                    data.hGuidelineSet = hGuidelineSet;
                    data.EdgeMode = (EdgeMode)GetValue(RenderOptions.EdgeModeProperty);
                    data.bitmapScalingMode = (BitmapScalingMode)GetValue(RenderOptions.BitmapScalingModeProperty);
                    data.ClearTypeHint = (ClearTypeHint)GetValue(RenderOptions.ClearTypeHintProperty);

                    channel.BeginCommand(
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_DRAWINGGROUP),
                        (int)(data.ChildrenSize)
                        );


                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < ChildrenCount; i++)
                    {
                        DUCE.ResourceHandle resource = ((DUCE.IResource)vChildren.Internal_GetItem(i)).GetHandle(channel);;
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(DUCE.ResourceHandle)
                            );
                    }

                    channel.EndCommand();
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:79,代码来源:DrawingGroup.cs

示例9: ManualUpdateResource

        private void ManualUpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                checked
                {
                    Transform vTransform = Transform;

                    // Obtain handles for properties that implement DUCE.IResource
                    DUCE.ResourceHandle hTransform;
                    if (vTransform == null ||
                        Object.ReferenceEquals(vTransform, Transform.Identity)
                       )
                    {
                        hTransform = DUCE.ResourceHandle.Null;
                    }
                    else
                    {
                        hTransform = ((DUCE.IResource)vTransform).GetHandle(channel);
                    }

                    DUCE.MILCMD_PATHGEOMETRY data;
                    data.Type = MILCMD.MilCmdPathGeometry;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.hTransform = hTransform;
                    data.FillRule = FillRule;

                    PathGeometryData pathData = GetPathGeometryData();

                    data.FiguresSize = pathData.Size;

                    unsafe
                    {
                        channel.BeginCommand(
                            (byte*)&data,
                            sizeof(DUCE.MILCMD_PATHGEOMETRY),
                            (int)data.FiguresSize
                            ); 

                        fixed (byte *pPathData = pathData.SerializedData)
                        {
                            channel.AppendCommandData(pPathData, (int)data.FiguresSize);
                        }
                    }

                    channel.EndCommand();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:52,代码来源:PathGeometry.cs

示例10: UpdateResource

        internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                base.UpdateResource(channel, skipOnChannelCheck);

                // Read values of properties into local variables
                Point3DCollection vPositions = Positions;
                Vector3DCollection vNormals = Normals;
                PointCollection vTextureCoordinates = TextureCoordinates;
                Int32Collection vTriangleIndices = TriangleIndices;

                // Store the count of this resource's contained collections in local variables.
                int PositionsCount = (vPositions == null) ? 0 : vPositions.Count;
                int NormalsCount = (vNormals == null) ? 0 : vNormals.Count;
                int TextureCoordinatesCount = (vTextureCoordinates == null) ? 0 : vTextureCoordinates.Count;
                int TriangleIndicesCount = (vTriangleIndices == null) ? 0 : vTriangleIndices.Count;

                // Pack & send command packet
                DUCE.MILCMD_MESHGEOMETRY3D data;
                unsafe
                {
                    data.Type = MILCMD.MilCmdMeshGeometry3D;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.PositionsSize = (uint)(sizeof(MilPoint3F) * PositionsCount);
                    data.NormalsSize = (uint)(sizeof(MilPoint3F) * NormalsCount);
                    data.TextureCoordinatesSize = (uint)(sizeof(Point) * TextureCoordinatesCount);
                    data.TriangleIndicesSize = (uint)(sizeof(Int32) * TriangleIndicesCount);

                    channel.BeginCommand(
                        (byte*)&data,
                        sizeof(DUCE.MILCMD_MESHGEOMETRY3D),
                        (int)(data.PositionsSize + 
                              data.NormalsSize + 
                              data.TextureCoordinatesSize + 
                              data.TriangleIndicesSize)
                        );


                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < PositionsCount; i++)
                    {
                        MilPoint3F resource = CompositionResourceManager.Point3DToMilPoint3F(vPositions.Internal_GetItem(i));
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(MilPoint3F)
                            );
                    }

                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < NormalsCount; i++)
                    {
                        MilPoint3F resource = CompositionResourceManager.Vector3DToMilPoint3F(vNormals.Internal_GetItem(i));
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(MilPoint3F)
                            );
                    }

                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < TextureCoordinatesCount; i++)
                    {
                        Point resource = vTextureCoordinates.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(Point)
                            );
                    }

                    // Copy this collection's elements (or their handles) to reserved data
                    for(int i = 0; i < TriangleIndicesCount; i++)
                    {
                        Int32 resource = vTriangleIndices.Internal_GetItem(i);
                        channel.AppendCommandData(
                            (byte*)&resource,
                            sizeof(Int32)
                            );
                    }

                    channel.EndCommand();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:86,代码来源:MeshGeometry3D.cs

示例11: ManualUpdateResource

        private void ManualUpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
        {
            // If we're told we can skip the channel check, then we must be on channel
            Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));

            if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
            {
                checked
                {
                    DUCE.MILCMD_PIXELSHADER data;
                    data.Type = MILCMD.MilCmdPixelShader;
                    data.Handle = _duceResource.GetHandle(channel);
                    data.PixelShaderBytecodeSize = (_shaderBytecode.Value == null) ? 0 : (uint)(_shaderBytecode.Value).Length;
                    data.ShaderRenderMode = ShaderRenderMode;
                    data.CompileSoftwareShader = CompositionResourceManager.BooleanToUInt32(!(ShaderMajorVersion == 3 && ShaderMinorVersion == 0));

                    unsafe
                    {
                        channel.BeginCommand(
                            (byte*)&data,                      
                            sizeof(DUCE.MILCMD_PIXELSHADER),
                            (int)data.PixelShaderBytecodeSize);   // extra data

                            if (data.PixelShaderBytecodeSize > 0)
                            {
                                fixed (byte *pPixelShaderBytecode = _shaderBytecode.Value)
                                {
                                    channel.AppendCommandData(pPixelShaderBytecode, (int)data.PixelShaderBytecodeSize);
                                }
                            }
                    }
                }

                channel.EndCommand();
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:36,代码来源:PixelShader.cs


注:本文中的System.Windows.Media.Composition.DUCE.EndCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。