当前位置: 首页>>代码示例>>C++>>正文


C++ FGeometry::ToInflatedPaintGeometry方法代码示例

本文整理汇总了C++中FGeometry::ToInflatedPaintGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ FGeometry::ToInflatedPaintGeometry方法的具体用法?C++ FGeometry::ToInflatedPaintGeometry怎么用?C++ FGeometry::ToInflatedPaintGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FGeometry的用法示例。


在下文中一共展示了FGeometry::ToInflatedPaintGeometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnPaint

int32 SProgressBar::OnPaint( 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;

    bool bEnabled = ShouldBeEnabled( bParentEnabled );
    const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;

    const FColor FillColorAndOpacitySRGB( InWidgetStyle.GetColorAndOpacityTint() * FillColorAndOpacity.Get().GetColor(InWidgetStyle) * FillImage->GetTint( InWidgetStyle ) );
    const FColor ColorAndOpacitySRGB = InWidgetStyle.GetColorAndOpacityTint();

    TOptional<float> ProgressFraction = Percent.Get();

    // Paint inside the border only.
    FPaintGeometry ForegroundPaintGeometry = AllottedGeometry.ToInflatedPaintGeometry( -BorderPadding.Get() );
    const FSlateRect ForegroundClippingRect = ForegroundPaintGeometry.ToSlateRect().IntersectionWith( MyClippingRect );

    FSlateDrawElement::MakeBox(
        OutDrawElements,
        RetLayerId++,
        AllottedGeometry.ToPaintGeometry(),
        BackgroundImage,
        MyClippingRect,
        DrawEffects,
        InWidgetStyle.GetColorAndOpacityTint() * BackgroundImage->GetTint( InWidgetStyle )
    );

    if( ProgressFraction.IsSet() )
    {
        const float ClampedFraction = FMath::Clamp( ProgressFraction.GetValue(), 0.0f, 1.0f  );

        // Draw Fill
        FSlateDrawElement::MakeBox(
            OutDrawElements,
            RetLayerId++,
            AllottedGeometry.ToPaintGeometry(
                FVector2D::ZeroVector,
                FVector2D( AllottedGeometry.Size.X * ( ClampedFraction ) , AllottedGeometry.Size.Y )),
            FillImage,
            ForegroundClippingRect,
            DrawEffects,
            FillColorAndOpacitySRGB
        );

    }
    else
    {
        // Draw Marquee
        const float MarqueeAnimOffset = MarqueeImage->ImageSize.X * CurveSequence.GetLerpLooping();
        const float MarqueeImageSize = MarqueeImage->ImageSize.X;

        FSlateDrawElement::MakeBox(
            OutDrawElements,
            RetLayerId++,
            AllottedGeometry.ToPaintGeometry(
                FVector2D( MarqueeAnimOffset - MarqueeImageSize, 0.0f ),
                FVector2D( AllottedGeometry.Size.X + MarqueeImageSize, AllottedGeometry.Size.Y )),
            MarqueeImage,
            ForegroundClippingRect,
            DrawEffects,
            ColorAndOpacitySRGB
        );

    }

    return RetLayerId - 1;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:67,代码来源:SProgressBar.cpp


注:本文中的FGeometry::ToInflatedPaintGeometry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。