Re: How to draw with a PEN ?? Please help
- From: "Scott McChesney" <scott.NO.SPAM.mcchesney@xxxxxxxxxxx>
- Date: Tue, 26 Jul 2005 09:05:00 -0500
Pamela -
After doing some tests, here's what I believe the issue is.
Your lines are not being drawn with an alpha of 255. What's happening is
that, since you are drawing over your filled shapes, the alpha-100 pen is
blending with the alpha-100 background and creating a color somewhere
between alpha-100 and alpha-255. Note that, if you draw your polygons and
then fill them, you will get lines that are closer to your fill color. But
it still won't be the same. I'm assuming you're filling first because your
output matches my tests when I fill first.
Changing the CompositingMode doesn't help. In fact, if I change it to
"SourceCopy", I get even worse results - the lines are drawn even more
starkly. However, the description of "SourceOver" seems to confirm what I'm
talking about above - the color of the pen will be blended with the
background based on the alpha component of the pen.
I guess I look at it this way: you are drawing your lines, presumably,
because you want to see them - right? So, in essence, you are getting what
you want. If you don't want to see the lines, then don't draw them.
Anything you try to do, since you are drawing over your alpha-blended
background, is not going to get you what you want - the alpha components of
the two objects will interace with each other, and you'll get what you're
getting. unless you create your pen with an Alpha of 0, which would be a
waste of time.
If you want the edges of your shapes to be defined in some fashion (which is
what I think you're really going after), then you'll have to create a new
polygon consisting of *only* your edge points, and draw that. Since you
want it defined for the user, I would think that what you're getting with
the pen you're using will work just fine (with the suggestion that you may
want to use a slightly thicker pen to get a bit more definition.) I also
believe that a polygon is not going to be the best thing for you in the
end - I think you'll want to investigate using a GraphicsPath to draw your
edges. But I may be wrong on that point.
HTH
- Scott
<expertware@xxxxxxxxx> wrote in message
news:1122359468.662976.64300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Dear Scott and James,
>
> Thank you very much for your suggestions.
> I have tried the Scott method (which actually I tried before)
> both using
> Graphics.CompositingMode =
> Drawing2D.CompositingMode.SourceOver
>
> Graphics.CompositingMode =
> Drawing2D.CompositingMode.SourceCopy
>
> In the first case the lines are still drawn with alpha=255 and in the
> second case
> they are white (on a white background).
> I have made a web page with the picture I get using:
>
> Graphics.CompositingMode =
> Drawing2D.CompositingMode.SourceOver
> Dim br As New SolidBrush(Color.FromArgb(100,
> FacesBrush.Color))
> PenUsatoPerSpigoli = New Pen(br)
> Graphics.DrawPolygon(p, Points)
>
> as suggested by Scott. Here is the result:
>
> http://cam70.sta.uniroma1.it/TechnicalPreview/scott.htm
>
> as you see, while the faces are semitransparent, the edges are drawn
> with a alpha value different
> from that used by for the faces (although the brush is the same).
>
> I need the edgest to be colored the same way as the faces (faces use a
> brush with A=100) !! Any suggestion?
>
> Thanks you very much!!
>
> Pamela
>
.
- Follow-Ups:
- Re: How to draw with a PEN ?? Please help
- From: expertware
- Re: How to draw with a PEN ?? Please help
- References:
- How to draw with a PEN ?? Please help
- From: expertware
- Re: How to draw with a PEN ?? Please help
- From: James Westgate
- Re: How to draw with a PEN ?? Please help
- From: expertware
- How to draw with a PEN ?? Please help
- Prev by Date: Bitmap Invalidate
- Next by Date: Dropdown list border color
- Previous by thread: Re: How to draw with a PEN ?? Please help
- Next by thread: Re: How to draw with a PEN ?? Please help
- Index(es):
Relevant Pages
|