Hi,
>How can print inside FPD26 program a graphic file (ex:.pcx,.ico,.bmp) to a Epson compatible printer ? (Of course,used Epson control caracter).
First of all, you need to read the pixels from the file. Here's some code that I use in our FPD 2.6 application to read PCX files with 256 colors and standard encoding (RLE). All colors belowe 128 are considered white, all above to be black:
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
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 = ""
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
Endfor
The 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.
Finally, you need send the image to the printer using the correct control codes which you've asked for in a different question, already.
--
Christof