add src files decompiled via jad
[rsa2client.git] / src / mcsClient / ColorPalette.java
1 // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
2 // Jad home page: http://www.kpdus.com/jad.html
3 // Decompiler options: packimports(3) fieldsfirst nonlb space 
4
5 package mcsClient;
6
7 import java.io.*;
8
9 public class ColorPalette {
10
11     private int javaColors[];
12     int hardwareColors[];
13     private int microsoftColors[];
14     private final int colorMap[] = {
15         0, 70, 127, 191, 255
16     };
17     private final byte hardwareMap[] = {
18         0, 25, 50, 75, 5, 30, 55, 80, 10, 35, 
19         60, 85, 15, 40, 65, 90, 1, 26, 51, 76, 
20         6, 31, 56, 81, 11, 36, 61, 86, 16, 41, 
21         66, 91, 2, 27, 52, 77, 7, 32, 57, 82, 
22         12, 37, 62, 87, 17, 42, 67, 92, 3, 28, 
23         53, 78, 8, 33, 58, 83, 13, 38, 63, 88, 
24         18, 43, 68, 93, 100, 101, 102, 103, 105, 106, 
25         107, 108, 110, 111, 112, 113, 115, 116, 117, 118, 
26         20, 45, 70, 95, 21, 46, 71, 96, 22, 47, 
27         72, 97, 23, 48, 73, 98, 4, 29, 54, 79, 
28         9, 34, 59, 84, 14, 39, 64, 89, 19, 44, 
29         69, 94, 120, 121, 122, 123, 104, 109, 114, 119, 
30         24, 49, 74, 99, 124, 125, 126, 127
31     };
32
33     public ColorPalette() {
34         javaColors = new int[128];
35         hardwareColors = new int[128];
36         microsoftColors = new int[256];
37         for (int i = 0; i < 125; i += 25) {
38             for (int k = 0; k < 25; k += 5) {
39                 for (int i1 = 0; i1 < 5; i1++)
40                     microsoftColors[i + k + i1] = colorMap[i / 25] << 24 | colorMap[k / 5] << 16 | colorMap[i1] << 8;
41
42             }
43
44         }
45
46         microsoftColors[125] = 0x5f5f5f5f;
47         microsoftColors[126] = 0x9f9f9f9f;
48         microsoftColors[127] = 0xdfdfdfdf;
49         for (int j = 0; j < 125; j += 25) {
50             for (int l = 0; l < 25; l += 5) {
51                 for (int j1 = 0; j1 < 5; j1++)
52                     javaColors[j + l + j1] = 0xff000000 | colorMap[j / 25] << 0 | colorMap[l / 5] << 8 | colorMap[j1] << 16;
53
54             }
55
56         }
57
58         javaColors[125] = 0xff5f5f5f;
59         javaColors[126] = 0xff9f9f9f;
60         javaColors[127] = 0xffdfdfdf;
61         for (int k1 = 0; k1 < 128; k1++)
62             hardwareColors[k1] = javaColors[hardwareMap[k1]];
63
64     }
65
66     public static void main(String args[]) throws IOException {
67         ColorPalette colorpalette = new ColorPalette();
68         colorpalette.printColorPalette();
69         System.exit(0);
70     }
71
72     public void writeColorPalette(DataOutputStream dataoutputstream) throws IOException {
73         for (int i = 0; i < microsoftColors.length; i++)
74             dataoutputstream.writeInt(microsoftColors[i]);
75
76     }
77
78     private void printColorPalette() throws IOException {
79         System.out.println();
80         System.out.println("Graphical Console Server Custom 128 Color Palette");
81         System.out.println("-------------------------------------------------");
82         System.out.println();
83         System.out.println("\tIndex\tRed\t\tGreen\tBlue");
84         System.out.println("\t-----\t---\t\t-----\t----");
85         for (int i = 0; i < hardwareColors.length; i++)
86             System.out.println("\t" + i + "\t\t" + ((hardwareColors[i] & 0xff0000) >> 16) + "\t\t" + ((hardwareColors[i] & 0xff00) >> 8) + "\t\t" + (hardwareColors[i] & 0xff));
87
88     }
89 }