/
rdp_gdi.go
121 lines (106 loc) · 3.42 KB
/
rdp_gdi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package main
/*
#include <freerdp/graphics.h>
#include "webrdp.h"
extern BOOL webRDPend_paint(rdpContext* context);
extern BOOL webRDPdesktop_resize(rdpContext* context);
extern BOOL webRDPdstblt(rdpContext* context, DSTBLT_ORDER* dstblt);
extern BOOL webRDPpatblt(rdpContext* context, PATBLT_ORDER* patblt);
extern BOOL webRDPscrblt(rdpContext* context, SCRBLT_ORDER* scrblt);
extern BOOL webRDPmemblt(rdpContext* context, MEMBLT_ORDER* memblt);
extern BOOL webRDPopaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect);
extern BOOL webRDPpalette_update(rdpContext* context, PALETTE_UPDATE* palette);
static void web_gdi_register_update_callbacks(rdpUpdate* update) {
rdpPrimaryUpdate* primary = update->primary;
update->Palette = webRDPpalette_update;
update->BeginPaint = NULL;
update->EndPaint = webRDPend_paint;
update->DesktopResize = webRDPdesktop_resize;
primary->DstBlt = webRDPdstblt;
primary->PatBlt = webRDPpatblt;
primary->ScrBlt = webRDPscrblt;
primary->OpaqueRect = webRDPopaquerect;
primary->DrawNineGrid = NULL;
primary->MultiDstBlt = NULL;
primary->MultiPatBlt = NULL;
primary->MultiScrBlt = NULL;
primary->MultiOpaqueRect = NULL;
primary->MultiDrawNineGrid = NULL;
primary->LineTo = NULL;
primary->Polyline = NULL;
primary->MemBlt = webRDPmemblt;
primary->Mem3Blt = NULL;
primary->SaveBitmap = NULL;
primary->GlyphIndex = NULL;
primary->FastIndex = NULL;
primary->FastGlyph = NULL;
primary->PolygonSC = NULL;
primary->PolygonCB = NULL;
primary->EllipseSC = NULL;
primary->EllipseCB = NULL;
}
*/
import "C"
import (
"log"
)
//export webRDPend_paint
func webRDPend_paint(context *C.rdpContext) C.BOOL {
// log.Println("webRDPend_paint")
return true
}
//export webRDPdesktop_resize
func webRDPdesktop_resize(context *C.rdpContext) C.BOOL {
log.Println("webRDPdesktop_resize")
return true
}
//export webRDPdstblt
func webRDPdstblt(context *C.rdpContext, dstblt *C.DSTBLT_ORDER) C.BOOL {
log.Println("webRDPdstblt")
info := RdpDrawInfo{}
info.Type = 1
info.Left = uint16(dstblt.nLeftRect)
info.Top = uint16(dstblt.nTopRect)
info.Width = uint16(dstblt.nWidth)
info.Height = uint16(dstblt.nHeight)
writeByChen(context, info)
return true
}
//export webRDPpatblt
func webRDPpatblt(context *C.rdpContext, patblt *C.PATBLT_ORDER) C.BOOL {
log.Println("webRDPpatblt")
return true
}
//export webRDPscrblt
func webRDPscrblt(context *C.rdpContext, scrblt *C.SCRBLT_ORDER) C.BOOL {
log.Println("webRDPscrblt")
return true
}
//export webRDPmemblt
func webRDPmemblt(context *C.rdpContext, memblt *C.MEMBLT_ORDER) C.BOOL {
log.Println("webRDPmemblt")
return true
}
//export webRDPopaquerect
func webRDPopaquerect(context *C.rdpContext, opaque_rect *C.OPAQUE_RECT_ORDER) C.BOOL {
log.Println("webRDPopaquerect")
color := C.freerdp_color_convert_var(opaque_rect.color, 32, 32, convert2webContext(context).clrconv)
log.Printf("webRDPopaquerect:%x==>%x", opaque_rect.color, color)
info := RdpDrawInfo{}
info.Type = 2
info.Color = uint32(color)
info.Left = uint16(opaque_rect.nLeftRect)
info.Top = uint16(opaque_rect.nTopRect)
info.Width = uint16(opaque_rect.nWidth)
info.Height = uint16(opaque_rect.nHeight)
writeByChen(context, info)
return true
}
//export webRDPpalette_update
func webRDPpalette_update(context *C.rdpContext, palette *C.PALETTE_UPDATE) C.BOOL {
log.Println("webRDPpalette_update")
return true
}
func webGdiRegisterUpdateCallbacks(update *C.rdpUpdate) {
C.web_gdi_register_update_callbacks(update)
}