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

github.com/FreeRDP/GdiTest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Moreau <marcandre.moreau@gmail.com>2011-03-28 07:49:16 +0400
committerMarc-André Moreau <marcandre.moreau@gmail.com>2011-03-28 07:49:16 +0400
commitc06bc704d0ac77a4735a3aef8c37b6aae3b3c98e (patch)
tree2cb346040b6aafd4ae2951b7c621a9f63e5add28
parent51f9edb1729be4b7cac9ee64c9a1d7790f71a836 (diff)
Started wrapping libfreerdpgdi
-rw-r--r--GdiTest.userprefs5
-rw-r--r--GdiTest/BitBltDrawingArea.cs13
-rw-r--r--GdiTest/FreeRDPGDI.cs90
-rw-r--r--GdiTest/GDI.cs (renamed from GdiTest/Gdi.cs)4
-rw-r--r--GdiTest/GdiTest.csproj5
-rw-r--r--GdiTest/GdiTest.pidbbin12101 -> 13782 bytes
-rw-r--r--GdiTest/Win32GDI.cs (renamed from GdiTest/Win32Gdi.cs)22
7 files changed, 120 insertions, 19 deletions
diff --git a/GdiTest.userprefs b/GdiTest.userprefs
index 232e216..ccf240c 100644
--- a/GdiTest.userprefs
+++ b/GdiTest.userprefs
@@ -2,7 +2,10 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="GdiTest/BitBltDrawingArea.cs">
<Files>
- <File FileName="GdiTest/BitBltDrawingArea.cs" Line="31" Column="39" />
+ <File FileName="GdiTest/BitBltDrawingArea.cs" Line="24" Column="18" />
+ <File FileName="GdiTest/Gdi.cs" Line="31" Column="27" />
+ <File FileName="GdiTest/Win32Gdi.cs" Line="45" Column="17" />
+ <File FileName="GdiTest/Main.cs" Line="10" Column="4" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
diff --git a/GdiTest/BitBltDrawingArea.cs b/GdiTest/BitBltDrawingArea.cs
index 2b13aa0..1a42802 100644
--- a/GdiTest/BitBltDrawingArea.cs
+++ b/GdiTest/BitBltDrawingArea.cs
@@ -33,14 +33,21 @@ namespace GdiTest
cg.LineTo (110, 110);
cg.Stroke ();
- Win32Gdi win32Gdi = Win32Gdi.getInstance();
+ Win32GDI GDI_Win32 = Win32GDI.getInstance();
- if (win32Gdi.isAvailable())
+ if (GDI_Win32.isAvailable())
{
System.Drawing.Graphics wg = Gtk.DotNet.Graphics.FromDrawable(this.GdkWindow, true);
IntPtr dc = wg.GetHdc();
- win32Gdi.BitBlt(dc, 70, 0, 60, 60, dc, 0, 0, Gdi.SRCCOPY);
+ GDI_Win32.BitBlt(dc, 70, 0, 60, 60, dc, 0, 0, GDI.SRCCOPY);
+ }
+
+ FreeRDPGDI GDI_FreeRDP = FreeRDPGDI.getInstance();
+
+ if (GDI_FreeRDP.isAvailable())
+ {
+ GDI_FreeRDP.GetDC((IntPtr) null);
}
}
return true;
diff --git a/GdiTest/FreeRDPGDI.cs b/GdiTest/FreeRDPGDI.cs
new file mode 100644
index 0000000..8c4b80d
--- /dev/null
+++ b/GdiTest/FreeRDPGDI.cs
@@ -0,0 +1,90 @@
+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 class 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 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 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;
+ }
+ }
+}
+
diff --git a/GdiTest/Gdi.cs b/GdiTest/GDI.cs
index dcfc602..9d323cc 100644
--- a/GdiTest/Gdi.cs
+++ b/GdiTest/GDI.cs
@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace GdiTest
{
- public abstract class Gdi
+ public abstract class GDI
{
public static System.Int32 SRCCOPY = 0x00CC0020; /* D = S */
public static System.Int32 SRCPAINT = 0x00EE0086; /* D = S | D */
@@ -23,7 +23,7 @@ namespace GdiTest
public static System.Int32 DSPDxax = 0x00E20746; /* D = (S & P) | (~S & D) */
public static System.Int32 SPna = 0x000C0324; /* D = S & ~P */
- public Gdi ()
+ public GDI ()
{
}
diff --git a/GdiTest/GdiTest.csproj b/GdiTest/GdiTest.csproj
index f4a91af..03387e3 100644
--- a/GdiTest/GdiTest.csproj
+++ b/GdiTest/GdiTest.csproj
@@ -58,8 +58,9 @@
<Compile Include="LineDrawingArea.cs" />
<Compile Include="BitBltDrawingArea.cs" />
<Compile Include="TestData.cs" />
- <Compile Include="Win32Gdi.cs" />
- <Compile Include="Gdi.cs" />
+ <Compile Include="GDI.cs" />
+ <Compile Include="Win32GDI.cs" />
+ <Compile Include="FreeRDPGDI.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/GdiTest/GdiTest.pidb b/GdiTest/GdiTest.pidb
index 0595485..351ed84 100644
--- a/GdiTest/GdiTest.pidb
+++ b/GdiTest/GdiTest.pidb
Binary files differ
diff --git a/GdiTest/Win32Gdi.cs b/GdiTest/Win32GDI.cs
index 23fdede..adc9e60 100644
--- a/GdiTest/Win32Gdi.cs
+++ b/GdiTest/Win32GDI.cs
@@ -3,13 +3,13 @@ using System.Runtime.InteropServices;
namespace GdiTest
{
- public class Win32Gdi : Gdi
+ public class Win32GDI : GDI
{
static bool available = false;
static bool initialized = false;
- static Win32Gdi instance = null;
+ static Win32GDI instance = null;
- public class NativeGdi
+ public class Callbacks
{
[DllImport("user32.dll")]
public static extern IntPtr GetDC(IntPtr hWnd);
@@ -37,16 +37,16 @@ namespace GdiTest
);
}
- public Win32Gdi ()
+ public Win32GDI ()
{
this.init();
}
- public static Win32Gdi getInstance()
+ public static Win32GDI getInstance()
{
if (!initialized)
{
- instance = new Win32Gdi();
+ instance = new Win32GDI();
initialized = true;
}
@@ -72,7 +72,7 @@ namespace GdiTest
public override IntPtr GetDC(IntPtr hWnd)
{
if (available)
- return NativeGdi.GetDC(hWnd);
+ return Callbacks.GetDC(hWnd);
else
return (IntPtr) null;
}
@@ -80,7 +80,7 @@ namespace GdiTest
public override int ReleaseDC(IntPtr hWnd, IntPtr hDC)
{
if (available)
- return NativeGdi.ReleaseDC(hWnd, hDC);
+ return Callbacks.ReleaseDC(hWnd, hDC);
else
return 0;
}
@@ -88,7 +88,7 @@ namespace GdiTest
public override int GetPixel(IntPtr hdc, int X, int Y)
{
if (available)
- return NativeGdi.GetPixel(hdc, X, Y);
+ return Callbacks.GetPixel(hdc, X, Y);
else
return 0;
}
@@ -96,7 +96,7 @@ namespace GdiTest
public override int SetPixel(IntPtr hdc, int X, int Y, int crColor)
{
if (available)
- return NativeGdi.SetPixel(hdc, X, Y, crColor);
+ return Callbacks.SetPixel(hdc, X, Y, crColor);
else
return 0;
}
@@ -105,7 +105,7 @@ namespace GdiTest
IntPtr hdcSrc, int nXSrc, int nYSrc, System.Int32 dwRop)
{
if (available)
- return NativeGdi.BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
+ return Callbacks.BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
else
return 0;
}