home *** CD-ROM | disk | FTP | other *** search
- procedure procolor(zdr_name :string;max_row_tiles, max_col_tiles :byte;
- no_of_cols_tiles: integer; start_tile:longint );
- var
- fv : file;
- ro, col, grdrv,grmod,n : integer;
- ch : char;
- buf : array[0..49151] of byte;
- pos ,tile, columna, fila,
- col_of_tiles, row_of_tiles : longint;
- r1, g1, b1, color : byte;
-
- {$I mvtopos.pas}
- {$I pro4bit.pas}
-
- begin {procedure}
- grdrv := EGA;grmod := EGAHi;
- InitGraph(grdrv,grmod,'');
- assign(fv,zdr_name);reset(fv,1);
- for row_of_tiles := 1 to max_row_tiles do
-
- for col_of_tiles := 1 to max_col_tiles do
- begin
-
- tile := (row_of_tiles-1)*no_of_cols_tiles
- + col_of_tiles + start_tile;
-
- pos := (tile-1) *49152 +2048; {128*128*3=49152}
- move_to_position(fv,pos);
- blockread(fv,buf,49152); { read all 3 bands of a tile
- to the buffer}
-
- for ro := 0 to 127 do
- for col := 0 to 127 do
- begin {for ro and col loops}
- r1 :=buf[ ro*128 + col ]; { locate the R,G,and B }
- g1 :=buf[ (ro+127)*128 + col + 128 ]; { value for a pixel }
- b1 :=buf[ (ro+254)*128 + col + 256 ];
- { return the cluster closest to this R-G-B combination }
- bit4(r1,g1,b1,color);
- columna := col+(col_of_tiles-1)*128; { transform tile coords. }
- fila := ro+(row_of_tiles-1)*128; { to screen coords. }
-
- { assign the EGA color to the pixel from the ones available to Turbo P
- this set works ~OK for some of the Germany Maps-TLMs. }
-
- case color of
- 0 : putpixel(columna,fila,15); {white}
- 4 : putpixel(columna,fila,0); {brown, black}
- 5 : putpixel(columna,fila,10); {l. green}
- 9 : putpixel(columna,fila,8); {gray}
- 12 : putpixel(columna,fila,9); {blue}
- 13,14 : putpixel(columna,fila,0); {black}
- 1,2,3,6,7 :putpixel(columna,fila,15); {l. gray, white}
- 8,10,11,15 :putpixel(columna,fila,7); {l. gray}
- end; {case}
-
- end; {for ro and col loops}
- end; {for col_of_tiles and row_of_tiles loops}
- end; {procedure}