J
jimgardener
i am trying to digitize a text file into tiff image.the algorithm is
as follows,
There is a 8x16, 256 character font table with 16 columns and 256
rows .each row of table represents a character(like 0...32,A,a etc)
and each column represents a row of font (font is of height
16).elements of the table are like 0x00,0x7e,0x81,0xff etc.Finding the
dot pattern for any character is done by using the value of a
character as one index into the font array, with the font row being
the other index.
i want to get a line of text from the file and using a for loop of 16
times (fontheight is 16) each character is examined and values are
taken from the font table
if textline is a line of text (probably obtained by readLine() of
BufferedReader)
int imageoffset=0;
for (int row=0 ; row<FONTHEIGHT ; row++){
for(int i=0;i<lengthof_textline;i++){
if(textline>SPACE){
bitimage[imageoffset++]=fonts[textline][row] ;
}
}
bit_image[imageoffset++]=EOLFLAG ;
}
here some constants are used to denote EOLFLAG ,SPACE etc
EOLFLAG =0x01 (hoping it will not occur for any in font data)
SPACE =0x20
the idea is to build bit_image with these hexadecimal values and
finally use this array to write an image(Tiff).There are some points
i would like to know
1.should i use a char array to represent bit_image? i believe that the
font table's array should be char[16][256] .
2.if bit_image is a char array filled with these font codes,can any
api translate it to a tiff image?I couldn't work out how to do this
using JAI.if anyone can ,pls help
jim
as follows,
There is a 8x16, 256 character font table with 16 columns and 256
rows .each row of table represents a character(like 0...32,A,a etc)
and each column represents a row of font (font is of height
16).elements of the table are like 0x00,0x7e,0x81,0xff etc.Finding the
dot pattern for any character is done by using the value of a
character as one index into the font array, with the font row being
the other index.
i want to get a line of text from the file and using a for loop of 16
times (fontheight is 16) each character is examined and values are
taken from the font table
if textline is a line of text (probably obtained by readLine() of
BufferedReader)
int imageoffset=0;
for (int row=0 ; row<FONTHEIGHT ; row++){
for(int i=0;i<lengthof_textline;i++){
if(textline>SPACE){
bitimage[imageoffset++]=fonts[textline][row] ;
}
}
bit_image[imageoffset++]=EOLFLAG ;
}
here some constants are used to denote EOLFLAG ,SPACE etc
EOLFLAG =0x01 (hoping it will not occur for any in font data)
SPACE =0x20
the idea is to build bit_image with these hexadecimal values and
finally use this array to write an image(Tiff).There are some points
i would like to know
1.should i use a char array to represent bit_image? i believe that the
font table's array should be char[16][256] .
2.if bit_image is a char array filled with these font codes,can any
api translate it to a tiff image?I couldn't work out how to do this
using JAI.if anyone can ,pls help
jim