Computer Graphics/Output Primitive
A computer Graphics can be anything like beautiful scenery, images, terrain, trees, or anything else that we can imagine, however all these computer graphics are made up of the most basic components of Computer Graphics that are called Graphics Output Primitive or simply primitive. The Primitives are the simple geometric functions that are used to generate various Computer Graphics required by the User. Some most basic Output primitives are point-position(pixel), and a straight line. However different Graphic packages offers different output primitives like a rectangle, conic section, circle, spline curve or may be a surface. Once it is specified what picture is to be displayed, various locations are converted into integer pixel positions within the frame buffer and various functions are used to generate the picture on the two dimensional co ordinate system of output display.By: Himansu Kisan
Computer Screen Coordinates
In video monitors Locations are referenced using Integer Screen coordinates which corresponds to the pixel positions in the frame buffer. These coordinates gives us the Column Number(x) and Scan Line Number(y). During screen refreshing the address of pixel along with other information stored in frame buffers are used to generated the pixel on the screen with respect to the top left corner of the screen. However it is possible to modify the origin of the coordinate system using various software commands or hardware controls. A frame buffer stores the pixel location and other information such as intensity, color of the pixel position that is to be generated on the screen.
Absolute and Relative Coordinate
The address stored in the Frame Buffer can be absolute or relative. There are various graphics packages that allows the location of Output primitive to be declared using relative Coordinate. This type of method is used for various graphics application, used for producing drawings etc. In this type of co ordinate system every pixel location is defined using offset which is added to last pixel position.
A point function is the most basic Output primitive in the graphic package. A point function contains location using x and y coordinate and the user may also pass other attributes such as its intensity and color. The location is stored as two integer tuple. The color is defined using hex codes. The size of a pixel is equal to the size of pixel on display monitor.
A Line Function
A line function is used to generate a straight line between any two end points. Usually a line function is provided with the location of two pixel points called the starting point and the end point and it is upto computer to decide what pixels fall between these two points so that a straight line is generated.
Line Drawing Algorithms
When a computer need to determine the positions of pixel that falls between two given points to generate a straight line it requires some algorithm. Line DDA basically takes the 2 end points of a line and then inputs pixel one at a time on the path.