分形的2D图形 [英] 2d graphics for fractals

查看:133
本文介绍了分形的2D图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个显示Mandelbrot分形的C#程序.哪些图形工具最适合执行此操作. GDI +,WPF还是其他?除了简单的表单和控件外,我从未使用过图形.

I want to do a C# program that shows a mandelbrot fractal. What graphics tools is the best suited to do this. GDI+, WPF or other? I have never worked with graphics other than simple forms and controls.

推荐答案

看看这个: ^ ]它仅使用SetPixel,它是System.Drawing的一部分.
Have a look at this: Mandelbrot Set for C#[^] it just uses SetPixel, which is part of System.Drawing


WPF或System.Drawing可以为您工作.我建议您使用位图进行渲染.这样,您可以在复杂的平原上拥有一棵已经计算出的区域的树,并且可以使用鼠标选择从任何已渲染的区域中得出新区域.

我只会警告您不要使用SetPixel.即使计算也很慢...

Wind System.Drawing,您应该使用基于LockBits的技术:
http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx [ ^ ].

使用WPF,您可以使用System.Windows.Media.Imaging.WriteableBitmap:
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx [ ^ ].

两个MSDN页面都有一些代码示例,这些示例显示了如何在不使用SetPixel
的情况下工作
—SA
Either WPF or System.Drawing with System.Windows.Forms could work for you. I would suggest you use a bitmap for rendering. This way, you can have a tree of already calculated regions on a complex plain, and you can derive new region from any of the already rendered regions using mouse selection.

I only would warn you against using SetPixel. Even though calculations are pretty slow, too…

Wind System.Drawing, you should use the technique based on LockBits:
http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx[^].

With WPF, you would use System.Windows.Media.Imaging.WriteableBitmap:
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx[^].

Both MSDN pages have some code samples showing how to work without SetPixel

—SA


这篇关于分形的2D图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆