473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Bad performance of .NET drawing

Dear all,
I have about 500 rectangles on the picturebox, and if I take one with the
move and move I MUST clear the whole picture and redraw, which takes about
1-2 second. The rectangles are drawen with FillRectangle(.). Is there a
better way to have the whole rendering much faster. (I have no problem with
flickers, because of rendering into memory).
Thanks in advance,
Nov 17 '05 #1
6 5284
Try turning off the various anti-aliasing and alpha-blending options
on the Graphics object you're drawing to. If that doesn't help you'll
have to manually draw pixels to a locked bitmap. That would require
pointer arithmetic and C# "unsafe" mode. If that still doesn't help
you'll have to use interop calls to C/C++, or wait for Avalon.

On Wed, 11 May 2005 02:00:37 +0200, "Boni" <oilia@nospam> wrote:
Dear all,
I have about 500 rectangles on the picturebox, and if I take one with the
move and move I MUST clear the whole picture and redraw, which takes about
1-2 second. The rectangles are drawen with FillRectangle(.). Is there a
better way to have the whole rendering much faster. (I have no problem with
flickers, because of rendering into memory).
Thanks in advance,

--
http://www.kynosarges.de
Nov 17 '05 #2

"Christoph Nahr" <ch************@kynosarges.de> wrote in message
news:55********************************@4ax.com...
Try turning off the various anti-aliasing and alpha-blending options
on the Graphics object you're drawing to. If that doesn't help you'll


Hi there

How do you turn of anti-aliasing and alpha blending on a graph object ?

--
Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net.
Current issue Diving in North America, 99 pages.
Download it in PDF
Nov 17 '05 #3
On Wed, 11 May 2005 09:41:16 +0200, "Søren Reinke"
<so***@reinke.fjernmig.dk> wrote:
How do you turn of anti-aliasing and alpha blending on a graph object ?


There are a bunch of System.Drawing.Graphics properties with somewhat
obscure names for this purpose:

CompositingMode -> SourceCopy turns off alpha blending
CompositingQuality -> HighSpeed turns off compositing
PixelOffsetMode -> None turns off one anti-aliasing method
SmoothingMode -> None turns off another anti-aliasing method

There's also TextRenderingHint for text drawing but you probably don't
want to change that.
--
http://www.kynosarges.de
Nov 17 '05 #4
>
How do you turn of anti-aliasing and alpha blending on a graph object ?


There are a bunch of System.Drawing.Graphics properties with somewhat
obscure names for this purpose:

CompositingMode -> SourceCopy turns off alpha blending
CompositingQuality -> HighSpeed turns off compositing
PixelOffsetMode -> None turns off one anti-aliasing method
SmoothingMode -> None turns off another anti-aliasing method

There's also TextRenderingHint for text drawing but you probably don't
want to change that.


Thanks for the tips, i'll to add it to see if my drawing will get speeded up
as well.

--
Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net.
Current issue Diving in North America, 99 pages.
Download it in PDF
Nov 17 '05 #5
On Wed, 11 May 2005 11:15:20 +0200, "Søren Reinke"
<so***@reinke.fjernmig.dk> wrote:
CompositingMode -> SourceCopy turns off alpha blending
CompositingQuality -> HighSpeed turns off compositing


Sorry, made a stupid mistake here. Alpha blending and compositing is
the same thing. When you switch CompositingMode to SourceCopy it's
turned off altogether, so the CompositingQuality value is ignored.
--
http://www.kynosarges.de
Nov 17 '05 #6

"Christoph Nahr" <ch************@kynosarges.de> wrote in message
news:ql********************************@4ax.com...
On Wed, 11 May 2005 11:15:20 +0200, "Søren Reinke"
<so***@reinke.fjernmig.dk> wrote:
CompositingMode -> SourceCopy turns off alpha blending
CompositingQuality -> HighSpeed turns off compositing


Sorry, made a stupid mistake here. Alpha blending and compositing is
the same thing. When you switch CompositingMode to SourceCopy it's
turned off altogether, so the CompositingQuality value is ignored.


Hehe, no problem.

Just shows you are human :)

--
Søren Reinke
www.Xray-Mag.com/ - Your free diving magazin on the net.
Current issue Diving in North America, 99 pages.
Download it in PDF
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Leif K-Brooks | last post by:
I'm considering writing a fairly basic vector drawing program using PyGTK. What's the best way to render it? What I'm thinking of is having everything render on a PIL image, then display that in...
12
by: Gustavo L. Fabro | last post by:
Greetings! Getting straight to the point, here are the results of my experiment. I've included my comments and questions after them. The timing: (The total time means the sum of each line's...
6
by: James dean | last post by:
I have heard that the video drivers in GDI+ are a big performance issue. But is this only an issue with something like Games Programming i think...is this wrong?. What about a drawing application...
1
by: James dean | last post by:
Could someone explain how this works. I think the graphics card is used to do blitting and drawing shapes like rectangles. How does it draw using the Graphics card on the PC and why is this feature...
0
by: Ivan | last post by:
I have the SystemMonitor ActiveX control on a form and I try to register a custom performance counter. I expect that after registering the counter with the OS, the user would be able to add it...
1
by: Hadar | last post by:
Hi, I'm getting "object is currently in use elsewhere" when I use System.Drawing.Graphics.MesureString. This is what I do: My controls use a utility class the helps it to mesure strings. To...
4
by: James Radke | last post by:
Hello, I am creating an owner draw listbox for a windows application. It is all working, except the performance is significantly slower than the standard listbox. Basically what I have done is...
1
by: Niels Jensen | last post by:
Hi guys, I have the following code which is supposed to draw a grid in a panel consisting of a specified number of squares. I can get it to draw the grid and activate the autoscroll feature,...
11
by: cty0000 | last post by:
I have some quiestion... I want to draw line,point,rectangles and etc... on the from So I code like this.. public update() { g = this.CreateGraphics(); g.FillRectangle(Brushes.White, x1,...
2
by: JMecc0 | last post by:
I am drawing simple graphics on a custom control which has a static background image. When I try to rapidly (maybe 50 times per second) redraw the graphics the computer can't keep up. There is no...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.