markus / ConvertService / ConverterService / ImageFields / DZTCommon.cs @ 07b7bd24
이력 | 보기 | 이력해설 | 다운로드 (1.65 KB)
1 | 7ca218b3 | KangIngu | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Xml.Linq; |
||
6 | |||
7 | namespace ImageFields |
||
8 | { |
||
9 | internal class DZTCommon |
||
10 | { |
||
11 | // Fields |
||
12 | private static XNamespace deepZoomNamespace2008 = "http://schemas.microsoft.com/deepzoom/2008"; |
||
13 | private static XNamespace deepZoomNamespace2009 = "http://schemas.microsoft.com/deepzoom/2009"; |
||
14 | public const string TileFolder = "_files"; |
||
15 | |||
16 | // Methods |
||
17 | internal static void MortonToXY(uint morton, out uint x, out uint y) |
||
18 | { |
||
19 | x = y = 0; |
||
20 | for (int i = 0; i < 0x10L; i++) |
||
21 | { |
||
22 | x = (uint)(x | ((morton & 1) << (i & 0x1f))); |
||
23 | y = (uint)(y | (((morton & 2) >> 1) << (i & 0x1f))); |
||
24 | morton = morton >> 2; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | public static bool VerifyDZNamespace(XNamespace nspace) |
||
29 | { |
||
30 | bool flag = false; |
||
31 | if ((nspace == deepZoomNamespace2009) || (nspace == deepZoomNamespace2008)) |
||
32 | { |
||
33 | flag = true; |
||
34 | } |
||
35 | return flag; |
||
36 | } |
||
37 | |||
38 | internal static uint XYToMorton(uint x, uint y) |
||
39 | { |
||
40 | uint num = 0; |
||
41 | for (int i = 0; i < 0x10L; i++) |
||
42 | { |
||
43 | num |= (uint)((x & 1) << ((i * 2) & 0x1f)); |
||
44 | num |= (uint)((y & 1) << (((i * 2) + 1) & 0x1f)); |
||
45 | x = x >> 1; |
||
46 | y = y >> 1; |
||
47 | } |
||
48 | return num; |
||
49 | } |
||
50 | |||
51 | // Properties |
||
52 | public static XNamespace DeepZoomNamespace |
||
53 | { |
||
54 | get |
||
55 | { |
||
56 | return deepZoomNamespace2009; |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | |||
61 | |||
62 | } |