cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

bitmap.h (3887B)


      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 GUAC_RDP_BITMAP_H
     21#define GUAC_RDP_BITMAP_H
     22
     23#include "config.h"
     24#include "common/display.h"
     25
     26#include <freerdp/freerdp.h>
     27#include <freerdp/graphics.h>
     28#include <guacamole/layer.h>
     29#include <winpr/wtypes.h>
     30
     31/**
     32 * Guacamole-specific rdpBitmap data.
     33 */
     34typedef struct guac_rdp_bitmap {
     35
     36    /**
     37     * FreeRDP bitmap data - MUST GO FIRST.
     38     */
     39    rdpBitmap bitmap;
     40
     41    /**
     42     * Layer containing cached image data.
     43     */
     44    guac_common_display_layer* layer;
     45
     46    /**
     47     * The number of times a bitmap has been used.
     48     */
     49    int used;
     50
     51} guac_rdp_bitmap;
     52
     53/**
     54 * Caches the given bitmap immediately, storing its data in a remote Guacamole
     55 * buffer. As RDP bitmaps are frequently created, used once, and immediately
     56 * destroyed, we defer actual remote-side caching of RDP bitmaps until they are
     57 * used at least once.
     58 *
     59 * @param context
     60 *     The rdpContext associated with the current RDP session.
     61 *
     62 * @param bitmap
     63 *     The bitmap to cache.
     64 */
     65void guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap);
     66
     67/**
     68 * Initializes the given newly-created rdpBitmap.
     69 *
     70 * @param context
     71 *     The rdpContext associated with the current RDP session.
     72 *
     73 * @param bitmap
     74 *     The bitmap to initialize.
     75 *
     76 * @return
     77 *     TRUE if successful, FALSE otherwise.
     78 */
     79BOOL guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap);
     80
     81/**
     82 * Paints the given rdpBitmap on the primary display surface. Note that this
     83 * operation does NOT draw to the "current" surface set by calls to
     84 * guac_rdp_bitmap_setsurface().
     85 *
     86 * @param context
     87 *     The rdpContext associated with the current RDP session.
     88 *
     89 * @param bitmap
     90 *     The bitmap to paint. This structure will also contain the specifics of
     91 *     the paint operation to perform, including the destination X/Y
     92 *     coordinates.
     93 *
     94 * @return
     95 *     TRUE if successful, FALSE otherwise.
     96 */
     97BOOL guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap);
     98
     99/**
    100 * Frees any Guacamole-specific data associated with the given rdpBitmap.
    101 *
    102 * @param context
    103 *     The rdpContext associated with the current RDP session.
    104 *
    105 * @param bitmap
    106 *     The bitmap whose Guacamole-specific data is to be freed.
    107 */
    108void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap);
    109
    110/**
    111 * Sets the given rdpBitmap as the drawing surface for future operations or,
    112 * if the primary flag is set, resets the current drawing surface to the
    113 * primary drawing surface of the remote display.
    114 *
    115 * @param context
    116 *     The rdpContext associated with the current RDP session.
    117 *
    118 * @param bitmap
    119 *     The rdpBitmap to set as the current drawing surface. This parameter is
    120 *     only valid if the primary flag is FALSE.
    121 *
    122 * @param primary
    123 *     TRUE if the bitmap parameter should be ignored, and the current drawing
    124 *     surface should be reset to the primary drawing surface of the remote
    125 *     display, FALSE otherwise.
    126 *
    127 * @return
    128 *     TRUE if successful, FALSE otherwise.
    129 */
    130BOOL guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap,
    131        BOOL primary);
    132
    133#endif