foot/render.h

52 lines
1.3 KiB
C
Raw Normal View History

#pragma once
#include <stdbool.h>
#include "terminal.h"
#include "fdm.h"
#include "wayland.h"
#include "misc.h"
struct renderer;
struct renderer *render_init(struct fdm *fdm, struct wayland *wayl);
void render_destroy(struct renderer *renderer);
enum resize_options {
RESIZE_NORMAL = 0,
RESIZE_FORCE = 1 << 0,
RESIZE_BY_CELLS = 1 << 1,
RESIZE_KEEP_GRID = 1 << 2,
};
bool render_resize(
struct terminal *term, int width, int height, uint8_t resize_options);
2019-07-24 20:09:49 +02:00
void render_refresh(struct terminal *term);
void render_refresh_app_id(struct terminal *term);
void render_refresh_icon(struct terminal *term);
void render_refresh_csd(struct terminal *term);
void render_refresh_search(struct terminal *term);
void render_refresh_title(struct terminal *term);
void render_refresh_urls(struct terminal *term);
bool render_xcursor_set(
struct seat *seat, struct terminal *term, enum cursor_shape shape);
bool render_xcursor_is_valid(const struct seat *seat, const char *cursor);
2019-07-29 20:13:26 +02:00
void render_overlay(struct terminal *term);
2019-07-29 20:13:26 +02:00
struct render_worker_context {
int my_id;
struct terminal *term;
};
int render_worker_thread(void *_ctx);
struct csd_data {
int x;
int y;
int width;
int height;
};
struct csd_data get_csd_data(const struct terminal *term, enum csd_surface surf_idx);
render: gamma-correct blending This implements gamma-correct blending, which mainly affects font rendering. The implementation requires compile-time availability of the new color-management protocol (available in wayland-protocols >= 1.41), and run-time support for the same in the compositor (specifically, the EXT_LINEAR TF function and sRGB primaries). How it works: all colors are decoded from sRGB to linear (using a lookup table, generated in the exact same way pixman generates it's internal conversion tables) before being used by pixman. The resulting image buffer is thus in decoded/linear format. We use the color-management protocol to inform the compositor of this, by tagging the wayland surfaces with the 'ext_linear' image attribute. Sixes: all colors are sRGB internally, and decoded to linear before being used in any sixels. Thus, the image buffers will contain linear colors. This is important, since otherwise there would be a decode/encode penalty every time a sixel is blended to the grid. Emojis: we require fcft >= 3.2, which adds support for sRGB decoding color glyphs. Meaning, the emoji pixman surfaces can be blended directly to the grid, just like sixels. Gamma-correct blending is enabled by default *when the compositor supports it*. There's a new option to explicitly enable/disable it: gamma-correct-blending=no|yes. If set to 'yes', and the compositor does not implement the required color-management features, warning logs are emitted. There's a loss of precision when storing linear pixels in 8-bit channels. For this reason, this patch also adds supports for 10-bit surfaces. For now, this is disabled by default since such surfaces only have 2 bits for alpha. It can be enabled with tweak.surface-bit-depth=10-bit. Perhaps, in the future, we can enable it by default if: * gamma-correct blending is enabled * the user has not enabled a transparent background
2025-02-21 11:01:29 +01:00
bool render_do_linear_blending(const struct terminal *term);