FreeRDP
include/freerdp/graphics.h
1 
22 #ifndef FREERDP_GRAPHICS_H
23 #define FREERDP_GRAPHICS_H
24 
25 #include <stdlib.h>
26 #include <freerdp/api.h>
27 #include <freerdp/types.h>
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34  typedef struct rdp_bitmap rdpBitmap;
35  typedef struct rdp_pointer rdpPointer;
36  typedef struct rdp_glyph rdpGlyph;
37 
38  /* Bitmap Class */
39  typedef BOOL (*pBitmap_New)(rdpContext* context, rdpBitmap* bitmap);
40  typedef void (*pBitmap_Free)(rdpContext* context, rdpBitmap* bitmap);
41  typedef BOOL (*pBitmap_Paint)(rdpContext* context, rdpBitmap* bitmap);
42  typedef BOOL (*pBitmap_Decompress)(rdpContext* context, rdpBitmap* bitmap, const BYTE* data,
43  UINT32 width, UINT32 height, UINT32 bpp, UINT32 length,
44  BOOL compressed, UINT32 codec_id);
45  typedef BOOL (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, BOOL primary);
46 
47  struct rdp_bitmap
48  {
49  size_t size; /* 0 */
50  pBitmap_New New; /* 1 */
51  pBitmap_Free Free; /* 2 */
52  pBitmap_Paint Paint; /* 3 */
53  pBitmap_Decompress Decompress; /* 4 */
54  pBitmap_SetSurface SetSurface; /* 5 */
55  UINT32 paddingA[16 - 6]; /* 6 */
56 
57  UINT32 left; /* 16 */
58  UINT32 top; /* 17 */
59  UINT32 right; /* 18 */
60  UINT32 bottom; /* 19 */
61  UINT32 width; /* 20 */
62  UINT32 height; /* 21 */
63  UINT32 format; /* 22 */
64  UINT32 flags; /* 23 */
65  UINT32 length; /* 24 */
66  BYTE* data; /* 25 */
67  UINT64 key64; /* 26 */
68  UINT32 paddingB[32 - 27]; /* 27 */
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, 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, 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 
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  typedef struct rdp_graphics rdpGraphics;
161 
162  FREERDP_API void graphics_register_bitmap(rdpGraphics* graphics, const rdpBitmap* bitmap);
163  FREERDP_API void graphics_register_pointer(rdpGraphics* graphics, const rdpPointer* pointer);
164  FREERDP_API void graphics_register_glyph(rdpGraphics* graphics, const rdpGlyph* glyph);
165 
166  FREERDP_API void graphics_free(rdpGraphics* graphics);
167 
168  WINPR_ATTR_MALLOC(graphics_free, 1)
169  FREERDP_API rdpGraphics* graphics_new(rdpContext* context);
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif /* FREERDP_GRAPHICS_H */