如何创建一个线采用布氏任意厚度的? [英] how do I create a line of arbitrary thickness using Bresenham?

查看:101
本文介绍了如何创建一个线采用布氏任意厚度的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的布氏算法来画线,但它们是(当然)厚的一个像素。我的问题是什么是绘制任意厚度线最有效的方法是什么?

I am currently using Bresenham's algorithm to draw lines but they are (of course) one pixel in thickness. My question is what is the most efficient way to draw lines of arbitrary thickness?

我使用的语言是C。

推荐答案

我觉得最好的办法就是画一个矩形而不是一条线,因为与宽度的线是两维的对象。特林绘制的一组平行线,以避免透支(以减少写入带宽)和underdraw(缺失像素)将是非常复杂的。这不是太硬,从起始点和结束点和宽度来计算矩形的角点。

I think the best way is to draw a rectangle rather than a line since a line with width is a two dimensional object. Tring to draw a set of parallel lines to avoid overdraw (to reduce write bandwidth) and underdraw (missing pixels) would be quite complex. It's not too hard to calculate the corner points of the rectangle from the start and end point and the width.

这篇关于如何创建一个线采用布氏任意厚度的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆