DAImage Class

Creates a DAImage object that represents a (potentially) animated image. Much like a bitmap, an image is a two-dimensional picture composed of individual picture elements. However, because it can be animated, the value of the picture elements can change over time.

Every DAImage object consists of an infinite set of two-dimensional points, each representing a picture element and each having color, opacity, and detectability attributes. Colors in an image are defined using DAColor objects. Opacity values are DANumber objects, and can range in value from 0 through 1, with 0 for fully transparent and 1 for fully opaque. Only points that are "non-transparent" have any visible effect when the image is output or combined with other images.

Points in the image are either detectable or not. If a point is detectable, the image fires a pick event whenever the mouse passes over it.

The bounding box operation is used to construct and compose media, and different types of images and behaviors provide specific bounding boxes. This means, for example, that the bounding box of an image is not defined as the smallest axis-aligned enclosing region of the non-transparent parts of an image. Instead, bounding boxes are defined on a per-operation basis.

This class inherits from DABehavior.

For relevant functions and properties in the DAStatics class, see the following topics:

DAImage Functions

Clip Creates a DAImage object by clipping the original image.
ClipPolygonImage Creates a DAImage object by returning the portion of the original image that is within the specified polygon.
ColorKey Creates a DAImage object in which the specified color is treated as transparent.
Crop Creates a DAImage object by cropping the original image.
ImageQuality Creates a DAImage object with the specified anti-aliasing.
MapToUnitSquare Creates a DAImage object that is mapped to the unit square.
Opacity Creates a DAImage object with the specified opacity. Same as OpacityAnim except that opac is a nonanimated number (a double).
OpacityAnim Creates a DAImage object with the specified animated opacity.
Pickable Makes a DAImage object pickable.
PickableOccluded Makes a DAImage object pickable, including portions of the object that are blocked (occluded) by other images.
RenderResolution Creates a DAImage object for which you can specify the size when you render the image as a bitmap. By default, images are resolution independent.
Tile Creates a DAImage object that consists of the original image tiled (repeated) in all directions.
Transform Creates a DAImage object that is the result of applying the given transformation to the points in the original image.
Undetectable Creates an undetectable DAImage from the original image.

DAImage Properties

BoundingBox A read-only property that creates a bounding box (DABbox2) enclosing all the non-transparent portions of the DAImage.

DAImage Functions

This section contains reference material for the DAImage functions.

Clip

DAImage Class

Creates a DAImage by clipping the original image. The new image consists of the portion of the original image that is within the region(s) defined by the given matte behavior. The bounding box of an image clipped to a matte is the intersection of the matte's bounding box (the axis-aligned box that surrounds the matte), and the bounding box of the underlying image.

Syntax

imageObj.Clip( matte )

Parameters

matte
DAMatte object.

Return Value

Returns the DAImage object.

ClipPolygonImage

DAImage Class

Creates a DAImage object by clipping the original image. The new image consists of the portion of the original image that is within the closed figure defined by the given DAPoint2 objects. The bounding box is the intersection of the box surrounding the points of the polygon with the box of the underlying image.

Syntax

imageObj.ClipPolygonImage( points )

Parameters

points
Array (variant) of DAPoint2 objects representing the endpoints of the line segments that define the figure. If the first and last points are not the same, these points are implicitly connected to close the figure.

Return Value

Returns the DAImage object.

ColorKey

DAImage Class

Creates a DAImage object in which the specified color is treated as transparent. The color is defined by a DAColor object and can be animated.

Note this function can be used only with Microsoft® DirectAnimation® version 6.x or later.

Syntax

imageObj.ColorKey( colorKey )

Parameters

colorKey
A DAColor object that defines the color that is treated as transparent in the image.

Return Value

Returns the DAImage object.

Crop

DAImage Class

Creates a DAImage object by cropping the original image. The new image consists of that portion of the original image which is within the region given by minPt and maxPt. The bounding box of a cropped image is the intersection of the crop box and the box of the underlying image.

Syntax

imageObj.Crop( minPt, maxPt )

Parameters

minPt and maxPt
DAPoint2 objects representing the lower-left and upper-right corners of the box enclosing the portion of the original image to use.

Return Value

Returns the DAImage object.

ImageQuality

DAImage Class

Creates a DAImage with the specified antialiasing. You can specify antialiasing for text, lines, solids, and clips. You can also specify a flag to enable MSHTML colors. If this flag is on, DirectAnimation will match the color of your HTML page for seamless transitions between your page and your animations, rather than choosing the closest color match. You can also specify a flag to enable high-quality DirectX Transform transforms.

Note You can only use this function with DirectAnimation version 6.x or later.

Syntax

imageObj.ImageQuality( dwQualityFlags )

Parameters

dwQualityFlags
A DWORD (32-bit unsigned integer) that contains the image quality flags, which can be one or more of the following values:
DAQUAL_AA_TEXT_ON = 1
DAQUAL_AA_TEXT_OFF = 2
DAQUAL_AA_LINES_ON = 4
DAQUAL_AA_LINES_OFF = 8
DAQUAL_AA_SOLIDS_ON = 16
DAQUAL_AA_SOLIDS_OFF = 32
DAQUAL_AA_CLIP_ON = 64
DAQUAL_AA_CLIP_OFF = 128
DAQUAL_MSHTML_COLORS_ON = 256
DAQUAL_MSHTML_COLORS_OFF = 512
DAQUAL_QUALITY_TRANSFORMS_ON = 1024
DAQUAL_QUALITY_TRANSFORMS_OFF = 2048

Return Value

Returns the DAImage object.

Remarks

You can combine the image quality flags with a logical OR. Subsequent calls to ImageQuality with new flags override the old flags on a per flag basis. That is, if you have previously set antialiasing on for text and lines, then in a subsequent call set antialiasing on for solids and off for lines, antialiasing will be on for text and solids.

The following code sets antialiasing on for text and lines. The | operator is a bit-wise logical OR.

img.ImageQuality(1 | 4);

MapToUnitSquare

DAImage Class

Creates an image that is mapped to the unit square. This is a square at coordinates [(0,0) (1,1)]. It is commonly used for images that will be textured because a geometry's texture coordinates generally span the unit square. It is also used for transforming an image into a space where it is easy to manipulate.

Syntax

imageObj.MapToUnitSquare( )

Return Value

Returns the DAImage object.

Opacity

DAImage Class

Creates a DAImage object with the specified opacity. Same as OpacityAnim except that opac is a nonanimated number (a double).

Syntax

imageObj.Opacity( opac )

Parameters

opac
A double value representing the opacity. The image is fully opaque if the value is 1, and fully transparent if the value is 0. This is a nonanimated number.

Return Value

Returns the DAImage object.

OpacityAnim

DAImage Class

Creates a DAImage object in which the opacity value for each point is set to the given animated number (DANumber object). By default, an image's opacity is 1 (completely opaque). The bounding box is simply the bounding box of the underlying image itself.

Syntax

imageObj.OpacityAnim( opac )

Parameters

opac
DANumber object representing the opacity value. The image is fully opaque if the value is 1, and fully transparent if the value is 0. This must be an animated number.

Return Value

Returns the DAImage object.

Remarks

Opacity values can range from 0.0 (no opacity) to 1.0 (completely opaque). If the corresponding number behavior has a value outside this range, the integer part of the value is discarded and only the fractional part is used. This function composes values. The resulting opacity is the new value times the old value.

Pickable

DAImage Class

Makes a DAImage object pickable. Use this function along with the returned DAPickableResult object to create a reactive behavior. (This means that, when the mouse is in the pickable area, an event occurs).

The behavior of a "pickable" image is identical to that of an ordinary image until the mouse is in the pickable region and there are no geometries (other than Undetectable ones) between it and the mouse. Then, an event (created in DAPickableResult) occurs.

Syntax

imageObj.Pickable( )

Return Value

Returns the DAPickableResult object.

See Also

PickableOccluded

PickableOccluded

DAImage Class

Makes a DAImage object pickable when there are other images between it and the mouse. This means that the pickable image will still get the event even if the mouse is on the occluding image.

Syntax

imageObj.PickableOccluded( )

Return Value

Returns the DAPickableResult object.

See Also

Pickable

RenderResolution

DAImage Class

Creates a DAImage object for which you can specify the size when you render the image as a bitmap. This is necessary when you use the image as a texture and want to preserve the same detail by making the texture size the same as the original image. It is also necessary for some DirectX Transform effects, which require images of a certain size.

Note this function can be used only with DirectAnimation version 6.x or later.

Syntax

imageObj.RenderResolution( width, height )

Parameters

width and height
The size of the bitmap to be rendered when this image is made into a bitmap.

Return Value

Returns the DAImage object.

Remarks

By default, images that you create have a size of 256 X 256 pixels. By default, imported images preserve their natural size. However, some applications (DirectX Transform applications, for example) expect DirectDraw surfaces and need a particular image size. You can use RenderResolution to set this size.

Tile

DAImage Class

Creates a DAImage object that consists of the original image tiled (repeated) in all directions. The bounding box is the infinite bounding box.

Syntax

imageObj.Tile( )

Return Value

Returns the DAImage object.

Remark

Since a SolidColorImage has an infinite bounding box, overlaying an image on the SolidColorImage and then tiling the image can cause performance problems while the system tries to make calculations for tiles in an infinite space. You can avoid this problem by tiling the image first, then overlaying it on the SolidColorImage, as shown in the following VBScript example, where the finite oval is tiled before placing it on the SolidColorImage background imgBack:

For example,

  Set m = DAControl.PixelLibrary 
  Set imgBack = m.SolidColorImage(m.Black)
  Set imgOval = m.Oval(200, 200).Fill(m.DefaultLineStyle, m.SolidColorImage(m.Red))

  Set imgTile = imgOval.Tile
  
  Set imgOver = m.Overlay(imgTile, imgBack)

  DAControl.Image = imgOver
  DAControl.Start()

Transform

DAImage Class

Creates a DAImage object that is the result of applying the given transformation to the points in the original image. For example, you can double the size of the opaque portion of the image by applying a transformation that scales by 2. The bounding box of a transformed image is determined by applying the transform to the bounding box of the underlying image and then enclosing the resultant quadrilateral with an axis-aligned box.

Syntax

imageObj.Transform( xf )

Parameters

xf
DATransform2 object applied to the original image.

Return Value

Returns the DAImage object.

Remarks

This function composes values. The resulting transformation is the new value applied to the old value.

Undetectable

DAImage Class

Creates an undetectable DAImage from the original image.

Syntax

imageObj.Undetectable( )

Return Value

Returns the DAImage object.

DAImage Properties

This section contains reference material for the DAImage properties.

BoundingBox

DAImage Class

Creates a DABbox2 object that defines the box that encloses all non-transparent portions of the DAImage object.

Syntax

imageObj.BoundingBox

Return Value

Returns the DABbox2 object.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.