A topographic map tile, containing a specified Latitude and Longitude, is to be located at the center of a 5 by 5 array of geographically contiguous map tiles. The array of map tiles are shown below where the central map tile containing the specified coordinate set is at position B12:
B00 B01 B02 B03 B04
B05 B06 B07 B08 B09
B10 B11 B12 B13 B14
B15 B16 B17 B18 B19
B20 B21 B22 B23 B24
The individual map tiles are in a BMP-compatible format, with a common 256 color LUT and each containing 256 x 256 pixels for a total of 66,614 bytes including the standard 1078 byte header for a 256 color LUT. It is desired to assemble this 25 tile array into a single BMP compatible file containing 1280 x 1280 pixels. The size of the file would then be 1,639,478 bytes including the 1078 byte header.
The PB code I have used to accomplish this process is shown below. The implementation works correctly but is slower than i would prefer. Could anyone suggest an approach that would be faster than reading each tile into a temporary array (TileArray) and then loading, pixel by pixel, the TileArray contents into the desired location in the 1280 x1280 array (CompositeArray)??
REGISTER Column AS LONG
REGISTER Row AS LONG
DIM RowNumber AS LONG
DIM RowIndex AS LONG
DIM IndexRow AS LONG
DIM ColumnIndex AS LONG
DIM N AS LONG
DIM BMPCount AS LONG
DIM BMPArray(1 TO 66614)AS BYTE
DIM CompositeArray(1 TO 1639478)AS BYTE
FOR BMPCount = 0 TO 24
OPEN "C:\Tile(" & BMPCount & ").bmp" FOR BINARY ACCESS READ AS 1
GET 1, 1, BMPArray()
CLOSE 1
If BMPCount=0 then
FOR N = 1 TO 1078
CompositeArray(N) = BMPArray(N) 'LOAD THE HEADER
NEXT N
END IF
RowIndex = (BMPCount \ 5) * 327680
ColumnIndex = 1079 + (BMPCount MOD 5) * 256
FOR Row = 0 TO 255
IndexRow = Row * 256
RowNumber = RowIndex + IndexRow * 5
FOR Column = 0 TO 255
CompositeArray(ColumnIndex + Column + RowNumber) = BMPArray(1079 + Column + IndexRow)
NEXT Column
NEXT Row
NEXT BMPCount
OPEN C"C:\Composite.bmp" FOR BINARY ACCESS WRITE AS 1
PUT 1, 1, CompositeArray()
CLOSE 1
B00 B01 B02 B03 B04
B05 B06 B07 B08 B09
B10 B11 B12 B13 B14
B15 B16 B17 B18 B19
B20 B21 B22 B23 B24
The individual map tiles are in a BMP-compatible format, with a common 256 color LUT and each containing 256 x 256 pixels for a total of 66,614 bytes including the standard 1078 byte header for a 256 color LUT. It is desired to assemble this 25 tile array into a single BMP compatible file containing 1280 x 1280 pixels. The size of the file would then be 1,639,478 bytes including the 1078 byte header.
The PB code I have used to accomplish this process is shown below. The implementation works correctly but is slower than i would prefer. Could anyone suggest an approach that would be faster than reading each tile into a temporary array (TileArray) and then loading, pixel by pixel, the TileArray contents into the desired location in the 1280 x1280 array (CompositeArray)??
REGISTER Column AS LONG
REGISTER Row AS LONG
DIM RowNumber AS LONG
DIM RowIndex AS LONG
DIM IndexRow AS LONG
DIM ColumnIndex AS LONG
DIM N AS LONG
DIM BMPCount AS LONG
DIM BMPArray(1 TO 66614)AS BYTE
DIM CompositeArray(1 TO 1639478)AS BYTE
FOR BMPCount = 0 TO 24
OPEN "C:\Tile(" & BMPCount & ").bmp" FOR BINARY ACCESS READ AS 1
GET 1, 1, BMPArray()
CLOSE 1
If BMPCount=0 then
FOR N = 1 TO 1078
CompositeArray(N) = BMPArray(N) 'LOAD THE HEADER
NEXT N
END IF
RowIndex = (BMPCount \ 5) * 327680
ColumnIndex = 1079 + (BMPCount MOD 5) * 256
FOR Row = 0 TO 255
IndexRow = Row * 256
RowNumber = RowIndex + IndexRow * 5
FOR Column = 0 TO 255
CompositeArray(ColumnIndex + Column + RowNumber) = BMPArray(1079 + Column + IndexRow)
NEXT Column
NEXT Row
NEXT BMPCount
OPEN C"C:\Composite.bmp" FOR BINARY ACCESS WRITE AS 1
PUT 1, 1, CompositeArray()
CLOSE 1
Comment