Professional Documents
Culture Documents
Windows® Presentation
Foundation
Module 8: Graphics and Multimedia
• Creating 2-D Graphics
• Displaying Images
• Adding Multimedia
Lesson: Creating 2-D Graphics
• 2-D Graphics Support in WPF
• Drawing Shapes
Shapes
Ellipse
Rectangle
Geometry
Ellipse
Brush
Line Pen
Path
Drawing Shapes
• Bitmap (BMP)
• JPEG
• Portable Network Graphics (PNG)
• Graphics Interchange Format (GIF)
• Windows Media Photo (WMP)
Demonstration: Displaying Images in WPF
In this demonstration, you will see how to:
• Display an image by using the Image class
BitmapDecoder BitmapEncoder
Rotating, Converting, and Cropping Images
To rotate an image:
• Use FormatConverterBitmap
To crop an image:
• What Is a Viewport3D?
• Creating Models
• Z-axis
• Cameras
• Lights
Viewport3D
Model3D Light
What is a Viewport3D?
</Viewport3D>
</Canvas>
Camera Types for Viewport3D
Perspective Orthographic
<PerspectiveCamera <OrthographicCamera
FieldOfView="45" LookDirection="-1.0 -1 -4"
LookDirection="-1.0 -1 -4" Position="2 2 4"
Position="2 2 4" UpDirection="0 1 0"
UpDirection="0 1 0" /> Width="3.5" />
Creating Models
• Use models to define the shape of your 3-D objects
<MeshGeometry3D
Positions="2 0 0, 2 2 0, -2 0 0, -2 2 0"
TriangleIndices="0 1 2, 3 2 1" />
Y
1
220
2 0
-2 0 0 200
X
Demonstration: Rendering 3-D Content
In this demonstration, you will see how to:
• Review triangle geometry
• Create a rectangle
• EmissiveMaterial
<GeometryModel3D.Material>
<DiffuseMaterial
Brush="CornflowerBlue">
...
Specifying Light for a 3-D Model
Use any Light-derived classes in your model:
• AmbientLight
• DirectionalLight
• PointLight
• SpotLight
<ModelVisual3D>
...
<AmbientLight Color="#404040" />
<DirectionalLight Color="#C0C0C0"
Direction="2 -3 -1" />
...
Demonstration: Transforming a 3-D Model
In this demonstration, you will see how to:
• Make a geometry a resource
• MediaElement
• MediaPlayer
Sound
Video
Media Playback Modes
• LoadedBehavior
• UnloadedBehavior
• Play
• Pause
• Stop
• Close
Playing Media by Using a MediaPlayer
<VideoDrawing x:Name="videoSurface"
Rect="0,0,300,200" />
XAML
Logon information
Virtual machine 6460A-LON-DEV-08
Password Pa$$w0rd
• Best Practices
• Tools