importc and stb

Guillaume Piolat first.last at gmail.com
Thu Dec 16 16:04:34 UTC 2021


On Thursday, 16 December 2021 at 13:38:06 UTC, Adam D Ruppe wrote:
> On Thursday, 16 December 2021 at 10:38:38 UTC, stb wrote:
>> are we going to be able use https://github.com/nothings/stb 
>> with importc?
>> these are header only libraries and i use stb (and similar 
>> libraries) all the time.
>> there is no reason for me to use c/c++ for tools if importc 
>> can pull this off.
>
> note that some of these have already been ported to D like
> https://github.com/adamdruppe/arsd/blob/master/ttf.d
>
> though i haven't updated it back from upstream for a while.
>
> but i think the import C should work with those if you can set 
> up the macros in a separate file ahead of time.

More STB translations:

  - `stb_image.h` v2.27
     => [D 
translation](https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/pngload.d)
     I believe this is the fastest/resource efficient PNG loading 
available in D.
     That one is stripped for only PNG decoding only, it's useful 
if you want 16-bit PNG and the latest STB optimizations.

  - `stb_image_resize.h` v0.96:
     => [D 
translation](https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/stb_image_resize.d)
     I believe this is the fastest/memory-aware image resizing 
available in D. It is an image resizer with an excellent quality.

  - `stb_truetype.h` v0.7:
    => [D 
translation](https://github.com/AuburnSounds/Dplug/blob/master/graphics/dplug/graphics/stb_truetype.d)

  - `stb_vorbis.h` v1.22:
     => [D 
translation](https://github.com/AuburnSounds/audio-formats/blob/master/source/audioformats/stb_vorbis2.d)

Most of the translations can't be used as-is in our codebase 
anyway, so they were all tweaked to fit their D purpose (eg: 
original might have ARM intrinsics).


More information about the Digitalmars-d mailing list