本文整理汇总了C#中System.Windows.Media.Composition.DUCE类的典型用法代码示例。如果您正苦于以下问题:C# DUCE类的具体用法?C# DUCE怎么用?C# DUCE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DUCE类属于System.Windows.Media.Composition命名空间,在下文中一共展示了DUCE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateResourceCore
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));
}
}
示例2: CreateUCEResources
internal override void CreateUCEResources(DUCE.Channel channel, DUCE.Channel outOfBandChannel)
{
Debug.Assert(channel != null);
Debug.Assert(outOfBandChannel != null);
_outOfBandChannel = outOfBandChannel;
// create visual target resources
base.CreateUCEResources(channel, outOfBandChannel);
// Update state to propagate flags as necessary
StateChangedCallback(
new object[]
{
HostStateFlags.None
});
//
// Addref content node on the channel. We need extra reference
// on that node so that it does not get immediately released
// when Dispose is called. Actual release of the node needs
// to be synchronized with node disconnect by the host.
//
bool resourceCreated = _contentRoot.CreateOrAddRefOnChannel(this, outOfBandChannel, s_contentRootType);
Debug.Assert(!resourceCreated);
_contentRoot.CreateOrAddRefOnChannel(this, channel, s_contentRootType);
BeginHosting();
}
示例3: UpdateResourceCore
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));
}
}
示例4: Render
static public void Render(
IntPtr pRenderTarget,
DUCE.Channel channel,
Visual visual,
int width,
int height,
double dpiX,
double dpiY)
{
Render(pRenderTarget, channel, visual, width, height, dpiX, dpiY, Matrix.Identity, Rect.Empty);
}
示例5: CreateUCEResources
/// <summary>
/// This method is used to create all uce resources either on Startup or session connect
/// </summary>
internal virtual void CreateUCEResources(DUCE.Channel channel, DUCE.Channel outOfBandChannel)
{
Debug.Assert(channel != null);
Debug.Assert(!_contentRoot.IsOnChannel(channel));
Debug.Assert(outOfBandChannel != null);
Debug.Assert(!_contentRoot.IsOnChannel(outOfBandChannel));
//
// Create root visual on the current channel and send
// this command out of band to ensure that composition node is
// created by the time this visual target is available for hosting
// and to avoid life-time issues when we are working with this node
// from the different channels.
//
bool resourceCreated = _contentRoot.CreateOrAddRefOnChannel(this, outOfBandChannel, s_contentRootType);
Debug.Assert(resourceCreated);
_contentRoot.DuplicateHandle(outOfBandChannel, channel);
outOfBandChannel.CloseBatch();
outOfBandChannel.Commit();
}
示例6: using
/// <summary>
/// AddRefOnChannel
/// </summary>
DUCE.ResourceHandle DUCE.IResource.AddRefOnChannel(DUCE.Channel channel)
{
//
using (CompositionEngineLock.Acquire())
{
#if DEBUG
// We assume that a multi-channel resource can only be multi-channel
// if it is Frozen and does not have animated properties. In this case we know
// the target resource has at least one animated property so we expect that this
// independently animated property resource will only be added to the channel
// associated with the MediaContext associated with the target object's Dispatcher.
DependencyObject d = (DependencyObject)_dependencyObject.Target;
// I'm not sure how our target animated DependencyObject would get garbage
// collected before we call AddRefOnChannel on one of its animated property
// resources, but if it happens it will be a bad thing.
Debug.Assert(d != null);
// Any animated DependencyObject must be associated with a Dispatcher because the
// AnimationClocks doing the animating must be associated with a Dispatcher.
Debug.Assert(d.Dispatcher != null);
// Make sure the target belongs to this thread
Debug.Assert(d.CheckAccess());
#endif
if (_duceResource.CreateOrAddRefOnChannel(this, channel, ResourceType))
{
_updateResourceHandler = new MediaContext.ResourcesUpdatedHandler(UpdateResource);
UpdateResourceCore(channel);
}
return _duceResource.GetHandle(channel);
}
}
示例7: AddRefOnChannelAnimations
internal virtual void AddRefOnChannelAnimations(DUCE.Channel channel)
{
if (IAnimatable_HasAnimatedProperties)
{
FrugalMap animatedPropertiesMap = AnimationStorage.GetAnimatedPropertiesMap(this);
Debug.Assert(animatedPropertiesMap.Count > 0);
for (int i = 0; i < animatedPropertiesMap.Count; i++)
{
Int32 dpGlobalIndex;
Object storageObject;
animatedPropertiesMap.GetKeyValuePair(i, out dpGlobalIndex, out storageObject);
DUCE.IResource storage = storageObject as DUCE.IResource;
if (storage != null)
{
storage.AddRefOnChannel(channel);
}
}
}
}
示例8: AddRefOnChannelCore
internal override DUCE.ResourceHandle AddRefOnChannelCore(DUCE.Channel channel)
{
if (_duceResource.CreateOrAddRefOnChannel(this, channel, DUCE.ResourceType.TYPE_BITMAPSOURCE))
{
UpdateResource(channel, true /* skip "on channel" check - we already know that we're on channel */ );
}
return _duceResource.GetHandle(channel);
}
示例9: ReleaseOnChannelCore
internal override void ReleaseOnChannelCore(DUCE.Channel channel)
{
Debug.Assert(_duceResource.IsOnChannel(channel));
if (_duceResource.ReleaseOnChannel(channel))
{
ReleaseOnChannelAnimations(channel);
// If we are being pulled off the asynchronous compositor channel
// while we still have a handler hooked to the commit batch event,
// remove the handler to avoid situations where would leak the D3DImage
if (!channel.IsSynchronous)
{
UnsubscribeFromCommittingBatch();
}
}
}
示例10: ReleaseOnChannelCore
internal override void ReleaseOnChannelCore(DUCE.Channel channel)
{
Debug.Assert(_duceResource.IsOnChannel(channel));
if (_duceResource.ReleaseOnChannel(channel))
{
MaterialCollection vChildren = Children;
if (vChildren != null)
{
int count = vChildren.Count;
for (int i = 0; i < count; i++)
{
((DUCE.IResource) vChildren.Internal_GetItem(i)).ReleaseOnChannel(channel);
}
}
ReleaseOnChannelAnimations(channel);
}
}
示例11: GetHandleCore
DUCE.ResourceHandle DUCE.IResource.GetHandle(DUCE.Channel channel)
{
using (CompositionEngineLock.Acquire())
{
return GetHandleCore(channel);
}
}
示例12: UpdateResource
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;
}
示例13: AddRefOnChannelCore
//------------------------------------------------------
//
// Protected Methods
//
//------------------------------------------------------
#region Protected Methods
#endregion ProtectedMethods
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
#region Internal Methods
internal abstract DUCE.ResourceHandle AddRefOnChannelCore(DUCE.Channel channel);
示例14: using
void DUCE.IResource.ReleaseOnChannel(DUCE.Channel channel)
{
//
using (CompositionEngineLock.Acquire())
{
ReleaseOnChannelCore(channel);
}
}
示例15: using
void DUCE.IResource.ReleaseOnChannel(DUCE.Channel channel)
{
using (CompositionEngineLock.Acquire())
{
Debug.Assert(_duceResource.IsOnChannel(channel));
if (_duceResource.ReleaseOnChannel(channel))
{
ReleaseOnChannelAnimations(channel);
}
}
}