clipping to pen width
- From: "spaghetti code warehouse" <xxx@xxxxxxx>
- Date: Tue, 21 Nov 2006 09:11:23 -0600
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.
.
- Follow-Ups:
- Re: clipping to pen width
- From: spaghetti code warehouse
- Re: clipping to pen width
- Prev by Date: Re: Multiple GDI newsgroups
- Next by Date: Re: Multiple GDI newsgroups
- Previous by thread: Re: Problem declaring a Font*
- Next by thread: Re: clipping to pen width
- Index(es):
Relevant Pages
|