参考:http://www.matrix67.com/blog/archives/292
c=(0.285,0)的图不知道为什么弄不出来QAQ
用cuda写了一下Julia分形
直接生成bmp (下次写个带交互的能放大缩小的
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <Windows.h>
#include <wingdi.h>
using namespace std;
struct BMP {
template<class T>
void wri(ofstream &os, T data) {
//小端输出
int len = sizeof(T);
char *p = new char[len];
for (int i = 0; i < len; ++i) {
p[i] = data % 256;
data >>= 8;
}
os.write(p, len);
}
BITMAPFILEHEADER p1;
BITMAPINFOHEADER p2;
unsigned char *src;
int wid, hei;
BMP(unsigned char *source, int width, int height):
src(source), wid(width), hei(height) {
p1.bfType = 0x4d42;//"MB" 小端输出变成"BM"
p1.bfSize = 54 + width * height * 4;
p1.bfReserved1 = p1.bfReserved2 = 0;
p1.bfOffBits = 54;
p2.biSize = 40;//40 (in windows)
p2.biWidth = width;
p2.biHeight = height;
p2.biPlanes =