DOC PREVIEW
lecture

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 5: Other Output Models: Structured Graphics; Object-Oriented TechniquesStructured GraphicsStructured Graphics, cont.Structured Graphics Can SupportStructured Graphics DisadvantagesRedisplay AlgorithmsRedisplay only the affected areas of the screenIssue: Anti-Aliasing and special effectsOptimizing RedrawSlide 10Object-Oriented TechniquesObject OrientedOOSlide 14Multiple inheritancePrototype-Instance modelSlide 17Slide 18Examples of OO SystemsSlide 20Slide 21Slide 22Slide 23Slide 24Amulet and Garnet Videos1Lecture 5:Other Output Models:Structured Graphics;Object-Oriented Techniques Brad Myers 05-830Advanced User Interface Software2Structured GraphicsSaves a list of all the graphical objects Edit the screen by editing the saved list Also called "display list" or "retained object model" Provided by many toolkits and graphics packages early vector displays CORE (~1977), GKS (1985), PHIGS (1988) Optional in InterViews, CLIM, etc. Required in Amulet, Garnet, Rendezvous, etc.3Structured Graphics, cont.Advantages: Simpler to program with: don't call "draw" and "erase" Automatic refresh of windows when uncovered, etc. Automatic redisplay of objects when change and also of other overlapping objects4Structured Graphics Can SupportAbility to support: high-level behaviors like move, grow, cut/copy/paste, etc. high-level widgets like selection handles constraints among objects automatic layout grouping: "Groups" in Garnet automatic PostScript printing tutors and monitors external scripting, ...5Structured Graphics DisadvantagesDisadvantages: Significant space penalties objects take up to 1000 bytes each imagine a scene with 40,000 dots (200x200 fat bits) Time penalties Redisplay doesn't take advantage of special properties of data: regularity non-overlapping6Redisplay AlgorithmsRedisplay everything each time Most appropriate for small numbers of objects, and if drawing is really quick compared to computation Used on the Macintosh and many others Used by AmuletUsed by homework 2May add clipping region and/or double-buffering7Redisplay only the affected areas of the screenRequires computing what areas are affected Garnet: 1. keep track of objects that change any "interesting" slot 2. compute the bounding box of all these changed objects in their old and new locations 3. assert this as the clipping region (must not self-intersect; Garnet uses 2 regions) 4. erase the area 5. go through objects from top-to-bottom, back to front draw those which overlap the bounding box for step 4: goes through all top level aggregates, and any children of the aggregates that intersect (recursively) Other techniques: quad trees8Issue: Anti-Aliasing and special effectsDrop shadows, highlights, other special effectsCan’t assume clipping regions will workCan draw outside of the bounding boxesMac OS X uses anti-aliasing and seems to redraw lots of windows9Optimizing RedrawSpecial additions in Garnet; not in Amulet "Fast-redraws" declared by the programmer objects drawn with XOR on top of other objects those that have a solid color behind them (nothing in front) so can be erased with a rectangle or by redrawing with the background color When change, have to be erased using old values No bounding boxes, no intersections, etc. "Virtual aggregates" only pretend to allocate storage for elements provide table and arbitrary layouts10Optimizing Redraw“Glyphs” in InterViewsCalder, P.R. and Linton, M.A. “Glyphs: Flyweight Objects for User Interfaces,” in Proceedings UIST'90: ACM SIGGRAPH Symposium on User Interface Software and Technology. 1990. Snowbird, Utah: pp. 92-101. Don't include position information, etc. so very small Much of the layout retained by the aggregate (computed as needed) Object can be reused in many places: e.g.: the letter "a" Used for a text editor Issue: why is location special? What about red vs. blue "a"s?11Object-Oriented TechniquesMotivation Became popular along with GUIs, Direct Manipulation Icons, graphics seem like objects: have internal state, persistance OO was originally developed (SmallTalk) and became popular (C++) mostly due to GUIs.12Object Oriented As a UI technique: Same as GUI, Direct Manipulation = icons, graphical objects, widgets Here, as a programming paradigm (often in a language) A form of "data abstraction" "Classes" describe the basic structure of the data Also, the methods that can be called Usually no direct access to the data, only the methods13OOCreate "instances" of the classes local copy of data may also be class data shares all methods "Inheritance": create a new class "like" the superclass by default has all the same methods and data can add new data and methods and re-program inherited methods Example: graphical_object.draw ... circle.draw14OONew style of programming; thinking about the problem Many books about how to do it right. OO design; getting the classes and protocols right So subclasses don't have extra, wasted data space Methods make sense to all sub-classes So external classes don't need to know inside description. Also OO databases, etc. Implementation: object in memory, starts with pointer to table of methods, etc. lots of tricks and extra declarations in C++ etc. to avoid overhead of lookups ("virtual", "pure virtual")15Multiple inheritanceClass has multiple parent classes Combine all the methods and data of all Special rules for when conflict (same method, same name of data with different types, etc.) Example: circle inherits from graphical-object and moveable-object Complex so often not used even when available Amulet uses constraints to provide flexible copying of values insteadJava, etc. use “interfaces”No inheritance of implementations, but ability to have arbitrary “mix-ins”16Prototype-Instance modelInstead of the class-instance model All objects are instances Can use any object as a prototype for other objects Inherits all slots it doesn't override (= instance variables, member variables, fields, attributes). Methods are just a value in a slot Dynamic changing of methods Easy to implement using structures. Usually, changing prototype data also changes all instances that do not override it.17Prototype-Instance


lecture

Download lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?