Awesome Open Source
Awesome Open Source
Sponsorship

#+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"stipje_palette, 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 :-)


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
c-plus-plus (16,763
cpp (1,137
metaprogramming (69
pixel-art (47
unicorns (14

Find Open Source By Browsing 7,000 Topics Across 59 Categories