簡體   English   中英

directx11向DrawLine 2d添加輝光

[英]directx11 add glow to DrawLine 2d

我畫一條2D線我該如何給它增加發光效果?

auto renderer::draw_line(point<float> const& start_point, point<float> const& end_point, float const stroke_width, color const& stroke_color) -> void {

    brush->SetColor(D2D1::ColorF(stroke_color.r, stroke_color.g, stroke_color.b, stroke_color.a));

    device_context_d2d1->DrawLine(
        D2D1::Point2F(start_point.x + offsetX, start_point.y + offsetY),
        D2D1::Point2F(end_point.x + offsetX, end_point.y + offsetY),
        brush.get(), stroke_width
    );

}

我認為這與該功能有關

ID2D1Effect* shadowEffect;
device_context_d2d1->CreateEffect(CLSID_D2D1Shadow, &shadowEffect);

您可以應用高斯模糊效果 (實際上是在陰影效果中使用),然后(可選) 將“亮度”效果應用於模糊圖像,然后最終在原始線條圖像的頂部繪制模糊圖像。

模糊線

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM