Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
fractus5_02.cpp
Package: fenxin.rar [view]
Upload User: hzcygd
Upload Date: 2022-04-30
Package Size: 109k
Code Size: 2k
Category:
Fractal program
Development Platform:
Visual C++
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "fractus5_02.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- #include "glib.h"
- int A=1,B=0,C=1,MAX_COL=4,Y=256;
- double delta=0.0001;TRect rect;
- int colors[16]={0x00000000,0x00FF0000,0x0000FF00,0x00FF8C00,
- 0x000000FF,0x00FF00FF,0x0000FFFF,0x00A0A0A0,
- 0x009BFFFF,0x009BFFFF,0x00A0FF00,0x00FFFF00,
- 0x006E6EFF,0x00FF9BFF,0x009BFFFF,0x00FFFFFF};
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- //细胞自动装置(1)
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- Image1->Height=0;Image1->Top=0;
- Image1->Width=Screen->Width;Image1->Height=Screen->Height;
- rect=Rect(0,0,Image1->Width,Image1->Height);//清屏
- Image1->Canvas->CopyMode=cmBlackness;
- Image1->Canvas->CopyRect(rect,Image1->Canvas,rect);
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::N1Click(TObject *Sender)
- {
- int x,y;
- static int f[640],g[640];
- Image1->Canvas->CopyRect(rect,Image1->Canvas,rect);
- set0(0,72);
- for(x=0;x<640;x++)
- if(x==320)
- {f[x]=1;
- putpixel(x,0,colors[f[x]]);
- }
- else f[x]=0;
- for(y=1;y<Y;y++)
- {for(x=0;x<640;x++)
- {g[x]=(!x)?(B*f[x]+C*f[x+1])
- :((x==639)?(A*f[x-1]+B*f[x]):(A*f[x-1]+B*f[x]+C*f[x+1]));
- g[x]=(g[x]-1)%MAX_COL+1;
- if(g[x])
- putpixel(320+(x-320)/sqrt(3.0),y,colors[g[x]]);
- }
- for(x=0;x<640;x++)
- f[x]=g[x];
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::N2Click(TObject *Sender)
- {
- if(SavePictureDialog1->Execute())
- Image1->Picture->SaveToFile(SavePictureDialog1->FileName);
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::N3Click(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------