libguac  0.7.0
protocol.h
Go to the documentation of this file.
00001 
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is libguac.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Michael Jumper.
00019  * Portions created by the Initial Developer are Copyright (C) 2010
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _GUAC_PROTOCOL_H
00039 #define _GUAC_PROTOCOL_H
00040 
00041 #include <cairo/cairo.h>
00042 
00043 #include "layer.h"
00044 #include "socket.h"
00045 #include "timestamp.h"
00046 
00059 typedef enum guac_composite_mode {
00060 
00061     /*
00062      * A: Source where destination transparent = S n D'
00063      * B: Source where destination opaque      = S n D
00064      * C: Destination where source transparent = D n S'
00065      * D: Destination where source opaque      = D n S
00066      *
00067      * 0 = Active, 1 = Inactive
00068      */
00069                            /* ABCD */
00070     GUAC_COMP_ROUT  = 0x2, /* 0010 - Clears destination where source opaque  */
00071     GUAC_COMP_ATOP  = 0x6, /* 0110 - Fill where destination opaque only      */
00072     GUAC_COMP_XOR   = 0xA, /* 1010 - XOR                                     */
00073     GUAC_COMP_ROVER = 0xB, /* 1011 - Fill where destination transparent only */
00074     GUAC_COMP_OVER  = 0xE, /* 1110 - Draw normally                           */
00075     GUAC_COMP_PLUS  = 0xF, /* 1111 - Add                                     */
00076 
00077     /* Unimplemented in client: */
00078     /* NOT IMPLEMENTED:       0000 - Clear          */
00079     /* NOT IMPLEMENTED:       0011 - No operation   */
00080     /* NOT IMPLEMENTED:       0101 - Additive IN    */
00081     /* NOT IMPLEMENTED:       0111 - Additive ATOP  */
00082     /* NOT IMPLEMENTED:       1101 - Additive RATOP */
00083 
00084     /* Buggy in webkit browsers, as they keep channel C on in all cases: */
00085     GUAC_COMP_RIN   = 0x1, /* 0001 */
00086     GUAC_COMP_IN    = 0x4, /* 0100 */
00087     GUAC_COMP_OUT   = 0x8, /* 1000 */
00088     GUAC_COMP_RATOP = 0x9, /* 1001 */
00089     GUAC_COMP_SRC   = 0xC  /* 1100 */
00090 
00091     /* Bitwise composite operations (binary) */
00092 
00093     /*
00094      * A: S' & D'
00095      * B: S' & D
00096      * C: S  & D'
00097      * D: S  & D
00098      *
00099      * 0 = Active, 1 = Inactive
00100      */
00101 
00102 } guac_composite_mode;
00103 
00104 
00109 typedef enum guac_transfer_function {
00110 
00111     /* Constant functions */               /* ABCD */
00112     GUAC_TRANSFER_BINARY_BLACK      = 0x0, /* 0000 */
00113     GUAC_TRANSFER_BINARY_WHITE      = 0xF, /* 1111 */
00114 
00115     /* Copy functions */
00116     GUAC_TRANSFER_BINARY_SRC        = 0x3, /* 0011 */
00117     GUAC_TRANSFER_BINARY_DEST       = 0x5, /* 0101 */
00118     GUAC_TRANSFER_BINARY_NSRC       = 0xC, /* 1100 */
00119     GUAC_TRANSFER_BINARY_NDEST      = 0xA, /* 1010 */
00120 
00121     /* AND / NAND */
00122     GUAC_TRANSFER_BINARY_AND        = 0x1, /* 0001 */
00123     GUAC_TRANSFER_BINARY_NAND       = 0xE, /* 1110 */
00124 
00125     /* OR / NOR */
00126     GUAC_TRANSFER_BINARY_OR         = 0x7, /* 0111 */
00127     GUAC_TRANSFER_BINARY_NOR        = 0x8, /* 1000 */
00128 
00129     /* XOR / XNOR */
00130     GUAC_TRANSFER_BINARY_XOR        = 0x6, /* 0110 */
00131     GUAC_TRANSFER_BINARY_XNOR       = 0x9, /* 1001 */
00132 
00133     /* AND / NAND with inverted source */
00134     GUAC_TRANSFER_BINARY_NSRC_AND   = 0x4, /* 0100 */
00135     GUAC_TRANSFER_BINARY_NSRC_NAND  = 0xB, /* 1011 */
00136 
00137     /* OR / NOR with inverted source */
00138     GUAC_TRANSFER_BINARY_NSRC_OR    = 0xD, /* 1101 */
00139     GUAC_TRANSFER_BINARY_NSRC_NOR   = 0x2, /* 0010 */
00140 
00141     /* AND / NAND with inverted destination */
00142     GUAC_TRANSFER_BINARY_NDEST_AND  = 0x2, /* 0010 */
00143     GUAC_TRANSFER_BINARY_NDEST_NAND = 0xD, /* 1101 */
00144 
00145     /* OR / NOR with inverted destination */
00146     GUAC_TRANSFER_BINARY_NDEST_OR   = 0xB, /* 1011 */
00147     GUAC_TRANSFER_BINARY_NDEST_NOR  = 0x4  /* 0100 */
00148 
00149 } guac_transfer_function;
00150 
00154 typedef enum guac_line_cap_style {
00155     GUAC_LINE_CAP_BUTT   = 0x0,
00156     GUAC_LINE_CAP_ROUND  = 0x1,
00157     GUAC_LINE_CAP_SQUARE = 0x2
00158 } guac_line_cap_style;
00159 
00163 typedef enum guac_line_join_style {
00164     GUAC_LINE_JOIN_BEVEL = 0x0,
00165     GUAC_LINE_JOIN_MITER = 0x1,
00166     GUAC_LINE_JOIN_ROUND = 0x2
00167 } guac_line_join_style;
00168 
00169 /* CONTROL INSTRUCTIONS */
00170 
00181 int guac_protocol_send_args(guac_socket* socket, const char** args);
00182 
00193 int guac_protocol_send_connect(guac_socket* socket, const char** args);
00194 
00204 int guac_protocol_send_disconnect(guac_socket* socket);
00205 
00216 int guac_protocol_send_error(guac_socket* socket, const char* error);
00217 
00231 int guac_protocol_send_nest(guac_socket* socket, int index,
00232         const char* data);
00233 
00246 int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer,
00247         const char* name, const char* value);
00248 
00259 int guac_protocol_send_select(guac_socket* socket, const char* protocol);
00260 
00272 int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
00273 
00274 /* MEDIA INSTRUCTIONS */
00275 
00290 int guac_protocol_send_audio(guac_socket* socket, int channel,
00291         const char* mimetype, double duration, void* data, int size);
00292 
00317 int guac_protocol_send_audio_header(guac_socket* socket,
00318         int channel, const char* mimetype, double duration, int size);
00319 
00337 int guac_protocol_send_audio_data(guac_socket* socket, void* data, int count);
00338 
00350 int guac_protocol_send_audio_end(guac_socket* socket);
00351 
00365 int guac_protocol_send_file(guac_socket* socket, const char* name,
00366         const char* mimetype, void* data, int size);
00367 
00391 int guac_protocol_send_file_header(guac_socket* socket, const char* name,
00392         const char* mimetype, int size);
00393 
00411 int guac_protocol_send_file_data(guac_socket* socket, void* data, int count);
00412 
00424 int guac_protocol_send_file_end(guac_socket* socket);
00425 
00440 int guac_protocol_send_video(guac_socket* socket, const guac_layer* layer,
00441         const char* mimetype, double duration, void* data, int size);
00442 
00467 int guac_protocol_send_video_header(guac_socket* socket,
00468         const guac_layer* layer, const char* mimetype, double duration, int size);
00469 
00487 int guac_protocol_send_video_data(guac_socket* socket, void* data, int count);
00488 
00500 int guac_protocol_send_video_end(guac_socket* socket);
00501 
00502 /* DRAWING INSTRUCTIONS */
00503 
00521 int guac_protocol_send_arc(guac_socket* socket, const guac_layer* layer,
00522         int x, int y, int radius, double startAngle, double endAngle,
00523         int negative);
00524 
00540 int guac_protocol_send_cfill(guac_socket* socket,
00541         guac_composite_mode mode, const guac_layer* layer,
00542         int r, int g, int b, int a);
00543 
00554 int guac_protocol_send_clip(guac_socket* socket, const guac_layer* layer);
00555 
00566 int guac_protocol_send_close(guac_socket* socket, const guac_layer* layer);
00567 
00588 int guac_protocol_send_copy(guac_socket* socket, 
00589         const guac_layer* srcl, int srcx, int srcy, int w, int h,
00590         guac_composite_mode mode, const guac_layer* dstl, int dstx, int dsty);
00591 
00610 int guac_protocol_send_cstroke(guac_socket* socket,
00611         guac_composite_mode mode, const guac_layer* layer,
00612         guac_line_cap_style cap, guac_line_join_style join, int thickness,
00613         int r, int g, int b, int a);
00614 
00631 int guac_protocol_send_cursor(guac_socket* socket, int x, int y,
00632         const guac_layer* srcl, int srcx, int srcy, int w, int h);
00633 
00650 int guac_protocol_send_curve(guac_socket* socket, const guac_layer* layer,
00651         int cp1x, int cp1y, int cp2x, int cp2y, int x, int y);
00652 
00663 int guac_protocol_send_identity(guac_socket* socket, const guac_layer* layer);
00664 
00677 int guac_protocol_send_lfill(guac_socket* socket,
00678         guac_composite_mode mode, const guac_layer* layer,
00679         const guac_layer* srcl);
00680 
00693 int guac_protocol_send_line(guac_socket* socket, const guac_layer* layer,
00694         int x, int y);
00695 
00711 int guac_protocol_send_lstroke(guac_socket* socket,
00712         guac_composite_mode mode, const guac_layer* layer,
00713         guac_line_cap_style cap, guac_line_join_style join, int thickness,
00714         const guac_layer* srcl);
00715 
00731 int guac_protocol_send_png(guac_socket* socket, guac_composite_mode mode,
00732         const guac_layer* layer, int x, int y, cairo_surface_t* surface);
00733 
00744 int guac_protocol_send_pop(guac_socket* socket, const guac_layer* layer);
00745 
00756 int guac_protocol_send_push(guac_socket* socket, const guac_layer* layer);
00757 
00772 int guac_protocol_send_rect(guac_socket* socket, const guac_layer* layer,
00773         int x, int y, int width, int height);
00774 
00785 int guac_protocol_send_reset(guac_socket* socket, const guac_layer* layer);
00786 
00799 int guac_protocol_send_start(guac_socket* socket, const guac_layer* layer,
00800         int x, int y);
00801 
00822 int guac_protocol_send_transfer(guac_socket* socket, 
00823         const guac_layer* srcl, int srcx, int srcy, int w, int h,
00824         guac_transfer_function fn, const guac_layer* dstl, int dstx, int dsty);
00825 
00842 int guac_protocol_send_transform(guac_socket* socket, 
00843         const guac_layer* layer,
00844         double a, double b, double c,
00845         double d, double e, double f);
00846 
00847 /* LAYER INSTRUCTIONS */
00848 
00859 int guac_protocol_send_dispose(guac_socket* socket, const guac_layer* layer);
00860 
00877 int guac_protocol_send_distort(guac_socket* socket, 
00878         const guac_layer* layer,
00879         double a, double b, double c,
00880         double d, double e, double f);
00881 
00897 int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer,
00898         const guac_layer* parent, int x, int y, int z);
00899 
00911 int guac_protocol_send_shade(guac_socket* socket, const guac_layer* layer,
00912         int a);
00913 
00926 int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer,
00927         int w, int h);
00928 
00929 /* TEXT INSTRUCTIONS */
00930 
00941 int guac_protocol_send_clipboard(guac_socket* socket, const char* data);
00942 
00950 int guac_protocol_send_name(guac_socket* socket, const char* name);
00951 
00952 #endif
00953 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines