Is there a general method of drawing 2d objects on a digital screen

自古美人都是妖i 提交于 2019-12-13 08:20:03

问题


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:


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.



来源:https://stackoverflow.com/questions/40796339/is-there-a-general-method-of-drawing-2d-objects-on-a-digital-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!