Is it possible to convert a Cairo ImageSurface into a Texture2D?
I am exploring this in order to create textures with test dinamically, so I got this code from an example:
ImageSurface surface = new ImageSurface(Format.ARGB32, 31, 41);
Context cr = new Context(surface);
cr.SelectFontFace(“Georgia”, FontSlant.Normal, FontWeight.Bold);
cr.SetFontSize(1.2);
TextExtents te = cr.TextExtents(“a”);
cr.MoveTo(0.5 - te.Width / 2 - te.XBearing, 0.5 - te.Height / 2 - te.YBearing);
cr.ShowText(“a”);
But get stuck there, since I do not know now how to convert surface into a Texture2d or something usable within Unity.
It seems like ImageSurface has a WriteToPng method, but writing to a file for reading it again could be suboptimal. I think there should be an straightway that I do not know.
Thanks a lot in advance,