// ■フラクタルな市松模様 #include "myWin.h" #include "math.h" static HDC hbuf; static HBITMAP hBM; double PI=3.14159265358979; double dPI=PI/16; //int CTab1[]={0xFFFFFF, 0x0000FF,0xFF0000,0x00FFFF,0x007700}; //int CTab1[]={0x00FFFF, 0x777700,0x770000,0x00FF00,0x007700}; int CTab1[]={0x00FF00, 0xFF0000,0xAA0000,0x770000,0x550000}; void initBitMap(HWND hw){// ビットマップ作成とメモリデバイスコンテキスト作成 HDC hdc=GetDC(hw); hBM=CreateCompatibleBitmap(hdc,1000,1000); hbuf=CreateCompatibleDC(hdc);SelectObject(hbuf,hBM); SelectObject(hbuf,GetStockObject(NULL_PEN)); PatBlt(hbuf,0,0,1000,1000,WHITENESS); ReleaseDC(hw, hdc); } void Draw(){ int X,Y, L = 512, N=1; for(int ID=0;ID<=4;ID++,L/=4,N*=4){ HPEN p1=CreatePen(PS_SOLID,1,CTab1[ID]); HBRUSH b1 = CreateSolidBrush(CTab1[ID]); SelectObject(hbuf,p1); SelectObject(hbuf,b1); Y = 20; for(int i=0; i