mirror of
https://github.com/tmux/tmux.git
synced 2026-08-04 06:28:35 +00:00
41 lines
1.4 KiB
C
41 lines
1.4 KiB
C
/* $OpenBSD$ */
|
|
|
|
/*
|
|
* Copyright (c) 2026 Michael Grant <mgrant@grant.org>
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "tmux.h"
|
|
|
|
void
|
|
image_get_text_cell(__unused struct tty *tty, struct image *im, u_int x,
|
|
u_int y, const struct grid_cell *gc, struct grid_cell *out,
|
|
__unused const struct tty_style_ctx *style_ctx)
|
|
{
|
|
static const char ramp[] = " .:-=+*#%@";
|
|
const struct image_cell *cell;
|
|
u_int level = 0;
|
|
|
|
memcpy(out, gc, sizeof *out);
|
|
cell = image_get_cell(im, x, y);
|
|
if (cell != NULL)
|
|
level = cell->whole.brightness * (sizeof ramp - 2) / 255;
|
|
utf8_set(&out->data, ramp[level]);
|
|
out->flags &= ~GRID_FLAG_IMAGE;
|
|
}
|