Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphics not part of C++ libraries –X libraries –QT library –OS specific.

Similar presentations


Presentation on theme: "Graphics not part of C++ libraries –X libraries –QT library –OS specific."— Presentation transcript:

1 Graphics not part of C++ libraries –X libraries –QT library –OS specific

2 Introduction to Graphics Most commercial computer programs have graphical components A picture or drawing must be digitized for storage on a computer A picture is broken down into pixels, and each pixel is stored separately

3 Representing Color A black and white picture can be stored using one bit per pixel (0 = white and 1 = black) A color picture requires more information, and there are several techniques for representing a particular color For example, every color can be represented as a mixture of the three primary colors Red, Green, and Blue

4 Display Think of your display as a 2D array of pixels, each of which can be any of some (potentially large) number of colors –for a solid background, make all the pixels one color –to draw a line, change the color of all the pixels along the line –for text, use a matrix of dots for each letter

5 Coordinate Systems Each pixel can be identified using a two-dimensional coordinate system commonly use a coordinate system with the origin in the upper left corner Y X(0, 0) (112, 40) 112 40

6 Graphical User Interface GUI window-based applications graphical components that the user can use to interact with the program –menus –buttons –… typically respond to mouse operations

7 GUI vs console applications graphical order of operations chosen by user text-based program flow designed into program

8 What GUI apps need graphical instead of text display respond to mouse and keyboard (including non-ascii keys, key combinations) components with standard behavior

9 Typical GUI Application Create a window Display the window Identify inputs to watch for Process user requests (events) –mouse clicks –key press –window changes

10 GUI Application typically an infinite loop do wait for an event process event until program exits

11 Event Processing wait for an event identify source of event mouse, keyboard, … take appropriate action actions often defined in functions

12 Libraries Primitive graphics operations are tedious keeping track of multiple objects can be very complex GUI interactions have to be done carefully if they are to work properly

13 Windowing Protocols X Windows - multi-platform, commonly Unix Mac OS Microsoft Windows –it did not come first Each has a slightly different behavior

14 X Windows network-transparent GUI for workstations –no difference between local and remote processes device-independent protocol for programming and using display-dependent implementation of the primitive graphics operations comes with most Unix systems

15 Xlib Library (C) of functions to do the graphics needed for X applications Higher level libraries for common interface components (windows, buttons, …) –Athena –Motif –QT

16 Programming X Tutorials –http://www.kerguelen.org/x/index.htmlhttp://www.kerguelen.org/x/index.html –http://www.cs.uregina.ca/~cdshaw/X11/x11not es.htmlhttp://www.cs.uregina.ca/~cdshaw/X11/x11not es.html –http://www.comp.lancs.ac.uk/computing/users/s ean/Motif-Workshop/workshop1.html Links to X Windows information –http://www.rahul.net/kenton/xsites.framed.html

17 QT Library Commercially available for most OS –http://www.trolltech.com/products/qt/index.htmlhttp://www.trolltech.com/products/qt/index.html Documentation and tutorials on emerald –/usr/lib/qt-2.3.0

18 Compiler options -L/pathToTheLibrary -lnameOfLib -I/pathToTheIncludeFiles


Download ppt "Graphics not part of C++ libraries –X libraries –QT library –OS specific."

Similar presentations


Ads by Google