What is a graphic primitive? Definition, application and features

Starting to work in editors, beginners may encounter such a concept as a “graphic primitive”. For work, knowledge in this area will be very useful. What is a graphic primitive and how is it used? So called a simple or low-level object, as well as an elementary operation. With their help, you can build more complex objects and carry out operations of a higher level. Primitives in a graphics editor are basic elements such as lines, curves, and polygons that can be combined to create more complex graphic images. In programming, these are the basic operations supported by the programming language. To create any drawing on a computer, such graphic primitives are what form part of the software.

what is a graphic primitive




Using primitives in editors

Graphics in the general sense consists of three main elements, in contrast to a wide variety of graphic applications: pixel, line and polygon. The main of these elementary structures is a pixel. Graphic primitives in a graphical editor are a simple object necessary for creating or constructing complex images. Graphics in programs for creating vector images are built on such elements as a point, a line, and simple shapes consisting of them. This is a circle, triangle and square, which can also be called polygons. Therefore, most often when working in a graphical editor, these simple figures are called primitives. For raster graphics, this element will be a pixel.





graphic primitives are




What is a pixel?

A pixel is a graphic primitive that is a point of light. This is just one small dot, part of a bitmap. Although it does not have a structure, it is certainly a building block. Therefore, a pixel is a graphic primitive. The resolution of CRT monitors is related to the size of this point and its diameter, which can vary. The ratio of the distance between the centers of two adjacent horizontal pixels to the distance between the vertical pixels is called the pixel ratio. It should be taken into account in algorithms that generate images.

primitives in a graphical editor




Display file and frame buffer

The graphic primitive is also software, with the help of which a certain image is displayed on the screen. One of them is a display file. It is an array of uncorrelated data or a set of commands that are necessary for the correct rendering of the image on the screen. Arrays are populated from the list data stored in memory. As a result of their processing, a picture consisting of pixels of different colors is created on a CRT monitor. Frame buffer is a device for storing and displaying video on the screen. This is usually a device or type of memory that stores several frames of a video image. The image is stored in memory as an array of data, where successive color values ​​of each pixel are recorded.





Display control and display processor

The display management system allows you to control the appearance of the image on the screen and helps the user to view it at the desired angle or resize, reducing and enlarging it. The display processor at this time reads the data from the buffer and converts them into a picture. He can repeat this action about 30 times per second to save the image on the screen. To update the image, you need to change the contents of the buffer.

graphic primitives are




Graphic editor

Graphic software is a program or set of programs that allow you to manage visual images in a computer system. There are two types of graphics, namely raster and vector.

Bitmap graphics, or bitmap images, are a dot matrix data structure representing a generally rectangular grid of pixels.

Vector graphics use geometric primitives. What is a graphic primitive in vector graphics, has been said above. These are points, lines, curves and polygons (or polygons) or vector images. Such figures are based on mathematical expressions to represent images in computer graphics. Converting vector graphics to raster is quite simple, but from raster to vector is much more difficult. Some programs try to do this. In addition to static graphics, there is animation and video editing software. Computer graphics can also be used by other editing software, such as Adobe Photoshop, Pizap, Microsoft Publisher, Picasa, etc. Another option is animation programs and video editors such as Windows Movie Maker.

primitives in a graphical editor




Dots and lines in a graph

Now that it’s become a little clearer what a graphic primitive is, we’ll take a closer look at each of them. Let's start with dots and lines. Points are used throughout the chart as building blocks for more complex shapes. For example, triangles are created using three points connected to each other. Another fundamental geometric object in 2D graphics is a line. Two points are needed to create a straight line.

Line as a primitive

Lines are also graphic primitives, especially straight lines. Each of them is the main building block for line graphs, column and pie charts, two- and three-dimensional graphs of mathematical functions, engineering drawings and architectural plans. In computer graphics, the straight line is so simple that it is difficult not to consider its image as a graphic primitive. Straight lines in programming can be designed in two different ways. The first option is called the structural method. It determines which pixels should be set before drawing the line. The second option is a conditional method that takes into account certain conditions in order to find the necessary pixels.

Line generation

In order to understand what a graphic primitive is, you need to understand how it is created. In mathematics and computer science, there are special algorithms that are step-by-step instructions for performing calculations. Algorithms are created for calculating, processing data and their automated analysis. In order to draw lines on a computer screen, the so-called Bresenham algorithm is used. It determines how best to build a line, and forms the best option for creating a straight line between two given points, painting certain pixels on the monitor.

The algorithm was developed back in 1962 and is still relevant. It uses only integer addition, subtraction, and bit offset when numbers move or shift left or right. All of them are very cheap operations in standard computer architectures. This is one of the earliest algorithms developed in the field of computer graphics. A slight extension of the original algorithm also applies to drawing circles.

graphic primitive is




Digital differential analyzer

Another algorithm - a digital differential analyzer - is a segment generation algorithm based on the calculation of either dy or dx. To do this, you need to project the line into unit intervals in one coordinate and determine the corresponding integer values ​​closest to the line path for another coordinate. The algorithm takes as input two pixel positions at the ends of the segment. Horizontal and vertical differences between the positions of the endpoints are assigned to the dx and dy parameters. The difference with a larger value determines the increment of the parameter steps. Starting with the pixel position, the offset required at each step is determined to create the next pixel position along the line.

Polygons or Polygons

Primitives in a vector graphics editor are polygons, or polygons. This is a closed area of ​​the image, limited by straight or curved lines and filled with one solid color. Primitives in a graphical editor are two-dimensional shapes; therefore, a polygon is a closed, flat shape. Polygon is an important graphic primitive. It is treated as a whole, since images of objects from the real world are composed mostly of polygons.

primitives in a graphical editor are called




Polygons, or polygons, are used in computer graphics to create images that look three-dimensional. Typically, triangular polygons are used to model the surface of an object, selecting vertices and visualizing the object as wire models. This is faster for creating a three-dimensional image than working through the shadows. Also, the use of polygons is one of the stages in the process of designing computer animation.

Polygon Filling

Filling polygons is necessary in order to consider the entire area when rendering the image. If it is not filled, only the points along the perimeter of the polygon will be drawn, and the inside will remain empty. When filling the polygon, its internal part is taken into account. All pixels within the boundaries of the polygon are filled with the specified color or pattern. Various algorithms are used to determine which pixels are inside the polygon and which is outside.




All Articles