//完成最后一系列工作,并把缓冲区的内容转成字节数据返回 public static byte[] POS_Print() { if (PrintDirection != 0) { SYS_SetPrintDirection(0); } int nHeight = PageBuffer.Length; int nWidth = PageBuffer[0].Length; int blukHeight = 96; int blukSum = (nHeight + blukHeight - 1) / blukHeight; int byteLength = 8 * blukSum + (nWidth + 7) / 8 * ((nHeight + 7) / 8 * 8); byte[] latestData = new byte[byteLength]; int offset = 0; byte[][] desData; desData = CACULATE.getSampleDesData(blukHeight, nWidth); for (int i = 0; i < nHeight; i = i + blukHeight) { if ((nHeight - i > 0) & (nHeight - i < blukHeight)) { desData = CACULATE.getSampleDesData(nHeight - i, nWidth); } CACULATE.CACU_CutToData(PageBuffer, i, 0, desData); byte[] temp = CACULATE.CACU_PixDataToPrintedCommand(desData, 0); temp.CopyTo(latestData, offset); offset += temp.Length; } return(latestData); }
private static void TAC_PrintLibrary(String sZikuPath, int nFontHeight, int nFontWidth, int nPerWordByte) { FileStream readFileStream = new FileStream(sZikuPath, FileMode.Open); byte[] wordData = new byte[nPerWordByte]; int nWidth = nFontWidth * 16; int nHeight = (nFontHeight + 4) * 12; byte[][] pageData = new byte[nHeight][]; for (int i = 0; i < nHeight; i++) { pageData[i] = new byte[nWidth]; } for (int i = 0; i < nHeight; i = i + nFontHeight + 4) { for (int j = 0; j < nWidth; j = j + nFontWidth) { readFileStream.Read(wordData, 0, nPerWordByte); CACULATE.CACU_CopyData(TAC_TurnFontDataToBit(wordData, nFontHeight, nFontWidth), i, j, pageData); } } COMMUNICATION.CMNCT_Send(CACULATE.CACU_PixDataToPrintedCommand(pageData, 0)); }