Re: How to draw with a PEN ?? Please help

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Pamela -

I'll defer to Frank's much more extensive knowledge in this area. But I can
provide some information about why you are seeing what you're seeing - at
least, what I think is happening - as well as my own suggestions.

When filling a rectangle, GDI (and GDI+) doesn't consider the bottom and
right sides of the rectangle. The algorithm, as I understand it, is defined
such that the area of the rectangle includes the top and left sides, but not
the bottom and right sides. I don't know what your matrix of points looks
like, but given what you're doing, I would guess that you're essentially
working with rectangles that are "twisted" through various transformations
into the shapes you need for each section. Given that, this algorithm is
going to come back and bite you.

You might try modifying the edge-drawing code to only consider the "right"
and "bottom" portions of your edges, since it appears to be your "left" and
"top" edges that are giving you fits. I don't know whether this is
possible, and even if it is, it makes for a bunch of ugly DrawLine code.
The definition of "right and "bottom" may not be intuitively obvious from
the transformations you do, especially given that you need to generalize the
determination. It also adds even more time to the rendering operations,
since once you've twisted your rectangle, you have to examine all points to
find the right and bottom sides. While you could theoretically save some
time in the drawing phase - you're only drawing half the lines, after all -
I don't know whether that would offset all the additional polygon
calculations. Outside of that, Frank's suggestion of one massive polygon is
about all I can offer, and I would heartily agree with him that that's a
tall order.

Frank - would employing a GraphicsPath that contains all the polygon edges
to draw be a possible solution?

- Scott

<expertware@xxxxxxxxx> wrote in message
news:1122398085.968497.162690@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Dear Scott,
>
> thank you very much. Your analysis is enlighting.
> As I understand there is no way to eliminate the problem if I draw the
> edges.
>
> Actually I would be happy to avoid drawing the edges (which slows
> down), but the essential reason
> why I am doing it is that, if I don't, between the faces you can
> sometime see a thin white line (due
> to rounding I guess), which is *very* ugly.
>
> To show this problem , I have placed a picture for you (or any other
> interested) here : http://151.100.3.84/technicalpreview/scott.htm
>
> So back to the problem. How can I get this doughnut transparent and at
> the same time not having
> those ugly white spaces between faces? It would seem an elementary
> issue.
>
> By the way, faces are done simply with this instruction:
> Graphics.FillClosedCurve(FacesBrush, .Points)
>
> Thank you,
>
>
> Pamela
>


.



Relevant Pages

  • Re: VB Printer Dialog Problem (VB6)
    ... Now of course you will probably want the right and bottom margins to also be 15 millimeters from the edges of the physical page as well. ... One other point is that when you have calculated these values you need to check that those positions do not lie outside of the printer's current "printable rectangle". ... You can check this by checking the values returned by the GetDeviceCaps API for PHYSICALOFFSETX and PHYSICALOFFSETY, which are always in printer pixels so you'll need to convert. ...
    (comp.lang.basic.visual.misc)
  • Re: How to draw with a PEN ?? Please help
    ... I would assume that the filling of shapes - rectangular or otherwise - is ... Given how your polygon matrix is defined, ... To try and simplify what I was talking about, if you fill a rectangle, the ... are you doing this entirely within GDI+? ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: DrawText fails when attempting to retrieve string extents
    ... "Phil Taylor" wrote in message ... > DT_CALCRECT is filling Right and Bottom to make the rectangle big enough. ... list that will allow the specification of a Rect. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: How to get tranformed bounds?
    ... bounding rectangle for those using a simple min-max test. ... bottom = Math.Max ... Private Sub TestNonWorkingBob() ... Dim left As Integer = 100000 ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: A tables question!
    ... draw the AutoShape rectangle and set it behind text), ... of the Format AutoShape dialog is grayed out -- because the AutoShape ... bottom coincide with the table's top and bottom. ...
    (microsoft.public.word.pagelayout)