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 American Standard Code for Information Interchange, 7 bits, commonly used in the US and abroad alias ISO , 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 D Drawing Character Sets / Character Encoding Issues HTML Document Representation http://www.w3.org/TR/html4/charset.html#h- 5.2 Unicode Character Encoding Model A tutorial on character code issues Fonts: Bitmap, PostScript, and TrueType Compared Base Monospace Overview of the Java 2D API Concepts Java2D: An Introduction and Tutorial Bina Nusantara


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

Similar presentations


Ads by Google