Open main menu

CDOT Wiki β

Changes

GPU610 Team Tsubame

1,021 bytes added, 18:01, 5 April 2017
Maze
== PHASE 2 ==
=== Maze ===
 
* Introduction:
 
The Maze program (by corzani@github) generates a maze image (of type PNG).
 
This funtion creates the canvas of the Maze and initialize it by filling all the hexadecimal within each pixel
After the canvas is filled, the function calls the createImage function.
 
Finally, the function write the result from the createImage function in a png file using the "lpng" extension
The function returns void.
void MazePng::toPng(unsigned int scale)
...
color_type = PNG_COLOR_TYPE_RGB;
bit_depth = 8;
row_pointers = new png_bytep[height];
// This for loop filling all the hexadecimal within each pixel.
for (int i = 0; i < height; ++i) {
row_pointers[i] = new png_byte[width * 3];
// The inner for loop fills all three colours (red, green, blue) to the pixel.
for (int j = 0; j < width * 3; j += 3) {
row_pointers[i][j] = WALL;
row_pointers[i][j + 1] = WALL;
row_pointers[i][j + 2] = WALL;
}
}
createImage(row_pointers, 0);
...
'''Testing Environment:'''
46
edits