/ Published in: C#
For MFC, see: http://snipplr.com/view/24917/mfc-cimage-cmitmap-draw-a-sine-wave-and-save-to-a-bmp-file/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
string filename = @"C:\0\test.bmp"; int width = 640; int height = 480; for (int i = 0; i < width; i++) { int y = (int)((Math.Sin((double)i*2.0*Math.PI/width )+1.0)*(height-1)/2.0); b.SetPixel(i, y, Color.Black); } b.Save(filename);