save bmp
This commit is contained in:
parent
bcdea67e9a
commit
02e42d5efd
1 changed files with 10 additions and 7 deletions
11
mandelbrot.c
11
mandelbrot.c
|
@ -18,10 +18,6 @@ int main(int argc, char *argv[]) {
|
||||||
int y = i / screen->w;
|
int y = i / screen->w;
|
||||||
int x = i % screen->w;
|
int x = i % screen->w;
|
||||||
|
|
||||||
if (x == 0) {
|
|
||||||
printf("y = %d\n", y);
|
|
||||||
}
|
|
||||||
|
|
||||||
float complex c = ((3.0 * x / screen->w) - 2.0)
|
float complex c = ((3.0 * x / screen->w) - 2.0)
|
||||||
+ I * ((2.0 * y / screen->h) - 1.0);
|
+ I * ((2.0 * y / screen->h) - 1.0);
|
||||||
|
|
||||||
|
@ -47,6 +43,13 @@ int main(int argc, char *argv[]) {
|
||||||
if (y % 10 == 0)
|
if (y % 10 == 0)
|
||||||
SDL_Flip(screen);
|
SDL_Flip(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save BMP */
|
||||||
|
char *file = "mandelbrot.bmp";
|
||||||
|
if (SDL_SaveBMP(screen, file) != 0) {
|
||||||
|
fprintf(stderr, "Could not write %s!\n", file);
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_MUSTLOCK(screen)) {
|
if (SDL_MUSTLOCK(screen)) {
|
||||||
SDL_UnlockSurface(screen);
|
SDL_UnlockSurface(screen);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue