Using Director > Vector Shapes and Bitmaps > Controlling bitmap images with Lingo > Creating image objects |  |

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 will contain a reference to the image of the member. The following statement creates an image object containing a reference to the image of the cast member called Boat.

    myImage = member("Boat").image

Because the image object `myImage` contains a reference to the cast member Boat, any changes you make to the object will be reflected in the cast member. These changes will also be reflected in any sprites made from that cast member.

You can also create an image object containing a reference to the graphic contents of the Stage:

    myImage = (the stage).image

Any changes to this image object will be 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 do this by providing parameters that describe the size and bit depth of the image you are creating.

This statement creates an image object that contains a 640 x 480 pixel, 16-bit image:

    myImage = image(640, 480, 16)