<HTML>
<HEAD>
<TITLE>DirectX Media SDK DirectAnimation Tutorial</TITLE>
<LINK REL=STYLESHEET HREF="../../../../../webcd/da/tutorial.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex">
</HEAD>
<BODY BGCOLOR="WHITE" LINK=#0033CC TOPMARGIN=0 LEFTMARGIN=20>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->

<DIV CLASS="flush">
<TABLE WIDTH=100% BORDER=0 BGCOLOR=#000000>
<TR ALIGN=RIGHT><TD VALIGN=TOP><FONT CLASS=desc1 SIZE=2>
<A HREF="Section4.html" TARGET="_top">
<IMG SRC="../../../../../media/image/u_prev.gif"
 WIDTH=71 HEIGHT=16 BORDER=0 ALT="Previous Topic">
</A><A HREF="../../../../../webcd/da/tutorial_main.htm" TARGET="_top">
<IMG SRC="../../../../../media/image/d_home.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Tutorial Home Page"></A>
<IMG SRC="../../../../../media/image/d_next.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Next Topic">
</FONT></TD><TD WIDTH=30></TD></TR></TABLE></DIV>
<FONT CLASS=title><CENTER>Boiler Plates</CENTER></FONT>
<BR>
<FONT CLASS=code>
<BR>
import com.ms.dxmedia.*;    </FONT><FONT CLASS=desc2> All direct Animation classes</FONT><FONT CLASS=code><BR>
import java.net.*;          </FONT><FONT CLASS=desc2> the URL class</FONT><FONT CLASS=code><BR>
import java.awt.*;          </FONT><FONT CLASS=desc2> the Dimension class</FONT><FONT CLASS=code><BR>
import utility.*;           </FONT><FONT CLASS=desc2> the DraggableImage class</FONT><FONT CLASS=code><BR>
</FONT>
<BR>
<TABLE><TR><TD WIDTH=500><FONT CLASS=desc1> Splines is an applet that invokes SplinesModel to construct an
 interactive spline with the specified number of polynomial pieces</TD></TR></FONT></TABLE>
<FONT CLASS=code>public class Splines extends DXMApplet {<BR>
<DIV STYLE="margin-left: 0.125in">public void init() {<BR>
</DIV><DIV STYLE="margin-left: 0.25in">super.init() ;<BR>
setModel (new SplinesModel(this, 4));<BR>
</DIV><DIV STYLE="margin-left: 0.125in">}<BR>
</DIV>}<BR>
</FONT>
<BR>
<TABLE><TR><TD WIDTH=500><FONT CLASS=desc1><BR></TD></TR></FONT></TABLE>
<FONT CLASS=code>class SplinesModel extends Model {<BR>
<BR>
<DIV STYLE="margin-left: 0.125in">SplinesModel(DXMApplet dxma, int numPolys) {<BR>
</DIV><DIV STYLE="margin-left: 0.25in">_numPolys = numPolys;<BR>
</DIV></FONT>
<BR>
<TABLE><TR><TD WIDTH=500><FONT CLASS=desc1> Get the size of the viewport.</TD></TR></FONT></TABLE>
<FONT CLASS=code><DIV STYLE="margin-left: 0.25in">Dimension dim = dxma.getSize();</FONT>
<BR>
</DIV><TABLE><TR><TD WIDTH=500><FONT CLASS=desc1> The base unit of measure for DirectX Media is the meter.
 Convert the size into meters by multiplying it with the pixelBvr.</TD></TR></FONT></TABLE>
<FONT CLASS=code><DIV STYLE="margin-left: 0.25in">_halfWidth = mul(toBvr(dim.width*0.5),pixelBvr);<BR>
_halfHeight = mul(toBvr(dim.height*0.5),pixelBvr);<BR>
</DIV><DIV STYLE="margin-left: 0.125in">}<BR>
</DIV><BR>
<DIV STYLE="margin-left: 0.125in">private NumberBvr _halfWidth;      </FONT><FONT CLASS=desc2> half width of viewport</FONT><FONT CLASS=code><BR>
private NumberBvr _halfHeight;     </FONT><FONT CLASS=desc2> half height of viewport</FONT><FONT CLASS=code><BR>
</DIV><BR>
<BR>
</FONT><FONT CLASS=link><A ID=cpslug HREF="../../../../../help/da/dalegal.htm" TARGET="_top">&#169; 1997 Microsoft Corporation. All rights reserved. Terms of Use.</A></FONT>

<BR>
<BR>
<DIV CLASS="flush">
<TABLE WIDTH=100% BORDER=0 BGCOLOR=#000000>
<TR ALIGN=RIGHT><TD VALIGN=TOP><FONT CLASS=desc1 SIZE=2>
<A HREF="Section4.html" TARGET="_top">
<IMG SRC="../../../../../media/image/u_prev.gif"
 WIDTH=71 HEIGHT=16 BORDER=0 ALT="Previous Topic">
</A><A HREF="../../../../../webcd/da/tutorial_main.htm" TARGET="_top">
<IMG SRC="../../../../../media/image/d_home.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Tutorial Home Page"></A>
<IMG SRC="../../../../../media/image/d_next.gif" WIDTH=48 HEIGHT=16 BORDER=0 ALT="Next Topic">
</FONT></TD><TR><TD WIDTH=30></TD></TR></TABLE></DIV>
</BODY>
</HTML>
