Images can be imported into DirectAnimation from a URL or local file. DirectAnimation supports .png, .jpg, .gif, and .bmp formats. Importing is done in two steps: first you construct your URL base, then you use the importImage method, as shown in the following Java example:
//Create a URL base URL imageBase = buildURL(getImportBase(),"file:/c:/DxM/Media/image/"); // Create an image behavior by importing an image file ImageBvr img = importImage(buildURL(imageBase, "square.jpg"));
Here is an example of how to import an image from a local file, using JScript:
mediaBase = "..\\..\\..\\..\\media\\"; // the following form will also work as well // mediaBase = "file://c:\\dxm\\media\\"; imageBase = mediaBase + "image\\"; myImage = m.ImportImage(imageBase + "foliageUtah.jpg");
Here is an example of how to import an image from over the Internet, using JScript:
mediaBase = "http://dxmedia/directanimation/dxm_sdk/media/"; imageBase = mediaBase + "image/"; myImage = m.ImportImage(imageBase + "foliageUtah.jpg");
You can also construct an image by rendering lines, text, or geometries. See Using Images for more information.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.