2D computer graphics
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models (such as 2D geometric models, text, and digital images) and by techniques specific to them. It may refer to the branch of computer science that comprises such techniques or to the models themselves.
2D computer graphics are mainly used in applications that were originally developed upon traditional printing and drawing technologies, such as typography, cartography, technical drawing, advertising, etc. In those applications, the two-dimensional image is not just a representation of a real-world object, but an independent artifact with added semantic value; two-dimensional models are therefore preferred, because they give more direct control of the image than 3D computer graphics (whose approach is more akin to photography than to typography).
In many domains, such as
2D computer graphics started in the 1950s, based on vector graphics devices. These were largely supplanted by raster-based devices in the following decades. The PostScript language and the X Window System protocol were landmark developments in the field.
2D graphics models may combine
. InBackground (geometry)
This section splitting the content into a new article. (May 2022) |
In Euclidean geometry, a translation (geometry) moves every point a constant distance in a specified direction. A translation can be described as a rigid motion: other rigid motions include rotations and reflections. A translation can also be interpreted as the addition of a constant vector to every point, or as shifting the origin of the coordinate system. A translation operator is an operator such that
If v is a fixed vector, then the translation Tv will work as Tv(p) = p + v.
If T is a translation, then the image of a subset A under the function T is the translation of A by T. The translation of A by Tv is often written A + v.
In a Euclidean space, any translation is an isometry. The set of all translations forms the translation group T, which is isomorphic to the space itself, and a normal subgroup of Euclidean group E(n ). The quotient group of E(n ) by T is isomorphic to the orthogonal group O(n ):
- E(n ) / T ≅ O(n ).
Translation
Since a translation is an
To translate an object by a
As shown below, the multiplication will give the expected result:
The inverse of a translation matrix can be obtained by reversing the direction of the vector:
Similarly, the product of translation matrices is given by adding the vectors:
Because addition of vectors is
Rotation
In linear algebra, a rotation matrix is a matrix that is used to perform a rotation in Euclidean space.
rotates points in the xy-
Rotation matrices provide a simple algebraic description of such rotations, and are used extensively for computations in
Rotation matrices are square matrices, with real entries. More specifically they can be characterized as orthogonal matrices with determinant 1:
- .
The
In two dimensions
In two dimensions every rotation matrix has the following form:
- .
This rotates
- .
So the coordinates (x',y') of the point (x,y) after rotation are:
- ,
- .
The direction of vector rotation is counterclockwise if θ is positive (e.g. 90°), and clockwise if θ is negative (e.g. -90°).
- .
Non-standard orientation of the coordinate system
If a standard
See below for other alternative conventions which may change the sense of the rotation produced by a rotation matrix.
Common rotations
Particularly useful are the matrices for 90° and 180° rotations:
- (90° counterclockwise rotation)
- (180° rotation in either direction – a half-turn)
- (270° counterclockwise rotation, the same as a 90° clockwise rotation)
Scaling
This article needs additional citations for verification. (April 2008) |
In
More general is scaling with a separate scale factor for each axis direction. Non-uniform scaling (
A scaling can be represented by a scaling matrix. To scale an object by a
As shown below, the multiplication will give the expected result:
Such a scaling changes the diameter of an object by a factor between the scale factors, the area by a factor between the smallest and the largest product of two scale factors, and the volume by the product of all three.
The scaling is uniform if and only if the scaling factors are equal (vx = vy = vz). If all except one of the scale factors are equal to 1, we have directional scaling.
In the case where vx = vy = vz = k, the scaling is also called an enlargement or dilation by a factor k, increasing the area by a factor of k2 and the volume by a factor of k3.
Scaling in the most general sense is any affine transformation with a diagonalizable matrix. It includes the case that the three directions of scaling are not perpendicular. It includes also the case that one or more scale factors are equal to zero (projection), and the case of one or more negative scale factors. The latter corresponds to a combination of scaling proper and a kind of reflection: along lines in a particular direction we take the reflection in the point of intersection with a plane that need not be perpendicular; therefore it is more general than ordinary reflection in the plane.
Using homogeneous coordinates
In
As shown below, the multiplication will give the expected result:
Since the last component of a homogeneous coordinate can be viewed as the denominator of the other three components, a uniform scaling by a common factor s (uniform scaling) can be accomplished by using this scaling matrix:
For each vector p = (px, py, pz, 1) we would have
which would be homogenized to
Techniques
Direct painting
A convenient way to create a complex image is to start with a blank "canvas"
Some programs will set the pixel colors directly, but most will rely on some 2D graphics library or the machine's graphics card, which usually implement the following operations:
- paste a given image at a specified offset onto the canvas;
- write a string of characters with a specified font, at a given position and angle;
- paint a simple with given center and radius;
- draw a arc, or simple curve with a virtual pen of given width.
Extended color models
Text, shapes and lines are rendered with a client-specified color. Many libraries and cards provide color gradients, which are handy for the generation of smoothly-varying backgrounds, shadow effects, etc. (See also Gouraud shading). The pixel colors can also be taken from a texture, e.g. a digital image (thus emulating rub-on screentones and the fabled checker paint which used to be available only in cartoons).
Painting a
Layers
The models used in 2D computer graphics usually do not provide for three-dimensional shapes, or three-dimensional optical phenomena such as lighting,
Layered models are sometimes called "21⁄2-D computer graphics". They make it possible to mimic traditional drafting and printing techniques based on film and paper, such as cutting and pasting; and allow the user to edit any layer without affecting the others. For these reasons, they are used in most
Layered models are also used to allow the user to suppress unwanted information when viewing or printing a document, e.g. roads or railways from a map, certain process layers from an integrated circuit diagram, or hand annotations from a business letter.
In a layer-based model, the target image is produced by "painting" or "pasting" each layer, in order of decreasing depth, on the virtual canvas. Conceptually, each layer is first rendered on its own, yielding a digital image with the desired resolution which is then painted over the canvas, pixel by pixel. Fully transparent parts of a layer need not be rendered, of course. The rendering and painting may be done in parallel, i.e., each layer pixel may be painted on the canvas as soon as it is produced by the rendering procedure.
Layers that consist of complex geometric objects (such as
See also
Hardware
Modern computer
Classic 2D
- TIA, ANTIC, CTIA and GTIA
- Capcom's CPS-A and CPS-B
- OCS
- MOS Technology's VIC and VIC-II
- Hudson Soft's Cynthia and HuC6270
- NEC's μPD7220 and μPD72120
- S-PPU
- 315-5196/315-5197
- Texas Instruments' TMS9918
- YM7101 VDP
Software
Many graphical user interfaces (GUIs), including macOS, Microsoft Windows, or the X Window System, are primarily based on 2D graphical concepts. Such software provides a visual environment for interacting with the computer, and commonly includes some form of window manager to aid the user in conceptually distinguishing between different applications. The user interface within individual software applications is typically 2D in nature as well, due in part to the fact that most common input devices, such as the mouse, are constrained to two dimensions of movement.
2D graphics are very important in the control peripherals such as printers, plotters, sheet cutting machines, etc. They were also used in most early
2D graphics editors or drawing programs are application-level software for the creation of images, diagrams and illustrations by direct manipulation (through the mouse,
Developmental animation
With the resurgence[4]: 8 of 2D animation, free and proprietary software packages have become widely available for amateurs and professional animators. With software like RETAS UbiArt Framework and Adobe After Effects, coloring and compositing can be done in less time.[citation needed]
Various approaches have been developed
Programs like Blender or Adobe Substance allow the user to do either 3D animation, 2D animation or combine both in its software allowing experimentation with multiple forms of animation.[5]
See also
- 2.5D
- 3D computer graphics
- Computer animation
- CGI
- Bit blit
- Computer graphics
- Graphic art software
- Graphics
- Image scaling
- List of home computers by video hardware
- Turtle graphics
- Transparency in graphics
- Palette (computing)
- Pixel art
References
- ^ Richard Paul, 1981, Robot manipulators: mathematics, programming, and control : the computer control of robot manipulators, MIT Press, Cambridge, MA
- ^ "Scalable Vector Graphics -- the initial coordinate system", w3.org, 2003
- ^ Durand; Cutler. "Transformations" (PowerPoint). Massachusetts Institute of Technology. Retrieved 12 September 2008.
- ^ ISBN 978-1466501898.
- ^ "blender.org - Home of the Blender project - Free and Open 3D Creation Software". blender.org. Retrieved 2019-04-24.