diff --git a/libguac/include/protocol.h b/libguac/include/protocol.h index 9d87587e..31d6d734 100644 --- a/libguac/include/protocol.h +++ b/libguac/include/protocol.h @@ -271,6 +271,40 @@ int guac_send_copy(GUACIO* io, const guac_layer* srcl, int srcx, int srcy, int w, int h, guac_composite_mode_t mode, const guac_layer* dstl, int dstx, int dsty); +/** + * Sends a rect instruction over the given GUACIO connection. + * + * @param io The GUACIO connection to use. + * @param mode The composite mode to use. + * @param layer The destination layer. + * @param x The X coordinate of the rectangle. + * @param y The Y coordinate of the rectangle. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + * @param r The red component of the color of the rectangle. + * @param g The green component of the color of the rectangle. + * @param b The blue component of the color of the rectangle. + * @param a The alpha (transparency) component of the color of the rectangle. + * @return Zero on success, non-zero on error. + */ +int guac_send_rect(GUACIO* io, + guac_composite_mode_t mode, const guac_layer* layer, + int x, int y, int width, int height, + int r, int g, int b, int a); + +/** + * Sends a clip instruction over the given GUACIO connection. +* + * @param io The GUACIO connection to use. + * @param layer The layer to set the clipping region of. + * @param x The X coordinate of the clipping rectangle. + * @param y The Y coordinate of the clipping rectangle. + * @param width The width of the clipping rectangle. + * @param height The height of the clipping rectangle. + */ +int guac_send_clip(GUACIO* io, const guac_layer* layer, + int x, int y, int width, int height); + /** * Sends a png instruction over the given GUACIO connection. The PNG image data * given will be automatically base64-encoded for transmission. diff --git a/libguac/src/protocol.c b/libguac/src/protocol.c index 487a5872..14d6acb1 100644 --- a/libguac/src/protocol.c +++ b/libguac/src/protocol.c @@ -299,6 +299,54 @@ int guac_send_copy(GUACIO* io, } +int guac_send_rect(GUACIO* io, + guac_composite_mode_t mode, const guac_layer* layer, + int x, int y, int width, int height, + int r, int g, int b, int a) { + + return + guac_write_string(io, "rect:") + || guac_write_int(io, mode) + || guac_write_string(io, ",") + || guac_write_int(io, layer->index) + || guac_write_string(io, ",") + || guac_write_int(io, x) + || guac_write_string(io, ",") + || guac_write_int(io, y) + || guac_write_string(io, ",") + || guac_write_int(io, width) + || guac_write_string(io, ",") + || guac_write_int(io, height) + || guac_write_string(io, ",") + || guac_write_int(io, r) + || guac_write_string(io, ",") + || guac_write_int(io, g) + || guac_write_string(io, ",") + || guac_write_int(io, b) + || guac_write_string(io, ",") + || guac_write_int(io, a) + || guac_write_string(io, ";"); + +} + +int guac_send_clip(GUACIO* io, const guac_layer* layer, + int x, int y, int width, int height) { + + return + guac_write_string(io, "clip:") + || guac_write_int(io, layer->index) + || guac_write_string(io, ",") + || guac_write_int(io, x) + || guac_write_string(io, ",") + || guac_write_int(io, y) + || guac_write_string(io, ",") + || guac_write_int(io, width) + || guac_write_string(io, ",") + || guac_write_int(io, height) + || guac_write_string(io, ";"); + +} + cairo_status_t __guac_write_png(void* closure, const unsigned char* data, unsigned int length) { GUACIO* io = (GUACIO*) closure;