Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FreeRDPGDI.cs « GdiTest - github.com/FreeRDP/GdiTest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fff0a49d69770200ac2c1888891bb62e2be1235f (plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
using System;
using System.Runtime.InteropServices;

namespace GdiTest
{
	public class FreeRDPGDI : GDI
	{
		static bool available = false;
		static bool initialized = false;
		static FreeRDPGDI instance = null;
		
		public struct Callbacks
		{
			[DllImport("libfreerdpgdi")]
			public static extern IntPtr GetDC();
			
			[DllImport("libfreerdpgdi")]
			public static extern int BitBlt(
			                                 IntPtr hdcDest,
			                                 int nXDest,
			                                 int nYDest,
			                                 int nWidth,
			                                 int nHeight,
			                                 IntPtr hdcSrc,
			                                 int nXSrc,
			                                 int nYSrc,
			                                 System.Int32 dwRop
			                                 );
		}
		
		public FreeRDPGDI ()
		{
			this.init();
		}
		
		public static FreeRDPGDI getInstance()
		{
			if (!initialized)
			{
				instance = new FreeRDPGDI();
				initialized = true;
			}
			
			return instance;
		}
		
		public override void init()
		{
			available = false;
		}
		
		public override bool isAvailable()
		{
			return available;
		}
		
		public override IntPtr GetDC(IntPtr hWnd)
		{
			if (available)
				return Callbacks.GetDC();
			else
				return (IntPtr) null;
		}
		
		public override int ReleaseDC(IntPtr hWnd, IntPtr hDC)
		{
			return 0;
		}
		
		public override IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj)
		{
			return (IntPtr) null;	
		}
		
		public override bool DeleteObject(IntPtr hObject)
		{
			return false;
		}
		
		public override int GetPixel(IntPtr hdc, int X, int Y)
		{
			return 0;
		}
		
		public override int SetPixel(IntPtr hdc, int X, int Y, int crColor)
		{
			return 0;
		}
		
		public override bool MoveToEx(IntPtr hdc, int X, int Y, IntPtr lpPoint)
		{
			return false;
		}
		
		public override bool LineTo(IntPtr hdc, int nXEnd, int nYEnd)
		{
			return false;
		}
		
		public override bool PolylineTo(IntPtr hdc, POINT [] lppt, uint cCount)
		{
			return false;
		}
		
		public override IntPtr CreatePen(int fnPenStyle, int nWidth, int crColor)
		{
			return (IntPtr) null;
		}
		
		public override IntPtr CreateSolidBrush(int crColor)
		{
			return (IntPtr) null;
		}
		
		public override IntPtr CreatePatternBrush(IntPtr hbmp)
		{
			return (IntPtr) null;
		}
		
		public override IntPtr CreateBitmap(int nWidth, int nHeight, uint cPlanes, uint cBitsPerPel, IntPtr lpvBits)
		{
			return (IntPtr) null;
		}
		
		public override bool Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
		{
			return false;
		}
		
		public override bool Polygon(IntPtr hdc, POINT [] lpPoints, int nCount)
		{
			return false;
		}
		
		public override int BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
		                                 IntPtr hdcSrc, int nXSrc, int nYSrc, System.Int32 dwRop)
		{
			if (available)
				return Callbacks.BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
			else
				return 0;
		}		
	}
}