Documentation for <wlr/render/wlr_renderer.h>

Back to index

Table of contents

wlr_render_quad_with_matrix()

void wlr_render_quad_with_matrix(​struct wlr_renderer *r, const float color[], const float matrix[]);

Renders a solid quadrangle in the specified color with the specified matrix.

wlr_render_rect()

void wlr_render_rect(​struct wlr_renderer *r, const struct wlr_box *box, const float color[], const float projection[]);

Renders a solid rectangle in the specified color.

wlr_render_subtexture_with_matrix()

bool wlr_render_subtexture_with_matrix(​struct wlr_renderer *r, struct wlr_texture *texture, const struct wlr_fbox *box, const float matrix[], float alpha);

Renders the requested texture using the provided matrix, after cropping it to the provided rectangle.

wlr_render_texture()

bool wlr_render_texture(​struct wlr_renderer *r, struct wlr_texture *texture, const float projection[], int x, int y, float alpha);

Renders the requested texture.

wlr_render_texture_with_matrix()

bool wlr_render_texture_with_matrix(​struct wlr_renderer *r, struct wlr_texture *texture, const float matrix[], float alpha);

Renders the requested texture using the provided matrix.

struct wlr_renderer

struct wlr_renderer {
	const struct wlr_renderer_impl *impl;
	bool rendering;
	bool rendering_with_buffer;
	struct {
		struct wl_signal destroy;
	} events;
};

wlr_renderer_autocreate()

struct wlr_renderer *wlr_renderer_autocreate(​struct wlr_backend *backend);

wlr_renderer_begin()

void wlr_renderer_begin(​struct wlr_renderer *r, uint32_t width, uint32_t height);

wlr_renderer_begin_with_buffer()

bool wlr_renderer_begin_with_buffer(​struct wlr_renderer *r, struct wlr_buffer *buffer);

wlr_renderer_clear()

void wlr_renderer_clear(​struct wlr_renderer *r, const float color[]);

wlr_renderer_destroy()

void wlr_renderer_destroy(​struct wlr_renderer *renderer);

Destroys the renderer.

Textures must be destroyed separately.

wlr_renderer_end()

void wlr_renderer_end(​struct wlr_renderer *r);

wlr_renderer_get_drm_fd()

int wlr_renderer_get_drm_fd(​struct wlr_renderer *r);

Obtains the FD of the DRM device used for rendering, or -1 if unavailable.

The caller doesn't have ownership of the FD, it must not close it.

wlr_renderer_init_wl_display()

bool wlr_renderer_init_wl_display(​struct wlr_renderer *r, struct wl_display *wl_display);

Initializes wl_shm, linux-dmabuf and other buffer factory protocols.

Returns false on failure.

wlr_renderer_init_wl_shm()

bool wlr_renderer_init_wl_shm(​struct wlr_renderer *r, struct wl_display *wl_display);

Initializes wl_shm on the provided struct wl_display.

wlr_renderer_read_pixels()

bool wlr_renderer_read_pixels(​struct wlr_renderer *r, uint32_t fmt, uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, void *data);

Reads out of pixels of the currently bound surface into data. `stride` is in bytes.

If `flags` is not NULl, the caller indicates that it accepts frame flags defined in enum wlr_renderer_read_pixels_flags.

enum wlr_renderer_read_pixels_flags

enum wlr_renderer_read_pixels_flags {
	WLR_RENDERER_READ_PIXELS_Y_INVERT,
};

wlr_renderer_scissor()

void wlr_renderer_scissor(​struct wlr_renderer *r, struct wlr_box *box);

Defines a scissor box. Only pixels that lie within the scissor box can be modified by drawing functions. Providing a NULL `box` disables the scissor box.