Checksum: 03968 Path: utzoo!utgpu!sarathy From: sarathy@gpu.utcs.utoronto.ca (Rajiv Sarathy) Date: Tue, 17-Oct-89 17:51:25 EDT Message-ID: <1989Oct17.175125.23371@gpu.utcs.utoronto.ca> Organization: University of Toronto Computing Services Newsgroups: comp.graphics Subject: Re: Variable-width Bresenham References: <4162@deimos.cis.ksu.edu> Reply-To: sarathy@gpu.utcs.UUCP (Rajiv Sarathy) In article <4162@deimos.cis.ksu.edu> neil@calvin (Neil Erdwien) writes: >I'm looking for references/ideas for implementing a variable-width >version of Bresenham's algorithm for quantising line segments. > >In other words, I'm not content with single-pixel lines that result >from the standard algorithm. I'd like to be able to draw 2, 3, and >perhaps even fractional line widths. This seems like a common problem >and I assume someone has a more elegant solution than just drawing >multiple closely spaced lines. How about the next-most obvious way?: In the algorithm, plot more pixels: If you're stepping by x, then plot as many more pixels as you need vertically. If you're stepping by y, then plot as many more pixels as you need horizontally. Example: For a 2-pixel-width line with horizontal stepping: xx **xxxx ****xxx *** Where '*' is drawn by Bresenham, and 'x' is drawn by your additional SetPixel(). Of course, you'd need to build in some intelligence to not draw over viewport/window/screen boundaries. You might also want to check to make sure that your lines have even density. -- _____________________________________________________________________________ | Disclaimer: I'm just an undergrad. All views and opinions are therefore _ | | my own. /\ /\ /-----------------------------------oO(_)| | / \ / \ / NetNorth: sarathy@utorgpu | | Rajiv Partha Sarathy / \/ \/ sarathy@gpu.utcs.utoronto.ca | | --------------------/ {uunet!attcan mnetor att pyramid}!utgpu!sarathy | |_____________________________________________________________________________|