asd
Alejandro Acuña
2024-09-16 816cb391a192e357426312ab8e591fd49d1d242e
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
75
76
77
78
79
80
81
82
83
package art.servers.asfserver.types;
 
import art.servers.asfserver.protocols.dgt.AsfDgtConstants;
import java.awt.Color;
 
 
public class VmsLine
{
    public int subpanel = 0;
    public int line = 0;
    public int foreground = AsfDgtConstants.ASF_BLACK;
    public int background = AsfDgtConstants.ASF_BLACK;
    public boolean blinking = false;
    public String text = "";
 
 
    public void setAttribute (int attribute)
    {
        if ((attribute & 0x40) != 0) blinking = true;
 
        if (((attribute & 0x20) != 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_WHITE;
        if (((attribute & 0x20) == 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_YELLOW;
        
        if (((attribute & 0x20) != 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_MAGENTA;
        if (((attribute & 0x20) == 0) && ((attribute & 0x10) != 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_RED;
        
        if (((attribute & 0x20) != 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_CYAN;
        if (((attribute & 0x20) == 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) != 0)) foreground = AsfDgtConstants.ASF_GREEN;
        
        if (((attribute & 0x20) != 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_BLUE;
        if (((attribute & 0x20) == 0) && ((attribute & 0x10) == 0) && ((attribute & 0x08) == 0)) foreground = AsfDgtConstants.ASF_BLACK;
 
 
        if (((attribute & 0x04) != 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_WHITE;
        if (((attribute & 0x04) == 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_YELLOW;
        
        if (((attribute & 0x04) != 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_MAGENTA;
        if (((attribute & 0x04) == 0) && ((attribute & 0x02) != 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_RED;
        
        if (((attribute & 0x04) != 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_CYAN;
        if (((attribute & 0x04) == 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) != 0)) background = AsfDgtConstants.ASF_GREEN;
        
        if (((attribute & 0x04) != 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_BLUE;
        if (((attribute & 0x04) == 0) && ((attribute & 0x02) == 0) && ((attribute & 0x01) == 0)) background = AsfDgtConstants.ASF_BLACK;
    }
 
 
    public int getForeground ()
    {
        switch (foreground)
        {
            case AsfDgtConstants.ASF_BLACK:  return(Color.BLACK.getRGB());
            case AsfDgtConstants.ASF_WHITE:  return(Color.WHITE.getRGB());
            case AsfDgtConstants.ASF_RED:  return(Color.RED.getRGB());
            case AsfDgtConstants.ASF_GREEN:  return(Color.GREEN.getRGB());
            case AsfDgtConstants.ASF_BLUE:  return(Color.BLUE.getRGB());
            case AsfDgtConstants.ASF_YELLOW:  return(Color.YELLOW.getRGB());
            case AsfDgtConstants.ASF_CYAN:  return(Color.CYAN.getRGB());
            case AsfDgtConstants.ASF_MAGENTA:  return(Color.MAGENTA.getRGB());
        }
 
        return(Color.YELLOW.getRGB());
    }
 
 
    public int getBackground ()
    {
        switch (background)
        {
            case AsfDgtConstants.ASF_BLACK:  return(Color.black.getRGB());
            case AsfDgtConstants.ASF_WHITE:  return(Color.white.getRGB());
            case AsfDgtConstants.ASF_RED:  return(Color.red.getRGB());
            case AsfDgtConstants.ASF_GREEN:  return(Color.green.getRGB());
            case AsfDgtConstants.ASF_BLUE:  return(Color.blue.getRGB());
            case AsfDgtConstants.ASF_YELLOW:  return(Color.yellow.getRGB());
            case AsfDgtConstants.ASF_CYAN:  return(Color.cyan.getRGB());
            case AsfDgtConstants.ASF_MAGENTA:  return(Color.magenta.getRGB());
        }
 
        return(Color.black.getRGB());
    }
 
}