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

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

namespace GdiTest
{
	public struct Area
	{
		public int X;
		public int Y;
		public int W;
		public int H;
	}
	
	public struct Rect
	{
		public int x1;
		public int y1;
		public int x2;
		public int y2;
	}
	
	public abstract class TestDrawingArea : DrawingArea
	{	
		public TestDrawingArea ()
		{
		}
		
		abstract public String getDumpText();
		
		public String dumpPixelArea(GDI gdi, IntPtr hdc, int X, int Y, int W, int H)
		{
			String text = "";
			
			if (gdi.isAvailable())
			{
				text += "{\n";
				for (int y = Y; y < Y + H; y++)
				{
					text += "\t\"";
					for (int x = X; x < X + W; x++)
					{
						int p = gdi.GetPixel(hdc, x, y);
						
						if (p == 0)
							text += "\\x00";
						else
							text += "\\xFF";
					}
					text += "\"\n";
				}
				text += "};\n";
			}
				
			return text;
		}
	}
}