//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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); // Obtain handles for animated properties DUCE.ResourceHandle hRenderAtScaleAnimations = GetAnimationResourceHandle(RenderAtScaleProperty, channel); // Pack & send command packet DUCE.MILCMD_BITMAPCACHE data; unsafe { data.Type = MILCMD.MilCmdBitmapCache; data.Handle = _duceResource.GetHandle(channel); if (hRenderAtScaleAnimations.IsNull) { data.RenderAtScale = RenderAtScale; } data.hRenderAtScaleAnimations = hRenderAtScaleAnimations; data.SnapsToDevicePixels = CompositionResourceManager.BooleanToUInt32(SnapsToDevicePixels); data.EnableClearType = CompositionResourceManager.BooleanToUInt32(EnableClearType); // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_BITMAPCACHE)); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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); // Obtain handles for animated properties DUCE.ResourceHandle hQuaternionAnimations = GetAnimationResourceHandle(QuaternionProperty, channel); // Pack & send command packet DUCE.MILCMD_QUATERNIONROTATION3D data; unsafe { data.Type = MILCMD.MilCmdQuaternionRotation3D; data.Handle = _duceResource.GetHandle(channel); if (hQuaternionAnimations.IsNull) { data.quaternion = CompositionResourceManager.QuaternionToMilQuaternionF(Quaternion); } data.hQuaternionAnimations = hQuaternionAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_QUATERNIONROTATION3D)); } } }
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 GlyphRun vGlyphRun = GlyphRun; Brush vForegroundBrush = ForegroundBrush; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hGlyphRun = vGlyphRun != null ? ((DUCE.IResource)vGlyphRun).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hForegroundBrush = vForegroundBrush != null ? ((DUCE.IResource)vForegroundBrush).GetHandle(channel) : DUCE.ResourceHandle.Null; // Pack & send command packet DUCE.MILCMD_GLYPHRUNDRAWING data; unsafe { data.Type = MILCMD.MilCmdGlyphRunDrawing; data.Handle = _duceResource.GetHandle(channel); data.hGlyphRun = hGlyphRun; data.hForegroundBrush = hForegroundBrush; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_GLYPHRUNDRAWING)); } } }
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 Drawing vDrawing = Drawing; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hDrawing = vDrawing != null ? ((DUCE.IResource)vDrawing).GetHandle(channel) : DUCE.ResourceHandle.Null; // Pack & send command packet DUCE.MILCMD_DRAWINGIMAGE data; unsafe { data.Type = MILCMD.MilCmdDrawingImage; data.Handle = _duceResource.GetHandle(channel); data.hDrawing = hDrawing; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_DRAWINGIMAGE)); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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); // Obtain handles for animated properties DUCE.ResourceHandle hMatrixAnimations = GetAnimationResourceHandle(MatrixProperty, channel); // Pack & send command packet DUCE.MILCMD_MATRIXTRANSFORM data; unsafe { data.Type = MILCMD.MilCmdMatrixTransform; data.Handle = _duceResource.GetHandle(channel); if (hMatrixAnimations.IsNull) { data.Matrix = CompositionResourceManager.MatrixToMilMatrix3x2D(Matrix); } data.hMatrixAnimations = hMatrixAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_MATRIXTRANSFORM)); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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 Brush vBrush = Brush; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hBrush = vBrush != null ? ((DUCE.IResource)vBrush).GetHandle(channel) : DUCE.ResourceHandle.Null; // Pack & send command packet DUCE.MILCMD_DIFFUSEMATERIAL data; unsafe { data.Type = MILCMD.MilCmdDiffuseMaterial; data.Handle = _duceResource.GetHandle(channel); data.color = CompositionResourceManager.ColorToMilColorF(Color); data.ambientColor = CompositionResourceManager.ColorToMilColorF(AmbientColor); data.hbrush = hBrush; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_DIFFUSEMATERIAL)); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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; // 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); } // Obtain handles for animated properties DUCE.ResourceHandle hRadiusXAnimations = GetAnimationResourceHandle(RadiusXProperty, channel); DUCE.ResourceHandle hRadiusYAnimations = GetAnimationResourceHandle(RadiusYProperty, channel); DUCE.ResourceHandle hRectAnimations = GetAnimationResourceHandle(RectProperty, channel); // Pack & send command packet DUCE.MILCMD_RECTANGLEGEOMETRY data; unsafe { data.Type = MILCMD.MilCmdRectangleGeometry; data.Handle = _duceResource.GetHandle(channel); data.hTransform = hTransform; if (hRadiusXAnimations.IsNull) { data.RadiusX = RadiusX; } data.hRadiusXAnimations = hRadiusXAnimations; if (hRadiusYAnimations.IsNull) { data.RadiusY = RadiusY; } data.hRadiusYAnimations = hRadiusYAnimations; if (hRectAnimations.IsNull) { data.Rect = Rect; } data.hRectAnimations = hRectAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_RECTANGLEGEOMETRY)); } } }
SendMediaPlayerCommand( DUCE.Channel channel, DUCE.ResourceHandle handle, bool notifyUceDirectly ) { // // This is an interrop call, but, it does not set a last error being a COM call. So, suppress the // presharp warning about losing last error. // #pragma warning disable 6523 // // AddRef to ensure the media player stays alive during transport, even if the // MediaPlayer goes away. The slave video resource takes ownership of this AddRef. // Note there is still a gray danger zone here -- if the channel command is lost // this reference won't be cleaned up. // // MediaPlayer: AddRef on nativeMedia may be lost if the channel send command fails // // There is no point in addrefing the native media if we are going remote since // we will send null. // UnsafeNativeMethods.MILUnknown.AddRef(_nativeMedia); channel.SendCommandMedia( handle, _nativeMedia, notifyUceDirectly ); #pragma warning restore 6523 }
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(); } } }
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); // Obtain handles for animated properties DUCE.ResourceHandle hRadiusAnimations = GetAnimationResourceHandle(RadiusProperty, channel); // Pack & send command packet DUCE.MILCMD_BLUREFFECT data; unsafe { data.Type = MILCMD.MilCmdBlurEffect; data.Handle = _duceResource.GetHandle(channel); if (hRadiusAnimations.IsNull) { data.Radius = Radius; } data.hRadiusAnimations = hRadiusAnimations; data.KernelType = KernelType; data.RenderingBias = RenderingBias; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_BLUREFFECT)); } } }
// -------------------------------------------------------------------- // // Internal Methods // // -------------------------------------------------------------------- #region Internal Methods /// <summary> /// Initialize must be called before a frame is rendered. /// </summary> internal void Initialize( DUCE.Channel channel, DUCE.ResourceHandle root) { Debug.Assert(channel != null); _channel = channel; _root = root; }
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); // Obtain handles for animated properties DUCE.ResourceHandle hShadowDepthAnimations = GetAnimationResourceHandle(ShadowDepthProperty, channel); DUCE.ResourceHandle hColorAnimations = GetAnimationResourceHandle(ColorProperty, channel); DUCE.ResourceHandle hDirectionAnimations = GetAnimationResourceHandle(DirectionProperty, channel); DUCE.ResourceHandle hOpacityAnimations = GetAnimationResourceHandle(OpacityProperty, channel); DUCE.ResourceHandle hBlurRadiusAnimations = GetAnimationResourceHandle(BlurRadiusProperty, channel); // Pack & send command packet DUCE.MILCMD_DROPSHADOWEFFECT data; unsafe { data.Type = MILCMD.MilCmdDropShadowEffect; data.Handle = _duceResource.GetHandle(channel); if (hShadowDepthAnimations.IsNull) { data.ShadowDepth = ShadowDepth; } data.hShadowDepthAnimations = hShadowDepthAnimations; if (hColorAnimations.IsNull) { data.Color = CompositionResourceManager.ColorToMilColorF(Color); } data.hColorAnimations = hColorAnimations; if (hDirectionAnimations.IsNull) { data.Direction = Direction; } data.hDirectionAnimations = hDirectionAnimations; if (hOpacityAnimations.IsNull) { data.Opacity = Opacity; } data.hOpacityAnimations = hOpacityAnimations; if (hBlurRadiusAnimations.IsNull) { data.BlurRadius = BlurRadius; } data.hBlurRadiusAnimations = hBlurRadiusAnimations; data.RenderingBias = RenderingBias; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_DROPSHADOWEFFECT)); } } }
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 Transform3D vTransform = Transform; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hTransform; if (vTransform == null || Object.ReferenceEquals(vTransform, Transform3D.Identity) ) { hTransform = DUCE.ResourceHandle.Null; } else { hTransform = ((DUCE.IResource)vTransform).GetHandle(channel); } // Obtain handles for animated properties DUCE.ResourceHandle hColorAnimations = GetAnimationResourceHandle(ColorProperty, channel); DUCE.ResourceHandle hDirectionAnimations = GetAnimationResourceHandle(DirectionProperty, channel); // Pack & send command packet DUCE.MILCMD_DIRECTIONALLIGHT data; unsafe { data.Type = MILCMD.MilCmdDirectionalLight; data.Handle = _duceResource.GetHandle(channel); data.htransform = hTransform; if (hColorAnimations.IsNull) { data.color = CompositionResourceManager.ColorToMilColorF(Color); } data.hColorAnimations = hColorAnimations; if (hDirectionAnimations.IsNull) { data.direction = CompositionResourceManager.Vector3DToMilPoint3F(Direction); } data.hDirectionAnimations = hDirectionAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_DIRECTIONALLIGHT)); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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(); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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 Rotation3D vRotation = Rotation; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hRotation = vRotation != null ? ((DUCE.IResource)vRotation).GetHandle(channel) : DUCE.ResourceHandle.Null; // Obtain handles for animated properties DUCE.ResourceHandle hCenterXAnimations = GetAnimationResourceHandle(CenterXProperty, channel); DUCE.ResourceHandle hCenterYAnimations = GetAnimationResourceHandle(CenterYProperty, channel); DUCE.ResourceHandle hCenterZAnimations = GetAnimationResourceHandle(CenterZProperty, channel); // Pack & send command packet DUCE.MILCMD_ROTATETRANSFORM3D data; unsafe { data.Type = MILCMD.MilCmdRotateTransform3D; data.Handle = _duceResource.GetHandle(channel); if (hCenterXAnimations.IsNull) { data.centerX = CenterX; } data.hCenterXAnimations = hCenterXAnimations; if (hCenterYAnimations.IsNull) { data.centerY = CenterY; } data.hCenterYAnimations = hCenterYAnimations; if (hCenterZAnimations.IsNull) { data.centerZ = CenterZ; } data.hCenterZAnimations = hCenterZAnimations; data.hrotation = hRotation; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_ROTATETRANSFORM3D)); } } }
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); // Obtain handles for animated properties DUCE.ResourceHandle hAngleXAnimations = GetAnimationResourceHandle(AngleXProperty, channel); DUCE.ResourceHandle hAngleYAnimations = GetAnimationResourceHandle(AngleYProperty, channel); DUCE.ResourceHandle hCenterXAnimations = GetAnimationResourceHandle(CenterXProperty, channel); DUCE.ResourceHandle hCenterYAnimations = GetAnimationResourceHandle(CenterYProperty, channel); // Pack & send command packet DUCE.MILCMD_SKEWTRANSFORM data; unsafe { data.Type = MILCMD.MilCmdSkewTransform; data.Handle = _duceResource.GetHandle(channel); if (hAngleXAnimations.IsNull) { data.AngleX = AngleX; } data.hAngleXAnimations = hAngleXAnimations; if (hAngleYAnimations.IsNull) { data.AngleY = AngleY; } data.hAngleYAnimations = hAngleYAnimations; if (hCenterXAnimations.IsNull) { data.CenterX = CenterX; } data.hCenterXAnimations = hCenterXAnimations; if (hCenterYAnimations.IsNull) { data.CenterY = CenterY; } data.hCenterYAnimations = hCenterYAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_SKEWTRANSFORM)); } } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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 Transform3D vTransform = Transform; Geometry3D vGeometry = Geometry; Material vMaterial = Material; Material vBackMaterial = BackMaterial; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hTransform; if (vTransform == null || Object.ReferenceEquals(vTransform, Transform3D.Identity) ) { hTransform = DUCE.ResourceHandle.Null; } else { hTransform = ((DUCE.IResource)vTransform).GetHandle(channel); } DUCE.ResourceHandle hGeometry = vGeometry != null ? ((DUCE.IResource)vGeometry).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hMaterial = vMaterial != null ? ((DUCE.IResource)vMaterial).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hBackMaterial = vBackMaterial != null ? ((DUCE.IResource)vBackMaterial).GetHandle(channel) : DUCE.ResourceHandle.Null; // Pack & send command packet DUCE.MILCMD_GEOMETRYMODEL3D data; unsafe { data.Type = MILCMD.MilCmdGeometryModel3D; data.Handle = _duceResource.GetHandle(channel); data.htransform = hTransform; data.hgeometry = hGeometry; data.hmaterial = hMaterial; data.hbackMaterial = hBackMaterial; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_GEOMETRYMODEL3D)); } } }
/// <summary> /// Should be called from the VisualTarget thread /// when it is safe to access the composition node /// and out of band channel from the VisualTarget thread /// to allow for the handle duplication/channel commit /// </summary> internal object DoHandleDuplication(object channel) { DUCE.ResourceHandle targetsHandle = DUCE.ResourceHandle.Null; using (CompositionEngineLock.Acquire()) { targetsHandle = _target._contentRoot.DuplicateHandle(_target.OutOfBandChannel, (DUCE.Channel)channel); Debug.Assert(!targetsHandle.IsNull); _target.OutOfBandChannel.CloseBatch(); _target.OutOfBandChannel.Commit(); } return(targetsHandle); }
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; Geometry vGeometry1 = Geometry1; Geometry vGeometry2 = Geometry2; // 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.ResourceHandle hGeometry1 = vGeometry1 != null ? ((DUCE.IResource)vGeometry1).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hGeometry2 = vGeometry2 != null ? ((DUCE.IResource)vGeometry2).GetHandle(channel) : DUCE.ResourceHandle.Null; // Pack & send command packet DUCE.MILCMD_COMBINEDGEOMETRY data; unsafe { data.Type = MILCMD.MilCmdCombinedGeometry; data.Handle = _duceResource.GetHandle(channel); data.hTransform = hTransform; data.GeometryCombineMode = GeometryCombineMode; data.hGeometry1 = hGeometry1; data.hGeometry2 = hGeometry2; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_COMBINEDGEOMETRY)); } } }
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 Brush vBrush = Brush; DashStyle vDashStyle = DashStyle; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hBrush = vBrush != null ? ((DUCE.IResource)vBrush).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hDashStyle = vDashStyle != null ? ((DUCE.IResource)vDashStyle).GetHandle(channel) : DUCE.ResourceHandle.Null; // Obtain handles for animated properties DUCE.ResourceHandle hThicknessAnimations = GetAnimationResourceHandle(ThicknessProperty, channel); // Pack & send command packet DUCE.MILCMD_PEN data; unsafe { data.Type = MILCMD.MilCmdPen; data.Handle = _duceResource.GetHandle(channel); data.hBrush = hBrush; if (hThicknessAnimations.IsNull) { data.Thickness = Thickness; } data.hThicknessAnimations = hThicknessAnimations; data.StartLineCap = StartLineCap; data.EndLineCap = EndLineCap; data.DashCap = DashCap; data.LineJoin = LineJoin; data.MiterLimit = MiterLimit; data.hDashStyle = hDashStyle; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_PEN)); } } }
public DisconnectData(DispatcherOperation op, DUCE.Channel channel, Dispatcher dispatcher, HostVisual hostVisual, DUCE.ResourceHandle hostHandle, DUCE.ResourceHandle targetHandle, DUCE.MultiChannelResource contentRoot, DisconnectData next) { DispatcherOperation = op; Channel = channel; ChannelDispatcher = dispatcher; HostVisual = hostVisual; HostHandle = hostHandle; TargetHandle = targetHandle; ContentRoot = contentRoot; Next = next; }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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(); } } }
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); // Obtain handles for animated properties DUCE.ResourceHandle hOffsetXAnimations = GetAnimationResourceHandle(OffsetXProperty, channel); DUCE.ResourceHandle hOffsetYAnimations = GetAnimationResourceHandle(OffsetYProperty, channel); DUCE.ResourceHandle hOffsetZAnimations = GetAnimationResourceHandle(OffsetZProperty, channel); // Pack & send command packet DUCE.MILCMD_TRANSLATETRANSFORM3D data; unsafe { data.Type = MILCMD.MilCmdTranslateTransform3D; data.Handle = _duceResource.GetHandle(channel); if (hOffsetXAnimations.IsNull) { data.offsetX = OffsetX; } data.hOffsetXAnimations = hOffsetXAnimations; if (hOffsetYAnimations.IsNull) { data.offsetY = OffsetY; } data.hOffsetYAnimations = hOffsetYAnimations; if (hOffsetZAnimations.IsNull) { data.offsetZ = OffsetZ; } data.hOffsetZAnimations = hOffsetZAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_TRANSLATETRANSFORM3D)); } } }
protected override void UpdateResource( DUCE.ResourceHandle handle, DUCE.Channel channel) { DUCE.MILCMD_SIZERESOURCE cmd = new DUCE.MILCMD_SIZERESOURCE(); cmd.Type = MILCMD.MilCmdSizeResource; cmd.Handle = handle; cmd.Value = CurrentValue; unsafe { channel.SendCommand( (byte *)&cmd, sizeof(DUCE.MILCMD_SIZERESOURCE)); } // Validate this resource IsResourceInvalid = false; }
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 ImageSource vImageSource = ImageSource; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hImageSource = vImageSource != null ? ((DUCE.IResource)vImageSource).GetHandle(channel) : DUCE.ResourceHandle.Null; // Obtain handles for animated properties DUCE.ResourceHandle hRectAnimations = GetAnimationResourceHandle(RectProperty, channel); // Pack & send command packet DUCE.MILCMD_IMAGEDRAWING data; unsafe { data.Type = MILCMD.MilCmdImageDrawing; data.Handle = _duceResource.GetHandle(channel); data.hImageSource = hImageSource; if (hRectAnimations.IsNull) { data.Rect = Rect; } data.hRectAnimations = hRectAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_IMAGEDRAWING)); } } }
SendCommandMedia( DUCE.Channel channel, DUCE.ResourceHandle handle, bool notifyUceDirectly ) { SendMediaPlayerCommand( channel, handle, notifyUceDirectly ); // // Independently, tell the native media that we need to update the UI, the // reason we do this directly through the player is that effects can immediately // remove the channel on us and hence media might not get a chance to see // the media player resource. // if (!notifyUceDirectly) { NeedUIFrameUpdate(); } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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); // Obtain handles for animated properties DUCE.ResourceHandle hAxisAnimations = GetAnimationResourceHandle(AxisProperty, channel); DUCE.ResourceHandle hAngleAnimations = GetAnimationResourceHandle(AngleProperty, channel); // Pack & send command packet DUCE.MILCMD_AXISANGLEROTATION3D data; unsafe { data.Type = MILCMD.MilCmdAxisAngleRotation3D; data.Handle = _duceResource.GetHandle(channel); if (hAxisAnimations.IsNull) { data.axis = CompositionResourceManager.Vector3DToMilPoint3F(Axis); } data.hAxisAnimations = hAxisAnimations; if (hAngleAnimations.IsNull) { data.angle = Angle; } data.hAngleAnimations = hAngleAnimations; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_AXISANGLEROTATION3D)); } } }
/// <summary> /// Do the actual work to disconnect the VisualTarget. /// This is called (on the channel's thread) either from /// DisconnectHostedVisual or from DoPendingDisconnect, /// depending on which thread the request arrived on. /// </summary> private void Disconnect(DUCE.Channel channel, Dispatcher channelDispatcher, DUCE.ResourceHandle hostHandle, DUCE.ResourceHandle targetHandle, DUCE.MultiChannelResource contentRoot) { channelDispatcher.VerifyAccess(); DUCE.CompositionNode.RemoveChild( hostHandle, targetHandle, channel ); // // Release the targets handle. If we had duplicated the handle, // then this removes the duplicated handle, otherwise just decrease // the ref count for VisualTarget. // contentRoot.ReleaseOnChannel(channel); SetFlags(channel, false, VisualProxyFlags.IsContentNodeConnected); }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods 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 Brush vBrush = Brush; Pen vPen = Pen; Geometry vGeometry = Geometry; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hBrush = vBrush != null ? ((DUCE.IResource)vBrush).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hPen = vPen != null ? ((DUCE.IResource)vPen).GetHandle(channel) : DUCE.ResourceHandle.Null; DUCE.ResourceHandle hGeometry = vGeometry != null ? ((DUCE.IResource)vGeometry).GetHandle(channel) : DUCE.ResourceHandle.Null; // Pack & send command packet DUCE.MILCMD_GEOMETRYDRAWING data; unsafe { data.Type = MILCMD.MilCmdGeometryDrawing; data.Handle = _duceResource.GetHandle(channel); data.hBrush = hBrush; data.hPen = hPen; data.hGeometry = hGeometry; // Send packed command structure channel.SendCommand( (byte *)&data, sizeof(DUCE.MILCMD_GEOMETRYDRAWING)); } } }
internal override DUCE.ResourceHandle AddRefOnChannelCore(DUCE.Channel channel) { DUCE.ResourceHandle handle = base.AddRefOnChannelCore(channel); bool created = _proxy3D.CreateOrAddRefOnChannel(this, channel, DUCE.ResourceType.TYPE_VISUAL3D); Debug.Assert( _proxy.Count == _proxy3D.Count, "Viewport has been marshalled to a different number of channels than the 3D content."); // If we are creating the Viewport3DVisual/Visual3D for the first // time on this channel we need to connect the 3D root. if (created) { DUCE.Viewport3DVisualNode.Set3DChild( handle, _proxy3D.GetHandle(channel), channel); } return(handle); }