Canvas (GUI)

{{Short description|Container in computer graphics}}

In computer science and visualization, a canvas is a container that holds various drawing elements (lines, shapes, text, frames containing others elements, etc.). It takes its name from the canvas used in visual arts. It is sometimes called a scene graph because it arranges the logical representation of a user interface or graphical scene. Some implementations also define the spatial representation and allow the user to interact with the elements via a graphical user interface.{{cite web|url=https://metacpan.org/release/ZINCDEV/tk-zinc-3.303|title=tk-zinc-3.303 - TkZinc is another Canvas which proposes many new functions, some based on openGL - metacpan.org|website=metacpan.org}}

Library support

Various free and open-source canvas or scene-graph libraries allow developers to construct a user interface and/or user-interface elements for their computer programs.

Examples of free and open-source scene-graph canvas options include:

  • in C, [https://www.enlightenment.org/about-efl Evas (in EFL)] from the Enlightenment project
  • in C, Clutter, associated with the GNOME project
  • in C, GTK Scene Graph Kit (GSK)
  • in C++ or optionally in Qt's own markup language QML: Qt Quick, provides a [http://qt-project.org/doc/qt-5.1/qtquick/qtquick-visualcanvas-scenegraph.html scenegraph] {{Webarchive|url=https://web.archive.org/web/20131029183633/http://qt-project.org/doc/qt-5.1/qtquick/qtquick-visualcanvas-scenegraph.html |date=2013-10-29 }} associated with the Qt project
  • in C++, OpenSceneGraph, a 3D graphics API using OpenGL
  • in C++, the OGRE engine, based on a scene graph, supports multiple scene managers
  • in C++, OpenSG, a scene-graph system for real-time graphics, with clustering support and multi-thread safety
  • in C++, the FlightGear Flight Simulator uses a custom Canvas system (LGPL'ed via SimGear{{Cite web |url=https://gitorious.org/fg/simgear |title=Gitorious.org Git - fg:simgear.git/Summary |access-date=2016-03-04 |archive-url=https://web.archive.org/web/20171207203804/https://gitorious.org/fg/simgear |archive-date=2017-12-07 |url-status=dead }}) that is hardware-accelerated using OpenSceneGraph/OpenGL, OpenVG/ShivaVG:{{cite web|url=http://wiki.flightgear.org/Canvas_Development|title=Canvas Development - FlightGear wiki|website=wiki.flightgear.org}} [http://wiki.flightgear.org/Canvas The FlightGear Canvas system]
  • in Java, the Java FX scene graph with 2D and 3D functionality
  • in Tcl and other languages such as Perl, Python (Tkinter{{cite web|url=https://python-course.eu/tkinter_canvas.php|title=GUI Programming with Python: Canvas Widget|website=python-course.eu}}), and Ruby, the Tk toolkit provides a canvas widget for 2D graphics{{cite web|url=https://tkdocs.com/tutorial/canvas.html|title=TkDocs - Tk Tutorial - Canvas|website=tkdocs.com}}{{cite web|url=http://tcl.tk/man/tcl8.6/TkCmd/canvas.htm|title=canvas manual page - Tk Built-In Commands|website=tcl.tk}}
  • in Tcl{{cite web|url=https://wiki.tcl-lang.org/page/zinc|title=zinc|website=wiki.tcl-lang.org}} and other languages such as Perl{{cite web|url=https://metacpan.org/release/ZINCDEV/tk-zinc-3.303|title=tk-zinc-3.303 - TkZinc is another Canvas which proposes many new functions, some based on openGL - metacpan.org|website=metacpan.org}} and Python,{{cite web|url=https://wiki.python.org/moin/TkZinc|title=TkZinc - Python Wiki|website=wiki.python.org}} [https://bitbucket.org/plecoanet/tkzinc TkZinc] {{Webarchive|url=https://web.archive.org/web/20171207192634/https://bitbucket.org/plecoanet/tkzinc |date=2017-12-07 }} is an extended replacement for the Tk canvas, which adds support for hierarchical grouping, clipping, affine transformations, anti-aliasing, and specific items for air traffic control.

Some canvas modules within various libraries do not provide the power of a full scene-graph - they operate at a lower level which requires programmers to provide code such as mapping mouse-clicks to objects in the canvas. Examples of libraries which include such a canvas module include:

  • in C++, KDE Plasma Workspaces [http://techbase.kde.org/Projects/Plasma/Vocabulary#Corona Corona] canvas
  • the Canvas element in HTML5
  • for Java, the AWT library [http://docs.oracle.com/javase/7/docs/api/java/awt/Canvas.html Canvas]
  • for Java, the Java FX library [http://docs.oracle.com/javase/8/docs/api/javafx/scene/Canvas.html Canvas]{{dead link|date=November 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
  • for Java, the Swing library [https://web.archive.org/web/20130904235505/http://www.devoxx.com/display/DV11/From%2BJava%2BSwing%2Bto%2BHTML5%2BCanvas Canvas]
  • for Java, the SWT library [http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Canvas.html Canvas], associated with Eclipse
  • for Java-like JavaScript, the GWT library [http://www.gwtproject.org/javadoc/latest/com/google/gwt/canvas/client/Canvas.html Canvas]
  • in C++, the [http://freecode.com/projects/libpapyrus papyrus Canvas library] which renders using the Cairo (graphics) library
  • in C, [http://geocanvas.sourceforge.net/crcanvas/index.html crcanvas], a GTK canvas widget which renders using the Cairo (graphics) library
  • in C, [https://wiki.gnome.org/Projects/GooCanvas GooCanvas], a GTK canvas widget which renders using the Cairo (graphics) library

Proprietary canvas libraries include, for example:

  • the Microsoft Windows Win32 [https://web.archive.org/web/20130825181720/http://www.relisoft.com/win32/canvas.html Canvas]

References