Spring 20106.813/6.831 User Interface Design and Implementation1 Lecture 11: Output.

Slides:



Advertisements
Similar presentations
Graphics Programming. Introduction GOAL: Build the Indexer Client Event-driven vs. Sequential programs Terminology – Top-level windows are called “frame.
Advertisements

More Java Drawing in 2D Animations with Timer. Drawing Review A simple two-dimensional coordinate system exists for each graphics context or drawing surface.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
A Digital Imaging Primer Nick Dvoracek Instructional Resources Center University of Wisconsin Oshkosh.
User Interface Programming in C#: Graphics
Spring /6.831 User Interface Design and Implementation1 Lecture 10: Layout.
Multimedia for the Web: Creating Digital Excitement Multimedia Element -- Graphics.
Graphics File Formats. 2 Graphics Data n Vector data –Lines –Polygons –Curves n Bitmap data –Array of pixels –Numerical values corresponding to gray-
2.01 Understand Digital Raster Graphics
Graphics in the web Digital Media: Communication and Design
Introduction to Computer Graphics
V Obtained from a summer workshop in Guildford County July, 2014
Graphical images Bit-mapped (or raster-based) image: Matrix describing the individual dots that are the smallest elements (pixels) of resolution on a computer.
Web Design, 5 th Edition 5 Typography and Images.
1 Bitmap Graphics It is represented by a dot pattern in which each dot is called a pixel. Each pixel can be in any one of the colors available and the.
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
COMPUTER GRAPHICS Prepared by S.MAHALAKSHMI Asst. Prof(Sr) / SCSE VIT University.
Spring /6.831 User Interface Design and Implementation1 Lecture 22: Internationalization.
Lecture 4 - Introduction to Computer Graphics
Digital Images Chapter 8, Exploring the Digital Domain.
BFTAW BDPA Workshop Introduction to GIMP Chris
BFTAW BDPA Workshop Introduction to GIMP Chris
Tutorial 6 Working with Bitmaps and Gradients, and Publishing Flash Files.
Tutorial 2 Drawing Text, Adding Shapes, and Creating Symbols.
1 JPEG v JPEG stands for Joint Photographic Experts Group v Superior for continuous tone, photographic color images not good on sharp-edges or flat-colornot.
Processing and Exporting Images Ivan Zhekov Telerik Web Design Course html5course.telerik.com Front-end Developer
Tutorial 1 Introducing Adobe Flash CS3 Professional
3D Game Programming All in One By Kenneth C. Finney.
Computer Graphics Bitmaps & Sprites CO2409 Computer Graphics Week 3.
© De Montfort University, Vector and Bitmapped graphics Howell Istance School of Computing De Montfort University.
GDI+ 1. Objectives 2 GDI+ class  Create and render Graphic  Display information on the computer screen, printer 3.
Flash Flash. It’s components and usage. New generation of web- design  Definition Multimedia technology developed by Macromedia to allow much interactivity.
Spring /6.831 User Interface Design and Implementation1 Lecture 24: Animation HW2 out, due next Sunday look for your evaluation assignment on.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 3 This presentation © 2004, MacAvon Media Productions Introduction to Computer Graphics.
Java Graphics. Review 3 kinds of elements in components API? Layout managers Events Extend vs. Implement.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
Lecture 16 Image Document Formats. Bitmap vs. Vector Images Bitmaps do not generally.
ADOBE PHOTOSHOP VECTOR VS RASTER. Pixel A pixel is the fundamental unit of an image in Photoshop. It is a small square block of color. An image often.
Android Graphics Library. Color Android colors are represented with four numbers, one each for alpha, red, green, and blue (ARGB). Each component can.
2D Graphics Theory & Principles. Single Point Smallest addressable area on screen or digital image.
File Formats and Vector Graphics. File Types Images and data are stored in files. Each software application uses different native file types and file.
Digital Media Dr. Jim Rowan ITEC So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats.
Spring /6.831 User Interface Design and Implementation1 Lecture 9: UI Software Architecture RS1 (for 6.831G), PS1 (for 6.813U) released today,
Raster Graphics 2.01 Investigate graphic image design.
Fall UI Design and Implementation1 Lecture 6: Output.
CISC 110 Day 3 Introduction to Computer Graphics.
Slide 1 Graphics (Characteristics 1) Images have various characteristics that affect performance Size (number of pixels) – Large images can be several.
Graphics and Image Data Representations 1. Q1 How images are represented in a computer system? 2.
13 June – Session : Graphics Different types of Graphics for the web Features of image editing software Good practice for image editing.
Efficient Game Graphics From Flash MX 2004 Game Design Demystified.
Understanding Images. Pixels pixels Every image is made up of very small squares called pixels, and each pixel represents a color or shade. Pixels within.
BITMAPPED IMAGES & VECTOR DRAWN GRAPHICS
2.01 Understand Digital Raster Graphics
2.01 Understand Digital Raster Graphics
OVERVIEW Objectives Follow a design document to prepare images for inclusion in a Web page Run a batch process to prepare multiple images in one step Use.
2.01 Understand Digital Raster Graphics
Flash Interface, Commands and Functions
Raster Images CPSC 1030.
CS Computer Graphics Valdosta State University, Spring 2018
Chapter 3:- Graphics Eyad Alshareef Eyad Alshareef.
1.01 Investigate graphic types and file formats.
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
Introduction to Computer Graphics
2.01 Understand Digital Raster Graphics
MED 2001 Advanced Media Production
2.01 Understand Digital Raster Graphics
Web Programming– UFCFB Lecture 7
Vectors and Paths, also File Export
Multimedia System Image
Lecture 4 - Introduction to Computer Graphics
Presentation transcript:

Spring /6.831 User Interface Design and Implementation1 Lecture 11: Output

UI Hall of Fame or Shame? Spring User Interface Design and Implementation2 suggested by Jonathan Goldberg

Nanoquiz closed book, closed notes submit before time is up (paper or web) we’ll show a timer for the last 20 seconds Spring /6.831 User Interface Design and Implementation

1.Automatic layout: (choose all that apply) A. is a recursive process over the view hierarchy B. is useful for tolerating changes in font size C. is a feature of the MVC pattern D. is limited to enforcing one-dimensional constraints among objects 2.Which of the following is an uncontroversial statement: (choose all that apply) A. table elements should be used for layout in HTML and CSS B. CSS layout was originally designed for documents, not GUIs C. it’s harder to prepare for a nanoquiz when the lecture notes are scanty D. the Document Object Model stores application data 3.Which of the following is not a CSS layout style? (choose one answer) A. display: block B. display: inline C. display: div D. display: inline-block Spring /6.831 User Interface Design and Implementation

Today’s Topics Output approaches Drawing Rasterization Declarative programming Spring /6.831 User Interface Design and Implementation5

Three Output Approaches Objects –Graphical objects arranged in a tree with automatic redraw –Example: Label object, Line object –Also called: views, interactors, widgets, controls Strokes –High-level drawing primitives: lines, shapes, curves, text –Example: drawText() method, drawLine() method –Also called: vector graphics, structured graphics Pixels –2D array of pixels –Also called: raster, image, bitmap Spring /6.831 User Interface Design and Implementation6

Example: Designing a Graph View Object approach –Each node and edge is a component –A node might have two subcomponents: circle and label Stroke approach –Graph view draws lines, circles and text Pixel approach –Graph view has pixel images of the nodes Spring /6.831 User Interface Design and Implementation7 A C B Window Node A CircleLabel Edge A-B …

Issues in Choosing Output Approaches Layout Input Redraw Drawing order Heavyweight objects Device dependence Spring /6.831 User Interface Design and Implementation8

How Output Approaches Interact Spring /6.831 User Interface Design and Implementation9 Objects Strokes Pixels drawing rasterization

Drawing a View Tree Drawing goes top down –Draw self (using strokes or pixels) –For each child component, If child intersects clipping region then –intersect clipping region with child ’ s bounding box –recursively draw child with clip region set to the intersection Spring /6.831 User Interface Design and Implementation10 A C B clip region Window Node A CircleLabel Node B … …

Redraw Example Spring /6.831 User Interface Design and Implementation11 Window Node A Circle Label Node B … … Skipped (doesn’t intersect clip region) A C B A C B A C B A C B A Edge A-B A C B A

Z Order 2D GUIs are really “2 ½ D” –Drawing order produces layers –Not a true z coordinate for each object, but merely an ordering in the z dimension View tree and redraw algorithm dictate z order –Parents are drawn first, underneath children –Older siblings are drawn under younger ones Flex, HTML, most GUI toolkits and drawing programs behave this way Java Swing is backwards: last component added (highest index) is drawn first Spring /6.831 User Interface Design and Implementation12 A C B A C B A

Damage and Automatic Redraw Spring /6.831 User Interface Design and Implementation13 A C B A D B A C B damaged region Window Node A Node BNode C / D

Naïve Redraw Causes Flashing Effects Spring /6.831 User Interface Design and Implementation14 Determine damaged region Redraw parent (children blink out!) Redraw children Object moves

Double-Buffering Double-buffering solves the flashing problem Spring /6.831 User Interface Design and Implementation15 Screen Memory buffer

Going From Objects to Strokes Drawing method approach –e.g. Swing paint() method –Drawing method is called directly during redraw; override it to change how component draws itself Retained graphics approach –e.g. Adobe Flex –Stroke calls are recorded and played back at redraw time Differences –Retained graphics is less error prone –Drawing method gives more control and performance Spring /6.831 User Interface Design and Implementation16

Stroke Model Drawing surface –Also called drawable (X Windows), GDI (MS Win) –Screen, memory buffer, print driver, file, remote screen Graphics context –Encapsulates drawing parameters so they don ’ t have to be passed with each call to a drawing primitive –Font, color, line width, fill pattern, etc. Coordinate system –Origin, scale, rotation Clipping region Drawing primitives –Line, circle, ellipse, arc, rectangle, text, polyline, shapes Spring /6.831 User Interface Design and Implementation17

HTML5 Canvas in One Slide HTML element graphics context var ctx = canvas.getContext(“2d”) coordinate system ctx.translate() ctx.rotate() ctx.scale() color, font, line style, etc. ctx.strokeStyle = “rgb(0.5,0.5,0.5)” ctx.fillStyle = … ctx.font = “bold 12pt sans- serif” ctx.lineWidth = 2.5 drawing primitives ctx.beginPath(); ctx.moveTo(0,0) ctx.lineTo(500,500) ctx.stroke() ctx.beginPath() ctx.arc(500,500,100,0, 2*Math.PI,false) ctx.fill() clipping ctx.beginPath() ctx.rect(0, 0, 200, 300) ctx.clip() Spring /6.831 User Interface Design and Implementation18

Antialiasing and Subpixel Rendering Spring /6.831 User Interface Design and Implementation19 Simple Antialiased Subpixel rendering

Pixel Approach Pixel approachis a rectangular array of pixels –Each pixel is a vector (e.g., red, green, blue components), so pixel array is really 3 dimensional Bits per pixel (bpp) –1 bpp: black/white, or bit mask –4-8 bpp: each pixel is an index into a color palette –24 bpp: 8 bits for each color –32 bpp: 8 bits for each color + alpha channel Color components (e.g. RGB) are also called channels or bands Pixel model can be arranged in many ways –Packed into words (RGBR GBRG … ) or loosely (RGB- RGB- … ) –Separate planes (RRR … GGG … BBB … ) vs. interleaved (RGB RGB RGB … ) –Scanned from top to bottom vs. bottom to top Spring /6.831 User Interface Design and Implementation20

Transparency Alpha is a pixel ’ s transparency –from 0.0 (transparent) to 1.0 (opaque) –so each pixel has red, green, blue, and alpha values Uses for alpha –Antialiasing –Nonrectangular images –Translucent components –Clipping regions with antialiased edges Spring /6.831 User Interface Design and Implementation21

BitBlt BitBlt (bit block transfer) copies a block of pixels from one image to another –Drawing images on screen –Double-buffering –Scrolling –Clipping with nonrectangular masks Compositing rules control how pixels from source and destination are combined –More about this in a later lecture Spring /6.831 User Interface Design and Implementation22

Image File Formats GIF –8 bpp, palette uses 24-bit colors –1 color in the palette can be transparent (1-bit alpha channel) –lossless compression –suitable for screenshots, stroked graphics, icons JPEG –24 bpp, no alpha –lossy compression: visible artifacts (dusty noise, moire patterns) –suitable for photographs PNG –lossless compression –1, 2, 4, 8 bpp with palette –24 or 48 bpp with true color –32 or 64 bpp with true color and alpha channel –suitability same as GIF –better than GIF, but no animation Spring /6.831 User Interface Design and Implementation23

Hints for Debugging Output Something you ’ re drawing isn ’ t appearing on the screen. Why not? –Wrong place –Wrong size –Wrong color –Wrong z-order Spring /6.831 User Interface Design and Implementation24

Summary Component, stroke, pixel models Automatic redraw and double-buffering Image formats Spring /6.831 User Interface Design and Implementation25