Index Topic Contents | |||
Previous Topic: GeometryBvr Class Next Topic: JoinStyleBvr Class |
ImageBvr Class
public class ImageBvr extends Behavior { // Methods public Bbox2Bvr boundingBox(); public ImageBvr clip(MatteBvr matte); public ImageBvr clipPolygon(Point2Bvr[] points); public ImageBvr crop(Point2Bvr minPt, Point2Bvr maxPt); public ImageBvr mapToUnitSquare(); public ImageBvr opacity(NumberBvr opac); public ImageBvr tile(); public ImageBvr transform(Transform2Bvr xf); public ImageBvr undetectable(); public static ImageBvr newUninitBvr(); }Creates an object that represents an image behavior. Much like a bitmap, an image is a two-dimensional picture composed of individual picture elements. Like other behaviors, however, the value of the picture elements can change over time.
Every image behavior 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 color behaviors. Opacity values are number behaviors, 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 means, for example, that the clipPolygon method has its own definition of a bounding box, defined below.
For more information about behaviors, see the Behavior class.
ImageBvr Methods
ImageBvr Class
boundingBoxCreates a box behavior that defines the box that encloses all non-transparent portions of the image behavior.
public Bbox2Bvr boundingBox( );
Return Values
Returns the Bbox2Bvr object.
ImageBvr Class
clipCreates a new image behavior 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.
public ImageBvr clip(
MatteBvr matte
);Parameters
- matte
- The MatteBvr object.
Return Values
Returns the ImageBvr object.
Remarks
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.
ImageBvr Class
clipPolygonCreates a new image behavior 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 point behaviors.
public ImageBvr clipPolygon(
Point2Bvr[] points
);Parameters
- points
- The Point2Bvr object 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 Values
Returns the ImageBvr object.
Remarks
The bounding box is the intersection of the box surrounding the points of the polygon with the box of the underlying image.
ImageBvr Class
cropCreates a new image behavior by cropping the original image. The new image consists of the portion of the original image that is within the region given by minPt and maxPt.
public ImageBvr crop(
Point2Bvr minPt,
Point2Bvr maxPt
);Parameters
- minPt and maxPt
- The Point2Bvr objects representing the lower-left and upper-right corners of the box enclosing the portion of the original image to use.
Return Values
Returns the ImageBvr object.
Remarks
The bounding box of a cropped image is the intersection of the crop box and the box of the underlying image.
ImageBvr Class
mapToUnitSquareCreates an image that is mapped to the unit square. This is a square at coordinates [(0,0) (1,1)].
public ImageBvr mapToUnitSquare( );
Remarks
This method 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.
ImageBvr Class
opacityCreates an image behavior in which the opacity value for each point is set to the given number behavior.
public ImageBvr opacity(
NumberBvr opac
);Parameters
- opac
- The NumberBvr object representing the opacity value. The image is fully opaque if the value is 1, and fully transparent if the value is 0. This parameter can also be of type double.
Return Values
Returns the ImageBvr object.
Remarks
By default, an image's opacity is 1. The bounding box is simply the bounding box of the underlying image itself. Opacity values can range from 0.0 to 1.0. 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 attribute composes values. The resulting opacity is the new value times the old value.
ImageBvr Class
tileCreates a new image behavior that consists of the original image tiled (repeated) in all directions. The bounding box is the infinite bounding box.
public ImageBvr tile( );
Return Values
Returns the ImageBvr object.
ImageBvr Class
transformCreates a new image behavior that is the result of applying the given transformation to the points in the original image behavior.
public ImageBvr transform(
Transform2Bvr xf
);Parameters
- xf
- The Transform2Bvr object.
Return Values
Returns the ImageBvr object.
Remarks
As an example, you can double the size of the opaque portion of the image that is the result of 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.
This attribute composes values.
ImageBvr Class
undetectableCreates a new undetectable image behavior from the original image.
public ImageBvr undetectable( );
Return Values
Returns the ImageBvr object.
ImageBvr Class
newUninitBvrThis method allows you to refer to an ImageBvr behavior before that behavior has been defined. With this method you can create the behavior and use it in the definition of other behaviors, but not actually define its contents until some later point. (This is accomplished with the init method, which is available on all behaviors.) The system generates a run-time error if you initialize a non-uninitialized behavior, initialize an uninitialized behavior that has already been initialized, or run an initialized behavior that has not yet been initialized.
public static ImageBvr newUninitBvr( );
Return Values
Returns the ImageBvr object.
Relevant Methods from the Statics Class
The following methods are defined in the Statics class and are most relevant to objects of type ImageBvr.
public static ImageBvr gradientHorizontal(ColorBvr start, ColorBvr stop, NumberBvr fallOff);
public static ImageBvr gradientPolygon(Point2Bvr[] pts, ColorBvr[] colors);
public static ImageBvr hatchBackwardDiagonal(ColorBvr color, NumberBvr size);
public static ImageBvr hatchCross(ColorBvr color, NumberBvr size);
public static ImageBvr hatchDiagonalCross(ColorBvr color, NumberBvr size);
public static ImageBvr hatchForwardDiagonal(ColorBvr color, NumberBvr size);
public static ImageBvr hatchHorizontal(ColorBvr color, NumberBvr size);
public static ImageBvr hatchVertical(ColorBvr color, NumberBvr size);
public static ImageBvr importImage(URL url);
public static ImageBvr importImageColorKey(URL url, ColorBvr red, ColorBvr green, ColorBvr blue);
public static NumberBvr importMovie(URL url, ImageBvr[] img, SoundBvr[] snd);
public static NumberBvr importMovie(URL url, ImageBvr[] img, SoundBvr[] snd);
public static ImageBvr overlay(ImageBvr i1, ImageBvr i2);
public static ImageBvr overlayArray(ImageBvr[] im);
public static ImageBvr radialGradientSquare(ColorBvr inner, ColorBvr outer, NumberBvr fallOff);
public static ImageBvr solidColorImage(ColorBvr col);
public static ImageBvr stringImage(StringBvr string, FontStyleBvr font);
Relevant Fields from the Statics Class
The following fields are defined in the Statics class and are most relevant to objects of type ImageBvr.
public final static ImageBvr detectableEmptyImage;
public final static ImageBvr emptyImage;
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.