本文整理汇总了C++中FGeometry::ToOffsetPaintGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ FGeometry::ToOffsetPaintGeometry方法的具体用法?C++ FGeometry::ToOffsetPaintGeometry怎么用?C++ FGeometry::ToOffsetPaintGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FGeometry
的用法示例。
在下文中一共展示了FGeometry::ToOffsetPaintGeometry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
int32 SSection::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
int32 StartLayer = SCompoundWidget::OnPaint( Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled );
FGeometry SectionGeometry = AllottedGeometry.MakeChild( FVector2D( SequencerSectionConstants::SectionGripSize, 0 ), AllottedGeometry.GetDrawSize() - FVector2D( SequencerSectionConstants::SectionGripSize*2, 0.0f ) );
FSlateRect SectionClipRect = SectionGeometry.GetClippingRect().IntersectionWith( MyClippingRect );
// Ask the interface to draw the section
int32 PostSectionLayer = SectionInterface->OnPaintSection( SectionGeometry, SectionClipRect, OutDrawElements, LayerId, bParentEnabled );
DrawSectionBorders(AllottedGeometry, MyClippingRect, OutDrawElements, PostSectionLayer );
PaintKeys( SectionGeometry, MyClippingRect, OutDrawElements, PostSectionLayer, InWidgetStyle );
// Section name with drop shadow
FText SectionTitle = SectionInterface->GetSectionTitle();
if (!SectionTitle.IsEmpty())
{
FSlateDrawElement::MakeText(
OutDrawElements,
PostSectionLayer+1,
SectionGeometry.ToOffsetPaintGeometry(FVector2D(6, 6)),
SectionTitle,
FEditorStyle::GetFontStyle("NormalFont"),
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::Black
);
FSlateDrawElement::MakeText(
OutDrawElements,
PostSectionLayer+2,
SectionGeometry.ToOffsetPaintGeometry(FVector2D(5, 5)),
SectionTitle,
FEditorStyle::GetFontStyle("NormalFont"),
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::White
);
}
return LayerId;
}
示例2: OnPaint
int32 SProfilerThreadView::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
// SCOPE_LOG_TIME_FUNC();
// Rendering info.
const bool bEnabled = ShouldBeEnabled( bParentEnabled );
const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
const FSlateBrush* BackgroundBrush = FEditorStyle::GetBrush( "Profiler.LineGraphArea" );
const FSlateBrush* WhiteBrush = FEditorStyle::GetBrush( "WhiteTexture" );
// Paint state for this call to OnPaint, valid only in this scope.
PaintState = new((void*)PaintStateMemory) FSlateOnPaintState( AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, DrawEffects );
// Draw background.
FSlateDrawElement::MakeBox
(
PaintState->OutDrawElements,
PaintState->LayerId,
PaintState->AllottedGeometry.ToPaintGeometry( FVector2D( 0, 0 ), PaintState->Size2D() ),
BackgroundBrush,
PaintState->AbsoluteClippingRect,
PaintState->DrawEffects,
BackgroundBrush->GetTint( InWidgetStyle ) * InWidgetStyle.GetColorAndOpacityTint()
);
LayerId++;
// Draw all cycle counters for each thread nodes.
if( IsReady() )
{
DrawFramesBackgroundAndTimelines();
DrawUIStackNodes();
DrawFrameMarkers();
}
#if 0/*DEBUG_PROFILER_PERFORMANCE*/
LayerId++;
// Draw debug information.
float GraphDescPosY = PaintState->Size2D().Y - 4.0f * PaintState->SummaryFont8Height;
// Debug text.
FSlateDrawElement::MakeText
(
OutDrawElements,
LayerId,
AllottedGeometry.ToOffsetPaintGeometry( FVector2D( 16.0f, GraphDescPosY ) ),
FString::Printf( TEXT( "Pos X=%f,Y=%f R X=%f,Y=%f TR X=%f,Y=%f ZF X=%f" ), PositionXMS, PositionY, RangeXMS, RangeY, TotalRangeXMS, TotalRangeY, ZoomFactorX ),
PaintState->SummaryFont8,
MyClippingRect,
DrawEffects,
FLinearColor::White
);
GraphDescPosY -= PaintState->SummaryFont8Height + 1.0f;
FSlateDrawElement::MakeText
(
OutDrawElements,
LayerId,
AllottedGeometry.ToOffsetPaintGeometry( FVector2D( 16.0f, GraphDescPosY ) ),
FString::Printf( TEXT( "NumMSPerWin=%f H Fr=%i,TID=%i,PX=%f,PY=%f" ), NumMillisecondsPerWindow, HoveredFrameIndex, HoveredThreadID, HoveredPositionX, HoveredPositionY ),
PaintState->SummaryFont8,
MyClippingRect,
DrawEffects,
FLinearColor::White
);
GraphDescPosY -= PaintState->SummaryFont8Height + 1.0f;
FSlateDrawElement::MakeText
(
OutDrawElements,
LayerId,
AllottedGeometry.ToOffsetPaintGeometry( FVector2D( 16.0f, GraphDescPosY ) ),
FString::Printf( TEXT( "DistD=%.2f FI=%3i,%3i" ), DistanceDragged, FramesIndices.X, FramesIndices.Y ),
PaintState->SummaryFont8,
MyClippingRect,
DrawEffects,
FLinearColor::White
);
GraphDescPosY -= PaintState->SummaryFont8Height + 1.0f;
#endif // DEBUG_PROFILER_PERFORMANCE
// Reset paint state.
PaintState = nullptr;
return SCompoundWidget::OnPaint( Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled && IsEnabled() );
}
示例3: OnPaint
int32 STimeline::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
// Used to track the layer ID we will return.
int32 RetLayerId = LayerId;
const TSharedRef< FSlateFontMeasure > FontMeasureService = FSlateApplication::Get().GetRenderer()->GetFontMeasureService();
bool bEnabled = ShouldBeEnabled( bParentEnabled );
const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
const FLinearColor ColorAndOpacitySRGB = InWidgetStyle.GetColorAndOpacityTint();
static const FLinearColor SelectedBarColor(FLinearColor::White);
// Paint inside the border only.
const FVector2D BorderPadding = FTaskGraphStyle::Get()->GetVector("TaskGraph.ProgressBar.BorderPadding");
const FSlateRect ForegroundClippingRect = AllottedGeometry.GetClippingRect().InsetBy(FMargin(BorderPadding.X, BorderPadding.Y)).IntersectionWith(MyClippingRect);
const float OffsetX = DrawingOffsetX; // BorderPadding.X
const float Width = DrawingGeometry.Size.X; // AllottedGeometry.Size.X - - 2.0f * BorderPadding.X
FSlateFontInfo MyFont( FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), 10 );
//FSlateDrawElement::MakeBox(
// OutDrawElements,
// RetLayerId++,
// AllottedGeometry.ToPaintGeometry(),
// BackgroundImage,
// MyClippingRect,
// DrawEffects,
// ColorAndOpacitySRGB
//);
// Create line points
const float RoundedMax = FMath::CeilToInt( MaxValue );
const float RoundedMin = FMath::FloorToInt( MinValue );
const float TimeScale = MaxValue - MinValue;
const int32 NumValues = FMath::FloorToInt( AllottedGeometry.Size.X * Zoom / FixedLabelSpacing );
TArray< FVector2D > LinePoints;
LinePoints.AddUninitialized( 2 );
{
LinePoints[0] = FVector2D( OffsetX, BorderPadding.Y + 1.0f );
LinePoints[1] = FVector2D( OffsetX + Width, BorderPadding.Y + 1.0f );
// Draw lines
FSlateDrawElement::MakeLines(
OutDrawElements,
RetLayerId++,
AllottedGeometry.ToPaintGeometry(),
LinePoints,
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::White
);
}
const FVector2D TextDrawSize = FontMeasureService->Measure(TEXT("0.00"), MyFont);
const float LineHeight = AllottedGeometry.Size.Y - BorderPadding.Y - TextDrawSize.Y - 2.0f;
for( int32 LineIndex = 0; LineIndex <= NumValues; LineIndex++ )
{
const float NormalizedX = (float)LineIndex / NumValues;
const float LineX = Offset + NormalizedX * Zoom;
if( LineX < 0.0f || LineX > 1.0f )
{
continue;
}
const float LineXPos = OffsetX + Width * LineX;
LinePoints[0] = FVector2D( LineXPos, BorderPadding.Y );
LinePoints[1] = FVector2D( LineXPos, LineHeight );
// Draw lines
FSlateDrawElement::MakeLines(
OutDrawElements,
RetLayerId++,
AllottedGeometry.ToPaintGeometry(),
LinePoints,
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::White
);
FString ValueText( FString::Printf( TEXT("%.2f"), MinValue + NormalizedX * TimeScale ) );
FVector2D DrawSize = FontMeasureService->Measure(ValueText, MyFont);
FVector2D TextPos( LineXPos - DrawSize.X * 0.5f, LineHeight );
if( TextPos.X < 0.0f )
{
TextPos.X = 0.0f;
}
else if( (TextPos.X + DrawSize.X) > AllottedGeometry.Size.X )
{
TextPos.X = OffsetX + Width - DrawSize.X;
}
FSlateDrawElement::MakeText(
OutDrawElements,
RetLayerId,
AllottedGeometry.ToOffsetPaintGeometry( TextPos ),
//.........这里部分代码省略.........
示例4: OnPaint
int32 SHistogram::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
static double TotalTime = 0.0f;
static uint32 NumCalls = 0;
const double StartTime = FPlatformTime::Seconds();
const TSharedRef< FSlateFontMeasure > FontMeasureService = FSlateApplication::Get().GetRenderer()->GetFontMeasureService();
// Rendering info.
const bool bEnabled = ShouldBeEnabled( bParentEnabled );
ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
const FSlateBrush* TimelineAreaBrush = FEditorStyle::GetBrush("Profiler.LineGraphArea");
const FSlateBrush* WhiteBrush = FEditorStyle::GetBrush("WhiteTexture");
const FSlateBrush* FillImage = FEditorStyle::GetBrush("TaskGraph.Mono");
// Draw background.
FSlateDrawElement::MakeBox
(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry( FVector2D(0,0), FVector2D(AllottedGeometry.Size.X,AllottedGeometry.Size.Y) ),
TimelineAreaBrush,
MyClippingRect,
DrawEffects,
TimelineAreaBrush->GetTint( InWidgetStyle ) * InWidgetStyle.GetColorAndOpacityTint()
);
LayerId++;
const float LabelBuffer = 25.0f;
// draw the grid lines
uint32 CountX = (uint32)((AllottedGeometry.Size.X-LabelBuffer*2.0f) / Description.GetBinCount());
float StartX = LabelBuffer;
static const FLinearColor GridColor = FLinearColor(0.0f,0.0f,0.0f, 0.25f);
static const FLinearColor GridTextColor = FLinearColor(1.0f,1.0f,1.0f, 0.25f);
static const FLinearColor BorderColor = FLinearColor(0.0f,0.0f,0.0f,1.0f);
FSlateFontInfo SummaryFont(FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), 8 );
const float MaxFontCharHeight = FontMeasureService->Measure( TEXT("!"), SummaryFont ).Y;
TArray<FVector2D> LinePoints;
// draw the histogram box
LinePoints.Add( FVector2D(StartX-1, LabelBuffer-1) );
LinePoints.Add( FVector2D(StartX + Description.GetBinCount()*CountX+1, LabelBuffer-1) );
LinePoints.Add( FVector2D(StartX + Description.GetBinCount()*CountX+1, AllottedGeometry.Size.Y - LabelBuffer+1) );
LinePoints.Add( FVector2D(StartX-1, AllottedGeometry.Size.Y - LabelBuffer+1) );
LinePoints.Add( FVector2D(StartX-1, LabelBuffer-1) );
FSlateDrawElement::MakeLines
(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
LinePoints,
MyClippingRect,
DrawEffects,
BorderColor
);
LinePoints.Empty();
LayerId++;
// draw the vertical lines
for (int32 Index = 0; Index < Description.GetBinCount(); ++Index)
{
float MarkerPosX = StartX + Index * CountX;
LinePoints.Add( FVector2D(MarkerPosX, LabelBuffer-1) );
LinePoints.Add( FVector2D(MarkerPosX, AllottedGeometry.Size.Y - LabelBuffer+1) );
FSlateDrawElement::MakeLines
(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
LinePoints,
MyClippingRect,
DrawEffects,
GridColor
);
LinePoints.Empty();
// Bottom - X-Axes numbers, starting from MinValue
const FString XLabel = FString::Printf(TEXT("%.0f"), Description.MinValue + Index*Description.Interval);
float FontCharWidth = FontMeasureService->Measure(XLabel, SummaryFont).X;
FSlateDrawElement::MakeText
(
OutDrawElements,
LayerId,
AllottedGeometry.ToOffsetPaintGeometry( FVector2D(MarkerPosX-FontCharWidth/2.0f,AllottedGeometry.Size.Y-LabelBuffer/2.0f-MaxFontCharHeight/2.0f) ),
XLabel,
SummaryFont,
MyClippingRect,
DrawEffects,
FLinearColor::White
);
}
LayerId++;
// draw the horizontal lines
float CountY = (AllottedGeometry.Size.Y-LabelBuffer*2.0f) / 4;
float StartY = LabelBuffer;
for (int32 Index = 0; Index < 5; ++Index)
{
float MarkerPosY = StartY + Index * CountY;
//.........这里部分代码省略.........