DirectAnimation Animated Header --DAStatic Functions Relevant to DAImage Objects DirectAnimation Animated Header --DAStatic Functions Relevant to DAImage Objects* Microsoft DirectAnimation SDK
*Contents  *Index  *Topic Contents
*Previous Topic: DAStatic Properties Relevant to DAGeometry Objects
*Next Topic: DAStatic Properties Relevant to DAImage Objects

DAStatic Functions Relevant to DAImage Objects



GradientHorizontalAnim

DAStatics Class

Creates a DAImage object that smoothly interpolates between the start and stop colors. Colors start on the left and go toward the right, based on the power specified by power.

The extent of the generated image is [-0.5,-0.5] to [0.5,0.5]. These dimensions are always in meters, even if the PixelLibrary is selected. To convert from pixels to meters, use the Pixel conversion factor.

lib.GradientHorizontalAnim(
  start,
  stop,
  power
  )

Parameters
start
The DAColor object representing the first color of the gradient fill.
stop
The DAColor object representing the final color of the gradient fill.
power
The DANumber object that is an exponent controlling how rapidly one color transitions into another. A value of 1 is a linear transition. For 0 < power < 1 the transition occurs rapidly, while power > 1 means that the transition occurs more slowly. For example, if you are transitioning from red to blue, and power = 2, you will see a great deal of red in the gradient fill. On the other hand, if power = 0.5 (the inverse of 2), you will see very little red. If power = 0, you will see only blue. More precisely, if x is considered the normalized distance (from 0 to 1), then the gradient is xp, where p is in the range [0, infinity]. This must be an animated number.
Return Values

Returns the DAImage object.


GradientHorizontal

DAStatics Class

Same as GradientHorizontalAnim except that power is a non-animated number.

lib.GradientHorizontal(
  start,
  stop,
  power
  )


GradientPolygon

DAStatics Class

Creates a polygon from an array of points and an array of colors. The polygon has a smooth interpolation between the colors at the vertices. This interpolation is in RGB space. The image is transparent and unpickable outside the polygon. The polygon must be convex and fanned, with at least 3 vertices. The tessellation into triangles occurs by fanning around the first vertex. If, for example, the first triangle is from vertices [0, 1, 2], the second is from [0, 2, 3], and so on. The tessellation determines how the color interpolation is done. The bounding box is the box surrounding the points of the polygon.

lib.GradientPolygon(
  pts,
  colors
  )

Parameters
pts
The array (variant) of DAPoint2 points that determine the polygon's vertices.
colors
The array (variant) of DAColor colors corresponding to the vertices.
Return Values

Returns the DAImage object.


GradientSquare

DAStatics Class

Creates a DAImage object with a square color wash. The image is a unit-sized square, centered at the origin, reaching from [-0.5, -0.5] to [0.5, 0.5]. The image contains the specified colors in the specified corners. The gradient fills are determined by bilinearly interpolating between these specified colors. (This means that, rather than being simply a four-cornered polygon, it is a polygon with four corners plus a point in the middle that is the average of the four colors.) The image is transparent and unpickable outside of this region. The interpolation is in RGB space. The bounding box is a box from (-0.5, -0.5) to (0.5, 0.5).

lib.GradientSquare(
  lowerLeft,
  upperLeft,
  upperRight,
  lowerRight
  )

Parameters
lowerLeft
The DAColor color in the lower-left hand corner of square.
upperLeft
The DAColor color in the upper-left hand corner of the square.
upperRight
The DAColor color in the upper-right hand corner of the square.
lowerRight
The DAColor color in the lower-right hand corner of the square.
Return Values

Returns the DAImage object.


HatchBackwardDiagonalAnim

DAStatics Class

Creates backward diagonal (lines that slant from right to left) hatch marks. All hatches fit in a box, of dimension size, that is infinitely tiled. For perpendicular hatches, the size of the box is twice the distance between the hatch lines. By default, hatch marks are black and appear on a transparent background.

lib.HatchBackwardDiagonalAnim(
  color,
  size
  )

Parameters
color
The DAColor object representing the line color.
size
The DANumber object representing the size of the hatch box. This must be an animated number.
Return Values

Returns the DAImage object.


HatchBackwardDiagonal

DAStatics Class

Same as HatchBackwardDiagonal except that size is a non-animated number.

lib.HatchBackwardDiagonal(
  color,
  size
  )


HatchCrossAnim

DAStatics Class

Creates cross-hatched markings. This function can be thought of as a combination of the HatchVerticalAnim and the HatchHorizontalAnim functions. All hatches fit in a box, of dimension size, that is infinitely tiled. For perpendicular hatches, the size of the box is twice the distance between the hatch lines. By default, hatch marks are black and appear on a transparent background.

lib.HatchCrossAnim(
  color,
  size
  )

Parameters
color
The DAColor object representing the line color.
size
The DANumber object representing the size of the hatch box. This must be an animated number.
Return Values

Returns the DAImage object.


HatchCross

DAStatics Class

Same as HatchCrossAnim except that size is a non-animated number (a double).

lib.HatchCross(
  color,
  size
  )


HatchDiagonalCrossAnim

DAStatics Class

Creates diagonally criss-crossed hatch marks. All hatches fit in a box, of dimension size, that is infinitely tiled. For perpendicular hatches, the size of the box is twice the distance between the hatch lines. By default, hatch marks are black and appear on a transparent background.

lib.HatchDiagonalCrossAnim(
  color,
  size
  )

Parameters
color
The DAColor object representing the line color.
size
The DANumber object representing the size of the hatch box. This must be an animated number.
Return Values

Returns the DAImage object.


HatchDiagonalCross

DAStatics Class

Same as HatchDiagonalCrossAnim except that size is a non-animated number (a double).

lib.HatchDiagonalCross(
  color,
  size
  )


HatchForwardDiagonalAnim

DAStatics Class

Creates forward diagonal (lines that slant from left to right) hatch marks. All hatches fit in a box, of dimension size, that is infinitely tiled. For perpendicular hatches, the size of the box is twice the distance between the hatch lines.

lib.HatchForwardDiagonalAnim(
  color,
  size
  )

Parameters
color
The DAColor object representing the line color.
size
The DANumber object representing the size of the hatch box. This must be an animated number.
Return Values

Returns the DAImage object.


HatchForwardDiagonal

DAStatics Class

Same as HatchForwardDiagonalAnim except that size is a non-animated number (a double).

lib.HatchForwardDiagonal(
  color,
  size
  )


HatchHorizontalAnim

DAStatics Class

Creates horizontal hatch lines. All hatches fit in a box, of dimension size, that is infinitely tiled. For perpendicular hatches, the size of the box is twice the distance between the hatch lines. By default, hatch marks are black and appear on a transparent background.

lib.HatchHorizontalAnim(
  color,
  size
  )

Parameters
color
The DAColor object representing the line color.
size
The DANumber object representing the size of the hatch box. This must be an animated number.
Return Values

Returns the DAImage object.


HatchHorizontal

DAStatics Class

Same as HatchHorizontalAnim except that size is a non-animated number (a double).

lib.HatchHorizontal(
  color,
  size
  )


HatchVerticalAnim

DAStatics Class

Creates vertical hatch lines. All hatches fit in a box, of dimension size, that is infinitely tiled. For perpendicular hatches, the size of the box is twice the distance between the hatch lines. By default, hatch marks are black and appear on a transparent background.

lib.HatchVerticalAnim(
  color,
  size
  )

Parameters
color
The DAColor object representing the line color.
size
The DANumber object representing the size of the hatch box. This must be an animated number.
Return Values

Returns the DAImage object.


HatchVertical

DAStatics Class

Same as HatchVerticalAnim except that size is a non-animated number (a double).

lib.HatchVertical(
  color,
  size
  )


ImportImage

DAStatics Class

Creates a DAImage by synchronously importing the given bitmap. The pixels of the bitmap are mapped to points in the image such that the center of the bitmap is placed at (0,0). The extent of the points affected depends on the width and height of the bitmap in pixels and the resolution of the bitmap in pixels per meter. The bounding box of an imported image is calculated as follows:

If the pixel dimensions are WxH, and given that:

halfWidthMeters = lib.mul(lib.DANumber(W/2), lib.Pixel)
halfHeightMeters = lib.mul(lib.DANumber(H/2), lib.Pixel)

then the bounding box will be (-halfWidthMeters, -halfHeightMeters) to (halfWidthMeters, halfHeightMeters) with the resultant image centered at the origin.

Synchronous loads are blocking calls, which means that ticking will not continue on any model until all synchronous downloads are completed. These downloads should be small and listed before asynchronous downloads. Use asynchronous downloads for more complex images and sounds. See below for a description of the asynchronous function, ImportImageAsync.

lib.ImportImage(
  url
  )

Parameters
url
The pathname of the image to be downloaded.
Return Values

Returns the DAImage object.

Remarks

The file formats that can be imported are .PNG, .JPG, .BMP, and .GIF.

See Also

ImportImageColorKey


ImportImageAsync

DAStatics Class

Asynchronously imports the given bitmap. The pixels of the bitmap are mapped to points in the image such that the center of the bitmap is placed at (0,0). The extent of the points affected depends on the width and height of the bitmap in pixels and the resolution of the bitmap in pixels per meter. The bounding box of an imported image is calculated as follows:

If the pixel dimensions are WxH, and given that:

halfWidthMeters = lib.mul(lib.DANumber(W/2), lib.Pixel)
halfHeightMeters = lib.mul(lib.DANumber(H/2), lib.Pixel)

then the bounding box will be (-halfWidthMeters, -halfHeightMeters) to (halfWidthMeters, halfHeightMeters) with the resultant image centered at the origin.

Asynchronous downloads should be listed after synchronous ones and used for more complex sounds and images. For a description of the synchronous import function, see ImportImage.

lib.ImportImageAsync(
  url,
  imgStandIn
  )

Parameters
url
The pathname (a string) of the image to be downloaded.
imgStandIn
The DAImage object to use while the contents at url are still being downloaded. This argument cannot be null, however, the image can be empty.
Return Values

Returns the DAImportationResult object, which has the following relevant properties:

See Also

ImportImageAsyncColorKey


ImportImageAsyncColorKey

DAStatics Class

Allows a particular color in the asynchronously imported image, specified by an RGB value, to be treated as transparent.

lib.ImportImageAsyncColorKey(
  url,
  imgStandIn,
  red,
  green,
  blue
  )

Parameters
url
The pathname (a string) of the image to be downloaded.
imgStandIn
The DAImage object to use while the contents at url are still being downloaded. This argument cannot be null, however, the image can be empty.
red
The red component, expressed as a value (a byte) ranging from 0 to 255.
green
The green component, expressed as a value (a byte) ranging from 0 to 255.
blue
The blue component, expressed as a value (a byte) ranging from 0 to 255.
Return Values

Returns the DAImportationResult object.

See Also

ImportImageAsync


ImportImageColorKey

DAStatics Class

Allows a particular color in the synchronously imported image, specified by an RGB value, to be treated as transparent.

lib.ImportImageColorKey(
  url,
  red,
  green,
  blue
  )

Parameters
url
The pathname (a string) of the image to be downloaded.
red
The red component, expressed as a value (a byte) ranging from 0 to 255.
green
The green component, expressed as a value (a byte) ranging from 0 to 255.
blue
The blue component, expressed as a value (a byte) ranging from 0 to 255.
Return Values

Returns the DAImage object.

See Also

ImportImage


ImportMovie

DAStatics Class

Downloads a movie synchronously. Synchronous loads are blocking calls, which means that ticking will not continue on any model until all synchronous downloads are completed. These downloads should be small and listed before asynchronous downloads. Use asynchronous downloads for more complex images and sounds. See ImportMovieAsync for a description of the asynchronous import function.

The image portion of a movie has the same bounding box and placement as a static image such as a GIF or PNG. For more information, see ImportImage.

lib.ImportMovie(
  url
  )

Parameters
url
The pathname (a string) of the movie to be downloaded.
Return Values

Returns the DAImportationResult object, which has the following relevant properties:


ImportMovieAsync

DAStatics Class

Imports a movie asynchronously. Asynchronous downloads should be listed after synchronous ones and used for more complex sounds and images. For a description of the synchronous import function, see ImportMovie.

The image portion of a movie has the same bounding box and placement as a static image such as a GIF or PNG. For more information, see ImportImage.

lib.ImportMovieAsync(
  url,
  imgStandIn,
  sndStandIn
  )

Parameters
url
The pathname (a string) of the movie to download.
imgStandIn
The DAImage to use while the movie is still being downloaded. This parameter cannot be null, however, the image can be empty.
sndStandIn
The DASound to use while the movie is still being downloaded. This parameter cannot be null, however, the sound can be silence.
Return Values

Returns the DAImportationResult object, which has the following relevant properties:


Overlay

DAStatics Class

Creates a DAImage object by laying the image i1 over the image behavior i2. The new image consists of all fully opaque points of i1, all points of i2 that are under fully transparent points in i1, and all partially opaque points of i1 modified such that the new point is a combination of the i1 point and the i2 point under it. The bounding box of a set of overlaid images is simply the union of the bounding boxes of the images themselves.

lib.Overlay(
  i1,
  i2
  )

Parameters
i1 and i2
The DAImage objects.
Return Values

Returns the DAImage object.


OverlayArray

DAStatics Class

Creates a DAImage object by layering the DAImage objects. The bounding box of a set of overlaid images is simply the union of the bounding boxes of the images themselves.

lib.OverlayArray(
  im
  )

Parameters
im
An array (variant) of DAImage objects.
Return Values

Returns the DAImage object.


RadialGradientPolygonAnim

DAStatics Class

Creates a DAImage object that is a regular polygon with a radial fill. The image contains the specified colors at the origin and the exterior points, respectively. The gradient fill is determined by the power argument and occurs in RGB space. Outside of the filled-in region, the image is transparent and unpickable. The bounding box is the box surrounding the points of the polygon.

lib.RadialGradientPolygonAnim(
  inner,
  outer,
  points,
  power
  )

Parameters
inner
The DAColor object representing the color at the origin of the polygon.
outer
The DAColor object representing the color at the vertices.
points
The DAPoint2 object representing the array of points that determine the polygon's vertices.
power
The DANumber object that is an exponent controlling how rapidly one color transitions into another. A value of 1 is a linear transition. For 0 < power < 1 the transition occurs rapidly, while power > 1 means that the transition occurs more slowly. For example, if you are transitioning from red to blue, and power = 2, you will see a great deal of red in the gradient fill. On the other hand, if power = 0.5 (the inverse of 2), you will see very little red. If power = 0, you will see only blue. More precisely, if x is considered the normalized distance (from 0 to 1), then the gradient is xp, where p is in the range [0, infinity]. This must be an animated number.
Return Values

Returns the DAImage object.


RadialGradientPolygon

DAStatics Class

Same as RadialGradientPolygonAnim except that power must be an animated number.

lib.RadialGradientPolygon(
  inner,
  outer,
  points,
  power
  )


RadialGradientRegularPolyAnim

DAStatics Class

Creates a DAImage object that is a regular, gradient polygon with the specified number of sides (there must be at least 3) and a radial fill. It has a unit width and height, centered at the origin, with an extent from (-0.5, -0.5) to (0.5, 0.5). (These dimensions are always in meters, even if the PixelLibrary is selected. To convert from pixels to meters, use the Pixel conversion factor.) The image contains the specified colors at the origin and the exterior points, respectively. The gradient fill is determined by the power argument and occurs in RGB space. Outside of the filled-in region, the image is transparent and unpickable. The bounding box is the box surrounding the points of the polygon.

Creates a DAImage object that smoothly interpolates between the start and stop colors. Colors start on the left and go toward the right, based on the power specified by power.

lib.RadialGradientRegularPolyAnim(
  inner,
  outer,
  edges,
  power
  )

Parameters
inner
The DAColor object representing the color at the origin of the polygon.
outer
The DAColor object representing the color at the vertices.
edges
The DANumber object representing the number of edges the polygon has. This parameter can also be of type double.
power
The DANumber object that is an exponent controlling how rapidly one color transitions into another. A value of 1 is a linear transition. For 0 < power < 1 the transition occurs rapidly, while power > 1 means that the transition occurs more slowly. For example, if you are transitioning from red to blue, and power = 2, you will see a great deal of red in the gradient fill. On the other hand, if power = 0.5 (the inverse of 2), you will see very little red. If power = 0, you will see only blue. More precisely, if x is considered the normalized distance (from 0 to 1), then the gradient is xp, where p is in the range [0, infinity]. This must be an animated number.
Return Values

Returns the DAImage object.


RadialGradientRegularPoly

DAStatics Class

Same as RadialGradientRegularPolyAnim except that power is a non-animated number (a double).

lib.RadialGradientRegularPoly(
  inner,
  outer,
  edges,
  power
  )


RadialGradientSquareAnim

DAStatics Class

Creates a DAImage object with a square radial fill. The image is a unit-sized square, centered at the origin, reaching from [-0.5, -0.5] to [0.5, 0.5]. (These dimensions are always in meters, even if the PixelLibrary is selected. To convert from pixels to meters, use the Pixel conversion factor.) The image contains the specified colors in the center and at the corners, respectively. The gradient fill is determined by the power argument. The interpolation occurs in RGB space. Outside of the fill, the image is transparent and unpickable. The bounding box is a box from [-0.5, -0.5] to [0.5, 0.5].

Creates a DAImage object that smoothly interpolates between the start and stop colors. Colors start on the left and go toward the right, based on the power specified by power.

lib.RadialGradientSquareAnim(
  inner,
  outer,
  power
  )

Parameters
inner
The DAColor at the center of the image.
outer
The DAColor at the corners of the image.
power
The DANumber object that is an exponent controlling how rapidly one color transitions into another. A value of 1 is a linear transition. For 0 < power < 1 the transition occurs rapidly, while power > 1 means that the transition occurs more slowly. For example, if you are transitioning from red to blue, and power = 2, you will see a great deal of red in the gradient fill. On the other hand, if power = 0.5 (the inverse of 2), you will see very little red. If power = 0, you will see only blue. More precisely, if x is considered the normalized distance (from 0 to 1), then the gradient is xp, where p is in the range [0, infinity]. This must be an animated number.
Return Values

Returns the DAImage object.


RadialGradientSquare

DAStatics Class

Same as RadialGradientSquareAnim except that power is a non-animated number (a double).

lib.RadialGradientSquare(
  inner,
  outer,
  power
  )


SolidColorImage

DAStatics Class

Creates a DAImage object and applies the given color behavior to all points in the image. The bounding box of a solid-color image is the infinite bounding box.

lib.SolidColorImage(
  col
  )

Parameters
col
The DAColor object used to color the image.
Return Values

Returns the DAImage object.


StringImageAnim

DAStatics Class

Constructs a DAImage object from a DAString object and a DAFontStyle object. Because both parameters are (potentially) animated, they can vary over time.

lib.StringImageAnim(
  string,
  font
  )

Parameters
string
The DAString object specifying the (potentially) animated text.
font
The DAFontStyle object specifying the font style (this can include the face, the size, the color, and the attributes).
Return Values

Returns the DAImage object.


StringImage

DAStatics Class

Same as StringImageAnim except that string is a string.

lib.StringImage(
  string,
  font
  )

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page