Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

StbSharp: C# Port of Famous C Framework

$
0
0

@rds1983 wrote:

Hello everyone,
I would like to introduce StbSharp: https://github.com/rds1983/StbSharp
Which is open-source(MIT licensed) C# port of famous framework Stb: https://github.com/nothings/stb
Right now, though, it is quite young. Only stb_image.h is ported and not completely; it can load only .png and .jpg files.

This sample demonstrates using StbSharp in the MonoGame: https://github.com/rds1983/StbSharp/releases/download/0.1/StbSharp.MonoGame.WindowsDX.Test.0.1.zip
It requires VS2013 & MonoGame 3.5 to be opened/compiled.
The sample loads the same .jpg image twice: first time through the Texture2D.FromStream and second - through StbSharp. Then it renders both images and reports loading time:

As you can see the StbSharp is somewhat slower. But on the other hand it gives consistent result of the run-time image loading through different platforms.

It is important to note, that StbSharp is not manual port. It has been ported using another open-source(MIT also) project called Sichem: https://github.com/rds1983/Sichem
Sichem is C to C# code converter. It uses libclang to build the syntax tree from C and generates the C# code from it. Right now, Sichem works only with stb_image.h. However if required it could be tuned to port other C projects.

Now, let's return to StbSharp. My first priority is to add other images types supported by stb_image.h (gif, pic, psd, etc). Then I'll consider taking another stb library (i.e. stb_truetype.h).

Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles