diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/rootston/desktop.h | 2 | ||||
-rw-r--r-- | include/wlr/render.h | 15 | ||||
-rw-r--r-- | include/wlr/render/interface.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_output.h | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_screenshooter.h | 26 |
5 files changed, 41 insertions, 5 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index 0d641848..68fc5b94 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -8,6 +8,7 @@ #include <wlr/types/wlr_wl_shell.h> #include <wlr/types/wlr_xdg_shell_v6.h> #include <wlr/types/wlr_gamma_control.h> +#include <wlr/types/wlr_screenshooter.h> #include <wlr/util/list.h> #include "rootston/view.h" #include "rootston/config.h" @@ -36,6 +37,7 @@ struct roots_desktop { struct wlr_xdg_shell_v6 *xdg_shell_v6; struct wlr_xwayland *xwayland; struct wlr_gamma_control_manager *gamma_control_manager; + struct wlr_screenshooter *screenshooter; struct wl_listener output_add; struct wl_listener output_remove; diff --git a/include/wlr/render.h b/include/wlr/render.h index 2fbfb476..5027064d 100644 --- a/include/wlr/render.h +++ b/include/wlr/render.h @@ -30,27 +30,32 @@ struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r); * This will render the texture at <123, 321>. */ bool wlr_render_with_matrix(struct wlr_renderer *r, - struct wlr_texture *texture, const float (*matrix)[16]); + struct wlr_texture *texture, const float (*matrix)[16]); /** * Renders a solid quad in the specified color. */ void wlr_render_colored_quad(struct wlr_renderer *r, - const float (*color)[4], const float (*matrix)[16]); + const float (*color)[4], const float (*matrix)[16]); /** * Renders a solid ellipse in the specified color. */ void wlr_render_colored_ellipse(struct wlr_renderer *r, - const float (*color)[4], const float (*matrix)[16]); + const float (*color)[4], const float (*matrix)[16]); /** * Returns a list of pixel formats supported by this renderer. */ const enum wl_shm_format *wlr_renderer_get_formats( - struct wlr_renderer *r, size_t *len); + struct wlr_renderer *r, size_t *len); /** * Returns true if this wl_buffer is a DRM buffer. */ bool wlr_renderer_buffer_is_drm(struct wlr_renderer *renderer, - struct wl_resource *buffer); + struct wl_resource *buffer); +/** + * Reads pixels and stores them in out_data as ARGB8888. + */ +void wlr_renderer_read_pixels(struct wlr_renderer *r, int x, int y, + int width, int height, void *out_data); /** * Destroys this wlr_renderer. Textures must be destroyed separately. */ diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index cbe33822..bbc5acb4 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -28,6 +28,8 @@ struct wlr_renderer_impl { struct wlr_renderer *renderer, size_t *len); bool (*buffer_is_drm)(struct wlr_renderer *renderer, struct wl_resource *buffer); + void (*read_pixels)(struct wlr_renderer *renderer, int x, int y, int width, + int height, void *out_data); void (*destroy)(struct wlr_renderer *renderer); }; diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 1fa6ad9e..52d377e3 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -37,6 +37,7 @@ struct wlr_output { struct { struct wl_signal frame; + struct wl_signal swap_buffers; struct wl_signal resolution; struct wl_signal destroy; } events; diff --git a/include/wlr/types/wlr_screenshooter.h b/include/wlr/types/wlr_screenshooter.h new file mode 100644 index 00000000..4bda3d3c --- /dev/null +++ b/include/wlr/types/wlr_screenshooter.h @@ -0,0 +1,26 @@ +#ifndef _WLR_SCREENSHOOTER_H +#define _WLR_SCREENSHOOTER_H +#include <wayland-server.h> + +struct wlr_screenshooter { + struct wl_global *wl_global; + struct wlr_renderer *renderer; + + void *data; +}; + +struct wlr_screenshot { + struct wl_resource *resource; + struct wl_resource *output_resource; + + struct wlr_output *output; + struct wlr_screenshooter *screenshooter; + + void* data; +}; + +struct wlr_screenshooter *wlr_screenshooter_create(struct wl_display *display, + struct wlr_renderer *renderer); +void wlr_screenshooter_destroy(struct wlr_screenshooter *screenshooter); + +#endif |