GraphicsPath IsVisible

C

Crirus

Hi
Is that true that this IsVisible method is incredible slow?

Seems that my app is much slower with only this added as a condition to draw
something

Crirus
 
A

Armin Zingler

Crirus said:
Is that true that this IsVisible method is incredible slow?

Seems that my app is much slower with only this added as a condition
to draw something

If you don't get an answer here:
microsoft.public.dotnet.framework.drawing
 
J

Jay B. Harlow [MVP - Outlook]

Crirus,
How complex is your GraphicsPath?

I currently do not use a GraphicsPath for clipping, I am thinking of using
it for drawing but need to figure out the logic, so I do not continue to
redraw the GraphicsPath, in a Paint event.

I would think the speed of GraphicsPath.IsVisible is dependant on how
complex your GraphicsPath is.

If the GraphicsPath has a number of unrelated figures in it, IsVisible would
need to check each figure, which obviously will take time.

I would also refer you to the microsoft.public.dotnet.framework.drawing
newsgroup.

Hope this helps
Jay
 
C

Crirus

Well, Jay, there are only 2 circles in my path... and I dont know another
way to clip the image instead of GraphicsPath
 
C

Crirus

No, I draw a bitmap with setPixel
Only certain regions must be drawed
I test if a point is inside the region in order to set that pixel
Seems that si much faster to draw the whole bounding region rectangle once
and redraw with clipping after is finished, so I get only that region drawed
 
J

Jay B. Harlow [MVP - Outlook]

Crirus,
I would not expect 2 circles to perform badly, 2000 circles yes, 2 circles
no. My concern is it is breaking the 2 circles into many rectangles &
checking each rectangle. Not sure how to check that, other then testing a
GraphicsPath with 2 circles & a GraphicsPath with 2 Rectangles to see if
there is a difference.

I'll try and play with it later this weekend, and get back to you.

I noticed you asked in the drawing newsgroup, but the person I expected to
"know" did not respond to you...

Is there anything mentioned on this GDI+ FAQ?

http://www.bobpowell.net/gdiplus_faq.htm

I'm not sure about other GDI+ FAQs you could check...

Hope this helps
Jay
 
C

Crirus

Hi
I can tell you that IsVisible on my 2 circles is so slow so I droped the
ideea... to draw the whole 512x512 image that is 3 times bigger than path
inside it take about 2-3 seconds. To draw only inside the path with
IsVisible take 10 secs at least
Is eye noticeable :(((

Regards, Crirus
 
Joined
Nov 15, 2011
Messages
1
Reaction score
0
Hi
Is that true that this IsVisible method is incredible slow?

Seems that my app is much slower with only this added as a condition to draw
something

Crirus

This reply might be a bit late but yes, GraphicsPath.IsVisible can be incredibly slow. Use a Region instead, which you can create from the GraphicsPath:

Region MyRegion = new Region(GraphicsPath);

the .IsVisble method of the region is very fast.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top