*----------------------------------------------------------------- * Wir lesen den Header der PCX-Datei ein, um zu überprüfen, ob * diese das richtige Format hat. Wenn nicht, wird die PCX-Datei * wieder geschlossen und abgebrochen. *----------------------------------------------------------------- Private lcHeader lcHeader = Fread( m.lnFileHandle, 128 ) If Asc(Substr(m.lcHeader,4,1)) # 8 ; or Asc(Substr(m.lcHeader,66,1)) # 1 =Fclose( m.lnFileHandle ) Return .F. Endif *----------------------------------------------------------------- * Die Höhe und Breite der Datei bestimmen. *----------------------------------------------------------------- Private lnWidth, lnHeight lnWidth = Asc(Substr(m.lcHeader,9,1)) + ; Asc(Substr(m.lcHeader,10,1))*256 + 1 lnHeight = Asc(Substr(m.lcHeader,11,1)) + ; Asc(Substr(m.lcHeader,12,1))*256 + 1 Dimension raObject[m.lnHeight] raObject = "" *----------------------------------------------------------------- * Das Bild einlesen. PCX verwendet ein Run Length Encoding Ver- * fahren, um Daten zu komprimieren. Das bedeutet, wenn ein Byte * in den Daten 0xC0 oder größer ist, gibt die Bits 0-5 die Anzahl * an, wieoft das nachfolgende Byte wiederholt werden soll. Dieser * Wert wird im nachfolgenden Code in der Variablen lnCount gespei- * chert. Ist dieser 0, wird der Wert direkt gelesen. *----------------------------------------------------------------- Private lnPixel, lnCount, lnByte, lnLine lnCount = 0 lnLine = 1 For lnPixel = 1 to m.lnWidth*m.lnHeight If m.lnCount == 0 lnByte = Asc( Fread(m.lnFileHandle,1) ) If m.lnByte >= 192 lnCount = m.lnByte - 192 lnByte = Asc( Fread(m.lnFileHandle,1) ) Else lnCount = 1 Endif Endif lnCount = m.lnCount - 1 If m.lnByte > 127 raObject[m.lnLine] = raObject[m.lnLine] + " " Else raObject[m.lnLine] = raObject[m.lnLine] + "#" Endif If Len(raObject[m.lnLine]) == m.lnWidth lnLine = m.lnLine + 1 Endif EndforThe image is in raObject afterwards. Once you got the image, you have to print it. Unlike images, dot matrix printers print severa lines at once. If I recall correctly, you have to submit the first pixel of 24 lines in the first 3 bytes, then the next pixel of the the same 24 lines in the following 3 bytes, etc. You can use BITSET() to create those bytes from the image.