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-30 07:07:05 +0400
committerMarc-André Moreau <marcandre.moreau@gmail.com>2011-03-30 07:07:05 +0400
commite37fc68b6a6d5fbea87554094cfb075a5aa7afb5 (patch)
tree296e43e3e723880aa51265db75607ff31d63e3a8
parentdff5f1d3bdb52feac65aacd4855597dd620ae459 (diff)
Added test drawing areas for Polygon() and PolylineTo()
-rw-r--r--GdiTest/FreeRDPGDI.cs5
-rw-r--r--GdiTest/GDI.cs24
-rw-r--r--GdiTest/GdiTest.csproj2
-rw-r--r--GdiTest/MainWindow.cs34
-rw-r--r--GdiTest/PolygonDrawingArea.cs19
-rw-r--r--GdiTest/PolylineToDrawingArea.cs19
-rw-r--r--GdiTest/Win32GDI.cs22
-rw-r--r--GdiTest/gtk-gui/MainWindow.cs44
-rw-r--r--GdiTest/gtk-gui/gui.stetic36
9 files changed, 147 insertions, 58 deletions
diff --git a/GdiTest/FreeRDPGDI.cs b/GdiTest/FreeRDPGDI.cs
index 89e8403..515ec84 100644
--- a/GdiTest/FreeRDPGDI.cs
+++ b/GdiTest/FreeRDPGDI.cs
@@ -97,6 +97,11 @@ namespace GdiTest
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;
diff --git a/GdiTest/GDI.cs b/GdiTest/GDI.cs
index fe3136c..839615a 100644
--- a/GdiTest/GDI.cs
+++ b/GdiTest/GDI.cs
@@ -5,6 +5,29 @@ namespace GdiTest
{
public abstract class GDI
{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct POINT
+ {
+ public int X;
+ public int Y;
+
+ public POINT(int x, int y)
+ {
+ this.X = x;
+ this.Y = y;
+ }
+
+ public static implicit operator System.Drawing.Point(POINT p)
+ {
+ return new System.Drawing.Point(p.X, p.Y);
+ }
+
+ public static implicit operator POINT(System.Drawing.Point p)
+ {
+ return new POINT(p.X, p.Y);
+ }
+ }
+
public static System.Int32 SRCCOPY = 0x00CC0020; /* D = S */
public static System.Int32 SRCPAINT = 0x00EE0086; /* D = S | D */
public static System.Int32 SRCAND = 0x008800C6; /* D = S & D */
@@ -37,6 +60,7 @@ namespace GdiTest
public abstract int SetPixel(IntPtr hdc, int X, int Y, int crColor);
public abstract bool MoveToEx(IntPtr hdc, int X, int Y, IntPtr lpPoint);
public abstract bool LineTo(IntPtr hdc, int nXEnd, int nYEnd);
+ public abstract bool PolylineTo(IntPtr hdc, POINT [] lppt, uint cCount);
public abstract IntPtr CreatePen(int fnPenStyle, int nWidth, int crColor);
public abstract IntPtr CreateSolidBrush(int crColor);
public abstract bool Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
diff --git a/GdiTest/GdiTest.csproj b/GdiTest/GdiTest.csproj
index 669c01c..6c0a462 100644
--- a/GdiTest/GdiTest.csproj
+++ b/GdiTest/GdiTest.csproj
@@ -62,6 +62,8 @@
<Compile Include="LineToDrawingArea.cs" />
<Compile Include="TestDrawingArea.cs" />
<Compile Include="EllipseDrawingArea.cs" />
+ <Compile Include="PolylineToDrawingArea.cs" />
+ <Compile Include="PolygonDrawingArea.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/GdiTest/MainWindow.cs b/GdiTest/MainWindow.cs
index 891b9d2..4ffa0da 100644
--- a/GdiTest/MainWindow.cs
+++ b/GdiTest/MainWindow.cs
@@ -7,18 +7,22 @@ using GdiTest;
public partial class MainWindow : Gtk.Window
{
TestDrawingArea testDrawingArea;
- TestDrawingArea lineToDrawingArea;
TestDrawingArea bitBltDrawingArea;
TestDrawingArea ellipseDrawingArea;
+ TestDrawingArea polygonDrawingArea;
+ TestDrawingArea lineToDrawingArea;
+ TestDrawingArea polylineToDrawingArea;
public MainWindow () : base(Gtk.WindowType.Toplevel)
{
- Build ();
- lineToDrawingArea = new LineToDrawingArea();
+ Build();
bitBltDrawingArea = new BitBltDrawingArea();
ellipseDrawingArea = new EllipseDrawingArea();
+ polygonDrawingArea = new PolygonDrawingArea();
+ lineToDrawingArea = new LineToDrawingArea();
+ polylineToDrawingArea = new PolylineToDrawingArea();
- testDrawingArea = lineToDrawingArea;
+ testDrawingArea = bitBltDrawingArea;
testFrame.Add(testDrawingArea);
testFrame.ShowAll();
}
@@ -40,21 +44,19 @@ public partial class MainWindow : Gtk.Window
String testSuiteName = testComboBox.ActiveText;
- if (testSuiteName.Equals("LineTo"))
- {
- testDrawingArea = lineToDrawingArea;
- testFrame.Add(testDrawingArea);
- testFrame.ShowAll();
- }
- else if (testSuiteName.Equals("BitBlt"))
- {
+ if (testSuiteName.Equals("BitBlt"))
testDrawingArea = bitBltDrawingArea;
- testFrame.Add(testDrawingArea);
- testFrame.ShowAll();
- }
else if (testSuiteName.Equals("Ellipse"))
- {
testDrawingArea = ellipseDrawingArea;
+ else if (testSuiteName.Equals("Polygon"))
+ testDrawingArea = polygonDrawingArea;
+ else if (testSuiteName.Equals("LineTo"))
+ testDrawingArea = lineToDrawingArea;
+ else if (testSuiteName.Equals("PolylineTo"))
+ testDrawingArea = polylineToDrawingArea;
+
+ if (testDrawingArea != null)
+ {
testFrame.Add(testDrawingArea);
testFrame.ShowAll();
}
diff --git a/GdiTest/PolygonDrawingArea.cs b/GdiTest/PolygonDrawingArea.cs
new file mode 100644
index 0000000..047fa1f
--- /dev/null
+++ b/GdiTest/PolygonDrawingArea.cs
@@ -0,0 +1,19 @@
+using System;
+namespace GdiTest
+{
+ public class PolygonDrawingArea : TestDrawingArea
+ {
+ private String dumpText;
+
+ public PolygonDrawingArea ()
+ {
+ dumpText = "";
+ }
+
+ public override String getDumpText()
+ {
+ return dumpText;
+ }
+ }
+}
+
diff --git a/GdiTest/PolylineToDrawingArea.cs b/GdiTest/PolylineToDrawingArea.cs
new file mode 100644
index 0000000..d418271
--- /dev/null
+++ b/GdiTest/PolylineToDrawingArea.cs
@@ -0,0 +1,19 @@
+using System;
+namespace GdiTest
+{
+ public class PolylineToDrawingArea : TestDrawingArea
+ {
+ private String dumpText;
+
+ public PolylineToDrawingArea ()
+ {
+ dumpText = "";
+ }
+
+ public override String getDumpText()
+ {
+ return dumpText;
+ }
+ }
+}
+
diff --git a/GdiTest/Win32GDI.cs b/GdiTest/Win32GDI.cs
index a6f8fd7..0532b48 100644
--- a/GdiTest/Win32GDI.cs
+++ b/GdiTest/Win32GDI.cs
@@ -23,19 +23,22 @@ namespace GdiTest
[DllImport("gdi32")]
public static extern bool DeleteObject(IntPtr hObject);
- [DllImport("gdi32.dll")]
+ [DllImport("gdi32")]
public static extern int GetPixel(IntPtr hdc, int X, int Y);
- [DllImport("gdi32.dll")]
+ [DllImport("gdi32")]
public static extern int SetPixel(IntPtr hdc, int X, int Y, int crColor);
[DllImport("gdi32")]
public static extern bool MoveToEx(IntPtr hdc, int X, int Y, IntPtr lpPoint);
- [DllImport("gdi32.dll")]
+ [DllImport("gdi32")]
public static extern bool LineTo(IntPtr hdc, int nXEnd, int nYEnd);
[DllImport("gdi32")]
+ public static extern bool PolylineTo(IntPtr hdc, POINT [] lppt, uint cCount);
+
+ [DllImport("gdi32")]
public static extern IntPtr CreatePen(int fnPenStyle, int nWidth, int crColor);
[DllImport("gdi32")]
@@ -44,7 +47,10 @@ namespace GdiTest
[DllImport("gdi32")]
public static extern bool Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
- [DllImport("gdi32.dll")]
+ [DllImport("gdi32")]
+ public static extern bool Polygon(IntPtr hdc, POINT [] lpPoints, int nCount);
+
+ [DllImport("gdi32")]
public static extern int BitBlt(
IntPtr hdcDest,
int nXDest,
@@ -163,6 +169,14 @@ namespace GdiTest
return false;
}
+ public override bool PolylineTo(IntPtr hdc, POINT [] lppt, uint cCount)
+ {
+ if (available)
+ return Callbacks.PolylineTo(hdc, lppt, cCount);
+ else
+ return false;
+ }
+
public override IntPtr CreatePen(int fnPenStyle, int nWidth, int crColor)
{
if (available)
diff --git a/GdiTest/gtk-gui/MainWindow.cs b/GdiTest/gtk-gui/MainWindow.cs
index 312714e..9e66c0e 100644
--- a/GdiTest/gtk-gui/MainWindow.cs
+++ b/GdiTest/gtk-gui/MainWindow.cs
@@ -5,8 +5,6 @@ public partial class MainWindow
{
private global::Gtk.Fixed mainFixedContainer;
- private global::Gtk.Label testLabel;
-
private global::Gtk.ScrolledWindow GtkScrolledWindow;
private global::Gtk.TextView dumpTextView;
@@ -15,6 +13,8 @@ public partial class MainWindow
private global::Gtk.Label drawingAreaLabel;
+ private global::Gtk.Label testLabel;
+
private global::Gtk.ComboBox testComboBox;
private global::Gtk.Button dumpButton;
@@ -31,14 +31,6 @@ public partial class MainWindow
this.mainFixedContainer.Name = "mainFixedContainer";
this.mainFixedContainer.HasWindow = false;
// Container child mainFixedContainer.Gtk.Fixed+FixedChild
- this.testLabel = new global::Gtk.Label ();
- this.testLabel.Name = "testLabel";
- this.testLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Test Suite");
- this.mainFixedContainer.Add (this.testLabel);
- global::Gtk.Fixed.FixedChild w1 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.testLabel]));
- w1.X = 11;
- w1.Y = 31;
- // Container child mainFixedContainer.Gtk.Fixed+FixedChild
this.GtkScrolledWindow = new global::Gtk.ScrolledWindow ();
this.GtkScrolledWindow.Name = "GtkScrolledWindow";
this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
@@ -51,9 +43,9 @@ public partial class MainWindow
this.dumpTextView.Editable = false;
this.GtkScrolledWindow.Add (this.dumpTextView);
this.mainFixedContainer.Add (this.GtkScrolledWindow);
- global::Gtk.Fixed.FixedChild w3 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.GtkScrolledWindow]));
- w3.X = 14;
- w3.Y = 286;
+ global::Gtk.Fixed.FixedChild w2 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.GtkScrolledWindow]));
+ w2.X = 14;
+ w2.Y = 286;
// Container child mainFixedContainer.Gtk.Fixed+FixedChild
this.testFrame = new global::Gtk.Frame ();
this.testFrame.WidthRequest = 600;
@@ -66,20 +58,30 @@ public partial class MainWindow
this.drawingAreaLabel.UseMarkup = true;
this.testFrame.LabelWidget = this.drawingAreaLabel;
this.mainFixedContainer.Add (this.testFrame);
- global::Gtk.Fixed.FixedChild w4 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.testFrame]));
- w4.X = 21;
- w4.Y = 76;
+ global::Gtk.Fixed.FixedChild w3 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.testFrame]));
+ w3.X = 21;
+ w3.Y = 76;
+ // Container child mainFixedContainer.Gtk.Fixed+FixedChild
+ this.testLabel = new global::Gtk.Label ();
+ this.testLabel.Name = "testLabel";
+ this.testLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Test Suite");
+ this.mainFixedContainer.Add (this.testLabel);
+ global::Gtk.Fixed.FixedChild w4 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.testLabel]));
+ w4.X = 24;
+ w4.Y = 30;
// Container child mainFixedContainer.Gtk.Fixed+FixedChild
this.testComboBox = global::Gtk.ComboBox.NewText ();
- this.testComboBox.AppendText (global::Mono.Unix.Catalog.GetString ("LineTo"));
this.testComboBox.AppendText (global::Mono.Unix.Catalog.GetString ("BitBlt"));
+ this.testComboBox.AppendText (global::Mono.Unix.Catalog.GetString ("LineTo"));
+ this.testComboBox.AppendText (global::Mono.Unix.Catalog.GetString ("PolylineTo"));
this.testComboBox.AppendText (global::Mono.Unix.Catalog.GetString ("Ellipse"));
+ this.testComboBox.AppendText (global::Mono.Unix.Catalog.GetString ("Polygon"));
this.testComboBox.Name = "testComboBox";
this.testComboBox.Active = 0;
this.mainFixedContainer.Add (this.testComboBox);
global::Gtk.Fixed.FixedChild w5 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.testComboBox]));
- w5.X = 74;
- w5.Y = 27;
+ w5.X = 79;
+ w5.Y = 26;
// Container child mainFixedContainer.Gtk.Fixed+FixedChild
this.dumpButton = new global::Gtk.Button ();
this.dumpButton.CanFocus = true;
@@ -88,8 +90,8 @@ public partial class MainWindow
this.dumpButton.Label = global::Mono.Unix.Catalog.GetString ("Dump");
this.mainFixedContainer.Add (this.dumpButton);
global::Gtk.Fixed.FixedChild w6 = ((global::Gtk.Fixed.FixedChild)(this.mainFixedContainer[this.dumpButton]));
- w6.X = 156;
- w6.Y = 26;
+ w6.X = 174;
+ w6.Y = 23;
this.Add (this.mainFixedContainer);
if ((this.Child != null)) {
this.Child.ShowAll ();
diff --git a/GdiTest/gtk-gui/gui.stetic b/GdiTest/gtk-gui/gui.stetic
index fcfc064..25d1a85 100644
--- a/GdiTest/gtk-gui/gui.stetic
+++ b/GdiTest/gtk-gui/gui.stetic
@@ -18,16 +18,6 @@
<property name="MemberName" />
<property name="HasWindow">False</property>
<child>
- <widget class="Gtk.Label" id="testLabel">
- <property name="MemberName" />
- <property name="LabelProp" translatable="yes">Test Suite</property>
- </widget>
- <packing>
- <property name="X">11</property>
- <property name="Y">31</property>
- </packing>
- </child>
- <child>
<placeholder />
</child>
<child>
@@ -89,18 +79,30 @@
</packing>
</child>
<child>
+ <widget class="Gtk.Label" id="testLabel">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Test Suite</property>
+ </widget>
+ <packing>
+ <property name="X">24</property>
+ <property name="Y">30</property>
+ </packing>
+ </child>
+ <child>
<widget class="Gtk.ComboBox" id="testComboBox">
<property name="MemberName" />
<property name="IsTextCombo">True</property>
- <property name="Items" translatable="yes">LineTo
-BitBlt
-Ellipse</property>
+ <property name="Items" translatable="yes">BitBlt
+LineTo
+PolylineTo
+Ellipse
+Polygon</property>
<property name="Active">0</property>
<signal name="Changed" handler="OnTestComboBoxChanged" />
</widget>
<packing>
- <property name="X">74</property>
- <property name="Y">27</property>
+ <property name="X">79</property>
+ <property name="Y">26</property>
</packing>
</child>
<child>
@@ -113,8 +115,8 @@ Ellipse</property>
<signal name="Clicked" handler="OnDumpButtonClicked" />
</widget>
<packing>
- <property name="X">156</property>
- <property name="Y">26</property>
+ <property name="X">174</property>
+ <property name="Y">23</property>
</packing>
</child>
</widget>