本文整理汇总了C++中FWidgetStyle::GetForegroundColor方法的典型用法代码示例。如果您正苦于以下问题:C++ FWidgetStyle::GetForegroundColor方法的具体用法?C++ FWidgetStyle::GetForegroundColor怎么用?C++ FWidgetStyle::GetForegroundColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWidgetStyle
的用法示例。
在下文中一共展示了FWidgetStyle::GetForegroundColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
int32 FSlateTextHighlightRunRenderer::OnPaint( const FPaintArgs& Args, const FTextLayout::FLineView& Line, const TSharedRef< ISlateRun >& Run, const TSharedRef< ILayoutBlock >& Block, const FTextBlockStyle& DefaultStyle, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
FVector2D Location( Block->GetLocationOffset() );
Location.Y = Line.Offset.Y;
// The block size and offset values are pre-scaled, so we need to account for that when converting the block offsets into paint geometry
const float InverseScale = Inverse(AllottedGeometry.Scale);
// Draw the actual highlight rectangle
FSlateDrawElement::MakeBox(
OutDrawElements,
++LayerId,
AllottedGeometry.ToPaintGeometry(TransformVector(InverseScale, FVector2D( Block->GetSize().X, Line.Size.Y )), FSlateLayoutTransform(TransformPoint(InverseScale, Location))),
&DefaultStyle.HighlightShape,
MyClippingRect,
bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect,
InWidgetStyle.GetColorAndOpacityTint() * DefaultStyle.HighlightColor
);
FLinearColor InvertedHighlightColor = FLinearColor::White - DefaultStyle.HighlightColor;
InvertedHighlightColor.A = InWidgetStyle.GetForegroundColor().A;
FWidgetStyle WidgetStyle( InWidgetStyle );
WidgetStyle.SetForegroundColor( InvertedHighlightColor );
return Run->OnPaint( Args, Line, Block, DefaultStyle, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, WidgetStyle, bParentEnabled );
}
示例2: OnPaint
int32 FSlateSimpleRunHighlighter::OnPaint( const FTextLayout::FLineView& Line, const TSharedRef< ISlateRun >& Run, const TSharedRef< ILayoutBlock >& Block, const FTextBlockStyle& DefaultStyle, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
FVector2D Location( Block->GetLocationOffset() );
Location.Y = Line.Offset.Y;
// Draw the actual highlight rectangle
FSlateDrawElement::MakeBox(
OutDrawElements,
++LayerId,
FPaintGeometry( AllottedGeometry.AbsolutePosition + Location, FVector2D( Block->GetSize().X, Line.Size.Y ), AllottedGeometry.Scale ),
&DefaultStyle.HighlightShape,
MyClippingRect,
bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect,
InWidgetStyle.GetColorAndOpacityTint() * DefaultStyle.HighlightColor
);
FLinearColor InvertedForeground = FLinearColor::White - InWidgetStyle.GetForegroundColor();
InvertedForeground.A = InWidgetStyle.GetForegroundColor().A;
FWidgetStyle WidgetStyle( InWidgetStyle );
WidgetStyle.SetForegroundColor( InvertedForeground );
return Run->OnPaint( Line, Block, DefaultStyle, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, WidgetStyle, bParentEnabled );
}