本文整理汇总了C++中FPaintArgs::GetWindowToDesktopTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ FPaintArgs::GetWindowToDesktopTransform方法的具体用法?C++ FPaintArgs::GetWindowToDesktopTransform怎么用?C++ FPaintArgs::GetWindowToDesktopTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPaintArgs
的用法示例。
在下文中一共展示了FPaintArgs::GetWindowToDesktopTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
void FCachedWidgetNode::Initialize(const FPaintArgs& Args, TSharedRef<SWidget> InWidget, const FGeometry& InGeometry, const FSlateRect& InClippingRect)
{
Widget = InWidget;
Geometry = InGeometry;
ClippingRect = InClippingRect;
WindowOffset = Args.GetWindowToDesktopTransform();
RecordedVisibility = Args.GetLastRecordedVisibility();
LastRecordedHittestIndex = 0;
if ( RecordedVisibility.AreChildrenHitTestVisible() )
{
RecordedVisibility = InWidget->GetVisibility();
}
Children.Reset();
}
示例2: OnPaint
//.........这里部分代码省略.........
const int32 CachedElementCount = CachedElements.Num();
for ( int32 Index = 0; Index < CachedElementCount; Index++ )
{
const FSlateDrawElement& LocalElement = CachedElements[Index];
FSlateDrawElement AbsElement = LocalElement;
AbsElement.SetPosition(LocalElement.GetPosition() + DeltaPosition);
AbsElement.SetClippingRect(LocalElement.GetClippingRect().OffsetBy(DeltaPosition));
OutDrawElements.AddItem(AbsElement);
}
}
else
{
OutDrawElements.AppendDrawElements(CachedWindowElements->GetDrawElements());
}
int32 OutMaxChildLayer = CachedMaxChildLayer;
// Paint the volatile elements
if ( CachedWindowElements.IsValid() )
{
OutMaxChildLayer = FMath::Max(CachedMaxChildLayer, CachedWindowElements->PaintVolatile(OutDrawElements));
}
#if !UE_BUILD_SHIPPING
if ( IsInvalidationDebuggingEnabled() )
{
// Draw a green or red border depending on if we were invalidated this frame.
{
check(Args.IsCaching() == false);
//const bool bShowOutlineAsCached = Args.IsCaching() || bWasCachingNeeded == false;
const FLinearColor DebugTint = bWasCachingNeeded ? FLinearColor::Red : FLinearColor::Green;
FGeometry ScaledOutline = AllottedGeometry.MakeChild(FVector2D(0, 0), AllottedGeometry.GetLocalSize() * AllottedGeometry.Scale, Inverse(AllottedGeometry.Scale));
FSlateDrawElement::MakeBox(
OutDrawElements,
++OutMaxChildLayer,
ScaledOutline.ToPaintGeometry(),
FCoreStyle::Get().GetBrush(TEXT("Debug.Border")),
MyClippingRect,
ESlateDrawEffect::None,
DebugTint
);
}
// Draw a yellow outline around any volatile elements.
const TArray< TSharedRef<FSlateWindowElementList::FVolatilePaint> >& VolatileElements = CachedWindowElements->GetVolatileElements();
for ( const TSharedRef<FSlateWindowElementList::FVolatilePaint>& VolatileElement : VolatileElements )
{
FSlateDrawElement::MakeBox(
OutDrawElements,
++OutMaxChildLayer,
VolatileElement->GetGeometry().ToPaintGeometry(),
FCoreStyle::Get().GetBrush(TEXT("FocusRectangle")),
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::Yellow
);
}
// Draw a white flash for any widget that invalidated us this frame.
for ( TWeakPtr<SWidget> Invalidator : InvalidatorWidgets )
{
TSharedPtr<SWidget> SafeInvalidator = Invalidator.Pin();
if ( SafeInvalidator.IsValid() )
{
FWidgetPath WidgetPath;
if ( FSlateApplication::Get().GeneratePathToWidgetUnchecked(SafeInvalidator.ToSharedRef(), WidgetPath, EVisibility::All) )
{
FArrangedWidget ArrangedWidget = WidgetPath.FindArrangedWidget(SafeInvalidator.ToSharedRef()).Get(FArrangedWidget::NullWidget);
ArrangedWidget.Geometry.AppendTransform( FSlateLayoutTransform(Inverse(Args.GetWindowToDesktopTransform())) );
FSlateDrawElement::MakeBox(
OutDrawElements,
++OutMaxChildLayer,
ArrangedWidget.Geometry.ToPaintGeometry(),
FCoreStyle::Get().GetBrush(TEXT("WhiteBrush")),
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::White.CopyWithNewOpacity(0.6f)
);
}
}
}
InvalidatorWidgets.Reset();
}
#endif
return OutMaxChildLayer;
}
else
{
return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
}
}
示例3: Paint
int32 SWidget::Paint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
INC_DWORD_STAT(STAT_SlateNumPaintedWidgets);
SLATE_CYCLE_COUNTER_SCOPE_CUSTOM_DETAILED(SLATE_STATS_DETAIL_LEVEL_MED, GSlateOnPaint, GetType());
// Save the current layout cache we're associated with (if any)
LayoutCache = Args.GetLayoutCache();
// Record if we're part of a volatility pass, this is critical for ensuring we don't report a child
// of a volatile widget as non-volatile, causing the invalidation panel to do work that's not required.
bInheritedVolatility = Args.IsVolatilityPass();
// If this paint pass is to cache off our geometry, but we're a volatile widget,
// record this widget as volatile in the draw elements so that we get our own tick/paint
// pass later when the layout cache draws.
if ( Args.IsCaching() && IsVolatile() )
{
const int32 VolatileLayerId = LayerId + 1;
OutDrawElements.QueueVolatilePainting(
FSlateWindowElementList::FVolatilePaint(SharedThis(this), Args, AllottedGeometry, MyClippingRect, VolatileLayerId, InWidgetStyle, bParentEnabled));
return VolatileLayerId;
}
if ( bFoldTick && bCanTick )
{
FGeometry TickGeometry = AllottedGeometry;
TickGeometry.AppendTransform( FSlateLayoutTransform(Args.GetWindowToDesktopTransform()) );
SWidget* MutableThis = const_cast<SWidget*>(this);
MutableThis->ExecuteActiveTimers( Args.GetCurrentTime(), Args.GetDeltaTime() );
MutableThis->Tick( TickGeometry, Args.GetCurrentTime(), Args.GetDeltaTime() );
}
// Record hit test geometry, but only if we're not caching.
const FPaintArgs UpdatedArgs = Args.RecordHittestGeometry(this, AllottedGeometry, MyClippingRect);
// Paint the geometry of this widget.
int32 NewLayerID = OnPaint(UpdatedArgs, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
// Check if we need to show the keyboard focus ring, this is only necessary if the widget could be focused.
if ( bCanSupportFocus && SupportsKeyboardFocus() )
{
bool bShowUserFocus = FSlateApplicationBase::Get().ShowUserFocus(SharedThis(this));
if (bShowUserFocus)
{
const FSlateBrush* BrushResource = GetFocusBrush();
if (BrushResource != nullptr)
{
FSlateDrawElement::MakeBox(
OutDrawElements,
NewLayerID,
AllottedGeometry.ToPaintGeometry(),
BrushResource,
MyClippingRect,
ESlateDrawEffect::None,
BrushResource->GetTint(InWidgetStyle)
);
}
}
}
return NewLayerID;
}