comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 75:bf01d1eec5c6 tn5250

convert 5250 to vt320 attributes
author Carl Byington <carl@five-ten-sg.com>
date Sun, 15 Jun 2014 10:56:09 -0700
parents c56032728742
children 00464d9c2f54
comparison
equal deleted inserted replaced
74:1aff8d06d5ef 75:bf01d1eec5c6
34 import java.util.Vector; 34 import java.util.Vector;
35 35
36 import org.tn5250j.TN5250jConstants; 36 import org.tn5250j.TN5250jConstants;
37 import android.util.Log; 37 import android.util.Log;
38 import de.mud.terminal.vt320; 38 import de.mud.terminal.vt320;
39 import de.mud.terminal.VDUBuffer;
39 40
40 41
41 public class Screen5250 { 42 public class Screen5250 {
42 private static final String TAG = "Screen5250"; 43 private static final String TAG = "Screen5250";
43 private ScreenFields screenFields; 44 private ScreenFields screenFields;
3819 /** 3820 /**
3820 * repaint part of the screen 3821 * repaint part of the screen
3821 * 3822 *
3822 */ 3823 */
3823 private void fireScreenChanged(int startRow, int startCol, int endRow, int endCol) { 3824 private void fireScreenChanged(int startRow, int startCol, int endRow, int endCol) {
3825 int [] vt320color = {0x0, // black
3826 0x4, // blue
3827 0x2, // green
3828 0x6, // cyan
3829 0x1, // red
3830 0x5, // magenta/purple
3831 0xb, // yellow
3832 0x7, // light gray/white
3833 0x8, // dark gray
3834 0xc, // light blue
3835 0xa, // light green
3836 0xe, // light cyan
3837 0x9, // light red
3838 0xd, // light magenta/purple
3839 0x3, // brown
3840 0xf, // bright white
3824 for (int r = startRow; r <= endRow; r++) { 3841 for (int r = startRow; r <= endRow; r++) {
3825 for (int c = startCol; c <= endCol; c++) { 3842 for (int c = startCol; c <= endCol; c++) {
3826 char ch = planes.getChar(getPos(r,c)); 3843 int p = getPos(r,c);
3844 char ch = planes.getChar(p);
3845 char co = planes.getCharColor(p);
3846 char at = planes.getCharExtended(p);
3827 if (ch < ' ') ch = ' '; 3847 if (ch < ' ') ch = ' ';
3828 buffer.putChar(c, r, ch, 0); 3848 int bg = vt320color[(int)((co >> 8) && 0x0f)];
3849 int fg = vt320color[(int)(co && 0x0f)];
3850 int ul = (int)(at && EXTENDED_5250_UNDERLINE);
3851 int nd = (int)(at && EXTENDED_5250_NON_DSP);
3852 int vt_attr = (fg << COLOR_FG_SHIFT) + (bg << COLOR_BG_SHIFT)
3853 if (ul > 0) vt_attr |= UNDERLINE;
3854 if (nd > 0) vt_attr |= INVISIBLE;
3855 buffer.putChar(c, r, ch, vt_attr);
3829 } 3856 }
3830 } 3857 }
3831 buffer.redrawPassthru(); 3858 buffer.redrawPassthru();
3832 dirtyScreen.setBounds(lenScreen,0,0,0); 3859 dirtyScreen.setBounds(lenScreen,0,0,0);
3833 } 3860 }