Controlling bitmap images with Lingo
Lingo lets you control bitmap images in two ways. First, you can perform simple operations that
affect the content of entire image cast members. These operations include changing the
background and foreground colors as well as switching the image that appears in a specific cast
member with that of another cast member. Each of these operations manipulates a property of the
entire image cast member.
Second, you can use Lingo to perform fine manipulations of the pixels of an image or to create
entirely new images. When you use Lingo you can be extremely flexible about which images you
display. You can create images based on dynamic information, such as user input, or based on any
other factors you want to include. To perform this kind of image operation, Lingo works with
image objects. See "Creating image objects" on page 222.
To change the image assigned to a bitmap cast member:
•
Set the
picture
Lingo Dictionary.
To specify the background or foreground of a bitmap sprite:
•
Set the
backColor
Lingo Dictionary.
To capture the current graphic contents of the Stage:
•
Set a bitmap's
(cast member property) in the Lingo Dictionary.
For example, the
the current image of the Stage the image for the bitmap cast member Archive.
Creating image objects
An image object can be either a self-contained set of image data or a reference to the image data of
a cast member or of the Stage. If an image object is created by referring to a cast member, the
object contains a reference to the image of the member. The following statement creates an image
object that contains a reference to the image of the cast member called Boat.
myImage = member("Boat").image
Because the image object
make to the object are reflected in the cast member. These changes are also reflected in any sprites
made from that cast member.
You can also create an image object that contains a reference to the graphic contents of the Stage:
myImage = (the stage).image
Any changes to this image object are reflected on the Stage.
To create an image object that is a self-contained set of image data instead of a reference to a cast
member, you must tell Lingo what kind of image you want to create. You must provide the
parameters that describe the size and bit depth of the image you are creating.
The following statement creates an image object that contains a 640 x 480 pixel, 16-bit image:
myImage = image(640, 480, 16)
222
Chapter 7
cast member property. See
or
sprite property. See
foreColor
cast member property to the Stage's
picture
member("Archive").picture = (the stage).picture
contains a reference to the cast member Boat, any changes you
myImage
(cast member property) in the
picture
and
backColor
picture
in the
foreColor
property. See
picture
statement makes
Need help?
Do you have a question about the DIRECTOR MX-USING DIRECTOR MX and is the answer not in the manual?
Questions and answers