本文整理汇总了C++中PlaylistItem::AlphaAnimator方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaylistItem::AlphaAnimator方法的具体用法?C++ PlaylistItem::AlphaAnimator怎么用?C++ PlaylistItem::AlphaAnimator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlaylistItem
的用法示例。
在下文中一共展示了PlaylistItem::AlphaAnimator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _
// ValidateItemLayout
void
SlideShowPlaylist::ValidateItemLayout()
{
int64 duration = Value(PROPERTY_DURATION, (int64)0);
if (duration == 0)
return;
int64 transitionDuration
= Value(PROPERTY_TRANSITION_DURATION, (int64)0);
// TODO: transition mode...
int32 count = CountItems();
BList managedItems;
int64 minDuration = 0;
int64 minItemDuration = transitionDuration * 3;
int64 fixedItemsDuration = 0;
int64 maxDuration = 0;
int32 variableItemCount = 0;
for (int32 i = 0; i < count; i++) {
PlaylistItem* item = ItemAtFast(i);
if (item->Track() > 1)
// not a "managed" item
continue;
managedItems.AddItem(item);
if (item->HasMaxDuration()) {
int64 maxItemDuration = item->MaxDuration();
minDuration += maxItemDuration;
fixedItemsDuration += maxItemDuration;
if (minItemDuration > maxItemDuration)
minItemDuration = maxItemDuration;
} else {
minDuration += 3 * transitionDuration;
variableItemCount++;
}
maxDuration += item->MaxDuration();
}
count = managedItems.CountItems();
if (count == 0)
return;
if (duration < minDuration)
duration = minDuration;
if (duration > maxDuration)
duration = maxDuration;
// limit transition duration to 1/3 of the minimum item duration
int64 maxTransitionDuration = minItemDuration / 3;
if (transitionDuration > maxTransitionDuration)
transitionDuration = maxTransitionDuration;
int64 variableItemsDuration = duration - fixedItemsDuration
+ transitionDuration * (count - variableItemCount);
int64 startFrame = 0;
int64 lastVariableStartFrame = 0;
int32 variableItemIndex = 0;
for (int32 i = 0; i < count; i++) {
PlaylistItem* item = (PlaylistItem*)managedItems.ItemAtFast(i);
// overlapping items
item->SetClipOffset(0);
item->SetTrack(i & 1);
int64 nextStartFrame;
if (item->HasMaxDuration()) {
nextStartFrame = startFrame + item->MaxDuration()
- transitionDuration;
} else {
variableItemIndex++;
int64 nextVariableStartFrame = (variableItemsDuration - transitionDuration)
* variableItemIndex / variableItemCount;
nextStartFrame = startFrame + nextVariableStartFrame - lastVariableStartFrame;
lastVariableStartFrame = nextVariableStartFrame;
}
item->SetStartFrame(startFrame);
item->SetDuration(nextStartFrame - startFrame + transitionDuration);
startFrame = nextStartFrame;
// transition
PropertyAnimator* animator = item->AlphaAnimator();
if (!animator)
continue;
AutoNotificationSuspender _(animator);
// remove all keyframes to get a clean start
animator->MakeEmpty();
KeyFrame* first = animator->InsertKeyFrameAt(0LL);
KeyFrame* last = animator->InsertKeyFrameAt(item->Duration() - 1);
if (!first || !last)
continue;
//.........这里部分代码省略.........