move function to generator.c
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
typedef void line_fn(unsigned long y, char *data_buffer);
|
||||
|
||||
void bmp_generate(unsigned long width, unsigned long height,
|
||||
unsigned int color_depth, char *file_path,
|
||||
void generate_line(unsigned long y, char *data_buffer));
|
||||
unsigned int color_depth, char *file_path, line_fn);
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "bmp.h"
|
||||
#include <string.h>
|
||||
|
||||
#define WIDTH 256
|
||||
#define HEIGHT 256
|
||||
#define COLOR_DEPTH 3
|
||||
|
||||
void generate_line(unsigned long y, char *data_buffer) {
|
||||
memset(data_buffer, y, WIDTH * COLOR_DEPTH);
|
||||
}
|
||||
|
||||
void generate() {
|
||||
bmp_generate(WIDTH, HEIGHT, COLOR_DEPTH, "test.bmp", generate_line);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void generate();
|
||||
+2
-12
@@ -1,16 +1,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bmp.h"
|
||||
|
||||
#define WIDTH 256
|
||||
#define HEIGHT 256
|
||||
#define COLOR_DEPTH 3
|
||||
|
||||
void generate_line(unsigned long y, char *data_buffer) {
|
||||
memset(data_buffer, y, WIDTH * COLOR_DEPTH);
|
||||
}
|
||||
#include "generator.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
bmp_generate(WIDTH, HEIGHT, COLOR_DEPTH, "test.bmp", generate_line);
|
||||
generate();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user