feat: change orientation (#7)
* feat: change orientation (wip) * wip * working rotation * small fix in help
This commit is contained in:
+6
-5
@@ -43,12 +43,13 @@ void generate_bmp_line(unsigned short y, unsigned char *data_buffer,
|
||||
unsigned int len) {
|
||||
unsigned int i;
|
||||
unsigned int x;
|
||||
if (y > 0 && (y % global_params.size) == 0) {
|
||||
if (y % global_params.size == 0) {
|
||||
generate_line();
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
x = i / (color_depth * global_params.size);
|
||||
data_buffer[i] = current_line[x * color_depth + (i % color_depth)];
|
||||
data_buffer[(global_params.rotation / 2) == 1 ? i : (len - i - 1)] =
|
||||
current_line[x * color_depth + (i % color_depth)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +69,7 @@ void debug_parameters(parameters params) {
|
||||
printf(" var. %u,%u,%u\n", params.var[0], params.var[1],
|
||||
params.var[2]);
|
||||
}
|
||||
printf(" rot. %d\n", params.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +86,6 @@ void init(parameters params) {
|
||||
current_line[i] = params.start[i % color_depth];
|
||||
}
|
||||
set_seed(params.seed);
|
||||
generate_line();
|
||||
}
|
||||
|
||||
void clean() {
|
||||
@@ -105,8 +106,8 @@ void generate(parameters params) {
|
||||
}
|
||||
clock_t start = clock();
|
||||
init(params);
|
||||
bmp_generate(params.width, params.height, color_depth, params.file_path,
|
||||
generate_bmp_line);
|
||||
bmp_generate(params.width, params.height, color_depth,
|
||||
params.rotation % 2 == 1, params.file_path, generate_bmp_line);
|
||||
clean();
|
||||
print_time(params, start);
|
||||
}
|
||||
Reference in New Issue
Block a user