libguac  0.8.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
protocol.h
Go to the documentation of this file.
1 
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is libguac.
16  *
17  * The Initial Developer of the Original Code is
18  * Michael Jumper.
19  * Portions created by the Initial Developer are Copyright (C) 2010
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 #ifndef _GUAC_PROTOCOL_H
39 #define _GUAC_PROTOCOL_H
40 
41 #include <cairo/cairo.h>
42 
43 #include "layer.h"
44 #include "socket.h"
45 #include "timestamp.h"
46 
59 typedef enum guac_composite_mode {
60 
61  /*
62  * A: Source where destination transparent = S n D'
63  * B: Source where destination opaque = S n D
64  * C: Destination where source transparent = D n S'
65  * D: Destination where source opaque = D n S
66  *
67  * 0 = Active, 1 = Inactive
68  */
69  /* ABCD */
70  GUAC_COMP_ROUT = 0x2, /* 0010 - Clears destination where source opaque */
71  GUAC_COMP_ATOP = 0x6, /* 0110 - Fill where destination opaque only */
72  GUAC_COMP_XOR = 0xA, /* 1010 - XOR */
73  GUAC_COMP_ROVER = 0xB, /* 1011 - Fill where destination transparent only */
74  GUAC_COMP_OVER = 0xE, /* 1110 - Draw normally */
75  GUAC_COMP_PLUS = 0xF, /* 1111 - Add */
76 
77  /* Unimplemented in client: */
78  /* NOT IMPLEMENTED: 0000 - Clear */
79  /* NOT IMPLEMENTED: 0011 - No operation */
80  /* NOT IMPLEMENTED: 0101 - Additive IN */
81  /* NOT IMPLEMENTED: 0111 - Additive ATOP */
82  /* NOT IMPLEMENTED: 1101 - Additive RATOP */
83 
84  /* Buggy in webkit browsers, as they keep channel C on in all cases: */
85  GUAC_COMP_RIN = 0x1, /* 0001 */
86  GUAC_COMP_IN = 0x4, /* 0100 */
87  GUAC_COMP_OUT = 0x8, /* 1000 */
88  GUAC_COMP_RATOP = 0x9, /* 1001 */
89  GUAC_COMP_SRC = 0xC /* 1100 */
90 
91  /* Bitwise composite operations (binary) */
92 
93  /*
94  * A: S' & D'
95  * B: S' & D
96  * C: S & D'
97  * D: S & D
98  *
99  * 0 = Active, 1 = Inactive
100  */
101 
103 
104 
110 
111  /* Constant functions */ /* ABCD */
112  GUAC_TRANSFER_BINARY_BLACK = 0x0, /* 0000 */
113  GUAC_TRANSFER_BINARY_WHITE = 0xF, /* 1111 */
114 
115  /* Copy functions */
116  GUAC_TRANSFER_BINARY_SRC = 0x3, /* 0011 */
117  GUAC_TRANSFER_BINARY_DEST = 0x5, /* 0101 */
118  GUAC_TRANSFER_BINARY_NSRC = 0xC, /* 1100 */
119  GUAC_TRANSFER_BINARY_NDEST = 0xA, /* 1010 */
120 
121  /* AND / NAND */
122  GUAC_TRANSFER_BINARY_AND = 0x1, /* 0001 */
123  GUAC_TRANSFER_BINARY_NAND = 0xE, /* 1110 */
124 
125  /* OR / NOR */
126  GUAC_TRANSFER_BINARY_OR = 0x7, /* 0111 */
127  GUAC_TRANSFER_BINARY_NOR = 0x8, /* 1000 */
128 
129  /* XOR / XNOR */
130  GUAC_TRANSFER_BINARY_XOR = 0x6, /* 0110 */
131  GUAC_TRANSFER_BINARY_XNOR = 0x9, /* 1001 */
132 
133  /* AND / NAND with inverted source */
134  GUAC_TRANSFER_BINARY_NSRC_AND = 0x4, /* 0100 */
135  GUAC_TRANSFER_BINARY_NSRC_NAND = 0xB, /* 1011 */
136 
137  /* OR / NOR with inverted source */
138  GUAC_TRANSFER_BINARY_NSRC_OR = 0xD, /* 1101 */
139  GUAC_TRANSFER_BINARY_NSRC_NOR = 0x2, /* 0010 */
140 
141  /* AND / NAND with inverted destination */
142  GUAC_TRANSFER_BINARY_NDEST_AND = 0x2, /* 0010 */
143  GUAC_TRANSFER_BINARY_NDEST_NAND = 0xD, /* 1101 */
144 
145  /* OR / NOR with inverted destination */
146  GUAC_TRANSFER_BINARY_NDEST_OR = 0xB, /* 1011 */
147  GUAC_TRANSFER_BINARY_NDEST_NOR = 0x4 /* 0100 */
148 
150 
154 typedef enum guac_line_cap_style {
155  GUAC_LINE_CAP_BUTT = 0x0,
156  GUAC_LINE_CAP_ROUND = 0x1,
157  GUAC_LINE_CAP_SQUARE = 0x2
159 
163 typedef enum guac_line_join_style {
164  GUAC_LINE_JOIN_BEVEL = 0x0,
165  GUAC_LINE_JOIN_MITER = 0x1,
166  GUAC_LINE_JOIN_ROUND = 0x2
168 
169 /* CONTROL INSTRUCTIONS */
170 
181 int guac_protocol_send_args(guac_socket* socket, const char** args);
182 
193 int guac_protocol_send_connect(guac_socket* socket, const char** args);
194 
205 
216 int guac_protocol_send_error(guac_socket* socket, const char* error);
217 
231 int guac_protocol_send_nest(guac_socket* socket, int index,
232  const char* data);
233 
246 int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer,
247  const char* name, const char* value);
248 
259 int guac_protocol_send_select(guac_socket* socket, const char* protocol);
260 
272 int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
273 
274 /* MEDIA INSTRUCTIONS */
275 
290 int guac_protocol_send_audio(guac_socket* socket, int channel,
291  const char* mimetype, double duration, void* data, int size);
292 
322  int channel, const char* mimetype, double duration, int size);
323 
341 int guac_protocol_send_audio_data(guac_socket* socket, void* data, int count);
342 
355 
369 int guac_protocol_send_file(guac_socket* socket, int index, const char* mimetype, const char* name);
370 
385 int guac_protocol_send_blob(guac_socket* socket, int index, void* data, int count);
386 
397 int guac_protocol_send_end(guac_socket* socket, int index);
398 
413 int guac_protocol_send_video(guac_socket* socket, const guac_layer* layer,
414  const char* mimetype, double duration, void* data, int size);
415 
445  const guac_layer* layer, const char* mimetype, double duration, int size);
446 
464 int guac_protocol_send_video_data(guac_socket* socket, void* data, int count);
465 
478 
479 /* DRAWING INSTRUCTIONS */
480 
498 int guac_protocol_send_arc(guac_socket* socket, const guac_layer* layer,
499  int x, int y, int radius, double startAngle, double endAngle,
500  int negative);
501 
518  guac_composite_mode mode, const guac_layer* layer,
519  int r, int g, int b, int a);
520 
531 int guac_protocol_send_clip(guac_socket* socket, const guac_layer* layer);
532 
543 int guac_protocol_send_close(guac_socket* socket, const guac_layer* layer);
544 
566  const guac_layer* srcl, int srcx, int srcy, int w, int h,
567  guac_composite_mode mode, const guac_layer* dstl, int dstx, int dsty);
568 
588  guac_composite_mode mode, const guac_layer* layer,
589  guac_line_cap_style cap, guac_line_join_style join, int thickness,
590  int r, int g, int b, int a);
591 
608 int guac_protocol_send_cursor(guac_socket* socket, int x, int y,
609  const guac_layer* srcl, int srcx, int srcy, int w, int h);
610 
627 int guac_protocol_send_curve(guac_socket* socket, const guac_layer* layer,
628  int cp1x, int cp1y, int cp2x, int cp2y, int x, int y);
629 
640 int guac_protocol_send_identity(guac_socket* socket, const guac_layer* layer);
641 
655  guac_composite_mode mode, const guac_layer* layer,
656  const guac_layer* srcl);
657 
670 int guac_protocol_send_line(guac_socket* socket, const guac_layer* layer,
671  int x, int y);
672 
689  guac_composite_mode mode, const guac_layer* layer,
690  guac_line_cap_style cap, guac_line_join_style join, int thickness,
691  const guac_layer* srcl);
692 
709  const guac_layer* layer, int x, int y, cairo_surface_t* surface);
710 
721 int guac_protocol_send_pop(guac_socket* socket, const guac_layer* layer);
722 
733 int guac_protocol_send_push(guac_socket* socket, const guac_layer* layer);
734 
749 int guac_protocol_send_rect(guac_socket* socket, const guac_layer* layer,
750  int x, int y, int width, int height);
751 
762 int guac_protocol_send_reset(guac_socket* socket, const guac_layer* layer);
763 
776 int guac_protocol_send_start(guac_socket* socket, const guac_layer* layer,
777  int x, int y);
778 
800  const guac_layer* srcl, int srcx, int srcy, int w, int h,
801  guac_transfer_function fn, const guac_layer* dstl, int dstx, int dsty);
802 
820  const guac_layer* layer,
821  double a, double b, double c,
822  double d, double e, double f);
823 
824 /* LAYER INSTRUCTIONS */
825 
836 int guac_protocol_send_dispose(guac_socket* socket, const guac_layer* layer);
837 
855  const guac_layer* layer,
856  double a, double b, double c,
857  double d, double e, double f);
858 
874 int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer,
875  const guac_layer* parent, int x, int y, int z);
876 
888 int guac_protocol_send_shade(guac_socket* socket, const guac_layer* layer,
889  int a);
890 
903 int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer,
904  int w, int h);
905 
906 /* TEXT INSTRUCTIONS */
907 
918 int guac_protocol_send_clipboard(guac_socket* socket, const char* data);
919 
927 int guac_protocol_send_name(guac_socket* socket, const char* name);
928 
929 #endif
930