cscg24-guacamole

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

graphics.h (6393B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * Graphical Objects
      4 *
      5 * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      6 * Copyright 2016 Armin Novak <armin.novak@thincast.com>
      7 * Copyright 2016 Thincast Technologies GmbH
      8 *
      9 * Licensed under the Apache License, Version 2.0 (the "License");
     10 * you may not use this file except in compliance with the License.
     11 * You may obtain a copy of the License at
     12 *
     13 *     http://www.apache.org/licenses/LICENSE-2.0
     14 *
     15 * Unless required by applicable law or agreed to in writing, software
     16 * distributed under the License is distributed on an "AS IS" BASIS,
     17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18 * See the License for the specific language governing permissions and
     19 * limitations under the License.
     20 */
     21
     22#ifndef FREERDP_GRAPHICS_H
     23#define FREERDP_GRAPHICS_H
     24
     25typedef struct rdp_bitmap rdpBitmap;
     26typedef struct rdp_pointer rdpPointer;
     27typedef struct rdp_glyph rdpGlyph;
     28
     29#include <stdlib.h>
     30#include <freerdp/api.h>
     31#include <freerdp/types.h>
     32#include <freerdp/freerdp.h>
     33
     34#ifdef __cplusplus
     35extern "C"
     36{
     37#endif
     38
     39	/* Bitmap Class */
     40	typedef BOOL (*pBitmap_New)(rdpContext* context, rdpBitmap* bitmap);
     41	typedef void (*pBitmap_Free)(rdpContext* context, rdpBitmap* bitmap);
     42	typedef BOOL (*pBitmap_Paint)(rdpContext* context, rdpBitmap* bitmap);
     43	typedef BOOL (*pBitmap_Decompress)(rdpContext* context, rdpBitmap* bitmap, const BYTE* data,
     44	                                   UINT32 width, UINT32 height, UINT32 bpp, UINT32 length,
     45	                                   BOOL compressed, UINT32 codec_id);
     46	typedef BOOL (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, BOOL primary);
     47
     48	struct rdp_bitmap
     49	{
     50		size_t size;                   /* 0 */
     51		pBitmap_New New;               /* 1 */
     52		pBitmap_Free Free;             /* 2 */
     53		pBitmap_Paint Paint;           /* 3 */
     54		pBitmap_Decompress Decompress; /* 4 */
     55		pBitmap_SetSurface SetSurface; /* 5 */
     56		UINT32 paddingA[16 - 6];       /* 6 */
     57
     58		UINT32 left;              /* 16 */
     59		UINT32 top;               /* 17 */
     60		UINT32 right;             /* 18 */
     61		UINT32 bottom;            /* 19 */
     62		UINT32 width;             /* 20 */
     63		UINT32 height;            /* 21 */
     64		UINT32 format;            /* 22 */
     65		UINT32 flags;             /* 23 */
     66		UINT32 length;            /* 24 */
     67		BYTE* data;               /* 25 */
     68		UINT32 paddingB[32 - 26]; /* 26 */
     69
     70		BOOL compressed;          /* 32 */
     71		BOOL ephemeral;           /* 33 */
     72		UINT32 paddingC[64 - 34]; /* 34 */
     73	};
     74
     75	FREERDP_API rdpBitmap* Bitmap_Alloc(rdpContext* context);
     76	FREERDP_API BOOL Bitmap_SetRectangle(rdpBitmap* bitmap, UINT16 left, UINT16 top, UINT16 right,
     77	                                     UINT16 bottom);
     78	FREERDP_API BOOL Bitmap_SetDimensions(rdpBitmap* bitmap, UINT16 width, UINT16 height);
     79
     80	/* Pointer Class */
     81
     82	typedef BOOL (*pPointer_New)(rdpContext* context, rdpPointer* pointer);
     83	typedef void (*pPointer_Free)(rdpContext* context, rdpPointer* pointer);
     84	typedef BOOL (*pPointer_Set)(rdpContext* context, const rdpPointer* pointer);
     85	typedef BOOL (*pPointer_SetNull)(rdpContext* context);
     86	typedef BOOL (*pPointer_SetDefault)(rdpContext* context);
     87	typedef BOOL (*pPointer_SetPosition)(rdpContext* context, UINT32 x, UINT32 y);
     88
     89	struct rdp_pointer
     90	{
     91		size_t size;                      /* 0 */
     92		pPointer_New New;                 /* 1 */
     93		pPointer_Free Free;               /* 2 */
     94		pPointer_Set Set;                 /* 3 */
     95		pPointer_SetNull SetNull;         /* 4*/
     96		pPointer_SetDefault SetDefault;   /* 5 */
     97		pPointer_SetPosition SetPosition; /* 6 */
     98		UINT32 paddingA[16 - 7];          /* 7 */
     99
    100		UINT32 xPos;              /* 16 */
    101		UINT32 yPos;              /* 17 */
    102		UINT32 width;             /* 18 */
    103		UINT32 height;            /* 19 */
    104		UINT32 xorBpp;            /* 20 */
    105		UINT32 lengthAndMask;     /* 21 */
    106		UINT32 lengthXorMask;     /* 22 */
    107		BYTE* xorMaskData;        /* 23 */
    108		BYTE* andMaskData;        /* 24 */
    109		UINT32 paddingB[32 - 25]; /* 25 */
    110	};
    111
    112	FREERDP_API rdpPointer* Pointer_Alloc(rdpContext* context);
    113
    114	/* Glyph Class */
    115	typedef BOOL (*pGlyph_New)(rdpContext* context, const rdpGlyph* glyph);
    116	typedef void (*pGlyph_Free)(rdpContext* context, rdpGlyph* glyph);
    117	typedef BOOL (*pGlyph_Draw)(rdpContext* context, const rdpGlyph* glyph, INT32 x, INT32 y,
    118	                            INT32 w, INT32 h, INT32 sx, INT32 sy, BOOL fOpRedundant);
    119	typedef BOOL (*pGlyph_BeginDraw)(rdpContext* context, INT32 x, INT32 y, INT32 width,
    120	                                 INT32 height, UINT32 bgcolor, UINT32 fgcolor,
    121	                                 BOOL fOpRedundant);
    122	typedef BOOL (*pGlyph_EndDraw)(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height,
    123	                               UINT32 bgcolor, UINT32 fgcolor);
    124	typedef BOOL (*pGlyph_SetBounds)(rdpContext* context, INT32 x, INT32 y, INT32 width,
    125	                                 INT32 height);
    126
    127	struct rdp_glyph
    128	{
    129		size_t size;                /* 0 */
    130		pGlyph_New New;             /* 1 */
    131		pGlyph_Free Free;           /* 2 */
    132		pGlyph_Draw Draw;           /* 3 */
    133		pGlyph_BeginDraw BeginDraw; /* 4 */
    134		pGlyph_EndDraw EndDraw;     /* 5 */
    135		pGlyph_SetBounds SetBounds; /* 6 */
    136		UINT32 paddingA[16 - 7];    /* 7 */
    137
    138		INT32 x;                  /* 16 */
    139		INT32 y;                  /* 17 */
    140		UINT32 cx;                /* 18 */
    141		UINT32 cy;                /* 19 */
    142		UINT32 cb;                /* 20 */
    143		BYTE* aj;                 /* 21 */
    144		UINT32 paddingB[32 - 22]; /* 22 */
    145	};
    146
    147	FREERDP_API rdpGlyph* Glyph_Alloc(rdpContext* context, INT32 x, INT32 y, UINT32 cx, UINT32 cy,
    148	                                  UINT32 cb, const BYTE* aj);
    149
    150	/* Graphics Module */
    151
    152	struct rdp_graphics
    153	{
    154		rdpContext* context;           /* 0 */
    155		rdpBitmap* Bitmap_Prototype;   /* 1 */
    156		rdpPointer* Pointer_Prototype; /* 2 */
    157		rdpGlyph* Glyph_Prototype;     /* 3 */
    158		UINT32 paddingA[16 - 4];       /* 4 */
    159	};
    160
    161	FREERDP_API void graphics_register_bitmap(rdpGraphics* graphics, rdpBitmap* bitmap);
    162	FREERDP_API void graphics_register_pointer(rdpGraphics* graphics, rdpPointer* pointer);
    163	FREERDP_API void graphics_register_glyph(rdpGraphics* graphics, rdpGlyph* glyph);
    164
    165	FREERDP_API rdpGraphics* graphics_new(rdpContext* context);
    166	FREERDP_API void graphics_free(rdpGraphics* graphics);
    167
    168#ifdef __cplusplus
    169}
    170#endif
    171
    172#endif /* FREERDP_GRAPHICS_H */