Home
Softono
stipje

stipje

Open source C++
12
Stars
0
Forks
0
Issues
2
Watchers
7 years
Last Commit

About stipje

Compile-time XPM-like image parser for C++

Platforms

Web Self-hosted

Languages

C++

Links

+TITLE: Stipje, like XPM images, but C++-style

+AUTHOR: Chris Smeele

Stipje reads XPM-style image strings and converts them to 32-bit pixel buffers at compile-time.

Several image formats are included as well, to (at runtime) output images in PNM, PAM or true-color console block drawing characters. Other formatters can be trivially added.

** Synopsis

Requirements:

  • GCC 8 for experimental c++2a support
  • Kvasir MPL for metaprogramming assistance

+BEGIN_SRC C++

include "stipje.hh"

include

int main() { constexpr auto example = " " " ooooooo " " o o #### ##### # ##### # ###### " " o # o # # # # # # # " " o # o #### # # # # # ##### " " o ### o # # # ##### # # " " o o # # # # # # # # " " ooooooo #### # # # #### ###### o " " "_stipje (" 00000000" // rgba "o ff0000ff" "# ffffffff"_stipjepalette, uint<49> {}, // width uint_< 9> {}, // height stipje::pixel_format::rgba{}); stipje::format(std::cout, example, stipje::image_format::console256_squared{});

return 0;

}

+END_SRC

: g++ -Impl/src/kvasir -std=c++2a -Os -o example example.cc : ./example

[[./example.png]]

More docs to be written later :-)