DirectAnimation Animated Header --Static Methods Relevant to ImageBvr Objects DirectAnimation Animated Header --Static Methods Relevant to ImageBvr Objects* Microsoft DirectAnimation SDK
*Contents  *Index  *Topic Contents
*Previous Topic: Static Fields Relevant to GeometryBvr Objects
*Next Topic: Static Fields Relevant to ImageBvr Objects

Static Methods Relevant to ImageBvr Objects



gradientHorizontal

Statics Class

Creates an image behavior 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 fallOff. The extent of the generated image is [-0.5,-0.5] to [0.5,0.5].

public static ImageBvr gradientHorizontal(
  ColorBvr start,
  ColorBvr stop,
  NumberBvr fallOff
  );

Parameters
start
The ColorBvr object representing the first color of the gradient fill.
stop
The ColorBvr object representing the final color of the gradient fill.
fallOff
The NumberBvr object used to control 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. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


gradientPolygon

Statics 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.

public static ImageBvr gradientPolygon(
  Point2Bvr[] pts,
  ColorBvr[] colors
  );

Parameters
pts
The array of points that determine the polygon's vertices.
colors
The array of colors corresponding to the vertices.
Return Values

Returns the ImageBvr object.


gradientSquare

Statics Class

Creates an image behavior 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).

public static ImageBvr gradientSquare(
  ColorBvr lowerLeft,
  ColorBvr upperLeft,
  ColorBvr upperRight,
  ColorBvr lowerRight
  );

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

Returns the ImageBvr object.


hatchBackwardDiagonal

Statics 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.

public static ImageBvr hatchBackwardDiagonal(
  ColorBvr color NumberBvr size
  );

Parameters
color
The ColorBvr object representing the line color.
size
The NumberBvr object representing the size of the hatch box. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


hatchCross

Statics Class

Creates cross-hatched markings. This method can be thought of as a combination of the hatchVertical and the hatchHorizontal methods. 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.

public static ImageBvr hatchCross(
  ColorBvr color,
  NumberBvr size
  );

Parameters
color
The ColorBvr object representing the line color.
size
The NumberBvr object representing the size of the hatch box. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


hatchDiagonalCross

Statics 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.

public static ImageBvr hatchDiagonalCross(
  ColorBvr color,
  NumberBvr size
  );

Parameters
color
The ColorBvr object representing the line color.
size
The NumberBvr object representing the size of the hatch box. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


hatchForwardDiagonal

Statics 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.

public static ImageBvr hatchForwardDiagonal(
  ColorBvr color,
  NumberBvr size
  );

Parameters
color
The ColorBvr object representing the line color.
size
The NumberBvr object representing the size of the hatch box. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


hatchHorizontal

Statics 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.

public static ImageBvr hatchHorizontal(
  ColorBvr color,
  NumberBvr size
  );

Parameters
color
The ColorBvr object representing the line color.
size
The NumberBvr object representing the size of the hatch box. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


hatchVertical

Statics 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.

public static ImageBvr hatchVertical(
  ColorBvr color,
  NumberBvr size
  );

Parameters
color
The ColorBvr object representing the line color.
size
The NumberBvr object representing the size of the hatch box. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


importImage

Statics Class

Creates an image behavior 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 W´H, and given that:

halfWidthMeters = Statics.pixel * W/2;
halfHeightMeters = Statics.pixel * H/2;

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 import method.

public static importImage(
  URL url
  );

Parameters
url
The fully-qualified pathname of the image to be downloaded. This parameter is of type java.net.URL.
Return Values

Returns the ImageBvr object.

Remarks

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

See Also

importImageColorKey


importImage

Statics Class

Creates an image behavior by asynchronously 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 W´H, and given that:

halfWidthMeters = Statics.pixel * W/2;
halfHeightMeters = Statics.pixel * H/2;

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 method, see above.

public static ImageBvr importImage(
  URL url,
  ImageBvr imgStandIn,
  DXMEvent[] ev,
  NumberBvr[] progress,
  NumberBvr[] size
  );

Parameters
url
The fully-qualified pathname of the image to be downloaded. This parameter is of type java.net.URL.
imgStandIn
The image to use while the contents at url are still being downloaded. This argument cannot be null, however, the image can be empty.
ev
The event to trigger once the download is complete. This argument can be null.
progress
A NumberBvr that goes from 0 to 1, tracking the progress of the download. For files downloaded via http, progress is reported as the percentage of the file that has been downloaded. Other protocols, the value may simply start at 0 and change to 1 once the download is complete. This argument can be null.
size
A NumberBvr that is the size of the image, in bytes. The value begins at -1 and will change to the true size if it is available. This argument can be null.
Return Values

Returns the ImageBvr object.

Remarks

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

See Also

importImageColorKey


importImageColorKey

Statics Class

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

public static ImageBvr importImageColorKey(
  URL url,
  ColorBvr red,
  ColorBvr green,
  ColorBvr blue
  );

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

Returns the ImageBvr object.

Remarks

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

See Also

ImportImage


importImageColorKey

Statics Class

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

public static ImageBvr importImage(
  URL url,
  ImageBvr imgStandIn,
  DXMEvent[] ev,
  NumberBvr[] progress,
  NumberBvr[] size,
  ColorBvr red,
  ColorBvr green,
  ColorBvr blue
  );

Parameters
url
The pathname (a string) of the image to be downloaded.
imgStandIn
The image to use while the contents at url are still being downloaded. This argument cannot be null, however, the image can be empty.
ev
The event to trigger once the download is complete. This argument can be null.
progress
A NumberBvr that goes from 0 to 1, tracking the progress of the download. For files downloaded via http, progress is reported as the percentage of the file that has been downloaded. Other protocols, the value may simply start at 0 and change to 1 once the download is complete. This argument can be null.
size
A NumberBvr that is the size of the image, in bytes. The value begins at -1 and will change to the true size if it is available. This argument can be null.
red
The ColorBvr red component, expressed as a value ranging from 0 to 255.
green
The ColorBvr green component, expressed as a value ranging from 0 to 255.
blue
The ColorBvr blue component, expressed as a value ranging from 0 to 255.
Return Values

Returns the ImageBvr object.

Remarks

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

See Also

importImage


importMovie

Statics 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 below for a description of the asynchronous import method.

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

public static NumberBvr importMovie(
  URL url,
  ImageBvr[] img,
  SoundBvr[] snd
  );

Parameters
url
The fully-qualified pathname of the movie to be downloaded. This parameter is of type java.net.URL.
img
The image portion of the movie (passed by reference).
snd
The sound portion of the movie (passed by reference).
Return Values

Returns the NumberBvr object that is the length of the movie in seconds.


importMovie

Statics 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 method, see above.

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

public static NumberBvr importMovie(
  URL url,
  ImageBvr[] img,
  SoundBvr[] snd,
  ImageBvr imgStandIn,
  SoundBvr sndStandIn,
  DXMEvent[] ev,
  NumberBvr[] progress,
  NumberBvr[] size
  );

Parameters
url
The fully-qualified pathname of the movie to download. This parameter is of type java.net.URL.
img
The image portion of the movie (passed by reference).
snd
The sound portion of the movie (passed by reference).
imgStandIn
The image to use while the movie is still being downloaded. This parameter cannot be null, however, the image can be empty.
sndStandIn
The sound to use while the movie is still being downloaded. This parameter cannot be null, however, the sound can be silence.
progress
A NumberBvr that goes from 0 to 1, tracking the progress of the download. For files downloaded via http, progress is reported as the percentage of the file that has been downloaded. Other protocols, the value may simply start at 0 and change to 1 once the download is complete. This argument can be null.
size
A NumberBvr that is the size of the image, in bytes. The value begins at -1 and will change to the true size if it is available. This argument can be null.
Return Values

Returns the NumberBvr object that is the length of the movie in seconds.


overlay

Statics Class

Creates an image behavior by laying the image behavior 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.

public static ImageBvr overlay(
  ImageBvr i1,
  ImageBvr i2
  );

Parameters
i1 and i2
The ImageBvr objects.
Return Values

Returns the ImageBvr object.


overlayArray

Statics Class

Creates an image behavior by layering the ImageBvr objects. The bounding box of a set of overlaid images is simply the union of the bounding boxes of the images themselves.

public static ImageBvr overlayArray(
  ImageBvr[] im
  );

Parameters
im
The ImageBvr objects in the array.
Return Values

Returns the ImageBvr object.


radialGradientPolygon

Statics Class

Creates an image behavior 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 fallOff 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.

public static ImageBvr radialGradientPolygon(
  ColorBvr inner,
  ColorBvr outer,
  Point2Bvr[] points,
  NumberBvr fallOff
  );

Parameters
inner
The ColorBvr object representing the color at the origin of the polygon.
outer
The ColorBvr object representing the color at the vertices.
points
The Point2Bvr object representing the array of points that determine the polygon's vertices.
fallOff
The NumberBvr object used to control 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. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


radialGradientRegularPoly

Statics Class

Creates an image behavior that is a regular, gradient polygon with the specified number of sides (there must be at least 3) and a radial fill. The image contains the specified colors at the origin and the exterior points, respectively. The gradient fill is determined by the fallOff 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.

public static ImageBvr radialGradientRegularPoly(
  ColorBvr inner,
  ColorBvr outer,
  NumberBvr edges,
  NumberBvr fallOff
  );

Parameters
inner
The ColorBvr object representing the color at the origin of the polygon.
outer
The ColorBvr object representing the color at the vertices.
edges
The NumberBvr object representing the number of edges the polygon has. This parameter can also be of type double.
fallOff
The NumberBvr object used to control 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. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


radialGradientSquare

Statics Class

Creates an image behavior 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]. The image contains the specified colors in the center and at the corners, respectively. The gradient fill is determined by the fallOff 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].

public static ImageBvr radialGradientSquare(
  ColorBvr inner,
  ColorBvr outer,
  NumberBvr fallOff
  );

Parameters
inner
The ColorBvr at the center of the image.
outer
The ColorBvr at the corners of the image.
fallOff
The NumberBvr object used to control 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. This parameter can also be of type double.
Return Values

Returns the ImageBvr object.


solidColorImage

Statics Class

Creates an image behavior 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.

public static ImageBvr solidColorImage(
  ColorBvr col
  );

Parameters
col
The ColorBvr object.
Return Values

Returns the ImageBvr object.


stringImage

Statics Class

Constructs an ImageBvr object from a StringBvr object and a FontStyleBvr object.

public static ImageBvr stringImage(
  StringBvr string,
  FontStyleBvr font
  );

Parameters
string
The StringBvr object specifying the (potentially) animated text. This parameter can also be of type java.lang.String.
font
The FontStyleBvr object specifying the font style (this can include the face, the size, the color, and the attributes).
Return Values

Returns the ImageBvr object.

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

*Top of Page