16.9 Introduction to Multimedia - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

16.9 Introduction to Multimedia

Description:

To use the Windows Media Player control, programmers must add the control to the ... 16.12 Windows Media Player. 16.13 Microsoft Agent. Microsoft Agent ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 27
Provided by: reha6
Category:

less

Transcript and Presenter's Notes

Title: 16.9 Introduction to Multimedia


1
16.9 Introduction to Multimedia
  • Visual Basic offers many convenient ways to
    include images and animations in programs
  • Computing field decades ago mainly used computers
    to perform arithmetic calculations
  • We are beginning to realize the importance of
    computers data-manipulation capabilities
  • Multimedia programming presents many challenges
  • Multimedia applications demand extraordinary
    computing power

2
16.10 Loading, Displaying and Scrolling Images
  • Visual Basics multimedia capabilities
  • Graphics
  • Images
  • Animations
  • Video
  • Image manipulation

3
  • 1 ' Fig. 16.23 DisplayLogo.vb
  • 2 ' Displaying and resizing an image.
  • 3
  • 4 Public Class FrmDisplayLogo
  • 5 Inherits System.Windows.Forms.Form
  • 6
  • 15 Private mGraphicsObject As Graphics
  • 16 Private mImage As Image
  • 17
  • 18 ' sets member variables on form load
  • 19 Private Sub FrmDisplayLogo_Load(ByVal
    sender As _
  • 20 System.Object, ByVal e As
    System.EventArgs) _
  • 21 Handles MyBase.Load
  • 22
  • 23 ' get Form's graphics object
  • 24 mGraphicsObject Me.CreateGraphics
  • 25
  • 26 ' load image
  • 27 mImage Image.FromFile("images/Logo.gi
    f")

Uses Form method CreateGraphics to create a
Graphics object associated with the Form
The Image method FromFile retrieves an image
stored on disk and assigns it to mImage
4
  • 33 Private Sub cmdSetButton_Click (ByVal
    sender As System.Object, _
  • 34 ByVal e As System.EventArgs) Handles
    cmdSetButton.Click
  • 35
  • 36 ' get user input
  • 37 Dim width As Integer
    Convert.ToInt32(txtWidth.Text)
  • 38 Dim height As Integer
    Convert.ToInt32(txtHeight.Text)
  • 39
  • 40 ' if specified dimensions are too
    large display problem
  • 41 If (width 375 OrElse height 225)
    Then
  • 42 MessageBox.Show("Height or Width
    too large")
  • 43
  • 44 Return
  • 45 End If
  • 46 mGraphicsObject.Clear(Me.BackColor) '
    clear Windows Form
  • 47
  • 48 ' draw image
  • 49 mGraphicsObject.DrawImage(mImage, 5,
    5, width, height)
  • 50 End Sub ' cmdSetButton_Click
  • 51

If the parameters are valid, Graphics method
Clear is called to paint the entire Form in the
current background color
Graphics method DrawImage is called with the
following parameters the image to draw, the
x-coordinate of the upper-left corner,
y-coordinate of the upper-left corner, width of
the image, and height of the image
5
(No Transcript)
6
16.11 Animating a Series of Images
  • Two-dimensional collision detection
  • Two-dimensional collision detection is the
    detection of an overlap between two shapes
  • Chess Board
  • Defined by alternating light and dark tiles
    across a row in the pattern where the color that
    starts each row is equal to the color of last
    tile of previous row
  • Artifacts
  • An artifact is any unintended visual abnormality
    in a graphical program

7
Places the first image in the PictureBox
The event handler for timers Tick event displays
the next mage from the ArrayList. Timer interval
50 ms
8
(No Transcript)
9
16.12 Windows Media Player
  • Windows Media player
  • Enables an application to play video and sound in
    many multimedia formats
  • Motion Pictures Experts Group (MPEG)
  • Audio-Video Interleave (AVI)
  • Windows wave-file format (WAV)
  • Musical Instrument Digital Interface (MIDI)
  • To use the Windows Media Player control,
    programmers must add the control to the Toolbox.
    This is accomplished as following

10
16.12 Windows Media Player
1. Go to ToolBox ? Choose Items...
2. Click on the COM Components tab and
scroll down near the bottom of the List.
Look for Windows Media Player.3. When you
have found Windows Media Player, check the
box beside it and click on Ok.
11
16.12 Windows Media Player
4. The windows media player control should
now be in your Toolbox
5. Drag the control over a form and size it as
needed.
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
16.13 Microsoft Agent
  • Microsoft Agent
  • Microsoft Agent is a technology used to add
    interactive animated characters to Windows
    applications or Web pages
  • Microsoft Agent control provides programmers with
    access to four predefined characters Genie (a
    genie), Merlin (a wizard), Peedy (a parrot), and
    Robby (a robot).

16
16.13 Microsoft Agent
  • Microsoft provides basic information on Agent
    technology at its Web site
  • www.microsoft.com/msagent
  • This section introduces the basic capabilities of
    the Microsoft Agent control. For complete details
    on downloading this control, visit
  • http//www.microsoft.com/msagent/downloads/us
    er.aspx
  • The following example, Peedys Pizza Palace, was
    developed by Microsoft to illustrate the
    capabilities of the Microsoft Agent control.
  • You can view this example at http//www.microsof
    t.com/msagent/sdk/samples/html/peedypza.htm

17
Fig. 16.28 Peedy introducing himself when the
window opens.
18
16.13 Microsoft Agent
  • To use MS Agent, you have to add to your ToolBox
  • 1. Go to ToolBox ? Choose Items...
  • 2. Click on the COM Components tab
    and scroll down near the
  • bottom of the List. Check MS
    Agent Control. 3. Drag it to your form
  • Before running any code, you first must download
    and install the control, speech recognition
    engine, text to speech engine and the character
    definitions from the Microsoft Agent Web site
    listed previously.

19
(No Transcript)
20
In addition to the Microsoft Agent object myAgent
(of type AxAgent) that manages all the
characters, we also need an object (of type
IAgentCtlCharacter) to represent the current
character. We create this object, named mSpkr,
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
(No Transcript)
25
(No Transcript)
26
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com