Content deleted Content added
Vita Astra (talk | contribs) m Grammar |
Ira Leviton (talk | contribs) m Fixed a reference. Please see Category:CS1 maint: numeric names: authors list. |
||
(44 intermediate revisions by 30 users not shown) | |||
Line 1:
{{Short description|Computer-based generation of digital images}}
{{Multiple issues|
{{Refimprove|date=December 2009}}
{{Original research|date=July 2019}}
}}
'''2D computer graphics''' is the [[computer
[[File:Blit dot.gif|thumb|[[Raster graphics|Raster graphic]] [[Sprite (computer graphics)|sprite]]s (left) and masks
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).
Line 12 ⟶ 13:
2D computer graphics started in the 1950s, based on [[vector graphics|vector graphics devices]]. These were largely supplanted by [[raster graphics|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 [[2D geometric model|geometric model]]s (also called [[vector graphics]]), digital images (also called [[raster graphics]]), text to be [[typesetting|typeset]] (defined by content, [[Typeface|font]] style and size, color, position, and orientation), mathematical [[function (mathematics)|function]]s and [[equation]]s, and more. These components can be modified and manipulated by two-dimensional [[Transformation (geometry)|geometric transformation]]s such as [[translation (geometry)|translation]], [[rotation]], and [[Scaling (geometry)|scaling]].▼
In [[object-oriented graphics]], the image is described indirectly by an [[object (computer science)|object]] endowed with a self-[[rendering (computer graphics)|rendering]] [[method (computer science)|method]]—a procedure
▲2D graphics models may combine [[2D geometric model|geometric model]]s (also called [[vector graphics]]), digital images (also called [[raster graphics]]), text to be [[typesetting|typeset]] (defined by content, [[Typeface|font]] style and size, color, position, and orientation), mathematical [[function (mathematics)|function]]s and [[equation]]s, and more. These components can be modified and manipulated by two-dimensional [[Transformation (geometry)|geometric transformation]]s such as [[translation (geometry)|translation]], [[rotation]], [[Scaling (geometry)|scaling]].
▲In [[object-oriented graphics]], the image is described indirectly by an [[object (computer science)|object]] endowed with a self-[[rendering (computer graphics)|rendering]] [[method (computer science)|method]]—a procedure which assigns colors to the image [[pixel]]s by an arbitrary algorithm. Complex models can be built by combining simpler objects, in the [[paradigms]] of [[object-oriented programming]].
==Background (geometry)==
{{Duplication|date=May 2022|section=y|dupe=Translation (geometry)|dupe2=Rotation (geometry)|discuss=Talk:2D computer graphics#Duplication}}
{{further|Rotations and reflections in two dimensions}}
<!-- content from article translation (physics) has been merged with this article {{Merge from|Translation (physics)|date=December 2010}}-->
<!-- added references {{refimprove|date=December 2007}}-->
[[File:Traslazione OK.svg|right|thumb|A translation moves every point of a figure or a space by the same amount in a given direction.]]
In [[Euclidean geometry]], a ''
If '''v''' is a fixed vector, then the translation ''T''<sub>'''v'''</sub> will work as ''T''<sub>'''v'''</sub>('''p''') = '''p''' + '''v'''.
If ''T'' is a translation, then the [[image (mathematics)|image]] of a subset ''A'' under the [[function (mathematics)|function]] ''T'' is the '''
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'' ).
===
Since a translation is an [[affine transformation]] but not a [[linear transformation]], [[homogeneous coordinates]] are normally used to represent the translation operator by a [[matrix (
To translate an object by a [[
: <math> T_{\mathbf{v}} =
Line 70 ⟶ 72:
===Rotation===
In [[linear algebra]], a ''
:<math>R =
Line 81 ⟶ 83:
rotates points in the ''xy''-[[Cartesian coordinate system|Cartesian plane]] counterclockwise through an angle ''θ'' about the origin of the [[Cartesian coordinate system]]. To perform the rotation using a rotation matrix ''R'', the position of each point must be represented by a [[column vector]] '''v''', containing the coordinates of the point. A rotated vector is obtained by using the [[matrix multiplication]] ''R'''''v'''. Since matrix multiplication has no effect on the zero vector (i.e., on the coordinates of the origin), rotation matrices can only be used to describe rotations about the origin of the coordinate system.
Rotation matrices provide a simple algebraic description of such rotations, and are used extensively for computations in [[geometry]], [[physics]], and [[computer graphics]]. In 2-dimensional space, a rotation can be simply described by an [[Angle of rotation|angle ''θ'' of rotation]], but it can be also represented by the 4 entries of a rotation matrix with 2 rows and 2 columns. In 3-dimensional space, every rotation can be interpreted as a rotation by a given angle about a single fixed axis of rotation (see [[Euler's rotation theorem]]), and hence it can be simply described by [[Axis-angle representation|an angle and a vector]] with 3 entries. However, it can also be represented by the 9 entries of a rotation matrix with 3 rows and 3 columns. The notion of rotation is not commonly used in dimensions higher than 3; there is a notion of a ''
Rotation matrices are [[square matrix|square matrices]], with [[real number|real]] entries. More specifically they can be characterized as [[orthogonal matrix|orthogonal matrices]] with [[determinant]] 1:
Line 126 ⟶ 128:
\end{bmatrix}\,</math>.
[[File:Clockwise rotation SVG.svg|thumb|A rotation through angle ''θ'' with non-standard axes
If a standard [[Orientation (
See [[Rotation matrix#Ambiguities|below]] for other alternative conventions which may change the sense of the rotation produced by a [[rotation matrix]].
Particularly useful are the matrices for 90° and 180° rotations:
Line 150 ⟶ 152:
\end{bmatrix}</math> (270° counterclockwise rotation, the same as a 90° clockwise rotation)
{{Refimprove|date=April 2008}}
In [[Euclidean geometry]], '''uniform scaling''' ('''[[isotropic]] scaling''',<ref>{{cite web|format=PowerPoint|last1=Durand|last2=Cutler|url=http://groups.csail.mit.edu/graphics/classes/6.837/F03/lectures/04_transformations.ppt |title=Transformations|publisher=Massachusetts Institute of Technology|
More general is '''scaling''' with a separate scale factor for each axis direction. '''Non-uniform scaling''' ('''[[anisotropic]] scaling''', '''inhomogeneous dilation''') is obtained when at least one of the scaling factors is different from the others; a special case is '''directional scaling''' or '''stretching''' (in one direction). Non-uniform scaling changes the [[shape]] of the object; e.g. a square may change into a rectangle, or into a parallelogram if the sides of the square are not parallel to the scaling axes (the angles between lines parallel to the axes are preserved, but not all angles).
A scaling can be represented by a scaling matrix. To scale an object by a [[Vector (geometric)|vector]] ''v'' = (''v<sub>x</sub>, v<sub>y</sub>, v<sub>z</sub>''), each point ''p'' = (''p<sub>x</sub>, p<sub>y</sub>, p<sub>z</sub>'') would need to be multiplied with this [[scaling matrix]]:▼
▲====Scaling====
▲A scaling can be represented by a scaling matrix. To scale an object by a [[Vector (geometric)|vector]] ''v'' = (''v<sub>x</sub>, v<sub>y</sub>, v<sub>z</sub>''), each point ''p'' = (''p<sub>x</sub>, p<sub>y</sub>, p<sub>z</sub>'') would need to be multiplied with this scaling matrix:
:<math> S_v =
\begin{bmatrix}
Line 188 ⟶ 190:
In the case where ''v<sub>x</sub> = v<sub>y</sub> = v<sub>z</sub> = k'', the scaling is also called an '''enlargement''' or '''[[Dilation (metric space)|dilation]]''' by a factor k, increasing the area by a factor of k<sup>2</sup> and the volume by a factor of k<sup>3</sup>.
In [[projective geometry]], often used in [[computer graphics]], points are represented using [[homogeneous coordinates]]. To scale an object by a [[Vector (geometric)|vector]] ''v'' = (''v<sub>x</sub>, v<sub>y</sub>, v<sub>z</sub>''), each homogeneous coordinate vector ''p'' = (''p<sub>x</sub>, p<sub>y</sub>, p<sub>z</sub>'', 1) would need to be multiplied with this [[projective transformation]] matrix:
Line 253 ⟶ 255:
\end{bmatrix}.
</math>
==Techniques==
===Direct painting===
Line 273 ⟶ 277:
====Layers====<!-- This section is linked from [[Layer]] -->
[[File:BabyAnimation.png|thumb|A 2D animated character [[
▲[[File:BabyAnimation.png|thumb|A 2D animated character [[Compositing|composited]] with 3D backgrounds using layers.]]
{{main|Layers (digital image editing)}}
The models used in 2D computer graphics usually do not provide for three-dimensional shapes, or three-dimensional optical phenomena such as lighting, [[shadow]]s, [[Reflection (physics)|reflection]], [[refraction]], etc. However, they usually can model multiple ''layers'' (conceptually of ink, paper, or film; opaque, [[translucent]], or [[Transparency (graphic)|transparent]]—stacked in a specific order. The ordering is usually defined by a single number (the layer's ''depth'', or distance from the viewer).
Layered models are sometimes called "2{{frac|1|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 [[graphics editor]]s. Layered models also allow better [[spatial anti-aliasing]] of complex drawings and provide a sound model for certain techniques such as ''mitered joints'' and the [[
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.
Line 289 ⟶ 292:
See also [[Portable Document Format#Layers]].
==Hardware==
{{See also|Video display controller|List of home computers by video hardware|Sprite (computer graphics)}}
Modern computer [[graphics card]] displays almost overwhelmingly use raster techniques, dividing the screen into a rectangular grid of [[pixel]]s, due to the relatively low cost of raster-based video hardware as compared with vector graphic hardware. Most graphic hardware has internal support for [[BitBLT|blitting]] operations or [[Sprite (computer graphics)|sprite]] drawing. A [[co-processor]] dedicated to [[BitBLT|blitting]] is known as a ''[[Blitter]] chip''.
Classic 2D [[graphics chip]]s and [[graphics processing unit]]s of the late 1970s to 1980s, used in [[8-bit computing|8-bit]] to early [[16-bit computing|16-bit]], [[arcade game]]s, [[video game console]]s, and [[home computer]]s, include:
*[[Atari, Inc.]]'s [[Television Interface Adapter|TIA]], [[ANTIC]], [[
*[[Capcom]]'s [[CP System|CPS-A and CPS-B]]
*[[Commodore International|Commodore]]'s [[Original Chip Set|OCS]]
Line 304 ⟶ 307:
*[[Ricoh]]'s [[Picture Processing Unit|PPU]] and [[Super Nintendo Entertainment System technical specifications|S-PPU]]
*[[Sega]]'s [[Video display controller|VDP]], [[Sega Super Scaler|Super Scaler]], [[Sega System 16|315-5011/315-5012]] and [[Sega System 16|315-5196/315-5197]]
*[[Texas Instruments]]' [[
*[[Yamaha Corporation|Yamaha]]'s [[Yamaha V9938|V9938]], [[Yamaha V9958|V9958]] and [[Mega Drive#Technical specifications|YM7101 VDP]]
==Software==
Many [[graphical user interface]]s (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 device]]s, such as the [[computer mouse|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 [[video game]]s; and are still used for card and board games such as [[Solitaire (game)|solitaire]], [[chess]], [[mahjongg]], etc.
2D graphics editors or ''drawing programs'' are application-level software for the creation of images, diagrams and illustrations by direct manipulation (through the mouse, [[graphics tablet]], or similar device) of 2D computer graphics primitives. These editors generally provide [[2D geometric primitive|geometric primitives]] as well as [[digital image]]s; and some even support procedural models. The illustration is usually represented internally as a layered model, often with a hierarchical structure to make editing more convenient. These editors generally output [[graphics file format|graphics files]] where the layers and primitives are separately preserved in their original form. [[MacDraw]], introduced in 1984 with the [[Apple Macintosh|Macintosh]] line of computers, was an early example of this class; recent examples are the commercial products [[Adobe Illustrator]] and [[CorelDRAW]], and the free editors such as [[xfig]] or [[Inkscape]]. There are also many 2D graphics editors specialized for certain types of drawings such as electrical, electronic and VLSI diagrams, topographic maps, computer fonts, etc.
[[Digital image processing|Image editors]] are specialized for the manipulation of [[digital image]]s, mainly by means of free-hand drawing/painting and [[signal processing]] operations. They typically use a direct-painting paradigm, where the user controls virtual pens, brushes, and other free-hand artistic instruments to apply paint to a virtual canvas. Some image editors support a multiple-layer model; however, in order to support signal-processing operations like blurring each layer is normally represented as a digital image. Therefore, any geometric primitives that are provided by the editor are immediately converted to pixels and painted onto the canvas. The name ''raster graphics editor'' is sometimes used to contrast this approach to that of general editors which also handle ''vector graphics''. One of the first popular image editors was [[Apple Computer|Apple]]'s [[MacPaint]], companion to [[MacDraw]]. Modern examples are the free [[GIMP]] editor, and the commercial products [[Photoshop]] and [[Paint Shop Pro]]. This class too includes many specialized editors
==Developmental animation==
With the resurgence<ref name="Pile">{{cite book |last=Pile
Various approaches have been developed<ref name="Pile"/>{{rp|38}} to aid and speed up the process of digital 2D animation. For example, by [[vector graphics editor|generating vector artwork]] in a tool like [[Adobe Flash]] an artist may employ software-driven automatic coloring and [[tweening|in-betweening]].
Programs like [[Blender (software)|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.<ref>{{Cite web|url=https://www.blender.org/|title=blender.org - Home of the Blender project - Free and Open 3D Creation Software
==See also==
{{Commons category
* [[2.5D]]
* [[3D computer graphics]]
Line 344 ⟶ 347:
{{reflist}}
{{Computer graphics}}
{{Visualization}}
{{Animation}}
{{DEFAULTSORT:2d Computer Graphics}}
[[Category:Computer graphics]]
[[Category:Euclidean plane geometry]]
|