Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
2D computer graphics
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Direct painting=== A convenient way to create a complex image is to start with a blank "canvas" [[raster graphics|raster map]] (an array of [[pixel]]s, also known as a [[bitmap]]) filled with some uniform [[background color]] and then "draw", "paint" or "paste" simple patches of color onto it, in an appropriate order. In particular the canvas may be the [[frame buffer]] for a [[computer display]]. 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 [[digital image|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 [[geometric shape]], such as a [[triangle]] defined by three corners, or a [[circle]] with given center and radius; * draw a [[line segment]], [[Arc (geometry)|arc]], or simple curve with a ''virtual pen'' of given width. <!-- limitations --> ====Extended color models==== Text, shapes and lines are rendered with a client-specified color. Many libraries and cards provide [[color gradient]]s, 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 [[screentone]]s and the fabled ''checker paint'' which used to be available only in [[cartoon]]s). Painting a [[pixel]] with a given color usually replaces its previous color. However, many systems support painting with [[Transparency (graphic)|transparent]] and [[translucent]] colors, which only modify the previous pixel values. <!--should elaborate: modify by mixing (weighted average) or by filtering (multiplication) --> The two colors may also be combined in more complex ways, e.g. by computing their [[bitwise operation|bitwise]] [[exclusive or]]. This technique is known as ''inverting color'' or ''color inversion'', and is often used in [[graphical user interface]]s for highlighting, rubber-band drawing, and other volatile painting—since re-painting the same shapes with the same color will restore the original pixel values. <!-- limitations --> ====Layers====<!-- This section is linked from [[Layer]] --> [[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 [[even–odd rule]]. 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 [[rendering (computer graphics)|rendered]] on its own, yielding a [[digital image]] with the desired [[Image resolution|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 [[String (computer science)|text]] or [[polyline]]s) may be broken down into simpler elements ([[Character (computing)|character]]s or [[line segment]]s, respectively), which are then painted as separate layers, in some order. However, this solution may create undesirable [[aliasing]] artifacts wherever two elements overlap the same pixel. See also [[Portable Document Format#Layers]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)