Layer/buffer support in png and copy instructions

This commit is contained in:
Michael Jumper 2011-02-11 23:16:46 -08:00
parent f60824686f
commit 3e6b22b071
2 changed files with 19 additions and 7 deletions

View File

@ -145,22 +145,26 @@ void guac_send_size(GUACIO* io, int w, int h);
* Sends a copy instruction over the given GUACIO connection. * Sends a copy instruction over the given GUACIO connection.
* *
* @param io The GUACIO connection to use. * @param io The GUACIO connection to use.
* @param srcl The index of the source layer.
* @param srcx The X coordinate of the source rectangle. * @param srcx The X coordinate of the source rectangle.
* @param srcy The Y coordinate of the source rectangle. * @param srcy The Y coordinate of the source rectangle.
* @param w The width of the source rectangle. * @param w The width of the source rectangle.
* @param h The height of the source rectangle. * @param h The height of the source rectangle.
* @param dstl The index of the destination layer.
* @param dstx The X coordinate of the destination, where the source rectangle * @param dstx The X coordinate of the destination, where the source rectangle
* should be copied. * should be copied.
* @param dsty The Y coordinate of the destination, where the source rectangle * @param dsty The Y coordinate of the destination, where the source rectangle
* should be copied. * should be copied.
*/ */
void guac_send_copy(GUACIO* io, int srcx, int srcy, int w, int h, int dstx, int dsty); void guac_send_copy(GUACIO* io, int srcl, int srcx, int srcy, int w, int h,
int dstl, int dstx, int dsty);
/** /**
* Sends a png instruction over the given GUACIO connection. The PNG image data * Sends a png instruction over the given GUACIO connection. The PNG image data
* given will be automatically base64-encoded for transmission. * given will be automatically base64-encoded for transmission.
* *
* @param io The GUACIO connection to use. * @param io The GUACIO connection to use.
* @param layer The index of the destination layer.
* @param x The destination X coordinate. * @param x The destination X coordinate.
* @param y The destination Y coordinate. * @param y The destination Y coordinate.
* @param png_rows A libpng-compatible PNG image buffer containing the image * @param png_rows A libpng-compatible PNG image buffer containing the image
@ -168,21 +172,23 @@ void guac_send_copy(GUACIO* io, int srcx, int srcy, int w, int h, int dstx, int
* @param w The width of the image in the image buffer. * @param w The width of the image in the image buffer.
* @param h The height of the image in the image buffer. * @param h The height of the image in the image buffer.
*/ */
void guac_send_png(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h); void guac_send_png(GUACIO* io, int layer, int x, int y,
png_byte** png_rows, int w, int h);
/** /**
* Sends a cursor instruction over the given GUACIO connection. The PNG image * Sends a cursor instruction over the given GUACIO connection. The PNG image
* data given will be automatically base64-encoded for transmission. * data given will be automatically base64-encoded for transmission.
* *
* @param io The GUACIO connection to use. * @param io The GUACIO connection to use.
* @param x The destination X coordinate. * @param x The X coordinate of the cursor hotspot.
* @param y The destination Y coordinate. * @param y The Y coordinate of the cursor hotspot.
* @param png_rows A libpng-compatible PNG image buffer containing the image * @param png_rows A libpng-compatible PNG image buffer containing the image
* data to send. * data to send.
* @param w The width of the image in the image buffer. * @param w The width of the image in the image buffer.
* @param h The height of the image in the image buffer. * @param h The height of the image in the image buffer.
*/ */
void guac_send_cursor(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h); void guac_send_cursor(GUACIO* io, int x, int y,
png_byte** png_rows, int w, int h);
/** /**
* Returns whether new instruction data is available on the given GUACIO * Returns whether new instruction data is available on the given GUACIO

View File

@ -199,8 +199,10 @@ void guac_send_error(GUACIO* io, const char* error) {
} }
void guac_send_copy(GUACIO* io, int srcx, int srcy, int w, int h, int dstx, int dsty) { void guac_send_copy(GUACIO* io, int srcl, int srcx, int srcy, int w, int h, int dstl, int dstx, int dsty) {
guac_write_string(io, "copy:"); guac_write_string(io, "copy:");
guac_write_int(io, srcl);
guac_write_string(io, ",");
guac_write_int(io, srcx); guac_write_int(io, srcx);
guac_write_string(io, ","); guac_write_string(io, ",");
guac_write_int(io, srcy); guac_write_int(io, srcy);
@ -209,6 +211,8 @@ void guac_send_copy(GUACIO* io, int srcx, int srcy, int w, int h, int dstx, int
guac_write_string(io, ","); guac_write_string(io, ",");
guac_write_int(io, h); guac_write_int(io, h);
guac_write_string(io, ","); guac_write_string(io, ",");
guac_write_int(io, dstl);
guac_write_string(io, ",");
guac_write_int(io, dstx); guac_write_int(io, dstx);
guac_write_string(io, ","); guac_write_string(io, ",");
guac_write_int(io, dsty); guac_write_int(io, dsty);
@ -228,7 +232,7 @@ void __guac_write_png(png_structp png, png_bytep data, png_size_t length) {
void __guac_write_flush(png_structp png) { void __guac_write_flush(png_structp png) {
} }
void guac_send_png(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h) { void guac_send_png(GUACIO* io, int layer, int x, int y, png_byte** png_rows, int w, int h) {
png_structp png; png_structp png;
png_infop png_info; png_infop png_info;
@ -272,6 +276,8 @@ void guac_send_png(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h)
); );
guac_write_string(io, "png:"); guac_write_string(io, "png:");
guac_write_int(io, layer);
guac_write_string(io, ",");
guac_write_int(io, x); guac_write_int(io, x);
guac_write_string(io, ","); guac_write_string(io, ",");
guac_write_int(io, y); guac_write_int(io, y);