protected override void UpdateResourceCore(DUCE.Channel channel) { Debug.Assert(_duceResource.IsOnChannel(channel)); DependencyObject dobj = ((DependencyObject) _dependencyObject.Target); // The dependency object was GCed, nothing to do here if (dobj == null) { return; } Quaternion tempValue = (Quaternion)dobj.GetValue(_dependencyProperty); DUCE.MILCMD_QUATERNIONRESOURCE data; data.Type = MILCMD.MilCmdQuaternionResource; data.Handle = _duceResource.GetHandle(channel); data.Value = CompositionResourceManager.QuaternionToMilQuaternionF(tempValue); unsafe { channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_QUATERNIONRESOURCE)); } }
protected override void UpdateResourceCore(DUCE.Channel channel) { Debug.Assert(_duceResource.IsOnChannel(channel)); DependencyObject dobj = ((DependencyObject) _dependencyObject.Target); // The dependency object was GCed, nothing to do here if (dobj == null) { return; } Double tempValue = (Double)dobj.GetValue(_dependencyProperty); DUCE.MILCMD_DOUBLERESOURCE data; data.Type = MILCMD.MilCmdDoubleResource; data.Handle = _duceResource.GetHandle(channel); data.Value = tempValue; unsafe { channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_DOUBLERESOURCE)); } }
internal override void UpdateBitmapSourceResource(DUCE.Channel channel, bool skipOnChannelCheck) { // // If we're in BitmapSource mode, then just defer to the BitmapSource // implementation. // if (_actLikeSimpleBitmap) { base.UpdateBitmapSourceResource(channel, skipOnChannelCheck); return; } // We override this method because we use a different resource type // than our base class does. This probably suggests that the base // class should not presume the resource type, but it currently // does. The base class uses TYPE_BITMAPSOURCE resources, and we // use TYPE_DOUBLEBUFFEREDBITMAP resources. // 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)) { DUCE.MILCMD_DOUBLEBUFFEREDBITMAP command; command.Type = MILCMD.MilCmdDoubleBufferedBitmap; command.Handle = _duceResource.GetHandle(channel); unsafe { command.SwDoubleBufferedBitmap = (UInt64) _pDoubleBufferedBitmap.DangerousGetHandle().ToPointer(); } command.UseBackBuffer = channel.IsSynchronous ? 1u : 0u; // // We need to ensure that this object stays alive while traveling over the channel // so we'll AddRef it here, and simply take over the reference on the other side. // UnsafeNativeMethods.MILUnknown.AddRef(_pDoubleBufferedBitmap); unsafe { channel.SendCommand( (byte*)&command, sizeof(DUCE.MILCMD_DOUBLEBUFFEREDBITMAP), false /* sendInSeparateBatch */ ); } } }
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; Transform vRelativeTransform = RelativeTransform; BitmapCache vBitmapCache = BitmapCache; Visual vInternalTarget = InternalTarget; // 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 hRelativeTransform; if (vRelativeTransform == null || Object.ReferenceEquals(vRelativeTransform, Transform.Identity) ) { hRelativeTransform = DUCE.ResourceHandle.Null; } else { hRelativeTransform = ((DUCE.IResource)vRelativeTransform).GetHandle(channel); } DUCE.ResourceHandle hBitmapCache = vBitmapCache != null ? ((DUCE.IResource)vBitmapCache).GetHandle(channel) : DUCE.ResourceHandle.Null; // Obtain handles for properties that implement DUCE.IResource DUCE.ResourceHandle hInternalTarget = vInternalTarget != null ? ((DUCE.IResource)vInternalTarget).GetHandle(channel) : DUCE.ResourceHandle.Null; // Obtain handles for animated properties DUCE.ResourceHandle hOpacityAnimations = GetAnimationResourceHandle(OpacityProperty, channel); // Pack & send command packet DUCE.MILCMD_BITMAPCACHEBRUSH data; unsafe { data.Type = MILCMD.MilCmdBitmapCacheBrush; data.Handle = _duceResource.GetHandle(channel); if (hOpacityAnimations.IsNull) { data.Opacity = Opacity; } data.hOpacityAnimations = hOpacityAnimations; data.hTransform = hTransform; data.hRelativeTransform = hRelativeTransform; data.hBitmapCache = hBitmapCache; data.hInternalTarget = hInternalTarget; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_BITMAPCACHEBRUSH)); } } }
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; Transform vRelativeTransform = RelativeTransform; // 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 hRelativeTransform; if (vRelativeTransform == null || Object.ReferenceEquals(vRelativeTransform, Transform.Identity) ) { hRelativeTransform = DUCE.ResourceHandle.Null; } else { hRelativeTransform = ((DUCE.IResource)vRelativeTransform).GetHandle(channel); } // Obtain handles for animated properties DUCE.ResourceHandle hOpacityAnimations = GetAnimationResourceHandle(OpacityProperty, channel); DUCE.ResourceHandle hColorAnimations = GetAnimationResourceHandle(ColorProperty, channel); // Pack & send command packet DUCE.MILCMD_SOLIDCOLORBRUSH data; unsafe { data.Type = MILCMD.MilCmdSolidColorBrush; data.Handle = _duceResource.GetHandle(channel); if (hOpacityAnimations.IsNull) { data.Opacity = Opacity; } data.hOpacityAnimations = hOpacityAnimations; data.hTransform = hTransform; data.hRelativeTransform = hRelativeTransform; if (hColorAnimations.IsNull) { data.Color = CompositionResourceManager.ColorToMilColorF(Color); } data.hColorAnimations = hColorAnimations; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_SOLIDCOLORBRUSH)); } } }
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 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); bool isSynchronous = channel.IsSynchronous; DUCE.MILCMD_D3DIMAGE data; unsafe { data.Type = MILCMD.MilCmdD3DImage; data.Handle = _duceResource.GetHandle(channel); if (_pInteropDeviceBitmap != null) { UnsafeNativeMethods.MILUnknown.AddRef(_pInteropDeviceBitmap); data.pInteropDeviceBitmap = (ulong)_pInteropDeviceBitmap.DangerousGetHandle().ToPointer(); } else { data.pInteropDeviceBitmap = 0; } data.pSoftwareBitmap = 0; if (isSynchronous) { _softwareCopy = CopyBackBuffer(); if (_softwareCopy != null) { UnsafeNativeMethods.MILUnknown.AddRef(_softwareCopy.WicSourceHandle); data.pSoftwareBitmap = (ulong)_softwareCopy.WicSourceHandle.DangerousGetHandle().ToPointer(); } } // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_D3DIMAGE), false /* sendInSeparateBatch */ ); } // Presents only happen on the async channel so don't let RTB flip this bit if (!isSynchronous) { _waitingForUpdateResourceBecauseBitmapChanged = 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 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 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_EMISSIVEMATERIAL data; unsafe { data.Type = MILCMD.MilCmdEmissiveMaterial; data.Handle = _duceResource.GetHandle(channel); data.color = CompositionResourceManager.ColorToMilColorF(Color); data.hbrush = hBrush; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_EMISSIVEMATERIAL)); } } }
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)); } } }
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 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 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); } // Pack & send command packet DUCE.MILCMD_MATRIXCAMERA data; unsafe { data.Type = MILCMD.MilCmdMatrixCamera; data.Handle = _duceResource.GetHandle(channel); data.htransform = hTransform; data.viewMatrix = CompositionResourceManager.Matrix3DToD3DMATRIX(ViewMatrix); data.projectionMatrix = CompositionResourceManager.Matrix3DToD3DMATRIX(ProjectionMatrix); // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_MATRIXCAMERA)); } } }
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 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 hPositionAnimations = GetAnimationResourceHandle(PositionProperty, channel); DUCE.ResourceHandle hRangeAnimations = GetAnimationResourceHandle(RangeProperty, channel); DUCE.ResourceHandle hConstantAttenuationAnimations = GetAnimationResourceHandle(ConstantAttenuationProperty, channel); DUCE.ResourceHandle hLinearAttenuationAnimations = GetAnimationResourceHandle(LinearAttenuationProperty, channel); DUCE.ResourceHandle hQuadraticAttenuationAnimations = GetAnimationResourceHandle(QuadraticAttenuationProperty, channel); DUCE.ResourceHandle hDirectionAnimations = GetAnimationResourceHandle(DirectionProperty, channel); DUCE.ResourceHandle hOuterConeAngleAnimations = GetAnimationResourceHandle(OuterConeAngleProperty, channel); DUCE.ResourceHandle hInnerConeAngleAnimations = GetAnimationResourceHandle(InnerConeAngleProperty, channel); // Pack & send command packet DUCE.MILCMD_SPOTLIGHT data; unsafe { data.Type = MILCMD.MilCmdSpotLight; data.Handle = _duceResource.GetHandle(channel); data.htransform = hTransform; if (hColorAnimations.IsNull) { data.color = CompositionResourceManager.ColorToMilColorF(Color); } data.hColorAnimations = hColorAnimations; if (hPositionAnimations.IsNull) { data.position = CompositionResourceManager.Point3DToMilPoint3F(Position); } data.hPositionAnimations = hPositionAnimations; if (hRangeAnimations.IsNull) { data.range = Range; } data.hRangeAnimations = hRangeAnimations; if (hConstantAttenuationAnimations.IsNull) { data.constantAttenuation = ConstantAttenuation; } data.hConstantAttenuationAnimations = hConstantAttenuationAnimations; if (hLinearAttenuationAnimations.IsNull) { data.linearAttenuation = LinearAttenuation; } data.hLinearAttenuationAnimations = hLinearAttenuationAnimations; if (hQuadraticAttenuationAnimations.IsNull) { data.quadraticAttenuation = QuadraticAttenuation; } data.hQuadraticAttenuationAnimations = hQuadraticAttenuationAnimations; if (hDirectionAnimations.IsNull) { data.direction = CompositionResourceManager.Vector3DToMilPoint3F(Direction); } data.hDirectionAnimations = hDirectionAnimations; if (hOuterConeAngleAnimations.IsNull) { data.outerConeAngle = OuterConeAngle; } data.hOuterConeAngleAnimations = hOuterConeAngleAnimations; if (hInnerConeAngleAnimations.IsNull) { data.innerConeAngle = InnerConeAngle; } data.hInnerConeAngleAnimations = hInnerConeAngleAnimations; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_SPOTLIGHT)); } } }
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 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)); } } }
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; Transform vRelativeTransform = RelativeTransform; Drawing vDrawing = Drawing; // 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 hRelativeTransform; if (vRelativeTransform == null || Object.ReferenceEquals(vRelativeTransform, Transform.Identity) ) { hRelativeTransform = DUCE.ResourceHandle.Null; } else { hRelativeTransform = ((DUCE.IResource)vRelativeTransform).GetHandle(channel); } DUCE.ResourceHandle hDrawing = vDrawing != null ? ((DUCE.IResource)vDrawing).GetHandle(channel) : DUCE.ResourceHandle.Null; // Obtain handles for animated properties DUCE.ResourceHandle hOpacityAnimations = GetAnimationResourceHandle(OpacityProperty, channel); DUCE.ResourceHandle hViewportAnimations = GetAnimationResourceHandle(ViewportProperty, channel); DUCE.ResourceHandle hViewboxAnimations = GetAnimationResourceHandle(ViewboxProperty, channel); // Pack & send command packet DUCE.MILCMD_DRAWINGBRUSH data; unsafe { data.Type = MILCMD.MilCmdDrawingBrush; data.Handle = _duceResource.GetHandle(channel); if (hOpacityAnimations.IsNull) { data.Opacity = Opacity; } data.hOpacityAnimations = hOpacityAnimations; data.hTransform = hTransform; data.hRelativeTransform = hRelativeTransform; data.ViewportUnits = ViewportUnits; data.ViewboxUnits = ViewboxUnits; if (hViewportAnimations.IsNull) { data.Viewport = Viewport; } data.hViewportAnimations = hViewportAnimations; if (hViewboxAnimations.IsNull) { data.Viewbox = Viewbox; } data.hViewboxAnimations = hViewboxAnimations; data.Stretch = Stretch; data.TileMode = TileMode; data.AlignmentX = AlignmentX; data.AlignmentY = AlignmentY; data.CachingHint = (CachingHint)GetValue(RenderOptions.CachingHintProperty); data.CacheInvalidationThresholdMinimum = (double)GetValue(RenderOptions.CacheInvalidationThresholdMinimumProperty); data.CacheInvalidationThresholdMaximum = (double)GetValue(RenderOptions.CacheInvalidationThresholdMaximumProperty); data.hDrawing = hDrawing; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_DRAWINGBRUSH)); } } }
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 hNearPlaneDistanceAnimations = GetAnimationResourceHandle(NearPlaneDistanceProperty, channel); DUCE.ResourceHandle hFarPlaneDistanceAnimations = GetAnimationResourceHandle(FarPlaneDistanceProperty, channel); DUCE.ResourceHandle hPositionAnimations = GetAnimationResourceHandle(PositionProperty, channel); DUCE.ResourceHandle hLookDirectionAnimations = GetAnimationResourceHandle(LookDirectionProperty, channel); DUCE.ResourceHandle hUpDirectionAnimations = GetAnimationResourceHandle(UpDirectionProperty, channel); DUCE.ResourceHandle hFieldOfViewAnimations = GetAnimationResourceHandle(FieldOfViewProperty, channel); // Pack & send command packet DUCE.MILCMD_PERSPECTIVECAMERA data; unsafe { data.Type = MILCMD.MilCmdPerspectiveCamera; data.Handle = _duceResource.GetHandle(channel); data.htransform = hTransform; if (hNearPlaneDistanceAnimations.IsNull) { data.nearPlaneDistance = NearPlaneDistance; } data.hNearPlaneDistanceAnimations = hNearPlaneDistanceAnimations; if (hFarPlaneDistanceAnimations.IsNull) { data.farPlaneDistance = FarPlaneDistance; } data.hFarPlaneDistanceAnimations = hFarPlaneDistanceAnimations; if (hPositionAnimations.IsNull) { data.position = CompositionResourceManager.Point3DToMilPoint3F(Position); } data.hPositionAnimations = hPositionAnimations; if (hLookDirectionAnimations.IsNull) { data.lookDirection = CompositionResourceManager.Vector3DToMilPoint3F(LookDirection); } data.hLookDirectionAnimations = hLookDirectionAnimations; if (hUpDirectionAnimations.IsNull) { data.upDirection = CompositionResourceManager.Vector3DToMilPoint3F(UpDirection); } data.hUpDirectionAnimations = hUpDirectionAnimations; if (hFieldOfViewAnimations.IsNull) { data.fieldOfView = FieldOfView; } data.hFieldOfViewAnimations = hFieldOfViewAnimations; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_PERSPECTIVECAMERA)); } } }
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 hCenterAnimations = GetAnimationResourceHandle(CenterProperty, channel); // Pack & send command packet DUCE.MILCMD_ELLIPSEGEOMETRY data; unsafe { data.Type = MILCMD.MilCmdEllipseGeometry; 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 (hCenterAnimations.IsNull) { data.Center = Center; } data.hCenterAnimations = hCenterAnimations; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_ELLIPSEGEOMETRY)); } } }
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 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 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 hXAnimations = GetAnimationResourceHandle(XProperty, channel); DUCE.ResourceHandle hYAnimations = GetAnimationResourceHandle(YProperty, channel); // Pack & send command packet DUCE.MILCMD_TRANSLATETRANSFORM data; unsafe { data.Type = MILCMD.MilCmdTranslateTransform; data.Handle = _duceResource.GetHandle(channel); if (hXAnimations.IsNull) { data.X = X; } data.hXAnimations = hXAnimations; if (hYAnimations.IsNull) { data.Y = Y; } data.hYAnimations = hYAnimations; // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_TRANSLATETRANSFORM)); } } }
protected override void UpdateResource( DUCE.ResourceHandle handle, DUCE.Channel channel) { DUCE.MILCMD_RECTRESOURCE cmd = new DUCE.MILCMD_RECTRESOURCE(); cmd.Type = MILCMD.MilCmdRectResource; cmd.Handle = handle; cmd.Value = CurrentValue; unsafe { channel.SendCommand( (byte*)&cmd, sizeof(DUCE.MILCMD_RECTRESOURCE)); } // 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); // Pack & send command packet DUCE.MILCMD_MATRIXTRANSFORM3D data; unsafe { data.Type = MILCMD.MilCmdMatrixTransform3D; data.Handle = _duceResource.GetHandle(channel); data.matrix = CompositionResourceManager.Matrix3DToD3DMATRIX(Matrix); // Send packed command structure channel.SendCommand( (byte*)&data, sizeof(DUCE.MILCMD_MATRIXTRANSFORM3D)); } } }
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)); } } }
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)); } } }
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 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); // 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)); } } }