2

It seems to me that all the effects available in Win2D are for drawing image.

What about CanvasGeometry? How do I draw a CanvasGeometry using, say glowing effect ?

Thanks.

1 Answer 1

1

Geometry objects provide a means of drawing and manipulating geometric shapes. It has CreatePolygon,CreatePathmethod could be used to create geometric shapes.

For glowing effect, you could refer this code sample.

private void DoEffect(CanvasDrawingSession ds, Size size, float amount)
{
    size.Width = size.Width - ExpandAmount;
    size.Height = size.Height - ExpandAmount;

    var offset = (float)(ExpandAmount / 2);           

    using (var textLayout = CreateTextLayout(ds, size))
    using (var textCommandList = new CanvasCommandList(ds))
    {
        using (var textDs = textCommandList.CreateDrawingSession())
        {                     
            textDs.DrawTextLayout(textLayout, 0, 0, GlowColor);
        }

         glowEffectGraph.Setup(textCommandList, amount);
         ds.DrawImage(glowEffectGraph.Output, offset, offset);

         ds.DrawTextLayout(textLayout, offset, offset, TextColor);
     }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. So, CanvasCommandList did the trick. I was looking for something like it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.