clipping to pen width

Tech-Archive recommends: Fix windows errors by optimizing your registry



This is a question involving the oldWin32SDK. I call it old because I know
stuff is done now in windows with C# and a managed programming environment
with which I have no experience. I presume the issues dealing with
painting, the GDI, window messages, etc. are still somewhat the same. But
anyway, its the straight win32 sdk I'm using (not MFC, not VB, or something
newer).

I'm trying to figure out how to clip to the width of a pen when drawing a
line. Say you create a pen using CreatePen and specify a width of fifteen
pixels. Then in the app, a user draws by depressing and dragging the mouse
in the client area, forming an arbitrary crisscrossing line where that line
is fifteen pixels in width. (Drawing is implemented using MoveTo and LineTo
and the xy coordinates of the changing mouse location).

Now, if you wanted to BitBlt something to the client area and have it
clipped to the image drawn by the user, how would you do that?

My first thought was BeginPath, followed by the sequence of MoveTo LineTo
calls, then EndPath, and then SelectClippingPath. This does not work,
because Windows apparently does not recognize the pen width for the purposes
of generating a clipping path and in any case would interpret the successive
lines drawn as the boundaries of a polygon (not as a 15-pixel width shape).

Of course,since the path drawn by the user is a certain color, you could use
ExtFloodFill, referencing the color of the path, But that's not the same as
being able to BitBlt some arbitrary image to the client area and have it
clipped to the user-drawn path (because ExtFloodFill is limited to using a
brush, which can only be an 8x8 bitmap, I think).

Hopefully this is elementary for someone.

Thanks.




.



Relevant Pages

  • Re: Form Shrinking due to Non Client area introduction
    ... Remember also that you don't need to change the rectangle size if WMParam is ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... of the Non Client area is 15 and 4 pixels border respectively. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: painting windows
    ... if Windows does buffer a the client area bitmap and do the redraw it ... Painting the entire client area is a task challenging enough, ...
    (microsoft.public.vc.mfc)
  • Re: painting windows
    ... if Windows does buffer a the client area bitmap and do the redraw it ... Painting the entire client area is a task challenging enough, ...
    (microsoft.public.vc.mfc)
  • Re: painting windows
    ... if Windows does buffer a the client area bitmap and do the redraw it ... Painting the entire client area is a task challenging enough, ...
    (microsoft.public.vc.mfc)
  • Re: Full screen dialogs / guidelines
    ... the designer to make it smaller it will still fill the entire client area on ... > need to subscribe to a certain windows message and do some crazy PInvoke ... > compact framework doesn't even include a method for handling windows ...
    (microsoft.public.pocketpc.developer)