Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphics 2D 1 Subject:T0934 / Multimedia Programming Foundation Session:6 Tahun:2009 Versi:1/0.

Similar presentations


Presentation on theme: "Graphics 2D 1 Subject:T0934 / Multimedia Programming Foundation Session:6 Tahun:2009 Versi:1/0."— Presentation transcript:

1 Graphics 2D 1 Subject:T0934 / Multimedia Programming Foundation Session:6 Tahun:2009 Versi:1/0

2 Bina Nusantara Learning Outcomes In the end of this session, students must be able to: –Understand the basic principal of Java2D Graphics –Apply correct Java syntax to use Java2D Graphics

3 Outline Font 2D Graphics Java 2D Graphics Bina Nusantara

4 Font - Characters Bina Nusantara Characters (Alphabets) WordsSentencesLanguage Digits (123) Letters (ABC) Symbols (~!@)

5 Character Codes Bina Nusantara Character Code ASCII ISO Latin 1 Unicode ISO 10646 American Standard Code for Information Interchange, 7 bits, commonly used in the US and abroad alias ISO 8859-1, 8 bits, commonly used for computer processing 16 bits, include characters from all known languages and alphabets in the world (multilingual text and character encoding) 32 bits, defines UCS (Universal Character Set) A group of characters, each assigned with a unique numerical code

6 Characters & Glyphs CharactersGlyphsFonts Bina Nusantara represented in a visual display organized in one set One character can be represented as several glyphs Two or more characters can be represented in one glyphs AAAAA

7 Fonts Size –measured in points ( 1 point = 1/72 inch) Style –Bold, Italic, Underline, superscript, subscript, etc Classification Bina Nusantara Bitmap Glyphs are represented in bitmap (raster) blocky and less legible if enlarge PostScript developed by Adobe scalable require Adobe Type Manager (ATM) software to look smooth good for design and publishing not cross platform compatible TrueType jointly developed by Apple and Microsoft scalable not cross platform compatible everyone can make a new TT font OpenType jointly developed by Apple and Microsoft scalable not supported by all application cross platform compatible

8 Font Spacing Bina Nusantara all characters have the same width used for typewriter/newspaper characters’ width varies with the shape easier to read used for textbook

9 Font Bina Nusantara Font is accessible as long as installed in your computer. Font use only setFont and drawString.

10 Graphics Bina Nusantara Graphic Primitives Shapes Images Text Rendering Engine Java graphics2D Output Devices Screens Printers An engine to display graphic primitives on output devices

11 Graphics Coordinates Shapes Stroke Fill Composite Antialiasing Bina Nusantara

12 Coordinates User space – The space in which graphics primitives are specified Device space – The coordinate system of an output device such as a screen, window, or a printer Bina Nusantara X Y 0

13 Coordinates Bina Nusantara Graphic Primitives Rendering Engine Output Devices User SpaceDevice Spacetransform user space into device space

14 Coordinates Bina Nusantara An example to know the coordinate of mouse click in an image. Use MouseListener. Full code is downloadable in Additional Material.

15 Shapes Point Lines Rectangular Shapes Quadratic and Cubic Curves Bina Nusantara

16 Shapes Bina Nusantara An example showing how to make an Ellipse Shape

17 Stroke An outline of lines /dashing patterns on a graphic primitive Bina Nusantara SolidRound DotDashLong Dash Dot Thickness & Color

18 Stroke Bina Nusantara We add these codes to the previous code of shape, and we get strokes. Full code is downloadable in Additional Material.

19 Fill Interior of a graphic primitive Bina Nusantara SolidGradientTexture/ Pattern Image

20 Fill Bina Nusantara We add these codes to the previous code of shape, and we get gradient paint to fill. Full code is downloadable in Additional Material.

21 Composite Adding new objects on existing objects Bina Nusantara Composite

22 Bina Nusantara We add two shapes and for the second one we apply AlphaComposite to blend them together. Full code is downloadable in Additional Material.

23 Antialiasing Bina Nusantara AliasingAntialiasing

24 Bina Nusantara Antialiasing is used to smooth the curve of the font. In this example, “W” is smooth enough, even though it is enlarged.

25 Java 2D Graphics Bina Nusantara Graphic Primitives Rendering Engine Output Devices

26 References Java2D: An Introduction and Tutorial. 1998. http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html 2D Drawing. 2008. http://courses.coreservlets.com/Course-Materials/java5.htmlhttp://courses.coreservlets.com/Course-Materials/java5.html Character Sets / Character Encoding Issues. 2008. http://www.phpwact.org/php/i18n/charsets http://www.phpwact.org/php/i18n/charsets HTML Document Representation. 2009. http://www.w3.org/TR/html4/charset.html#h- 5.2http://www.w3.org/TR/html4/charset.html#h- 5.2 Unicode Character Encoding Model. 2008. http://www.unicode.org/unicode/reports/tr17/ http://www.unicode.org/unicode/reports/tr17/ A tutorial on character code issues. 2009. http://www.cs.tut.fi/~jkorpela/chars.htmlhttp://www.cs.tut.fi/~jkorpela/chars.html Fonts: Bitmap, PostScript, and TrueType Compared. 2004. http://support.apple.com/kb/TA21573?viewlocale=en_US http://support.apple.com/kb/TA21573?viewlocale=en_US Base Monospace. 2009. http://www.emigre.com/EFfeature.php?di=80http://www.emigre.com/EFfeature.php?di=80 Overview of the Java 2D API Concepts. 2008. http://java.sun.com/docs/books/tutorial/2d/overview/index.html http://java.sun.com/docs/books/tutorial/2d/overview/index.html Java2D: An Introduction and Tutorial. 1998. http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html Bina Nusantara


Download ppt "Graphics 2D 1 Subject:T0934 / Multimedia Programming Foundation Session:6 Tahun:2009 Versi:1/0."

Similar presentations


Ads by Google