void AaScreen::show() { int c; // make screen_buffer RGBA to grey uint8_t *aa_buf = (uint8_t*)aa_image(ascii_context); uint32_t *rgb_buf = (uint32_t*) screen_buffer; for(c = 0; c < geo.pixelsize; c++) aa_buf[c] = .30 * rgba_to_r(rgb_buf[c]) + .59 * rgba_to_g(rgb_buf[c]) + .11 * rgba_to_b(rgb_buf[c]); aa_render(ascii_context, ascii_rndparms, 0, 0, geo.w, geo.h); aa_flush(ascii_context); }
//! \brief create a COLOR from an rgba unsigned int // (ignores alpha) inline COLOR rgba_to_color(uint rgba) { return COLOR(rgba_to_r(rgba)/255.0, rgba_to_g(rgba)/255.0, rgba_to_b(rgba)/255.0); }