layer.h (2794B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20#ifndef GUACENC_LAYER_H 21#define GUACENC_LAYER_H 22 23#include "config.h" 24#include "buffer.h" 25 26/** 27 * The value assigned to the parent_index property of a guacenc_layer if it has 28 * no parent. 29 */ 30#define GUACENC_LAYER_NO_PARENT -1 31 32/** 33 * A visible Guacamole layer. 34 */ 35typedef struct guacenc_layer { 36 37 /** 38 * The actual image contents of this layer, as well as this layer's size 39 * (width and height). 40 */ 41 guacenc_buffer* buffer; 42 43 /** 44 * The index of the layer that contains this layer. If this layer is the 45 * default layer (and thus has no parent), this will be 46 * GUACENC_LAYER_NO_PARENT. 47 */ 48 int parent_index; 49 50 /** 51 * The X coordinate of the upper-left corner of this layer within the 52 * Guacamole display. 53 */ 54 int x; 55 56 /** 57 * The Y coordinate of the upper-left corner of this layer within the 58 * Guacamole display. 59 */ 60 int y; 61 62 /** 63 * The relative stacking order of this layer with respect to other sibling 64 * layers. 65 */ 66 int z; 67 68 /** 69 * The opacity of this layer, where 0 is completely transparent and 255 is 70 * completely opaque. 71 */ 72 int opacity; 73 74 /** 75 * The internal buffer used by to record the state of this layer in the 76 * previous frame and to render additional frames. 77 */ 78 guacenc_buffer* frame; 79 80} guacenc_layer; 81 82/** 83 * Allocates and initializes a new layer object. This allocation is independent 84 * of the Guacamole video encoder display; the allocated guacenc_layer will not 85 * automatically be associated with the active display. 86 * 87 * @return 88 * A newly-allocated and initialized guacenc_layer, or NULL if allocation 89 * fails. 90 */ 91guacenc_layer* guacenc_layer_alloc(); 92 93/** 94 * Frees all memory associated with the given layer object. If the layer 95 * provided is NULL, this function has no effect. 96 * 97 * @param layer 98 * The layer to free, which may be NULL. 99 */ 100void guacenc_layer_free(guacenc_layer* layer); 101 102#endif 103