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

BitBltDrawingArea.cs « GdiTest - github.com/FreeRDP/GdiTest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 269f2f14de7bbb4af4ff1e2f7e121be051b6b5a4 (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
using Gtk;
using Cairo;
using System;
using System.Drawing;

namespace GdiTest
{
	public class BitBltDrawingArea : TestDrawingArea
	{		
		public BitBltDrawingArea ()
		{
		}
		
		protected override bool OnExposeEvent (Gdk.EventExpose args)
		{
			using (Context cg = Gdk.CairoHelper.Create (args.Window))
			{	
				Win32GDI GDI_Win32 = Win32GDI.getInstance();
				
				if (GDI_Win32.isAvailable())
				{
					System.Drawing.Graphics wg = Gtk.DotNet.Graphics.FromDrawable(this.GdkWindow, true);
					IntPtr hdc = wg.GetHdc();
				
					TestData data = new TestData();
					
					for (int i = 0; i < data.bmp_SRC.GetLength(0) / 2; i++)
					{
						for (int j = 0; j < data.bmp_SRC.GetLength(1); j++)
						{
							uint p = 0;
							
							if (data.bmp_SRC[i, j] == 0)
								p = 0;
							else
								p = 0xFFFFFFFF;
							
							GDI_Win32.SetPixel(hdc, i, j, p);
						}
					}
					
					//GDI_Win32.BitBlt(dc, 70, 0, 60, 60, dc, 0, 0, GDI.SRCCOPY);
				}
			}
			return true;
		}
		
		public override String dump()
		{
			String text = "";
			
			Win32GDI GDI_Win32 = Win32GDI.getInstance();
				
			if (GDI_Win32.isAvailable())
			{					
				System.Drawing.Graphics wg = Gtk.DotNet.Graphics.FromDrawable(this.GdkWindow, true);
				IntPtr hdc = wg.GetHdc();
				
				for (int y = 0; y < 16; y++)
				{
					for (int x = 0; x < 16; x++)
					{
						System.Drawing.Color color = GDI_Win32.GetPixelColor(x, y);
						text += String.Format("0x{0:X}, ", color.ToArgb());
					}
					text += "\n";
				}
			}
				
			return text;
		}
	}
}