替代使用Bitmap [英] Alternative to using Bitmap

查看:59
本文介绍了替代使用Bitmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是VB.NET的新手。我已经创建了一个程序,在窗体上随机绘制像素。

。我有19英寸的液晶显示器的分辨率设置为1280×1024.如果你需要数学,那就意味着有超过130万像素。在该程序的一个

版本中,像素开始绘制在左上角和左上角。下来

表格从上到下&左到右。在另一个版本中,像素

随机绘制。我有一个2.4 GHZ Athlon 64和1 GB的RAM。如果

DrawImage在For-Next循环中,我可以看到正在绘制的像素。

它是sooo slooow!如果DrawImage在For-Next循环之外,我会坐下来在绘制图像之前,以空白形式盯着

。不幸的是,它的.NET等价物没有Pset或

。微软以其无限的智慧选择不包括它的b $ b。我希望能够创建一个可以绘制分形的程序。我知道

分形计算非常耗时。我不想等待

小时才能看到分形。是否有更快的方法来绘制单个像素

而无需使用Bitmap?记住,我是新手。我不想要b $ b想要一种复杂的复杂方式来绘制像素。我可以创建一个物体

,它会比Bitmap更快地绘制像素,还是我运气不好?什么是

Path对象?我可以用它来绘制单个像素吗?谢谢。大卫

解决方案

你能先用矩形阵列预先构建你的分形,然后

把它画成一幅图像吗? />
假装2D数组是您要绘制的表单。最后只画它






pcnerd写道:
< blockquote class =post_quotes>
我是VB.NET的新手。我已经创建了一个程序,在窗体上随机绘制像素。

。我有19英寸的液晶显示器的分辨率设置为1280×1024.如果你需要数学,那就意味着有超过130万像素。在该程序的一个

版本中,像素开始绘制在左上角和左上角。下来

表格从上到下&左到右。在另一个版本中,像素

随机绘制。我有一个2.4 GHZ Athlon 64和1 GB的RAM。如果

DrawImage在For-Next循环中,我可以看到正在绘制的像素。

它是sooo slooow!



向我们展示您的代码。我自己没有特别优化的Mandelbrot计划

全屏显示Mandelbrot套装的一部分,一半是,b
半,在大约7秒内完成3 GHz P4。请注意,像

这样的程序在没有附加

debuger的情况下运行时通常会更快(数量级) - 一旦没有已知的错误,使用Ctrl + F5运行<尝试这个。$ / b $ b而不是F5。


如果DrawImage在For-Next循环之外,我坐下来&在绘制图像之前,以空白形式盯着

。不幸的是,它的.NET等价物没有Pset或

。微软以其无限的智慧选择不包括它的b $ b。



什么是Bitmap.SetPixel呢?


-

Larry Lard

回复团体请

在开始一个新主题时,请提一下您使用哪个版本的VB / C#



不要为您绘制的每个像素绘制位图。使用

计数器并为每千个像素或其他东西绘制位图。


pcnerd写道:


我是VB.NET的新手。我已经创建了一个程序,在窗体上随机绘制像素。

。我有19英寸的液晶显示器的分辨率设置为1280×1024.如果你需要数学,那就意味着有超过130万像素。在该程序的一个

版本中,像素开始绘制在左上角和左上角。下来

表格从上到下&左到右。在另一个版本中,像素

随机绘制。我有一个2.4 GHZ Athlon 64和1 GB的RAM。如果

DrawImage在For-Next循环中,我可以看到正在绘制的像素。

它是sooo slooow!如果DrawImage在For-Next循环之外,我会坐下来在绘制图像之前,以空白形式盯着

。不幸的是,它的.NET等价物没有Pset或

。微软以其无限的智慧选择不包括它的b $ b。我希望能够创建一个可以绘制分形的程序。我知道

分形计算非常耗时。我不想等待

小时才能看到分形。是否有更快的方法来绘制单个像素

而无需使用Bitmap?记住,我是新手。我不想要b $ b想要一种复杂的复杂方式来绘制像素。我可以创建一个物体

,它会比Bitmap更快地绘制像素,还是我运气不好?什么是

Path对象?我可以用它来绘制单个像素吗?谢谢。 David


I''m a VB.NET newbie. I''ve created a program that plots pixels at random on
the form. I have a 19" LCD monitor with a resolution set to 1280 by 1024. If
you do the math, that means that there are over 1.3 million pixels. In one
version of the program, the pixels start plotting at the upper-left & go down
the form from top to bottom & left to right. In another version, the pixels
are plotted at random. I have a 2.4 GHZ Athlon 64 with 1 gigabyte of RAM. If
DrawImage is inside the For-Next loop, I can see the pixels being plotted.
It''s sooo slooow! If DrawImage is outside of the For-Next loop, I sit & stare
at a blank form until the image is drawn. Unfortunately, there is no Pset or
its .NET equivalent. Microsoft in its infinite wisdom chose to not include
it. I want to be able to create a program that can draw fractals. I know that
fractal calculations are time-consuming. I don''t want to have to wait for
hours to see a fractal. Is there a faster way to plot individual pixels
without having to resort to using Bitmap? Remember, I''m a newbie. I don''t
want a complicated convoluted way to draw pixels. Can I create an object
that will plot pixels faster than Bitmap or am I out of luck? What is the
Path object? Can I use that to plot individual pixels? Thank you. David

解决方案

Can you preconstruct your fractal in a rectangular array first, then
draw it as one image?
Pretend a 2D array is your form that you are drawing to. Only draw it
at the end.



pcnerd wrote:

I''m a VB.NET newbie. I''ve created a program that plots pixels at random on
the form. I have a 19" LCD monitor with a resolution set to 1280 by 1024. If
you do the math, that means that there are over 1.3 million pixels. In one
version of the program, the pixels start plotting at the upper-left & go down
the form from top to bottom & left to right. In another version, the pixels
are plotted at random. I have a 2.4 GHZ Athlon 64 with 1 gigabyte of RAM. If
DrawImage is inside the For-Next loop, I can see the pixels being plotted.
It''s sooo slooow!

Show us your code. My own not-particularly-optimised Mandelbrot program
does a full screen of a part of the Mandelbrot set that is half in,
half out, in about 7 seconds on a 3 GHz P4. Note that programs like
this are often much (order of magnitude) quicker when run without the
debuger attached - once there are no known bugs, run with Ctrl+F5
rather than F5 to try this.

If DrawImage is outside of the For-Next loop, I sit & stare
at a blank form until the image is drawn. Unfortunately, there is no Pset or
its .NET equivalent. Microsoft in its infinite wisdom chose to not include
it.

What''s Bitmap.SetPixel then?

--
Larry Lard
Replies to group please
When starting a new topic, please mention which version of VB/C# you
are using


Don''t draw the bitmap for every single pixel that you draw. Use a
counter and draw the bitmap for every thousand pixel or something.

pcnerd wrote:

I''m a VB.NET newbie. I''ve created a program that plots pixels at random on
the form. I have a 19" LCD monitor with a resolution set to 1280 by 1024. If
you do the math, that means that there are over 1.3 million pixels. In one
version of the program, the pixels start plotting at the upper-left & go down
the form from top to bottom & left to right. In another version, the pixels
are plotted at random. I have a 2.4 GHZ Athlon 64 with 1 gigabyte of RAM. If
DrawImage is inside the For-Next loop, I can see the pixels being plotted.
It''s sooo slooow! If DrawImage is outside of the For-Next loop, I sit & stare
at a blank form until the image is drawn. Unfortunately, there is no Pset or
its .NET equivalent. Microsoft in its infinite wisdom chose to not include
it. I want to be able to create a program that can draw fractals. I know that
fractal calculations are time-consuming. I don''t want to have to wait for
hours to see a fractal. Is there a faster way to plot individual pixels
without having to resort to using Bitmap? Remember, I''m a newbie. I don''t
want a complicated convoluted way to draw pixels. Can I create an object
that will plot pixels faster than Bitmap or am I out of luck? What is the
Path object? Can I use that to plot individual pixels? Thank you. David


这篇关于替代使用Bitmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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