Draw SF Symbol on Canvas with color / color group

Hi,

I am trying to draw a picture containing a SF Symbol onto a canvas but instead of the defined color its drawn in black.

Var Testcolor As New ColorGroup(Color.Red, Color.Green )
  Var Icon As Picture = Picture.SystemImage(LeftIconName, 0, Picture.SystemImageWeights.Regular, Testcolor, Nil)
  //Icon = ImageExtensionsXC.ImageWithColorXC(Icon, Color.White)
  g.DrawPicture(Icon, 20, 25, 30, 30)
  ImageViewer1.Image = Icon

The ImageViewer shows the icon with correct color but on the canvas it’s drawn in black. Also when I try to save the icon to check it, it’s saved in black.
What am I doing wrong?

Best regards

Fabian

You might need to do the following to force the color.

Icon = imageExtensionsXC.imageOriginalXC(icon)
//then draw the picture

Or

g.fillcolor= TestColor
Icon = imageExtensionsXC.ImageWithMaskXC(icon) //not sure about the exact method name
//then draw the picture 

Thank you Jeremie.

I tried

Icon = imageExtensionsXC.imageOriginalXC(icon)

But no difference.
And also

Var Icon As Picture = Picture.SystemImage(LeftIconName, 0, Picture.SystemImageWeights.Regular, Testcolor, Nil)
g.DrawingColor = Testcolor
Icon = ImageExtensionsXC.ImageWithMaskXC(Icon)
g.DrawPicture(Icon, 20, 25, 30, 30)

makes no difference.

See this issue, could be the same behavior:
[iOS] Resizing pictures created via Picture.SystemImage causes loss of color information

1 Like

You’ll need to draw like this to prevent the bug:

It kills me to see a one year old bug with many thumbs up still not being fixed. :confounded:

2 Likes

That’s it. Thank you very much Anthony and Jeremie.