Re: GraphicsPath.IsVisible broken?



I just ran into a similar situation. All you have to do is scale both the GraphicsPath and the point you´re testing by the same proportion.

Following your example:
(sorry if the syntax is not correct. I usually use C#)

Public Sub IsVisibleExample(ByVal e As PaintEventArgs)
Dim myPath As New GraphicsPath
myPath.AddEllipse(0.0, 0.0, 1.0, 1.0)

myPath.Transform(new Matrix(100, 0, 0, 100, 0, 0)) '(1)

Dim visible As Boolean = myPath.IsVisible(0.5 * 100, 0.5 * 100, e.Graphics) '(2)
MessageBox.Show(visible.ToString())
End Sub

(1) Scale by 100 units in both the x and y dimensions. NOTE: If yopu´re planning to use the GraphicsPath again (for drawing it for example) do not scale it, scale a copy instead. The Transform method transforms the object that calls it.

(2) To scale a point just multiply the x and y coordinates by the desired factor.

So, that´s it. The higher the number you use as scale factor the more precise your IsVisible approach will be.

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
.



Relevant Pages

  • Re: MusicWeb and National Socialism
    ... shit about what happened to Jews or other minorities in Germany - Jews ... There's that scale thing again. ... You need to acquire a sense of proportion. ...
    (rec.music.classical.recordings)
  • Re: MusicWeb and National Socialism
    ... shit about what happened to Jews or other minorities in Germany - Jews ... There's that scale thing again. ... There is no sense of proportion when it comes to crimes on massive ...
    (rec.music.classical.recordings)
  • Re: Root cause idiotcy, solution: lower speed limit
    ... >> liability, the total loss of scale and proportion. ...
    (rec.autos.driving)
  • Re: Yes, but is it art?
    ... Jim spoke: ... Monet was also severely myopic, and simply painted *exactly what he ... his proportion and scale are very ...
    (uk.rec.motorcycles)
  • Re: Need to overlay two images
    ... One minor correction. ... He need to keep them in proportion, as you said, so they ... adjust them accordingly, but at the scale he seems to be working at, I ... floodplain map and then set the layer's transparency to something like ...
    (comp.graphics.apps.photoshop)

Loading