directx11 为 DrawLine 2d 添加光晕
directx11 add glow to DrawLine 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);
您可以将Gaussian blur effect (that is actually used in shadow effect), then (optionally) apply Brightness effect应用于模糊图像,然后最终在原始线条图像之上绘制模糊图像。
我正在绘制一条二维线,如何为其添加发光效果?
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);
您可以将Gaussian blur effect (that is actually used in shadow effect), then (optionally) apply Brightness effect应用于模糊图像,然后最终在原始线条图像之上绘制模糊图像。