Is there a general method of drawing 2d objects on

2019-09-22 03:41发布

Some context, I want to draw 2D objects by defining a set of pixels to change to a color which represents the shape. For example, if I wanted to draw a square I'd define a top left corner say (0,0), and a bottom right corner say (10,10). Then I'd change the color of all the pixels x values 0-10 with y values 0-10.

Unfortunately I don't have a solid step by step method to complete this, and am only able to draw squares/rectangles due to how simple they are.

Is there a method you can describe, or a resource that describes how to do this you can point me to, which will help me draw shapes other then squares and rectangles?

pseudo code, or a basic implementation of this in C, or java would be very helpful. Also, just a thorough description of how this would be achieved would also be helpful.

1条回答
再贱就再见
2楼-- · 2019-09-22 04:34

Like J... said there's a lot to cover, but I do like the method you described in the comments. I think the biggest challenge of using the method you have described would be creating the vectors between the nodes. A solution you could use to draw the vectors would be to stagger the pixels to create the illusion of a straight line. Also, shapes would become less jagged as you increased the value of n.

查看更多
登录 后发表回答