package medicomed.keymon.com.mx; import anywheresoftware.b4a.BA; import anywheresoftware.b4a.B4AClass; import anywheresoftware.b4a.BALayout; import anywheresoftware.b4a.debug.*; public class escposprinter extends B4AClass.ImplB4AClass implements BA.SubDelegator{ private static java.util.HashMap htSubs; private void innerInitialize(BA _ba) throws Exception { if (ba == null) { ba = new BA(_ba, this, htSubs, "medicomed.keymon.com.mx.escposprinter"); if (htSubs == null) { ba.loadHtSubs(this.getClass()); htSubs = ba.htSubs; } } if (BA.isShellModeRuntimeCheck(ba)) this.getClass().getMethod("_class_globals", medicomed.keymon.com.mx.escposprinter.class).invoke(this, new Object[] {null}); else ba.raiseEvent2(null, true, "class_globals", false); } public anywheresoftware.b4a.keywords.Common __c = null; public double _version = 0; public String _eventname = ""; public Object _callback = null; public anywheresoftware.b4a.objects.Serial _serial1 = null; public anywheresoftware.b4a.randomaccessfile.AsyncStreams _astream = null; public boolean _connected = false; public String _connectederror = ""; public String _esc = ""; public String _fs = ""; public String _gs = ""; public String _unreverse = ""; public String _reverse = ""; public String _uninvert = ""; public String _invert = ""; public String _unrotate = ""; public String _rotate = ""; public String _ht = ""; public String _uline0 = ""; public String _uline1 = ""; public String _uline2 = ""; public String _bold = ""; public String _nobold = ""; public String _single = ""; public String _high = ""; public String _wide = ""; public String _highwide = ""; public String _leftjustify = ""; public String _linedefault = ""; public String _linset0 = ""; public String _lmargin0 = ""; public String _width0 = ""; public String _charspacing0 = ""; public String _charfont0 = ""; public String _defaults = ""; public b4a.example.dateutils _dateutils = null; public medicomed.keymon.com.mx.main _main = null; public medicomed.keymon.com.mx.starter _starter = null; public medicomed.keymon.com.mx.appupdater _appupdater = null; public medicomed.keymon.com.mx.mapa_rutas _mapa_rutas = null; public medicomed.keymon.com.mx.mapa_cliente _mapa_cliente = null; public medicomed.keymon.com.mx.subs _subs = null; public medicomed.keymon.com.mx.notificationservice _notificationservice = null; public medicomed.keymon.com.mx.pendientes _pendientes = null; public medicomed.keymon.com.mx.tracker _tracker = null; public medicomed.keymon.com.mx.newinst2 _newinst2 = null; public medicomed.keymon.com.mx.b4xpages _b4xpages = null; public medicomed.keymon.com.mx.b4xcollections _b4xcollections = null; public medicomed.keymon.com.mx.httputils2service _httputils2service = null; public medicomed.keymon.com.mx.xuiviewsutils _xuiviewsutils = null; public static class _animage{ public boolean IsInitialized; public int Width; public int Height; public byte[] Data; public void Initialize() { IsInitialized = true; Width = 0; Height = 0; Data = new byte[0]; ; } @Override public String toString() { return BA.TypeToString(this, false); }} public String _astream_error() throws Exception{ //BA.debugLineNum = 1162;BA.debugLine="Private Sub AStream_Error"; //BA.debugLineNum = 1163;BA.debugLine="If SubExists(CallBack, EventName & \"_Error\") Then"; if (__c.SubExists(ba,_callback,_eventname+"_Error")) { //BA.debugLineNum = 1164;BA.debugLine="CallSub(CallBack, EventName & \"_Error\")"; __c.CallSubNew(ba,_callback,_eventname+"_Error"); }; //BA.debugLineNum = 1166;BA.debugLine="End Sub"; return ""; } public String _astream_newdata(byte[] _buffer) throws Exception{ //BA.debugLineNum = 1155;BA.debugLine="Private Sub AStream_NewData (Buffer() As Byte)"; //BA.debugLineNum = 1156;BA.debugLine="If SubExists(CallBack, EventName & \"_NewData\") Th"; if (__c.SubExists(ba,_callback,_eventname+"_NewData")) { //BA.debugLineNum = 1157;BA.debugLine="CallSub2(CallBack, EventName & \"_NewData\", Buffe"; __c.CallSubNew2(ba,_callback,_eventname+"_NewData",(Object)(_buffer)); }; //BA.debugLineNum = 1159;BA.debugLine="Log(\"Data \" & Buffer(0))"; __c.LogImpl("774579972","Data "+BA.NumberToString(_buffer[(int) (0)]),0); //BA.debugLineNum = 1160;BA.debugLine="End Sub"; return ""; } public String _astream_terminated() throws Exception{ //BA.debugLineNum = 1168;BA.debugLine="Private Sub AStream_Terminated"; //BA.debugLineNum = 1169;BA.debugLine="Connected = False"; _connected = __c.False; //BA.debugLineNum = 1170;BA.debugLine="If SubExists(CallBack, EventName & \"_Terminated\")"; if (__c.SubExists(ba,_callback,_eventname+"_Terminated")) { //BA.debugLineNum = 1171;BA.debugLine="CallSub(CallBack, EventName & \"_Terminated\")"; __c.CallSubNew(ba,_callback,_eventname+"_Terminated"); }; //BA.debugLineNum = 1173;BA.debugLine="End Sub"; return ""; } public String _class_globals() throws Exception{ //BA.debugLineNum = 4;BA.debugLine="Sub Class_Globals"; //BA.debugLineNum = 11;BA.debugLine="Private Version As Double = 2.0 ' Printer class v"; _version = 2.0; //BA.debugLineNum = 13;BA.debugLine="Type AnImage(Width As Int, Height As Int, Data()"; ; //BA.debugLineNum = 15;BA.debugLine="Private EventName As String 'ignore"; _eventname = ""; //BA.debugLineNum = 16;BA.debugLine="Private CallBack As Object 'ignore"; _callback = new Object(); //BA.debugLineNum = 18;BA.debugLine="Private Serial1 As Serial"; _serial1 = new anywheresoftware.b4a.objects.Serial(); //BA.debugLineNum = 19;BA.debugLine="Private Astream As AsyncStreams"; _astream = new anywheresoftware.b4a.randomaccessfile.AsyncStreams(); //BA.debugLineNum = 20;BA.debugLine="Private Connected As Boolean"; _connected = false; //BA.debugLineNum = 21;BA.debugLine="Private ConnectedError As String"; _connectederror = ""; //BA.debugLineNum = 23;BA.debugLine="Dim ESC As String = Chr(27)"; _esc = BA.ObjectToString(__c.Chr((int) (27))); //BA.debugLineNum = 24;BA.debugLine="Dim FS As String = Chr(28)"; _fs = BA.ObjectToString(__c.Chr((int) (28))); //BA.debugLineNum = 25;BA.debugLine="Dim GS As String = Chr(29)"; _gs = BA.ObjectToString(__c.Chr((int) (29))); //BA.debugLineNum = 28;BA.debugLine="Dim UNREVERSE As String = GS & \"B\" & Chr(0)"; _unreverse = _gs+"B"+BA.ObjectToString(__c.Chr((int) (0))); //BA.debugLineNum = 29;BA.debugLine="Dim REVERSE As String = GS & \"B\" & Chr(1)"; _reverse = _gs+"B"+BA.ObjectToString(__c.Chr((int) (1))); //BA.debugLineNum = 32;BA.debugLine="Dim UNINVERT As String = ESC & \"{0\""; _uninvert = _esc+"{0"; //BA.debugLineNum = 33;BA.debugLine="Dim INVERT As String = ESC & \"{1\""; _invert = _esc+"{1"; //BA.debugLineNum = 36;BA.debugLine="Dim UNROTATE As String = ESC & \"V0\""; _unrotate = _esc+"V0"; //BA.debugLineNum = 37;BA.debugLine="Dim ROTATE As String = ESC & \"V1\""; _rotate = _esc+"V1"; //BA.debugLineNum = 40;BA.debugLine="Dim HT As String = Chr(9)"; _ht = BA.ObjectToString(__c.Chr((int) (9))); //BA.debugLineNum = 43;BA.debugLine="Dim ULINE0 As String = ESC & \"-0\""; _uline0 = _esc+"-0"; //BA.debugLineNum = 44;BA.debugLine="Dim ULINE1 As String = ESC & \"-1\""; _uline1 = _esc+"-1"; //BA.debugLineNum = 45;BA.debugLine="Dim ULINE2 As String = ESC & \"-2\""; _uline2 = _esc+"-2"; //BA.debugLineNum = 48;BA.debugLine="Dim BOLD As String = ESC & \"E1\""; _bold = _esc+"E1"; //BA.debugLineNum = 49;BA.debugLine="Dim NOBOLD As String = ESC & \"E0\""; _nobold = _esc+"E0"; //BA.debugLineNum = 52;BA.debugLine="Dim SINGLE As String = GS & \"!\" & Chr(0x00)"; _single = _gs+"!"+BA.ObjectToString(__c.Chr(((int)0x00))); //BA.debugLineNum = 53;BA.debugLine="Dim HIGH As String = GS & \"!\" & Chr(0x01)"; _high = _gs+"!"+BA.ObjectToString(__c.Chr(((int)0x01))); //BA.debugLineNum = 54;BA.debugLine="Dim WIDE As String = GS & \"!\" & Chr(0x10)"; _wide = _gs+"!"+BA.ObjectToString(__c.Chr(((int)0x10))); //BA.debugLineNum = 55;BA.debugLine="Dim HIGHWIDE As String = GS & \"!\" & Chr(0x11)"; _highwide = _gs+"!"+BA.ObjectToString(__c.Chr(((int)0x11))); //BA.debugLineNum = 58;BA.debugLine="Private LEFTJUSTIFY As String = ESC & \"a0\""; _leftjustify = _esc+"a0"; //BA.debugLineNum = 59;BA.debugLine="Private LINEDEFAULT As String = ESC & \"2\""; _linedefault = _esc+"2"; //BA.debugLineNum = 60;BA.debugLine="Private LINSET0 As String = ESC & \"$\" & Chr(0x0)"; _linset0 = _esc+"$"+BA.ObjectToString(__c.Chr(((int)0x0)))+BA.ObjectToString(__c.Chr(((int)0x0))); //BA.debugLineNum = 61;BA.debugLine="Private LMARGIN0 As String = GS & \"L\" & Chr(0x0)"; _lmargin0 = _gs+"L"+BA.ObjectToString(__c.Chr(((int)0x0)))+BA.ObjectToString(__c.Chr(((int)0x0))); //BA.debugLineNum = 62;BA.debugLine="Private WIDTH0 As String = GS & \"W\" & Chr(0xff) &"; _width0 = _gs+"W"+BA.ObjectToString(__c.Chr(((int)0xff)))+BA.ObjectToString(__c.Chr(((int)0xff))); //BA.debugLineNum = 63;BA.debugLine="Private CHARSPACING0 As String = ESC & \" \" & Chr("; _charspacing0 = _esc+" "+BA.ObjectToString(__c.Chr((int) (0))); //BA.debugLineNum = 64;BA.debugLine="Private CHARFONT0 As String = ESC & \"M\" & Chr(0)"; _charfont0 = _esc+"M"+BA.ObjectToString(__c.Chr((int) (0))); //BA.debugLineNum = 65;BA.debugLine="Dim DEFAULTS As String = CHARSPACING0 & CHARFONT"; _defaults = _charspacing0+_charfont0+_lmargin0+_width0+_linset0+_linedefault+_leftjustify+_uninvert+_unrotate+_unreverse+_nobold+_uline0; //BA.debugLineNum = 68;BA.debugLine="End Sub"; return ""; } public boolean _connect() throws Exception{ anywheresoftware.b4a.objects.collections.Map _paireddevices = null; anywheresoftware.b4a.objects.collections.List _l = null; int _i = 0; int _res = 0; //BA.debugLineNum = 100;BA.debugLine="Public Sub Connect As Boolean"; //BA.debugLineNum = 104;BA.debugLine="Try"; try { //BA.debugLineNum = 105;BA.debugLine="If Starter.MAC_IMPRESORA = \"0\" Then"; if ((_starter._mac_impresora /*String*/ ).equals("0")) { //BA.debugLineNum = 106;BA.debugLine="Dim PairedDevices As Map"; _paireddevices = new anywheresoftware.b4a.objects.collections.Map(); //BA.debugLineNum = 107;BA.debugLine="PairedDevices = Serial1.GetPairedDevices"; _paireddevices = _serial1.GetPairedDevices(); //BA.debugLineNum = 108;BA.debugLine="Dim l As List"; _l = new anywheresoftware.b4a.objects.collections.List(); //BA.debugLineNum = 109;BA.debugLine="l.Initialize"; _l.Initialize(); //BA.debugLineNum = 111;BA.debugLine="For i = 0 To PairedDevices.Size - 1"; { final int step7 = 1; final int limit7 = (int) (_paireddevices.getSize()-1); _i = (int) (0) ; for (;_i <= limit7 ;_i = _i + step7 ) { //BA.debugLineNum = 112;BA.debugLine="l.Add(PairedDevices.GetKeyAt(i))"; _l.Add(_paireddevices.GetKeyAt(_i)); //BA.debugLineNum = 114;BA.debugLine="DisConnect"; _disconnect(); } }; //BA.debugLineNum = 116;BA.debugLine="Dim Res As Int"; _res = 0; //BA.debugLineNum = 117;BA.debugLine="Res = InputList(l, \"Choose a printer\", -1) 'sho"; _res = __c.InputList(_l,BA.ObjectToCharSequence("Choose a printer"),(int) (-1),getActivityBA()); //BA.debugLineNum = 118;BA.debugLine="If Res <> DialogResponse.CANCEL Then"; if (_res!=__c.DialogResponse.CANCEL) { //BA.debugLineNum = 119;BA.debugLine="Serial1.Connect(PairedDevices.Get(l.Get(Res)))"; _serial1.Connect(ba,BA.ObjectToString(_paireddevices.Get(_l.Get(_res)))); //BA.debugLineNum = 121;BA.debugLine="Starter.mac_impresora = PairedDevices.Get(l.Ge"; _starter._mac_impresora /*String*/ = BA.ObjectToString(_paireddevices.Get(_l.Get(_res))); //BA.debugLineNum = 122;BA.debugLine="Return True"; if (true) return __c.True; //BA.debugLineNum = 123;BA.debugLine="DisConnect"; _disconnect(); }; //BA.debugLineNum = 127;BA.debugLine="Return False"; if (true) return __c.False; }else { //BA.debugLineNum = 129;BA.debugLine="Serial1.Connect(Starter.mac_impresora)"; _serial1.Connect(ba,_starter._mac_impresora /*String*/ ); //BA.debugLineNum = 131;BA.debugLine="Return True"; if (true) return __c.True; //BA.debugLineNum = 132;BA.debugLine="DisConnect"; _disconnect(); //BA.debugLineNum = 133;BA.debugLine="Log(\"aqui 5\")"; __c.LogImpl("771434273","aqui 5",0); }; } catch (Exception e27) { ba.setLastException(e27); //BA.debugLineNum = 136;BA.debugLine="Log(LastException)"; __c.LogImpl("771434276",BA.ObjectToString(__c.LastException(getActivityBA())),0); //BA.debugLineNum = 137;BA.debugLine="Return False"; if (true) return __c.False; }; //BA.debugLineNum = 139;BA.debugLine="End Sub"; return false; } public String _connectederrormsg() throws Exception{ //BA.debugLineNum = 84;BA.debugLine="Public Sub ConnectedErrorMsg As String"; //BA.debugLineNum = 85;BA.debugLine="Return ConnectedError"; if (true) return _connectederror; //BA.debugLineNum = 86;BA.debugLine="End Sub"; return ""; } public int _createbox(int _x0,int _y0,int _x1,int _y1,boolean _fill) throws Exception{ int _box = 0; //BA.debugLineNum = 520;BA.debugLine="Public Sub CreateBox(x0 As Int, y0 As Int, x1 As I"; //BA.debugLineNum = 521;BA.debugLine="Dim box As Int = 0x10000000"; _box = ((int)0x10000000); //BA.debugLineNum = 522;BA.debugLine="If fill Then box = box + 0x80000000"; if (_fill) { _box = (int) (_box+((int)0x80000000));}; //BA.debugLineNum = 523;BA.debugLine="box = box + Bit.ShiftLeft(Bit.And(0xf,x0), 24)"; _box = (int) (_box+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x0),(int) (24))); //BA.debugLineNum = 524;BA.debugLine="box = box + Bit.ShiftLeft(Bit.And(0x1f,y0), 16)"; _box = (int) (_box+__c.Bit.ShiftLeft(__c.Bit.And(((int)0x1f),_y0),(int) (16))); //BA.debugLineNum = 525;BA.debugLine="box = box + Bit.ShiftLeft(Bit.And(0xf,x1), 8)"; _box = (int) (_box+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x1),(int) (8))); //BA.debugLineNum = 526;BA.debugLine="box = box + Bit.And(0x1f,y1)"; _box = (int) (_box+__c.Bit.And(((int)0x1f),_y1)); //BA.debugLineNum = 527;BA.debugLine="Return box"; if (true) return _box; //BA.debugLineNum = 528;BA.debugLine="End Sub"; return 0; } public int _createcircle(int _radius,int _quadrants,int _x1,int _y1,boolean _fill) throws Exception{ int _circle = 0; //BA.debugLineNum = 490;BA.debugLine="Public Sub CreateCircle(radius As Int, quadrants A"; //BA.debugLineNum = 491;BA.debugLine="Dim circle As Int = 0x20000000"; _circle = ((int)0x20000000); //BA.debugLineNum = 492;BA.debugLine="If fill Then circle = circle + 0x80000000"; if (_fill) { _circle = (int) (_circle+((int)0x80000000));}; //BA.debugLineNum = 493;BA.debugLine="circle = circle + Bit.ShiftLeft(radius, 24)"; _circle = (int) (_circle+__c.Bit.ShiftLeft(_radius,(int) (24))); //BA.debugLineNum = 494;BA.debugLine="circle = circle + Bit.ShiftLeft(quadrants, 16)"; _circle = (int) (_circle+__c.Bit.ShiftLeft(_quadrants,(int) (16))); //BA.debugLineNum = 495;BA.debugLine="circle = circle + Bit.ShiftLeft(x1, 8)"; _circle = (int) (_circle+__c.Bit.ShiftLeft(_x1,(int) (8))); //BA.debugLineNum = 496;BA.debugLine="circle = circle + y1"; _circle = (int) (_circle+_y1); //BA.debugLineNum = 497;BA.debugLine="Return circle"; if (true) return _circle; //BA.debugLineNum = 498;BA.debugLine="End Sub"; return 0; } public byte[] _createcustomcharacter(int[] _shapes,int _characterfont) throws Exception{ byte[] _masks = null; byte[][] _points = null; int _x = 0; int _y = 0; int _size = 0; byte[] _charbyes = null; int _c = 0; int _i = 0; int _fill = 0; int _shape = 0; int _x0 = 0; int _y0 = 0; int _x1 = 0; int _y1 = 0; int _x2 = 0; int _y2 = 0; String _logmsg = ""; byte _bits = (byte)0; int _b = 0; //BA.debugLineNum = 404;BA.debugLine="Public Sub CreateCustomCharacter(shapes() As Int,"; //BA.debugLineNum = 405;BA.debugLine="Dim masks(8) As Byte"; _masks = new byte[(int) (8)]; ; //BA.debugLineNum = 406;BA.debugLine="masks(0) = 0x80"; _masks[(int) (0)] = (byte) (((int)0x80)); //BA.debugLineNum = 407;BA.debugLine="masks(1) = 0x40"; _masks[(int) (1)] = (byte) (((int)0x40)); //BA.debugLineNum = 408;BA.debugLine="masks(2) = 0x20"; _masks[(int) (2)] = (byte) (((int)0x20)); //BA.debugLineNum = 409;BA.debugLine="masks(3) = 0x10"; _masks[(int) (3)] = (byte) (((int)0x10)); //BA.debugLineNum = 410;BA.debugLine="masks(4) = 0x08"; _masks[(int) (4)] = (byte) (((int)0x08)); //BA.debugLineNum = 411;BA.debugLine="masks(5) = 0x04"; _masks[(int) (5)] = (byte) (((int)0x04)); //BA.debugLineNum = 412;BA.debugLine="masks(6) = 0x02"; _masks[(int) (6)] = (byte) (((int)0x02)); //BA.debugLineNum = 413;BA.debugLine="masks(7) = 0x01"; _masks[(int) (7)] = (byte) (((int)0x01)); //BA.debugLineNum = 416;BA.debugLine="Dim points(16,32) As Byte"; _points = new byte[(int) (16)][]; { int d0 = _points.length; int d1 = (int) (32); for (int i0 = 0;i0 < d0;i0++) { _points[i0] = new byte[d1]; } } ; //BA.debugLineNum = 418;BA.debugLine="For x = 0 To 15"; { final int step11 = 1; final int limit11 = (int) (15); _x = (int) (0) ; for (;_x <= limit11 ;_x = _x + step11 ) { //BA.debugLineNum = 419;BA.debugLine="For y = 0 To 31"; { final int step12 = 1; final int limit12 = (int) (31); _y = (int) (0) ; for (;_y <= limit12 ;_y = _y + step12 ) { //BA.debugLineNum = 420;BA.debugLine="points(x,y) = 0"; _points[_x][_y] = (byte) (0); } }; } }; //BA.debugLineNum = 423;BA.debugLine="Dim size As Int = 12"; _size = (int) (12); //BA.debugLineNum = 424;BA.debugLine="If characterfont = 1 Then size = 9"; if (_characterfont==1) { _size = (int) (9);}; //BA.debugLineNum = 425;BA.debugLine="Dim charbyes(size * 3) As Byte"; _charbyes = new byte[(int) (_size*3)]; ; //BA.debugLineNum = 426;BA.debugLine="For c = 0 To charbyes.Length - 1"; { final int step19 = 1; final int limit19 = (int) (_charbyes.length-1); _c = (int) (0) ; for (;_c <= limit19 ;_c = _c + step19 ) { //BA.debugLineNum = 427;BA.debugLine="charbyes(c) = 0"; _charbyes[_c] = (byte) (0); } }; //BA.debugLineNum = 430;BA.debugLine="For i = 0 To shapes.Length -1"; { final int step22 = 1; final int limit22 = (int) (_shapes.length-1); _i = (int) (0) ; for (;_i <= limit22 ;_i = _i + step22 ) { //BA.debugLineNum = 431;BA.debugLine="Dim fill As Int = Bit.UnsignedShiftRight(Bit.An"; _fill = __c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x80000000),_shapes[_i]),(int) (31)); //BA.debugLineNum = 432;BA.debugLine="Dim shape As Int = Bit.UnsignedShiftRight(Bit.An"; _shape = __c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x70000000),_shapes[_i]),(int) (28)); //BA.debugLineNum = 433;BA.debugLine="Dim x0 As Int = Bit.UnsignedShiftRight(Bit.And(0"; _x0 = __c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x0f000000),_shapes[_i]),(int) (24)); //BA.debugLineNum = 434;BA.debugLine="Dim y0 As Int = Bit.UnsignedShiftRight(Bit.And(0"; _y0 = __c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x001f0000),_shapes[_i]),(int) (16)); //BA.debugLineNum = 435;BA.debugLine="Dim x1 As Int = Bit.UnsignedShiftRight(Bit.And(0"; _x1 = __c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x00000f00),_shapes[_i]),(int) (8)); //BA.debugLineNum = 436;BA.debugLine="Dim y1 As Int = Bit.And(0x0000001f, shapes(i))"; _y1 = __c.Bit.And(((int)0x0000001f),_shapes[_i]); //BA.debugLineNum = 437;BA.debugLine="Dim x2 As Int = Bit.UnsignedShiftRight(Bit.And(0"; _x2 = __c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x0000f000),_shapes[_i]),(int) (12)); //BA.debugLineNum = 438;BA.debugLine="Dim y2 As Int = Bit.UnsignedShiftRight(Bit.And(0"; _y2 = (int) (__c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x00e00000),_shapes[_i]),(int) (18))+__c.Bit.UnsignedShiftRight(__c.Bit.And(((int)0x000000e0),_shapes[_i]),(int) (5))); //BA.debugLineNum = 444;BA.debugLine="Dim logmsg As String = \": Fill=\" & fill & \" : Po"; _logmsg = ": Fill="+BA.NumberToString(_fill)+" : Points "+BA.NumberToString(_x0)+","+BA.NumberToString(_y0)+" "+BA.NumberToString(_x1)+","+BA.NumberToString(_y1)+" "+BA.NumberToString(_x2)+","+BA.NumberToString(_y2); //BA.debugLineNum = 445;BA.debugLine="If shape = 3 Then"; if (_shape==3) { //BA.debugLineNum = 446;BA.debugLine="Log(\"Triangle \" & logmsg)"; __c.LogImpl("772745002","Triangle "+_logmsg,0); //BA.debugLineNum = 447;BA.debugLine="PlotTriangle(x0, y0, x1, y1, x2, y2, points, fi"; _plottriangle(_x0,_y0,_x1,_y1,_x2,_y2,_points,_fill); }else if(_shape==2) { //BA.debugLineNum = 449;BA.debugLine="Log(\"Circle \" & logmsg)"; __c.LogImpl("772745005","Circle "+_logmsg,0); //BA.debugLineNum = 450;BA.debugLine="PlotCircle(x0, y0, x1, y1, points, fill)"; _plotcircle(_x0,_y0,_x1,_y1,_points,_fill); }else if(_shape==1) { //BA.debugLineNum = 452;BA.debugLine="Log(\"Box \" & logmsg)"; __c.LogImpl("772745008","Box "+_logmsg,0); //BA.debugLineNum = 453;BA.debugLine="PlotBox(x0, y0, x1, y1, points, fill)"; _plotbox(_x0,_y0,_x1,_y1,_points,_fill); }else { //BA.debugLineNum = 455;BA.debugLine="Log(\"Line \" & logmsg)"; __c.LogImpl("772745011","Line "+_logmsg,0); //BA.debugLineNum = 456;BA.debugLine="PlotLine(x0, y0, x1, y1, points)"; _plotline(_x0,_y0,_x1,_y1,_points); }; //BA.debugLineNum = 459;BA.debugLine="For x = 0 To size -1 ' 9 or 12 horizontal bytes"; { final int step45 = 1; final int limit45 = (int) (_size-1); _x = (int) (0) ; for (;_x <= limit45 ;_x = _x + step45 ) { //BA.debugLineNum = 460;BA.debugLine="For y = 0 To 2 ' 3 vertical bytes"; { final int step46 = 1; final int limit46 = (int) (2); _y = (int) (0) ; for (;_y <= limit46 ;_y = _y + step46 ) { //BA.debugLineNum = 461;BA.debugLine="Dim bits As Byte = 0"; _bits = (byte) (0); //BA.debugLineNum = 462;BA.debugLine="For b = 0 To 7 ' 8 vertical bits"; { final int step48 = 1; final int limit48 = (int) (7); _b = (int) (0) ; for (;_b <= limit48 ;_b = _b + step48 ) { //BA.debugLineNum = 463;BA.debugLine="If points(x, y*8+b) <> 0 Then"; if (_points[_x][(int) (_y*8+_b)]!=0) { //BA.debugLineNum = 464;BA.debugLine="bits = Bit.Or(bits, masks(b))"; _bits = (byte) (__c.Bit.Or((int) (_bits),(int) (_masks[_b]))); }; } }; //BA.debugLineNum = 467;BA.debugLine="charbyes(x*3+y) = bits"; _charbyes[(int) (_x*3+_y)] = _bits; } }; } }; } }; //BA.debugLineNum = 471;BA.debugLine="Return charbyes"; if (true) return _charbyes; //BA.debugLineNum = 472;BA.debugLine="End Sub"; return null; } public int _createline(int _x0,int _y0,int _x1,int _y1) throws Exception{ int _line = 0; //BA.debugLineNum = 477;BA.debugLine="Public Sub CreateLine(x0 As Int, y0 As Int, x1 As"; //BA.debugLineNum = 478;BA.debugLine="Dim line As Int = 0"; _line = (int) (0); //BA.debugLineNum = 479;BA.debugLine="line = line + Bit.ShiftLeft(Bit.And(0xf,x0), 24)"; _line = (int) (_line+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x0),(int) (24))); //BA.debugLineNum = 480;BA.debugLine="line = line + Bit.ShiftLeft(Bit.And(0x1f,y0), 16)"; _line = (int) (_line+__c.Bit.ShiftLeft(__c.Bit.And(((int)0x1f),_y0),(int) (16))); //BA.debugLineNum = 481;BA.debugLine="line = line + Bit.ShiftLeft(Bit.And(0xf,x1), 8)"; _line = (int) (_line+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x1),(int) (8))); //BA.debugLineNum = 482;BA.debugLine="line = line + Bit.And(0x1f,y1)"; _line = (int) (_line+__c.Bit.And(((int)0x1f),_y1)); //BA.debugLineNum = 483;BA.debugLine="Return line"; if (true) return _line; //BA.debugLineNum = 484;BA.debugLine="End Sub"; return 0; } public int _createtriangle(int _x0,int _y0,int _x1,int _y1,int _x2,int _y2,boolean _fill) throws Exception{ int _triangle = 0; //BA.debugLineNum = 504;BA.debugLine="Public Sub CreateTriangle(x0 As Int, y0 As Int, x1"; //BA.debugLineNum = 505;BA.debugLine="Dim triangle As Int = 0x30000000"; _triangle = ((int)0x30000000); //BA.debugLineNum = 506;BA.debugLine="If fill Then triangle = triangle + 0x80000000"; if (_fill) { _triangle = (int) (_triangle+((int)0x80000000));}; //BA.debugLineNum = 507;BA.debugLine="triangle = triangle + Bit.ShiftLeft(Bit.And(0xf,x"; _triangle = (int) (_triangle+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x0),(int) (24))); //BA.debugLineNum = 508;BA.debugLine="triangle = triangle + Bit.ShiftLeft(Bit.And(0x1f,"; _triangle = (int) (_triangle+__c.Bit.ShiftLeft(__c.Bit.And(((int)0x1f),_y0),(int) (16))); //BA.debugLineNum = 509;BA.debugLine="triangle = triangle + Bit.ShiftLeft(Bit.And(0xf,x"; _triangle = (int) (_triangle+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x1),(int) (8))); //BA.debugLineNum = 510;BA.debugLine="triangle = triangle + Bit.And(0x1f,y1)"; _triangle = (int) (_triangle+__c.Bit.And(((int)0x1f),_y1)); //BA.debugLineNum = 511;BA.debugLine="triangle = triangle + Bit.ShiftLeft(Bit.And(0xf,x"; _triangle = (int) (_triangle+__c.Bit.ShiftLeft(__c.Bit.And(((int)0xf),_x2),(int) (12))); //BA.debugLineNum = 512;BA.debugLine="triangle = triangle + Bit.ShiftLeft(Bit.And(0x7,y"; _triangle = (int) (_triangle+__c.Bit.ShiftLeft(__c.Bit.And(((int)0x7),_y2),(int) (5))); //BA.debugLineNum = 513;BA.debugLine="triangle = triangle + Bit.ShiftLeft(Bit.And(0x18,"; _triangle = (int) (_triangle+__c.Bit.ShiftLeft(__c.Bit.And(((int)0x18),_y2),(int) (18))); //BA.debugLineNum = 514;BA.debugLine="Return triangle"; if (true) return _triangle; //BA.debugLineNum = 515;BA.debugLine="End Sub"; return 0; } public int _definecustomcharacter(int _charcode,byte[] _bitdata) throws Exception{ int _excess = 0; int _size = 0; byte[] _params = null; //BA.debugLineNum = 352;BA.debugLine="Public Sub DefineCustomCharacter(charcode As Int,"; //BA.debugLineNum = 353;BA.debugLine="Dim excess As Int = bitdata.Length Mod 3"; _excess = (int) (_bitdata.length%3); //BA.debugLineNum = 354;BA.debugLine="If excess <> 0 Then Return -1"; if (_excess!=0) { if (true) return (int) (-1);}; //BA.debugLineNum = 355;BA.debugLine="Dim size As Int = bitdata.Length / 3"; _size = (int) (_bitdata.length/(double)3); //BA.debugLineNum = 356;BA.debugLine="WriteString(ESC & \"&\")"; _writestring(_esc+"&"); //BA.debugLineNum = 357;BA.debugLine="Dim params(4) As Byte"; _params = new byte[(int) (4)]; ; //BA.debugLineNum = 358;BA.debugLine="params(0) = 3"; _params[(int) (0)] = (byte) (3); //BA.debugLineNum = 359;BA.debugLine="params(1) = charcode"; _params[(int) (1)] = (byte) (_charcode); //BA.debugLineNum = 360;BA.debugLine="params(2) = charcode"; _params[(int) (2)] = (byte) (_charcode); //BA.debugLineNum = 361;BA.debugLine="params(3) = size"; _params[(int) (3)] = (byte) (_size); //BA.debugLineNum = 362;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 363;BA.debugLine="WriteBytes(bitdata)"; _writebytes(_bitdata); //BA.debugLineNum = 364;BA.debugLine="Return 0"; if (true) return (int) (0); //BA.debugLineNum = 365;BA.debugLine="End Sub"; return 0; } public String _deletecustomcharacter(int _charcode) throws Exception{ byte[] _params = null; //BA.debugLineNum = 317;BA.debugLine="Public Sub DeleteCustomCharacter(charcode As Int)"; //BA.debugLineNum = 318;BA.debugLine="WriteString(ESC & \"?\")"; _writestring(_esc+"?"); //BA.debugLineNum = 319;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 320;BA.debugLine="params(0) = charcode"; _params[(int) (0)] = (byte) (_charcode); //BA.debugLineNum = 321;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 322;BA.debugLine="End Sub"; return ""; } public String _disconnect() throws Exception{ //BA.debugLineNum = 143;BA.debugLine="Public Sub DisConnect"; //BA.debugLineNum = 144;BA.debugLine="Serial1.Disconnect"; _serial1.Disconnect(); //BA.debugLineNum = 145;BA.debugLine="Connected = False"; _connected = __c.False; //BA.debugLineNum = 146;BA.debugLine="End Sub"; return ""; } public medicomed.keymon.com.mx.escposprinter._animage _ditherimage1d(medicomed.keymon.com.mx.escposprinter._animage _img,int _threshold) throws Exception{ byte[] _pixels = null; int _error = 0; int _y = 0; int _x = 0; int _lum = 0; medicomed.keymon.com.mx.escposprinter._animage _ret = null; //BA.debugLineNum = 763;BA.debugLine="Sub DitherImage1D(img As AnImage, threshold As Int"; //BA.debugLineNum = 764;BA.debugLine="Dim pixels(img.Data.Length) As Byte"; _pixels = new byte[_img.Data /*byte[]*/ .length]; ; //BA.debugLineNum = 765;BA.debugLine="Dim error As Int"; _error = 0; //BA.debugLineNum = 766;BA.debugLine="For y = 0 To img.Height - 1"; { final int step3 = 1; final int limit3 = (int) (_img.Height /*int*/ -1); _y = (int) (0) ; for (;_y <= limit3 ;_y = _y + step3 ) { //BA.debugLineNum = 767;BA.debugLine="error = 0 ' reset on each new line"; _error = (int) (0); //BA.debugLineNum = 768;BA.debugLine="For x = 0 To img.Width - 1"; { final int step5 = 1; final int limit5 = (int) (_img.Width /*int*/ -1); _x = (int) (0) ; for (;_x <= limit5 ;_x = _x + step5 ) { //BA.debugLineNum = 769;BA.debugLine="Dim lum As Int = Bit.And(img.Data(y*img.Width +"; _lum = __c.Bit.And((int) (_img.Data /*byte[]*/ [(int) (_y*_img.Width /*int*/ +_x)]),((int)0xff)); //BA.debugLineNum = 770;BA.debugLine="lum = lum + error"; _lum = (int) (_lum+_error); //BA.debugLineNum = 771;BA.debugLine="If lum < threshold Then"; if (_lum<_threshold) { //BA.debugLineNum = 772;BA.debugLine="error = lum"; _error = _lum; //BA.debugLineNum = 773;BA.debugLine="lum = 1"; _lum = (int) (1); }else { //BA.debugLineNum = 775;BA.debugLine="error = lum - 255"; _error = (int) (_lum-255); //BA.debugLineNum = 776;BA.debugLine="lum = 0"; _lum = (int) (0); }; //BA.debugLineNum = 778;BA.debugLine="pixels(y*img.Width + x) = lum"; _pixels[(int) (_y*_img.Width /*int*/ +_x)] = (byte) (_lum); } }; } }; //BA.debugLineNum = 781;BA.debugLine="Dim ret As AnImage"; _ret = new medicomed.keymon.com.mx.escposprinter._animage(); //BA.debugLineNum = 782;BA.debugLine="ret.Width = img.Width"; _ret.Width /*int*/ = _img.Width /*int*/ ; //BA.debugLineNum = 783;BA.debugLine="ret.Height = img.Height"; _ret.Height /*int*/ = _img.Height /*int*/ ; //BA.debugLineNum = 784;BA.debugLine="ret.Data = pixels"; _ret.Data /*byte[]*/ = _pixels; //BA.debugLineNum = 785;BA.debugLine="Return ret"; if (true) return _ret; //BA.debugLineNum = 786;BA.debugLine="End Sub"; return null; } public medicomed.keymon.com.mx.escposprinter._animage _ditherimage2d(medicomed.keymon.com.mx.escposprinter._animage _img,int _threshold) throws Exception{ byte[] _pixels = null; int _xerror = 0; int[] _yerrors = null; int _i = 0; int _y = 0; int _x = 0; int _lum = 0; medicomed.keymon.com.mx.escposprinter._animage _ret = null; //BA.debugLineNum = 794;BA.debugLine="Sub DitherImage2D(img As AnImage, threshold As Int"; //BA.debugLineNum = 795;BA.debugLine="Dim pixels(img.Data.Length) As Byte"; _pixels = new byte[_img.Data /*byte[]*/ .length]; ; //BA.debugLineNum = 796;BA.debugLine="Dim xerror As Int"; _xerror = 0; //BA.debugLineNum = 797;BA.debugLine="Dim yerrors(img.Width) As Int"; _yerrors = new int[_img.Width /*int*/ ]; ; //BA.debugLineNum = 798;BA.debugLine="For i = 0 To yerrors.Length -1"; { final int step4 = 1; final int limit4 = (int) (_yerrors.length-1); _i = (int) (0) ; for (;_i <= limit4 ;_i = _i + step4 ) { //BA.debugLineNum = 799;BA.debugLine="yerrors(0) = 0"; _yerrors[(int) (0)] = (int) (0); } }; //BA.debugLineNum = 801;BA.debugLine="For y = 0 To img.Height - 1"; { final int step7 = 1; final int limit7 = (int) (_img.Height /*int*/ -1); _y = (int) (0) ; for (;_y <= limit7 ;_y = _y + step7 ) { //BA.debugLineNum = 802;BA.debugLine="xerror = 0 ' reset on each new line"; _xerror = (int) (0); //BA.debugLineNum = 803;BA.debugLine="For x = 0 To img.Width - 1"; { final int step9 = 1; final int limit9 = (int) (_img.Width /*int*/ -1); _x = (int) (0) ; for (;_x <= limit9 ;_x = _x + step9 ) { //BA.debugLineNum = 804;BA.debugLine="Dim lum As Int = Bit.And(img.Data(y*img.Width +"; _lum = __c.Bit.And((int) (_img.Data /*byte[]*/ [(int) (_y*_img.Width /*int*/ +_x)]),((int)0xff)); //BA.debugLineNum = 805;BA.debugLine="lum = lum + xerror + yerrors(x)"; _lum = (int) (_lum+_xerror+_yerrors[_x]); //BA.debugLineNum = 806;BA.debugLine="If lum < threshold Then"; if (_lum<_threshold) { //BA.debugLineNum = 807;BA.debugLine="xerror = lum/2"; _xerror = (int) (_lum/(double)2); //BA.debugLineNum = 808;BA.debugLine="yerrors(x) = xerror"; _yerrors[_x] = _xerror; //BA.debugLineNum = 809;BA.debugLine="lum = 1"; _lum = (int) (1); }else { //BA.debugLineNum = 811;BA.debugLine="xerror = (lum - 255)/2"; _xerror = (int) ((_lum-255)/(double)2); //BA.debugLineNum = 812;BA.debugLine="yerrors(x) = xerror"; _yerrors[_x] = _xerror; //BA.debugLineNum = 813;BA.debugLine="lum = 0"; _lum = (int) (0); }; //BA.debugLineNum = 815;BA.debugLine="pixels(y*img.Width + x) = lum"; _pixels[(int) (_y*_img.Width /*int*/ +_x)] = (byte) (_lum); } }; } }; //BA.debugLineNum = 818;BA.debugLine="Dim ret As AnImage"; _ret = new medicomed.keymon.com.mx.escposprinter._animage(); //BA.debugLineNum = 819;BA.debugLine="ret.Width = img.Width"; _ret.Width /*int*/ = _img.Width /*int*/ ; //BA.debugLineNum = 820;BA.debugLine="ret.Height = img.Height"; _ret.Height /*int*/ = _img.Height /*int*/ ; //BA.debugLineNum = 821;BA.debugLine="ret.Data = pixels"; _ret.Data /*byte[]*/ = _pixels; //BA.debugLineNum = 822;BA.debugLine="Return ret"; if (true) return _ret; //BA.debugLineNum = 823;BA.debugLine="End Sub"; return null; } public String _filltriangle(int _x0,int _y0,int _x1,int _y1,int _x2,int _y2,byte[][] _points) throws Exception{ int _tx = 0; int _ty = 0; double _dx0 = 0; double _dx1 = 0; double _dx2 = 0; double _x3 = 0; double _x4 = 0; double _y3 = 0; double _y4 = 0; int _inc = 0; int _x = 0; //BA.debugLineNum = 544;BA.debugLine="Private Sub FillTriangle(x0 As Int, y0 As Int, x1"; //BA.debugLineNum = 546;BA.debugLine="Dim tx, ty As Int"; _tx = 0; _ty = 0; //BA.debugLineNum = 547;BA.debugLine="If y0 > y1 Then"; if (_y0>_y1) { //BA.debugLineNum = 548;BA.debugLine="tx = x0 : ty = y0"; _tx = _x0; //BA.debugLineNum = 548;BA.debugLine="tx = x0 : ty = y0"; _ty = _y0; //BA.debugLineNum = 549;BA.debugLine="x0 = x1 : y0 = y1"; _x0 = _x1; //BA.debugLineNum = 549;BA.debugLine="x0 = x1 : y0 = y1"; _y0 = _y1; //BA.debugLineNum = 550;BA.debugLine="x1 = tx : y1 = ty"; _x1 = _tx; //BA.debugLineNum = 550;BA.debugLine="x1 = tx : y1 = ty"; _y1 = _ty; }; //BA.debugLineNum = 552;BA.debugLine="If y0 > y2 Then"; if (_y0>_y2) { //BA.debugLineNum = 553;BA.debugLine="tx = x0 : ty = y0"; _tx = _x0; //BA.debugLineNum = 553;BA.debugLine="tx = x0 : ty = y0"; _ty = _y0; //BA.debugLineNum = 554;BA.debugLine="x0 = x2 : y0 = y2"; _x0 = _x2; //BA.debugLineNum = 554;BA.debugLine="x0 = x2 : y0 = y2"; _y0 = _y2; //BA.debugLineNum = 555;BA.debugLine="x2 = tx : y2 = ty"; _x2 = _tx; //BA.debugLineNum = 555;BA.debugLine="x2 = tx : y2 = ty"; _y2 = _ty; }; //BA.debugLineNum = 557;BA.debugLine="If y1 > y2 Then"; if (_y1>_y2) { //BA.debugLineNum = 558;BA.debugLine="tx = x1 : ty = y1"; _tx = _x1; //BA.debugLineNum = 558;BA.debugLine="tx = x1 : ty = y1"; _ty = _y1; //BA.debugLineNum = 559;BA.debugLine="x1 = x2 : y1 = y2"; _x1 = _x2; //BA.debugLineNum = 559;BA.debugLine="x1 = x2 : y1 = y2"; _y1 = _y2; //BA.debugLineNum = 560;BA.debugLine="x2 = tx : y2 = ty"; _x2 = _tx; //BA.debugLineNum = 560;BA.debugLine="x2 = tx : y2 = ty"; _y2 = _ty; }; //BA.debugLineNum = 563;BA.debugLine="Dim dx0, dx1, dx2 As Double"; _dx0 = 0; _dx1 = 0; _dx2 = 0; //BA.debugLineNum = 564;BA.debugLine="Dim x3, x4, y3, y4 As Double"; _x3 = 0; _x4 = 0; _y3 = 0; _y4 = 0; //BA.debugLineNum = 565;BA.debugLine="Dim inc As Int"; _inc = 0; //BA.debugLineNum = 567;BA.debugLine="If y1 - y0 > 0 Then dx0=(x1-x0)/(y1-y0) Else dx0="; if (_y1-_y0>0) { _dx0 = (_x1-_x0)/(double)(_y1-_y0);} else { _dx0 = 0;}; //BA.debugLineNum = 568;BA.debugLine="If y2 - y0 > 0 Then dx1=(x2-x0)/(y2-y0) Else dx1="; if (_y2-_y0>0) { _dx1 = (_x2-_x0)/(double)(_y2-_y0);} else { _dx1 = 0;}; //BA.debugLineNum = 569;BA.debugLine="If y2 - y1 > 0 Then dx2=(x2-x1)/(y2-y1) Else dx2="; if (_y2-_y1>0) { _dx2 = (_x2-_x1)/(double)(_y2-_y1);} else { _dx2 = 0;}; //BA.debugLineNum = 570;BA.debugLine="x3 = x0 : x4 = x0"; _x3 = _x0; //BA.debugLineNum = 570;BA.debugLine="x3 = x0 : x4 = x0"; _x4 = _x0; //BA.debugLineNum = 571;BA.debugLine="y3 = y0 : y4 = y0"; _y3 = _y0; //BA.debugLineNum = 571;BA.debugLine="y3 = y0 : y4 = y0"; _y4 = _y0; //BA.debugLineNum = 572;BA.debugLine="If dx0 > dx1 Then"; if (_dx0>_dx1) { //BA.debugLineNum = 573;BA.debugLine="While"; __c.While(); //BA.debugLineNum = 574;BA.debugLine="Do While y3 <= y1"; while (_y3<=_y1) { //BA.debugLineNum = 575;BA.debugLine="If x3 > x4 Then inc = -1 Else inc = 1"; if (_x3>_x4) { _inc = (int) (-1);} else { _inc = (int) (1);}; //BA.debugLineNum = 576;BA.debugLine="For x = x3 To x4 Step inc"; { final int step40 = _inc; final int limit40 = (int) (_x4); _x = (int) (_x3) ; for (;(step40 > 0 && _x <= limit40) || (step40 < 0 && _x >= limit40) ;_x = ((int)(0 + _x + step40)) ) { //BA.debugLineNum = 577;BA.debugLine="points(x, y3) = 1"; _points[_x][(int) (_y3)] = (byte) (1); } }; //BA.debugLineNum = 579;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _y3 = _y3+1; //BA.debugLineNum = 579;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _y4 = _y4+1; //BA.debugLineNum = 579;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _x3 = _x3+_dx1; //BA.debugLineNum = 579;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _x4 = _x4+_dx0; } ; //BA.debugLineNum = 581;BA.debugLine="x4=x1"; _x4 = _x1; //BA.debugLineNum = 582;BA.debugLine="y4=y1"; _y4 = _y1; //BA.debugLineNum = 583;BA.debugLine="Do While y3 <= y2"; while (_y3<=_y2) { //BA.debugLineNum = 584;BA.debugLine="If x3 > x4 Then inc = -1 Else inc = 1"; if (_x3>_x4) { _inc = (int) (-1);} else { _inc = (int) (1);}; //BA.debugLineNum = 585;BA.debugLine="For x = x3 To x4 Step inc"; { final int step52 = _inc; final int limit52 = (int) (_x4); _x = (int) (_x3) ; for (;(step52 > 0 && _x <= limit52) || (step52 < 0 && _x >= limit52) ;_x = ((int)(0 + _x + step52)) ) { //BA.debugLineNum = 586;BA.debugLine="points(x ,y3) = 1"; _points[_x][(int) (_y3)] = (byte) (1); } }; //BA.debugLineNum = 588;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _y3 = _y3+1; //BA.debugLineNum = 588;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _y4 = _y4+1; //BA.debugLineNum = 588;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _x3 = _x3+_dx1; //BA.debugLineNum = 588;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx1 : x4"; _x4 = _x4+_dx2; } ; }else { //BA.debugLineNum = 591;BA.debugLine="While"; __c.While(); //BA.debugLineNum = 592;BA.debugLine="Do While y3 <= y1"; while (_y3<=_y1) { //BA.debugLineNum = 593;BA.debugLine="If x3 > x4 Then inc = -1 Else inc = 1"; if (_x3>_x4) { _inc = (int) (-1);} else { _inc = (int) (1);}; //BA.debugLineNum = 594;BA.debugLine="For x = x3 To x4 Step inc"; { final int step64 = _inc; final int limit64 = (int) (_x4); _x = (int) (_x3) ; for (;(step64 > 0 && _x <= limit64) || (step64 < 0 && _x >= limit64) ;_x = ((int)(0 + _x + step64)) ) { //BA.debugLineNum = 595;BA.debugLine="points(x, y3) = 1"; _points[_x][(int) (_y3)] = (byte) (1); } }; //BA.debugLineNum = 597;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx0 : x4"; _y3 = _y3+1; //BA.debugLineNum = 597;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx0 : x4"; _y4 = _y4+1; //BA.debugLineNum = 597;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx0 : x4"; _x3 = _x3+_dx0; //BA.debugLineNum = 597;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx0 : x4"; _x4 = _x4+_dx1; } ; //BA.debugLineNum = 599;BA.debugLine="x3=x1"; _x3 = _x1; //BA.debugLineNum = 600;BA.debugLine="y3=y1"; _y3 = _y1; //BA.debugLineNum = 601;BA.debugLine="Do While y3<=y2"; while (_y3<=_y2) { //BA.debugLineNum = 602;BA.debugLine="If x3 > x4 Then inc = -1 Else inc = 1"; if (_x3>_x4) { _inc = (int) (-1);} else { _inc = (int) (1);}; //BA.debugLineNum = 603;BA.debugLine="For x = x3 To x4 Step inc"; { final int step76 = _inc; final int limit76 = (int) (_x4); _x = (int) (_x3) ; for (;(step76 > 0 && _x <= limit76) || (step76 < 0 && _x >= limit76) ;_x = ((int)(0 + _x + step76)) ) { //BA.debugLineNum = 604;BA.debugLine="points(x, y3) = 1"; _points[_x][(int) (_y3)] = (byte) (1); } }; //BA.debugLineNum = 606;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx2 : x4"; _y3 = _y3+1; //BA.debugLineNum = 606;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx2 : x4"; _y4 = _y4+1; //BA.debugLineNum = 606;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx2 : x4"; _x3 = _x3+_dx2; //BA.debugLineNum = 606;BA.debugLine="y3 = y3 + 1 : y4 = y4 + 1 : x3 = x3 + dx2 : x4"; _x4 = _x4+_dx1; } ; }; //BA.debugLineNum = 609;BA.debugLine="End Sub"; return ""; } public medicomed.keymon.com.mx.escposprinter._animage _imagetobwimage(anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _bmp) throws Exception{ b4a.example.bitmapcreator _bc = null; int _w = 0; int _h = 0; byte[] _pixels = null; int _y = 0; int _x = 0; int _j = 0; b4a.example.bitmapcreator._argbcolor _col = null; int _lum = 0; medicomed.keymon.com.mx.escposprinter._animage _ret = null; //BA.debugLineNum = 713;BA.debugLine="Sub ImageToBWIMage(bmp As Bitmap) As AnImage"; //BA.debugLineNum = 714;BA.debugLine="Dim BC As BitmapCreator 'ignore"; _bc = new b4a.example.bitmapcreator(); //BA.debugLineNum = 715;BA.debugLine="Dim W As Int = bmp.Width"; _w = _bmp.getWidth(); //BA.debugLineNum = 716;BA.debugLine="Dim H As Int = bmp.Height"; _h = _bmp.getHeight(); //BA.debugLineNum = 717;BA.debugLine="Dim pixels(W * H) As Byte"; _pixels = new byte[(int) (_w*_h)]; ; //BA.debugLineNum = 719;BA.debugLine="For y = 0 To H - 1"; { final int step5 = 1; final int limit5 = (int) (_h-1); _y = (int) (0) ; for (;_y <= limit5 ;_y = _y + step5 ) { //BA.debugLineNum = 720;BA.debugLine="For x = 0 To W - 1"; { final int step6 = 1; final int limit6 = (int) (_w-1); _x = (int) (0) ; for (;_x <= limit6 ;_x = _x + step6 ) { //BA.debugLineNum = 721;BA.debugLine="Dim j As Int = bmp.GetPixel(x, y)"; _j = _bmp.GetPixel(_x,_y); //BA.debugLineNum = 723;BA.debugLine="Dim col As ARGBColor"; _col = new b4a.example.bitmapcreator._argbcolor(); //BA.debugLineNum = 724;BA.debugLine="BC.ColorToARGB(j, col )"; _bc._colortoargb(_j,_col); //BA.debugLineNum = 725;BA.debugLine="Dim lum As Int = col.r * 0.2 + col.b*0.1 + col."; _lum = (int) (_col.r*0.2+_col.b*0.1+_col.g*0.7); //BA.debugLineNum = 726;BA.debugLine="If lum> 255 Then lum = 255"; if (_lum>255) { _lum = (int) (255);}; //BA.debugLineNum = 728;BA.debugLine="pixels(y*W + x) = lum"; _pixels[(int) (_y*_w+_x)] = (byte) (_lum); } }; } }; //BA.debugLineNum = 731;BA.debugLine="Dim ret As AnImage"; _ret = new medicomed.keymon.com.mx.escposprinter._animage(); //BA.debugLineNum = 732;BA.debugLine="ret.Width = bmp.Width"; _ret.Width /*int*/ = _bmp.getWidth(); //BA.debugLineNum = 733;BA.debugLine="ret.Height = bmp.Height"; _ret.Height /*int*/ = _bmp.getHeight(); //BA.debugLineNum = 734;BA.debugLine="ret.Data = pixels"; _ret.Data /*byte[]*/ = _pixels; //BA.debugLineNum = 735;BA.debugLine="Return ret"; if (true) return _ret; //BA.debugLineNum = 736;BA.debugLine="End Sub"; return null; } public String _initialize(anywheresoftware.b4a.BA _ba,Object _vcallback,String _veventname) throws Exception{ innerInitialize(_ba); //BA.debugLineNum = 75;BA.debugLine="Public Sub Initialize(vCallback As Object, vEventN"; //BA.debugLineNum = 76;BA.debugLine="EventName = vEventName"; _eventname = _veventname; //BA.debugLineNum = 77;BA.debugLine="CallBack = vCallback"; _callback = _vcallback; //BA.debugLineNum = 78;BA.debugLine="Serial1.Initialize(\"Serial1\")"; _serial1.Initialize("Serial1"); //BA.debugLineNum = 79;BA.debugLine="Connected = False"; _connected = __c.False; //BA.debugLineNum = 80;BA.debugLine="ConnectedError = \"\""; _connectederror = ""; //BA.debugLineNum = 81;BA.debugLine="End Sub"; return ""; } public boolean _isbluetoothon() throws Exception{ //BA.debugLineNum = 94;BA.debugLine="Public Sub IsBluetoothOn As Boolean"; //BA.debugLineNum = 95;BA.debugLine="Return Serial1.IsEnabled"; if (true) return _serial1.IsEnabled(); //BA.debugLineNum = 96;BA.debugLine="End Sub"; return false; } public boolean _isconnected() throws Exception{ //BA.debugLineNum = 89;BA.debugLine="Public Sub IsConnected As Boolean"; //BA.debugLineNum = 90;BA.debugLine="Return Connected"; if (true) return _connected; //BA.debugLineNum = 91;BA.debugLine="End Sub"; return false; } public medicomed.keymon.com.mx.escposprinter._animage _packimage(medicomed.keymon.com.mx.escposprinter._animage _imagedata) throws Exception{ int _xbytes = 0; byte[] _pixels = null; byte[] _masks = null; int _index = 0; int _y = 0; int _x = 0; byte _xbyte = (byte)0; int _b = 0; byte _pix = (byte)0; medicomed.keymon.com.mx.escposprinter._animage _ret = null; //BA.debugLineNum = 865;BA.debugLine="Public Sub PackImage(imagedata As AnImage) As AnIm"; //BA.debugLineNum = 866;BA.debugLine="Dim xbytes As Int = imagedata.width/8"; _xbytes = (int) (_imagedata.Width /*int*/ /(double)8); //BA.debugLineNum = 867;BA.debugLine="Dim pixels(xbytes * imagedata.height) As Byte"; _pixels = new byte[(int) (_xbytes*_imagedata.Height /*int*/ )]; ; //BA.debugLineNum = 868;BA.debugLine="Dim masks(8) As Byte"; _masks = new byte[(int) (8)]; ; //BA.debugLineNum = 869;BA.debugLine="masks(0) = 0x80"; _masks[(int) (0)] = (byte) (((int)0x80)); //BA.debugLineNum = 870;BA.debugLine="masks(1) = 0x40"; _masks[(int) (1)] = (byte) (((int)0x40)); //BA.debugLineNum = 871;BA.debugLine="masks(2) = 0x20"; _masks[(int) (2)] = (byte) (((int)0x20)); //BA.debugLineNum = 872;BA.debugLine="masks(3) = 0x10"; _masks[(int) (3)] = (byte) (((int)0x10)); //BA.debugLineNum = 873;BA.debugLine="masks(4) = 0x08"; _masks[(int) (4)] = (byte) (((int)0x08)); //BA.debugLineNum = 874;BA.debugLine="masks(5) = 0x04"; _masks[(int) (5)] = (byte) (((int)0x04)); //BA.debugLineNum = 875;BA.debugLine="masks(6) = 0x02"; _masks[(int) (6)] = (byte) (((int)0x02)); //BA.debugLineNum = 876;BA.debugLine="masks(7) = 0x01"; _masks[(int) (7)] = (byte) (((int)0x01)); //BA.debugLineNum = 877;BA.debugLine="Dim index As Int = 0"; _index = (int) (0); //BA.debugLineNum = 878;BA.debugLine="For y = 0 To imagedata.Height - 1"; { final int step13 = 1; final int limit13 = (int) (_imagedata.Height /*int*/ -1); _y = (int) (0) ; for (;_y <= limit13 ;_y = _y + step13 ) { //BA.debugLineNum = 879;BA.debugLine="For x = 0 To xbytes - 1"; { final int step14 = 1; final int limit14 = (int) (_xbytes-1); _x = (int) (0) ; for (;_x <= limit14 ;_x = _x + step14 ) { //BA.debugLineNum = 880;BA.debugLine="Dim xbyte As Byte = 0"; _xbyte = (byte) (0); //BA.debugLineNum = 881;BA.debugLine="For b = 0 To 7"; { final int step16 = 1; final int limit16 = (int) (7); _b = (int) (0) ; for (;_b <= limit16 ;_b = _b + step16 ) { //BA.debugLineNum = 883;BA.debugLine="Dim pix As Byte = imagedata.Data(index)"; _pix = _imagedata.Data /*byte[]*/ [_index]; //BA.debugLineNum = 884;BA.debugLine="If pix <> 0 Then"; if (_pix!=0) { //BA.debugLineNum = 885;BA.debugLine="xbyte = xbyte + masks(b)"; _xbyte = (byte) (_xbyte+_masks[_b]); }; //BA.debugLineNum = 887;BA.debugLine="index = index + 1"; _index = (int) (_index+1); } }; //BA.debugLineNum = 889;BA.debugLine="pixels(y*xbytes + x) = xbyte"; _pixels[(int) (_y*_xbytes+_x)] = _xbyte; } }; } }; //BA.debugLineNum = 892;BA.debugLine="Dim ret As AnImage"; _ret = new medicomed.keymon.com.mx.escposprinter._animage(); //BA.debugLineNum = 893;BA.debugLine="ret.Width = xbytes"; _ret.Width /*int*/ = _xbytes; //BA.debugLineNum = 894;BA.debugLine="ret.Height = imagedata.Height"; _ret.Height /*int*/ = _imagedata.Height /*int*/ ; //BA.debugLineNum = 895;BA.debugLine="ret.Data = pixels"; _ret.Data /*byte[]*/ = _pixels; //BA.debugLineNum = 896;BA.debugLine="Return ret"; if (true) return _ret; //BA.debugLineNum = 897;BA.debugLine="End Sub"; return null; } public byte[] _packimageslice(medicomed.keymon.com.mx.escposprinter._animage _img,int _slice,boolean _dots24) throws Exception{ int _bytes = 0; byte[] _pixels = null; int _slicestart = 0; byte[] _masks = null; int _x = 0; int _s = 0; byte _xbyte = (byte)0; int _b = 0; byte _pix = (byte)0; //BA.debugLineNum = 963;BA.debugLine="Public Sub PackImageSlice(img As AnImage, slice As"; //BA.debugLineNum = 964;BA.debugLine="Dim bytes As Int = img.width"; _bytes = _img.Width /*int*/ ; //BA.debugLineNum = 965;BA.debugLine="If dots24 Then"; if (_dots24) { //BA.debugLineNum = 966;BA.debugLine="Dim pixels(bytes * 3) As Byte"; _pixels = new byte[(int) (_bytes*3)]; ; //BA.debugLineNum = 967;BA.debugLine="Dim slicestart As Int = slice * bytes * 8 * 3"; _slicestart = (int) (_slice*_bytes*8*3); }else { //BA.debugLineNum = 969;BA.debugLine="Dim pixels(bytes) As Byte"; _pixels = new byte[_bytes]; ; //BA.debugLineNum = 970;BA.debugLine="Dim slicestart As Int = slice * bytes * 8"; _slicestart = (int) (_slice*_bytes*8); }; //BA.debugLineNum = 973;BA.debugLine="Dim masks(8) As Byte"; _masks = new byte[(int) (8)]; ; //BA.debugLineNum = 974;BA.debugLine="masks(0) = 0x80"; _masks[(int) (0)] = (byte) (((int)0x80)); //BA.debugLineNum = 975;BA.debugLine="masks(1) = 0x40"; _masks[(int) (1)] = (byte) (((int)0x40)); //BA.debugLineNum = 976;BA.debugLine="masks(2) = 0x20"; _masks[(int) (2)] = (byte) (((int)0x20)); //BA.debugLineNum = 977;BA.debugLine="masks(3) = 0x10"; _masks[(int) (3)] = (byte) (((int)0x10)); //BA.debugLineNum = 978;BA.debugLine="masks(4) = 0x08"; _masks[(int) (4)] = (byte) (((int)0x08)); //BA.debugLineNum = 979;BA.debugLine="masks(5) = 0x04"; _masks[(int) (5)] = (byte) (((int)0x04)); //BA.debugLineNum = 980;BA.debugLine="masks(6) = 0x02"; _masks[(int) (6)] = (byte) (((int)0x02)); //BA.debugLineNum = 981;BA.debugLine="masks(7) = 0x01"; _masks[(int) (7)] = (byte) (((int)0x01)); //BA.debugLineNum = 983;BA.debugLine="If dots24 Then"; if (_dots24) { //BA.debugLineNum = 984;BA.debugLine="For x = 0 To bytes - 1"; { final int step19 = 1; final int limit19 = (int) (_bytes-1); _x = (int) (0) ; for (;_x <= limit19 ;_x = _x + step19 ) { //BA.debugLineNum = 985;BA.debugLine="For s = 0 To 2"; { final int step20 = 1; final int limit20 = (int) (2); _s = (int) (0) ; for (;_s <= limit20 ;_s = _s + step20 ) { //BA.debugLineNum = 986;BA.debugLine="Dim xbyte As Byte = 0"; _xbyte = (byte) (0); //BA.debugLineNum = 987;BA.debugLine="For b = 0 To 7"; { final int step22 = 1; final int limit22 = (int) (7); _b = (int) (0) ; for (;_b <= limit22 ;_b = _b + step22 ) { //BA.debugLineNum = 989;BA.debugLine="Dim pix As Byte = img.Data(slicestart + ((b +"; _pix = _img.Data /*byte[]*/ [(int) (_slicestart+((_b+_s*8)*_bytes)+_x)]; //BA.debugLineNum = 990;BA.debugLine="If pix <> 0 Then"; if (_pix!=0) { //BA.debugLineNum = 991;BA.debugLine="xbyte = xbyte + masks(b)"; _xbyte = (byte) (_xbyte+_masks[_b]); }; } }; //BA.debugLineNum = 994;BA.debugLine="pixels(x*3+s) = xbyte"; _pixels[(int) (_x*3+_s)] = _xbyte; } }; } }; }else { //BA.debugLineNum = 998;BA.debugLine="For x = 0 To bytes - 1"; { final int step32 = 1; final int limit32 = (int) (_bytes-1); _x = (int) (0) ; for (;_x <= limit32 ;_x = _x + step32 ) { //BA.debugLineNum = 999;BA.debugLine="Dim xbyte As Byte = 0"; _xbyte = (byte) (0); //BA.debugLineNum = 1000;BA.debugLine="For b = 0 To 7"; { final int step34 = 1; final int limit34 = (int) (7); _b = (int) (0) ; for (;_b <= limit34 ;_b = _b + step34 ) { //BA.debugLineNum = 1002;BA.debugLine="Dim pix As Byte = img.Data(slicestart + (b * b"; _pix = _img.Data /*byte[]*/ [(int) (_slicestart+(_b*_bytes)+_x)]; //BA.debugLineNum = 1003;BA.debugLine="If pix <> 0 Then"; if (_pix!=0) { //BA.debugLineNum = 1004;BA.debugLine="xbyte = xbyte + masks(b)"; _xbyte = (byte) (_xbyte+_masks[_b]); }; } }; //BA.debugLineNum = 1007;BA.debugLine="pixels(x) = xbyte"; _pixels[_x] = _xbyte; } }; }; //BA.debugLineNum = 1010;BA.debugLine="Return pixels"; if (true) return _pixels; //BA.debugLineNum = 1011;BA.debugLine="End Sub"; return null; } public String _plotbox(int _x0,int _y0,int _x1,int _y1,byte[][] _points,int _fill) throws Exception{ int _x = 0; //BA.debugLineNum = 611;BA.debugLine="Private Sub PlotBox(x0 As Int, y0 As Int, x1 As In"; //BA.debugLineNum = 613;BA.debugLine="PlotLine(x0, y0, x0, y1, points)"; _plotline(_x0,_y0,_x0,_y1,_points); //BA.debugLineNum = 614;BA.debugLine="PlotLine(x0, y0, x1, y0, points)"; _plotline(_x0,_y0,_x1,_y0,_points); //BA.debugLineNum = 615;BA.debugLine="PlotLine(x1, y0, x1, y1, points)"; _plotline(_x1,_y0,_x1,_y1,_points); //BA.debugLineNum = 616;BA.debugLine="PlotLine(x0, y1, x1, y1, points)"; _plotline(_x0,_y1,_x1,_y1,_points); //BA.debugLineNum = 617;BA.debugLine="If Fill > 0 Then"; if (_fill>0) { //BA.debugLineNum = 618;BA.debugLine="For x = x0 To x1"; { final int step6 = 1; final int limit6 = _x1; _x = _x0 ; for (;_x <= limit6 ;_x = _x + step6 ) { //BA.debugLineNum = 619;BA.debugLine="PlotLine(x, y0, x, y1, points)"; _plotline(_x,_y0,_x,_y1,_points); } }; }; //BA.debugLineNum = 622;BA.debugLine="End Sub"; return ""; } public String _plotcircle(int _radius,int _quadrants,int _x1,int _y1,byte[][] _points,int _fill) throws Exception{ int _mask = 0; int _q = 0; int _i = 0; double _x = 0; double _y = 0; //BA.debugLineNum = 625;BA.debugLine="Private Sub PlotCircle(radius As Int, quadrants As"; //BA.debugLineNum = 627;BA.debugLine="Dim mask As Int = 1"; _mask = (int) (1); //BA.debugLineNum = 628;BA.debugLine="For q = 3 To 0 Step -1"; { final int step2 = -1; final int limit2 = (int) (0); _q = (int) (3) ; for (;_q >= limit2 ;_q = _q + step2 ) { //BA.debugLineNum = 629;BA.debugLine="If Bit.And(quadrants, mask) <> 0 Then"; if (__c.Bit.And(_quadrants,_mask)!=0) { //BA.debugLineNum = 630;BA.debugLine="For i = q*90 To q*90+90 Step 1"; { final int step4 = 1; final int limit4 = (int) (_q*90+90); _i = (int) (_q*90) ; for (;_i <= limit4 ;_i = _i + step4 ) { //BA.debugLineNum = 631;BA.debugLine="Dim x,y As Double"; _x = 0; _y = 0; //BA.debugLineNum = 632;BA.debugLine="x = x1 - SinD(i)*radius"; _x = _x1-__c.SinD(_i)*_radius; //BA.debugLineNum = 633;BA.debugLine="y = y1 - CosD(i)*radius"; _y = _y1-__c.CosD(_i)*_radius; //BA.debugLineNum = 634;BA.debugLine="If fill > 0 Then"; if (_fill>0) { //BA.debugLineNum = 635;BA.debugLine="PlotLine(x1, y1, x, y, points)"; _plotline(_x1,_y1,(int) (_x),(int) (_y),_points); }else { //BA.debugLineNum = 637;BA.debugLine="points(Round(x), Round(y)) = 1"; _points[(int) (__c.Round(_x))][(int) (__c.Round(_y))] = (byte) (1); }; } }; }; //BA.debugLineNum = 641;BA.debugLine="mask = Bit.ShiftLeft(mask, 1)"; _mask = __c.Bit.ShiftLeft(_mask,(int) (1)); } }; //BA.debugLineNum = 643;BA.debugLine="End Sub"; return ""; } public String _plotline(int _x0,int _y0,int _x1,int _y1,byte[][] _points) throws Exception{ //BA.debugLineNum = 646;BA.debugLine="Private Sub PlotLine(x0 As Int, y0 As Int, x1 As I"; //BA.debugLineNum = 647;BA.debugLine="If Abs(y1 - y0) < Abs(x1 - x0) Then"; if (__c.Abs(_y1-_y0)<__c.Abs(_x1-_x0)) { //BA.debugLineNum = 648;BA.debugLine="If x0 > x1 Then"; if (_x0>_x1) { //BA.debugLineNum = 649;BA.debugLine="PlotLineLow(x1, y1, x0, y0, points)"; _plotlinelow(_x1,_y1,_x0,_y0,_points); }else { //BA.debugLineNum = 651;BA.debugLine="PlotLineLow(x0, y0, x1, y1, points)"; _plotlinelow(_x0,_y0,_x1,_y1,_points); }; }else { //BA.debugLineNum = 654;BA.debugLine="If y0 > y1 Then"; if (_y0>_y1) { //BA.debugLineNum = 655;BA.debugLine="PlotLineHigh(x1, y1, x0, y0, points)"; _plotlinehigh(_x1,_y1,_x0,_y0,_points); }else { //BA.debugLineNum = 657;BA.debugLine="PlotLineHigh(x0, y0, x1, y1, points)"; _plotlinehigh(_x0,_y0,_x1,_y1,_points); }; }; //BA.debugLineNum = 660;BA.debugLine="End Sub"; return ""; } public String _plotlinehigh(int _x0,int _y0,int _x1,int _y1,byte[][] _points) throws Exception{ int _dx = 0; int _dy = 0; int _xi = 0; int _d = 0; int _x = 0; int _y = 0; //BA.debugLineNum = 662;BA.debugLine="Private Sub PlotLineHigh(x0 As Int, y0 As Int, x1"; //BA.debugLineNum = 663;BA.debugLine="Dim dx As Int = x1 - x0"; _dx = (int) (_x1-_x0); //BA.debugLineNum = 664;BA.debugLine="Dim dy As Int = y1 - y0"; _dy = (int) (_y1-_y0); //BA.debugLineNum = 665;BA.debugLine="Dim xi As Int = 1"; _xi = (int) (1); //BA.debugLineNum = 666;BA.debugLine="If dx < 0 Then"; if (_dx<0) { //BA.debugLineNum = 667;BA.debugLine="xi = -1"; _xi = (int) (-1); //BA.debugLineNum = 668;BA.debugLine="dx = -dx"; _dx = (int) (-_dx); }; //BA.debugLineNum = 670;BA.debugLine="Dim D As Int = 2*dx - dy"; _d = (int) (2*_dx-_dy); //BA.debugLineNum = 671;BA.debugLine="Dim x As Int = x0"; _x = _x0; //BA.debugLineNum = 672;BA.debugLine="For y = y0 To y1"; { final int step10 = 1; final int limit10 = _y1; _y = _y0 ; for (;_y <= limit10 ;_y = _y + step10 ) { //BA.debugLineNum = 673;BA.debugLine="points(x,y) = 1"; _points[_x][_y] = (byte) (1); //BA.debugLineNum = 674;BA.debugLine="If D > 0 Then"; if (_d>0) { //BA.debugLineNum = 675;BA.debugLine="x = x + xi"; _x = (int) (_x+_xi); //BA.debugLineNum = 676;BA.debugLine="D = D - 2*dy"; _d = (int) (_d-2*_dy); }; //BA.debugLineNum = 678;BA.debugLine="D = D + 2*dx"; _d = (int) (_d+2*_dx); } }; //BA.debugLineNum = 680;BA.debugLine="End Sub"; return ""; } public String _plotlinelow(int _x0,int _y0,int _x1,int _y1,byte[][] _points) throws Exception{ int _dx = 0; int _dy = 0; int _yi = 0; int _d = 0; int _y = 0; int _x = 0; //BA.debugLineNum = 682;BA.debugLine="Private Sub PlotLineLow(x0 As Int, y0 As Int, x1 A"; //BA.debugLineNum = 683;BA.debugLine="Dim dx As Int = x1 - x0"; _dx = (int) (_x1-_x0); //BA.debugLineNum = 684;BA.debugLine="Dim dy As Int = y1 - y0"; _dy = (int) (_y1-_y0); //BA.debugLineNum = 685;BA.debugLine="Dim yi As Int = 1"; _yi = (int) (1); //BA.debugLineNum = 686;BA.debugLine="If dy < 0 Then"; if (_dy<0) { //BA.debugLineNum = 687;BA.debugLine="yi = -1"; _yi = (int) (-1); //BA.debugLineNum = 688;BA.debugLine="dy = -dy"; _dy = (int) (-_dy); }; //BA.debugLineNum = 690;BA.debugLine="Dim D As Int = 2*dy - dx"; _d = (int) (2*_dy-_dx); //BA.debugLineNum = 691;BA.debugLine="Dim y As Int = y0"; _y = _y0; //BA.debugLineNum = 692;BA.debugLine="For x = x0 To x1"; { final int step10 = 1; final int limit10 = _x1; _x = _x0 ; for (;_x <= limit10 ;_x = _x + step10 ) { //BA.debugLineNum = 693;BA.debugLine="points(x,y) = 1"; _points[_x][_y] = (byte) (1); //BA.debugLineNum = 694;BA.debugLine="If D > 0 Then"; if (_d>0) { //BA.debugLineNum = 695;BA.debugLine="y = y + yi"; _y = (int) (_y+_yi); //BA.debugLineNum = 696;BA.debugLine="D = D - 2*dx"; _d = (int) (_d-2*_dx); }; //BA.debugLineNum = 698;BA.debugLine="D = D + 2*dy"; _d = (int) (_d+2*_dy); } }; //BA.debugLineNum = 700;BA.debugLine="End Sub"; return ""; } public String _plottriangle(int _x0,int _y0,int _x1,int _y1,int _x2,int _y2,byte[][] _points,int _fill) throws Exception{ //BA.debugLineNum = 534;BA.debugLine="Private Sub PlotTriangle(x0 As Int, y0 As Int, x1"; //BA.debugLineNum = 536;BA.debugLine="PlotLine(x0, y0, x1, y1, points)"; _plotline(_x0,_y0,_x1,_y1,_points); //BA.debugLineNum = 537;BA.debugLine="PlotLine(x1, y1, x2, y2, points)"; _plotline(_x1,_y1,_x2,_y2,_points); //BA.debugLineNum = 538;BA.debugLine="PlotLine(x2, y2, x0, y0, points)"; _plotline(_x2,_y2,_x0,_y0,_points); //BA.debugLineNum = 539;BA.debugLine="If Fill > 0 Then"; if (_fill>0) { //BA.debugLineNum = 540;BA.debugLine="FillTriangle(x0, y0, x1, y1, x2, y2, points)"; _filltriangle(_x0,_y0,_x1,_y1,_x2,_y2,_points); }; //BA.debugLineNum = 542;BA.debugLine="End Sub"; return ""; } public String _printandfeedpaper(int _units) throws Exception{ byte[] _params = null; //BA.debugLineNum = 160;BA.debugLine="Public Sub PrintAndFeedPaper(units As Int)"; //BA.debugLineNum = 161;BA.debugLine="WriteString(ESC & \"J\")"; _writestring(_esc+"J"); //BA.debugLineNum = 162;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 163;BA.debugLine="params(0) = units"; _params[(int) (0)] = (byte) (_units); //BA.debugLineNum = 164;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 165;BA.debugLine="End Sub"; return ""; } public int _printimage(medicomed.keymon.com.mx.escposprinter._animage _img) throws Exception{ int _xh = 0; int _xl = 0; int _yh = 0; int _yl = 0; byte[] _params = null; //BA.debugLineNum = 837;BA.debugLine="Public Sub PrintImage(img As AnImage) As Int"; //BA.debugLineNum = 840;BA.debugLine="If img.width > 72 Then Return -1"; if (_img.Width /*int*/ >72) { if (true) return (int) (-1);}; //BA.debugLineNum = 841;BA.debugLine="If img.height > 512 Then Return -2"; if (_img.Height /*int*/ >512) { if (true) return (int) (-2);}; //BA.debugLineNum = 842;BA.debugLine="If img.data.Length < img.width * img.height Then"; if (_img.Data /*byte[]*/ .length<_img.Width /*int*/ *_img.Height /*int*/ ) { if (true) return (int) (-3);}; //BA.debugLineNum = 843;BA.debugLine="Dim xh As Int = img.width / 256"; _xh = (int) (_img.Width /*int*/ /(double)256); //BA.debugLineNum = 844;BA.debugLine="Dim xl As Int = img.width - xh * 256"; _xl = (int) (_img.Width /*int*/ -_xh*256); //BA.debugLineNum = 845;BA.debugLine="Dim yh As Int = img.height / 256"; _yh = (int) (_img.Height /*int*/ /(double)256); //BA.debugLineNum = 846;BA.debugLine="Dim yl As Int = img.height - yh * 256"; _yl = (int) (_img.Height /*int*/ -_yh*256); //BA.debugLineNum = 847;BA.debugLine="Dim params(5) As Byte"; _params = new byte[(int) (5)]; ; //BA.debugLineNum = 848;BA.debugLine="params(0) = 0 '"; _params[(int) (0)] = (byte) (0); //BA.debugLineNum = 849;BA.debugLine="params(1) = xl"; _params[(int) (1)] = (byte) (_xl); //BA.debugLineNum = 850;BA.debugLine="params(2) = xh"; _params[(int) (2)] = (byte) (_xh); //BA.debugLineNum = 851;BA.debugLine="params(3) = yl"; _params[(int) (3)] = (byte) (_yl); //BA.debugLineNum = 852;BA.debugLine="params(4) = yh"; _params[(int) (4)] = (byte) (_yh); //BA.debugLineNum = 853;BA.debugLine="WriteString(GS & \"v0\")"; _writestring(_gs+"v0"); //BA.debugLineNum = 854;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 855;BA.debugLine="WriteBytes(img.data)"; _writebytes(_img.Data /*byte[]*/ ); //BA.debugLineNum = 856;BA.debugLine="WriteString(CRLF)"; _writestring(__c.CRLF); //BA.debugLineNum = 857;BA.debugLine="Return 0"; if (true) return (int) (0); //BA.debugLineNum = 858;BA.debugLine="End Sub"; return 0; } public int _printimage2(int _width,byte[] _data,boolean _highdensity,boolean _dotds24) throws Exception{ String _d = ""; int _xh = 0; int _xl = 0; byte[] _params = null; //BA.debugLineNum = 927;BA.debugLine="Public Sub PrintImage2(width As Int, data() As Byt"; //BA.debugLineNum = 928;BA.debugLine="Dim d As String = Chr(0)"; _d = BA.ObjectToString(__c.Chr((int) (0))); //BA.debugLineNum = 929;BA.debugLine="If Not(highdensity) And Not(dotds24 ) Then"; if (__c.Not(_highdensity) && __c.Not(_dotds24)) { //BA.debugLineNum = 930;BA.debugLine="d = Chr(0)"; _d = BA.ObjectToString(__c.Chr((int) (0))); //BA.debugLineNum = 931;BA.debugLine="If width > 288 Then Return -1"; if (_width>288) { if (true) return (int) (-1);}; //BA.debugLineNum = 932;BA.debugLine="If data.Length <> width Then Return -3"; if (_data.length!=_width) { if (true) return (int) (-3);}; }else if(_highdensity && __c.Not(_dotds24)) { //BA.debugLineNum = 934;BA.debugLine="d = Chr(1)"; _d = BA.ObjectToString(__c.Chr((int) (1))); //BA.debugLineNum = 935;BA.debugLine="If width > 576 Then Return -1"; if (_width>576) { if (true) return (int) (-1);}; //BA.debugLineNum = 936;BA.debugLine="If data.Length <> width Then Return -3"; if (_data.length!=_width) { if (true) return (int) (-3);}; }else if(__c.Not(_highdensity) && _dotds24) { //BA.debugLineNum = 938;BA.debugLine="d = Chr(32)"; _d = BA.ObjectToString(__c.Chr((int) (32))); //BA.debugLineNum = 939;BA.debugLine="If width > 288 Then Return -1"; if (_width>288) { if (true) return (int) (-1);}; //BA.debugLineNum = 940;BA.debugLine="If data.Length <> width*3 Then Return -3"; if (_data.length!=_width*3) { if (true) return (int) (-3);}; }else { //BA.debugLineNum = 942;BA.debugLine="d = Chr(33)"; _d = BA.ObjectToString(__c.Chr((int) (33))); //BA.debugLineNum = 943;BA.debugLine="If width > 576 Then Return -1"; if (_width>576) { if (true) return (int) (-1);}; //BA.debugLineNum = 944;BA.debugLine="If data.Length <> width*3 Then Return -3"; if (_data.length!=_width*3) { if (true) return (int) (-3);}; }; //BA.debugLineNum = 946;BA.debugLine="Dim xh As Int = width / 256"; _xh = (int) (_width/(double)256); //BA.debugLineNum = 947;BA.debugLine="Dim xl As Int = width - xh * 256"; _xl = (int) (_width-_xh*256); //BA.debugLineNum = 948;BA.debugLine="Dim params(2) As Byte"; _params = new byte[(int) (2)]; ; //BA.debugLineNum = 949;BA.debugLine="params(0) = xl"; _params[(int) (0)] = (byte) (_xl); //BA.debugLineNum = 950;BA.debugLine="params(1) = xh"; _params[(int) (1)] = (byte) (_xh); //BA.debugLineNum = 951;BA.debugLine="WriteString(ESC & \"*\" & d)"; _writestring(_esc+"*"+_d); //BA.debugLineNum = 952;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 953;BA.debugLine="WriteBytes(data)"; _writebytes(_data); //BA.debugLineNum = 954;BA.debugLine="WriteString(CRLF)"; _writestring(__c.CRLF); //BA.debugLineNum = 955;BA.debugLine="Return 0"; if (true) return (int) (0); //BA.debugLineNum = 956;BA.debugLine="End Sub"; return 0; } public String _reset() throws Exception{ //BA.debugLineNum = 149;BA.debugLine="Public Sub Reset"; //BA.debugLineNum = 150;BA.debugLine="WriteString(ESC & \"@\")"; _writestring(_esc+"@"); //BA.debugLineNum = 151;BA.debugLine="End Sub"; return ""; } public String _serial1_connected(boolean _success) throws Exception{ //BA.debugLineNum = 1130;BA.debugLine="Private Sub Serial1_Connected(Success As Boolean)"; //BA.debugLineNum = 1131;BA.debugLine="If Success Then"; if (_success) { //BA.debugLineNum = 1132;BA.debugLine="Try"; try { //BA.debugLineNum = 1133;BA.debugLine="Astream.Initialize(Serial1.InputStream, Serial1"; _astream.Initialize(ba,_serial1.getInputStream(),_serial1.getOutputStream(),"astream"); //BA.debugLineNum = 1134;BA.debugLine="Connected = True"; _connected = __c.True; //BA.debugLineNum = 1135;BA.debugLine="ConnectedError = \"\""; _connectederror = ""; //BA.debugLineNum = 1136;BA.debugLine="Serial1.Listen"; _serial1.Listen(ba); } catch (Exception e8) { ba.setLastException(e8); //BA.debugLineNum = 1138;BA.debugLine="Connected = False"; _connected = __c.False; //BA.debugLineNum = 1139;BA.debugLine="ConnectedError = LastException.Message"; _connectederror = __c.LastException(getActivityBA()).getMessage(); }; }else { //BA.debugLineNum = 1142;BA.debugLine="Connected = False"; _connected = __c.False; //BA.debugLineNum = 1143;BA.debugLine="ConnectedError = LastException.Message"; _connectederror = __c.LastException(getActivityBA()).getMessage(); }; //BA.debugLineNum = 1145;BA.debugLine="If SubExists(CallBack, EventName & \"_Connected\")"; if (__c.SubExists(ba,_callback,_eventname+"_Connected")) { //BA.debugLineNum = 1146;BA.debugLine="CallSub2(CallBack, EventName & \"_Connected\", Suc"; __c.CallSubNew2(ba,_callback,_eventname+"_Connected",(Object)(_success)); }; //BA.debugLineNum = 1148;BA.debugLine="End Sub"; return ""; } public String _setbarcodeheight(int _height) throws Exception{ byte[] _params = null; //BA.debugLineNum = 1019;BA.debugLine="Public Sub setBarCodeHeight(height As Int)"; //BA.debugLineNum = 1020;BA.debugLine="WriteString(GS & \"h\")"; _writestring(_gs+"h"); //BA.debugLineNum = 1021;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 1022;BA.debugLine="params(0) = height"; _params[(int) (0)] = (byte) (_height); //BA.debugLineNum = 1023;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 1024;BA.debugLine="End Sub"; return ""; } public String _setbarcodeleft(int _left) throws Exception{ byte[] _params = null; //BA.debugLineNum = 1028;BA.debugLine="Public Sub setBarCodeLeft(left As Int)"; //BA.debugLineNum = 1029;BA.debugLine="WriteString(GS & \"x\")"; _writestring(_gs+"x"); //BA.debugLineNum = 1030;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 1031;BA.debugLine="params(0) = left"; _params[(int) (0)] = (byte) (_left); //BA.debugLineNum = 1032;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 1033;BA.debugLine="End Sub"; return ""; } public String _setbarcodewidth(int _width) throws Exception{ byte[] _params = null; //BA.debugLineNum = 1038;BA.debugLine="Public Sub setBarCodeWidth(width As Int)"; //BA.debugLineNum = 1039;BA.debugLine="WriteString(GS & \"w\")"; _writestring(_gs+"w"); //BA.debugLineNum = 1040;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 1041;BA.debugLine="params(0) = width"; _params[(int) (0)] = (byte) (_width); //BA.debugLineNum = 1042;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 1043;BA.debugLine="End Sub"; return ""; } public String _setcharacterfont(int _font) throws Exception{ //BA.debugLineNum = 247;BA.debugLine="Public Sub setCharacterFont(font As Int)"; //BA.debugLineNum = 248;BA.debugLine="WriteString(ESC & \"M\" & Chr(Bit.And(1,font)))"; _writestring(_esc+"M"+BA.ObjectToString(__c.Chr(__c.Bit.And((int) (1),_font)))); //BA.debugLineNum = 249;BA.debugLine="End Sub"; return ""; } public String _setcharacterspacing(int _spacing) throws Exception{ byte[] _params = null; //BA.debugLineNum = 168;BA.debugLine="Public Sub setCharacterSpacing(spacing As Int)"; //BA.debugLineNum = 169;BA.debugLine="WriteString(ESC & \" \")"; _writestring(_esc+" "); //BA.debugLineNum = 170;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 171;BA.debugLine="params(0) = spacing"; _params[(int) (0)] = (byte) (_spacing); //BA.debugLineNum = 172;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 173;BA.debugLine="End Sub"; return ""; } public String _setcodepage(int _codepage) throws Exception{ byte[] _params = null; //BA.debugLineNum = 236;BA.debugLine="Public Sub setCodePage(codepage As Int)"; //BA.debugLineNum = 237;BA.debugLine="WriteString(ESC & \"t\")"; _writestring(_esc+"t"); //BA.debugLineNum = 238;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 239;BA.debugLine="params(0) = codepage"; _params[(int) (0)] = (byte) (_codepage); //BA.debugLineNum = 240;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 241;BA.debugLine="End Sub"; return ""; } public String _sethrifont(int _font) throws Exception{ //BA.debugLineNum = 1060;BA.debugLine="Public Sub setHriFont(font As Int)"; //BA.debugLineNum = 1061;BA.debugLine="WriteString(GS & \"f\" & Chr(font))"; _writestring(_gs+"f"+BA.ObjectToString(__c.Chr(_font))); //BA.debugLineNum = 1062;BA.debugLine="End Sub"; return ""; } public String _sethriposn(int _posn) throws Exception{ byte[] _params = null; //BA.debugLineNum = 1049;BA.debugLine="Public Sub setHriPosn(posn As Int)"; //BA.debugLineNum = 1050;BA.debugLine="WriteString(GS & \"H\")"; _writestring(_gs+"H"); //BA.debugLineNum = 1051;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 1052;BA.debugLine="params(0) = posn"; _params[(int) (0)] = (byte) (_posn); //BA.debugLineNum = 1053;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 1054;BA.debugLine="End Sub"; return ""; } public String _setjustify(int _justify) throws Exception{ //BA.debugLineNum = 230;BA.debugLine="Public Sub setJustify(justify As Int)"; //BA.debugLineNum = 231;BA.debugLine="WriteString(ESC & \"a\" & Chr(justify + 48))"; _writestring(_esc+"a"+BA.ObjectToString(__c.Chr((int) (_justify+48)))); //BA.debugLineNum = 232;BA.debugLine="End Sub"; return ""; } public String _setleftinset(int _inset) throws Exception{ int _dh = 0; int _dl = 0; byte[] _params = null; //BA.debugLineNum = 178;BA.debugLine="Public Sub setLeftInset(inset As Int)"; //BA.debugLineNum = 179;BA.debugLine="Dim dh As Int = inset / 256"; _dh = (int) (_inset/(double)256); //BA.debugLineNum = 180;BA.debugLine="Dim dl As Int = inset - dh"; _dl = (int) (_inset-_dh); //BA.debugLineNum = 181;BA.debugLine="WriteString(ESC & \"$\" & Chr(dl) & Chr(dh))"; _writestring(_esc+"$"+BA.ObjectToString(__c.Chr(_dl))+BA.ObjectToString(__c.Chr(_dh))); //BA.debugLineNum = 182;BA.debugLine="Dim params(2) As Byte"; _params = new byte[(int) (2)]; ; //BA.debugLineNum = 183;BA.debugLine="params(0) = dl"; _params[(int) (0)] = (byte) (_dl); //BA.debugLineNum = 184;BA.debugLine="params(1) = dh"; _params[(int) (1)] = (byte) (_dh); //BA.debugLineNum = 185;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 186;BA.debugLine="End Sub"; return ""; } public String _setleftmargin(int _margin) throws Exception{ int _dh = 0; int _dl = 0; byte[] _params = null; //BA.debugLineNum = 191;BA.debugLine="Public Sub setLeftMargin(margin As Int)"; //BA.debugLineNum = 192;BA.debugLine="Dim dh As Int = margin / 256"; _dh = (int) (_margin/(double)256); //BA.debugLineNum = 193;BA.debugLine="Dim dl As Int = margin - dh"; _dl = (int) (_margin-_dh); //BA.debugLineNum = 194;BA.debugLine="WriteString(GS & \"L\")"; _writestring(_gs+"L"); //BA.debugLineNum = 195;BA.debugLine="Dim params(2) As Byte"; _params = new byte[(int) (2)]; ; //BA.debugLineNum = 196;BA.debugLine="params(0) = dl"; _params[(int) (0)] = (byte) (_dl); //BA.debugLineNum = 197;BA.debugLine="params(1) = dh"; _params[(int) (1)] = (byte) (_dh); //BA.debugLineNum = 198;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 199;BA.debugLine="End Sub"; return ""; } public String _setlinespacing(int _spacing) throws Exception{ byte[] _params = null; //BA.debugLineNum = 217;BA.debugLine="Public Sub setLineSpacing(spacing As Int)"; //BA.debugLineNum = 218;BA.debugLine="If spacing < 0 Then"; if (_spacing<0) { //BA.debugLineNum = 219;BA.debugLine="WriteString(ESC & \"2\")"; _writestring(_esc+"2"); }else { //BA.debugLineNum = 221;BA.debugLine="WriteString(ESC & \"3\")"; _writestring(_esc+"3"); //BA.debugLineNum = 222;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 223;BA.debugLine="params(0) = spacing"; _params[(int) (0)] = (byte) (_spacing); //BA.debugLineNum = 224;BA.debugLine="WriteBytes(params)"; _writebytes(_params); }; //BA.debugLineNum = 226;BA.debugLine="End Sub"; return ""; } public String _setprintwidth(int _width) throws Exception{ int _dh = 0; int _dl = 0; byte[] _params = null; //BA.debugLineNum = 205;BA.debugLine="Public Sub setPrintWidth(width As Int)"; //BA.debugLineNum = 206;BA.debugLine="Dim dh As Int = width / 256"; _dh = (int) (_width/(double)256); //BA.debugLineNum = 207;BA.debugLine="Dim dl As Int = width - dh"; _dl = (int) (_width-_dh); //BA.debugLineNum = 208;BA.debugLine="WriteString(GS & \"W\")"; _writestring(_gs+"W"); //BA.debugLineNum = 209;BA.debugLine="Dim params(2) As Byte"; _params = new byte[(int) (2)]; ; //BA.debugLineNum = 210;BA.debugLine="params(0) = dl"; _params[(int) (0)] = (byte) (_dl); //BA.debugLineNum = 211;BA.debugLine="params(1) = dh"; _params[(int) (1)] = (byte) (_dh); //BA.debugLineNum = 212;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 213;BA.debugLine="End Sub"; return ""; } public String _setrelativeprintposn(int _relposn) throws Exception{ int _dh = 0; int _dl = 0; byte[] _params = null; //BA.debugLineNum = 269;BA.debugLine="Public Sub setRelativePrintPosn(relposn As Int)"; //BA.debugLineNum = 270;BA.debugLine="Dim dh As Int = relposn / 256"; _dh = (int) (_relposn/(double)256); //BA.debugLineNum = 271;BA.debugLine="Dim dl As Int = relposn - dh"; _dl = (int) (_relposn-_dh); //BA.debugLineNum = 272;BA.debugLine="WriteString(ESC & \"\\\")"; _writestring(_esc+"\\"); //BA.debugLineNum = 273;BA.debugLine="Dim params(2) As Byte"; _params = new byte[(int) (2)]; ; //BA.debugLineNum = 274;BA.debugLine="params(0) = dl"; _params[(int) (0)] = (byte) (_dl); //BA.debugLineNum = 275;BA.debugLine="params(1) = dh"; _params[(int) (1)] = (byte) (_dh); //BA.debugLineNum = 276;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 277;BA.debugLine="End Sub"; return ""; } public String _settabpositions(int[] _tabs) throws Exception{ byte[] _data = null; int _i = 0; //BA.debugLineNum = 255;BA.debugLine="Public Sub setTabPositions(tabs() As Int)"; //BA.debugLineNum = 256;BA.debugLine="WriteString(ESC & \"D\")"; _writestring(_esc+"D"); //BA.debugLineNum = 257;BA.debugLine="Dim data(tabs.Length+1) As Byte"; _data = new byte[(int) (_tabs.length+1)]; ; //BA.debugLineNum = 258;BA.debugLine="For i = 0 To tabs.Length - 1"; { final int step3 = 1; final int limit3 = (int) (_tabs.length-1); _i = (int) (0) ; for (;_i <= limit3 ;_i = _i + step3 ) { //BA.debugLineNum = 259;BA.debugLine="data(i) = tabs(i)"; _data[_i] = (byte) (_tabs[_i]); } }; //BA.debugLineNum = 261;BA.debugLine="data(tabs.Length) = 0"; _data[_tabs.length] = (byte) (0); //BA.debugLineNum = 262;BA.debugLine="WriteBytes(data)"; _writebytes(_data); //BA.debugLineNum = 263;BA.debugLine="End Sub"; return ""; } public String _setusecustomcharacters(boolean _custom) throws Exception{ //BA.debugLineNum = 329;BA.debugLine="Public Sub setUseCustomCharacters(custom As Boolea"; //BA.debugLineNum = 330;BA.debugLine="If custom Then"; if (_custom) { //BA.debugLineNum = 331;BA.debugLine="WriteString(ESC & \"%1\")"; _writestring(_esc+"%1"); }else { //BA.debugLineNum = 333;BA.debugLine="WriteString(ESC & \"%0\")"; _writestring(_esc+"%0"); }; //BA.debugLineNum = 335;BA.debugLine="End Sub"; return ""; } public medicomed.keymon.com.mx.escposprinter._animage _thresholdimage(medicomed.keymon.com.mx.escposprinter._animage _img,int _threshold) throws Exception{ byte[] _pixels = null; int _i = 0; int _lum = 0; medicomed.keymon.com.mx.escposprinter._animage _ret = null; //BA.debugLineNum = 740;BA.debugLine="Sub ThresholdImage(img As AnImage, threshold As In"; //BA.debugLineNum = 741;BA.debugLine="Dim pixels(img.Data.Length) As Byte"; _pixels = new byte[_img.Data /*byte[]*/ .length]; ; //BA.debugLineNum = 742;BA.debugLine="For i = 0 To pixels.Length - 1"; { final int step2 = 1; final int limit2 = (int) (_pixels.length-1); _i = (int) (0) ; for (;_i <= limit2 ;_i = _i + step2 ) { //BA.debugLineNum = 743;BA.debugLine="Dim lum As Int = Bit.And(img.Data(i), 0xff) ' by"; _lum = __c.Bit.And((int) (_img.Data /*byte[]*/ [_i]),((int)0xff)); //BA.debugLineNum = 744;BA.debugLine="If lum < threshold Then"; if (_lum<_threshold) { //BA.debugLineNum = 745;BA.debugLine="lum = 1"; _lum = (int) (1); }else { //BA.debugLineNum = 747;BA.debugLine="lum = 0"; _lum = (int) (0); }; //BA.debugLineNum = 749;BA.debugLine="pixels(i) = lum"; _pixels[_i] = (byte) (_lum); } }; //BA.debugLineNum = 751;BA.debugLine="Dim ret As AnImage"; _ret = new medicomed.keymon.com.mx.escposprinter._animage(); //BA.debugLineNum = 752;BA.debugLine="ret.Width = img.Width"; _ret.Width /*int*/ = _img.Width /*int*/ ; //BA.debugLineNum = 753;BA.debugLine="ret.Height = img.Height"; _ret.Height /*int*/ = _img.Height /*int*/ ; //BA.debugLineNum = 754;BA.debugLine="ret.Data = pixels"; _ret.Data /*byte[]*/ = _pixels; //BA.debugLineNum = 755;BA.debugLine="Return ret"; if (true) return _ret; //BA.debugLineNum = 756;BA.debugLine="End Sub"; return null; } public String _writebarcode(String _bartype,String _data) throws Exception{ byte[] _databytes = null; int _dlow = 0; byte[] _params = null; //BA.debugLineNum = 1076;BA.debugLine="Public Sub WriteBarCode(bartype As String, data As"; //BA.debugLineNum = 1077;BA.debugLine="Dim databytes() As Byte = data.GetBytes(\"ASCII\")"; _databytes = _data.getBytes("ASCII"); //BA.debugLineNum = 1078;BA.debugLine="Dim dlow As Int = databytes.Length"; _dlow = _databytes.length; //BA.debugLineNum = 1079;BA.debugLine="Log(\"Barcode \" & bartype & \", Size \" & dlow & \","; __c.LogImpl("774383363","Barcode "+_bartype+", Size "+BA.NumberToString(_dlow)+", "+_data,0); //BA.debugLineNum = 1080;BA.debugLine="WriteString(GS & \"k\" & bartype.ToUpperCase.CharAt"; _writestring(_gs+"k"+BA.ObjectToString(_bartype.toUpperCase().charAt((int) (0)))); //BA.debugLineNum = 1081;BA.debugLine="Dim params(1) As Byte"; _params = new byte[(int) (1)]; ; //BA.debugLineNum = 1082;BA.debugLine="params(0) = dlow"; _params[(int) (0)] = (byte) (_dlow); //BA.debugLineNum = 1083;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 1084;BA.debugLine="WriteBytes(databytes)"; _writebytes(_databytes); //BA.debugLineNum = 1085;BA.debugLine="End Sub"; return ""; } public String _writebytes(byte[] _data) throws Exception{ //BA.debugLineNum = 281;BA.debugLine="Public Sub WriteBytes(data() As Byte)"; //BA.debugLineNum = 282;BA.debugLine="If Connected Then"; if (_connected) { //BA.debugLineNum = 283;BA.debugLine="Astream.Write(data)"; _astream.Write(_data); }; //BA.debugLineNum = 285;BA.debugLine="End Sub"; return ""; } public String _writeqrcode(int _size,String _ec,int _scale,String _data) throws Exception{ byte[] _databytes = null; int _dhigh = 0; int _dlow = 0; byte[] _params = null; //BA.debugLineNum = 1092;BA.debugLine="Public Sub WriteQRCode(size As Int, EC As String,"; //BA.debugLineNum = 1093;BA.debugLine="Dim databytes() As Byte = data.GetBytes(\"ISO-8859"; _databytes = _data.getBytes("ISO-8859-1"); //BA.debugLineNum = 1094;BA.debugLine="Dim dhigh As Int = databytes.Length / 256"; _dhigh = (int) (_databytes.length/(double)256); //BA.debugLineNum = 1095;BA.debugLine="Dim dlow As Int = databytes.Length - dhigh*256"; _dlow = (int) (_databytes.length-_dhigh*256); //BA.debugLineNum = 1096;BA.debugLine="Log(\"QR Code : Size \" & size & \", EC \" & EC & \","; __c.LogImpl("774448900","QR Code : Size "+BA.NumberToString(_size)+", EC "+_ec+", Scale "+BA.NumberToString(_scale)+", Size "+BA.NumberToString(_dlow)+" "+BA.NumberToString(_dhigh)+" : Data = "+_data,0); //BA.debugLineNum = 1097;BA.debugLine="Dim params(3) As Byte"; _params = new byte[(int) (3)]; ; //BA.debugLineNum = 1098;BA.debugLine="params(0) = scale"; _params[(int) (0)] = (byte) (_scale); //BA.debugLineNum = 1099;BA.debugLine="params(1) = dlow"; _params[(int) (1)] = (byte) (_dlow); //BA.debugLineNum = 1100;BA.debugLine="params(2) = dhigh"; _params[(int) (2)] = (byte) (_dhigh); //BA.debugLineNum = 1101;BA.debugLine="WriteString(ESC & \"Z\" & Chr(size) & EC.ToUpperCas"; _writestring(_esc+"Z"+BA.ObjectToString(__c.Chr(_size))+BA.ObjectToString(_ec.toUpperCase().charAt((int) (0)))); //BA.debugLineNum = 1102;BA.debugLine="WriteBytes(params)"; _writebytes(_params); //BA.debugLineNum = 1103;BA.debugLine="WriteBytes(databytes)"; _writebytes(_databytes); //BA.debugLineNum = 1104;BA.debugLine="End Sub"; return ""; } public String _writestring(String _data) throws Exception{ //BA.debugLineNum = 291;BA.debugLine="Public Sub WriteString(data As String)"; //BA.debugLineNum = 292;BA.debugLine="WriteString2(data, \"IBM437\")"; _writestring2(_data,"IBM437"); //BA.debugLineNum = 293;BA.debugLine="End Sub"; return ""; } public String _writestring2(String _data,String _encoding) throws Exception{ //BA.debugLineNum = 299;BA.debugLine="Public Sub WriteString2(data As String, encoding A"; //BA.debugLineNum = 300;BA.debugLine="Try"; try { //BA.debugLineNum = 301;BA.debugLine="If Connected Then"; if (_connected) { //BA.debugLineNum = 302;BA.debugLine="Astream.Write(data.GetBytes(encoding))"; _astream.Write(_data.getBytes(_encoding)); }; } catch (Exception e6) { ba.setLastException(e6); //BA.debugLineNum = 305;BA.debugLine="Log(\"Printer error : \" & LastException.Message)"; __c.LogImpl("772482822","Printer error : "+__c.LastException(getActivityBA()).getMessage(),0); //BA.debugLineNum = 306;BA.debugLine="AStream_Error"; _astream_error(); }; //BA.debugLineNum = 308;BA.debugLine="End Sub"; return ""; } public Object callSub(String sub, Object sender, Object[] args) throws Exception { BA.senderHolder.set(sender); return BA.SubDelegator.SubNotFound; } }