MM Developer's Guide
MM Interfaces | MM Methods MM Types and Misc API

IMoaMmImage

Interface ID: IID_IMoaMmImage
Pointer type:PIMoaMmImage
Inheritance: IMoaUnknown
Header file: mmiimage.h

Description

This callback interface provides MoaMmImage manipulation functions and support for image object (interface new to Director 8.5). Most of the methods in this inteface have a direct correspondance with the lingo imaging commands. Please see the Director 8.5 documentation for more information about image objects and image methods.

Constants and Structures

typedef struct MoaMmImageInfo
{
	MoaLong iWidth;
	MoaLong iHeight;
	MoaLong iRowBytes;
	MoaLong iTotalDepth;
	MoaLong iAlphaDepth;
	MoaBool bCartesian;

} MoaMmImageInfo, *PMoaMmImageInfo;

Methods

Image Creation and Information

NewImage()
Duplicate()
NewImageFromStream()
UpdateImageFromStream()
ReleaseProgressCookie()
NewImageFromPath()
GetImageInfo()

Image Manipulation Methods

CopyPixels()
Crop()
Draw()
Fill()
CreateMatte()
CreateMask()
TrimWhiteSpace()
SetAlpha()
ExtractAlpha()

Pixel Access Methods

GetPixel()
SetPixel()
GetPixelInteger()
SetPixelInteger()
LockPixels()
UnlockPixels()

NewImage()

Syntax

NewImage(MoaLong iWidth, MoaLong iHeight, MoaLong iBitDepth, MoaLong iAlphaDepth,
   PMoaMmValue pPaletteRef, PMoaMmValue pResultImage)

Parameters

iWidth
The width of the new image.
iHeight
The height of the new image.
iBitDepth
The bit depth of the new image.
iAlphaDepth
The alpha channel depth of the new image.
pPaletteRef
Pointer to a MoaMmValue that contains a member reference for a palette member. Use NULL for a missing palette reference. The movie default palette is used.
pResultImage
Pointer to a MoaMmValue that will receive the new image object.

Returns

MoaError

Description

Creates a lingo image object based upon the passed in parameters.

Duplicate()

Syntax

Duplicate(ConstPMoaMmValue pSourceImage, PMoaMmValue pResultImage)

Parameters

pSourceImage
Pointer to a MmValue that contains the source image object
pResultImage
Pointer to a MmValue that will receive the destination image object

Returns

MoaError

Description

Creates a copy of a lingo image object. This does not work on mask items.

NewImageFromStream()

Syntax

NewImageFromStream(PIMoaStream pStream, PPMoaVoid pProgressCookie, PMoaMmValue pResultImage)

Parameters

pStream
Pointer to an open Moa stream that references a file with image data.
pProgressCookie
Pass NULL for pProgressCookie if all data is available in the stream. Otherwise pass in the address of a pointer that will be used to store a cookie.
pResultImage
Pointer to a MmValue that will receive the destination image object

Returns

MoaError

Description

Takes an open PIMoaStream and reads (and parses) an image from a file format. If pProgressCookie is non-NULL, a cookie is allocated and can be passed in to UpdateImageFromStream. In this case ReleaseProgressCookie must be called to deallocate the cookie.

UpdateImageFromStream()

Syntax

UpdateImageFromStream(PIMoaStream pStream, PMoaVoid pProgressCookie, PMoaMmValue pUpdateImage)

Parameters

pStream
Pointer to the open Moa stream that references a file with image data.
pProgressCookie
The cookie for this stream.
pUpdateImage
Pointer to a MoaMmValue that is in the process of receiving the image object

Returns

MoaError

Description

Called when an image object is being streamed in from a file.

ReleaseProgressCookie()

Syntax

ReleaseProgressCookie(PPMoaVoid pProgressCookie)

Parameters

pProgressCookie
The cookie to be released.

Returns

MoaError

Description

Called to release the cookie that was allocated by NewImageFromStream.

NewImageFromPath()

Syntax

NewImageFromPath(PIMoaPathName pMoaPath, PMoaMmValue pResultImage)

Parameters

pMoaPath
Pointer to a file that contains image data.
pResultImage
Pointer to a MoaMmValue that will receive the image object

Returns

MoaError

Description

Takes a PIMoaPathName and opens and reads (and parses) an image from a file.

GetImageInfo()

Syntax

GetImageInfo(ConstPMoaMmValue pImage, PMoaMmImageInfo pImageInfo)

Parameters

pImage
Pointer to a MoaMmValue that contains an image object.
pImageInfo
Pointer to a MoaMmImageInfo structure that will be filled with the information about the passed in image.

Returns

kMoaDrErr_ImageExpected is returned if pImage does not reference an image object

Description

Takes a MoaMmValue containing an ImageRef and returns a filled out MoaMmImageInfo structure. This routine is the best way to find out if a MoaMmValue contains a reference to an image object/

CopyPixels()

Syntax

CopyPixels(ConstPMoaMmValue pImage, ConstPMoaMmValue pSourceImage, ConstPMoaMmValue pDestRectOrQuad,
   ConstPMoaMmValue pSourceRect, ConstPMoaMmValue pPropList)

Parameters

pImage
Pointer to a MoaMmValue that contains the destination image object
pSourceImage
Pointer to a MoaMmValue that contains the source image object
pDestRectOrQuad
Pointer to a MoaMmValue that contains the destination rectangle or quad for the copy
pSourceRect
Pointer to a MoaMmValue that contains the source rectangle
pPropList
Pointer to a MoaMmValue that contains a property list with various parameters used for modifiying the copy. Use NULL for a missing property list

Returns

MoaError

Description

Does a blit from the source image to a destination image using either a destination quad or rectangle, a source rectangle and various ink parameters. This method provides the same functionality as the lingo image.copyPixels command. The property list can contain the following items:

#color - lingo color object
#bgColor - lingo color object
#ink - lingo ink value
#blendLevel - lingo blend value
#dither - non-zero value to dither, zero to not dither
#useFastQuads - non-zero value to use fast quads in quad mode
#maskImage - lingo mask image object for masking
#maskOffset - lingo point for mask offset.

Crop()

Syntax

Crop(ConstPMoaMmValue pSourceImage, ConstPMoaMmValue pRect, PMoaMmValue pResultImage)

Parameters

pSourceImage
Pointer to a MoaMmValue that contains the source image object
pRect
Pointer to a MoaMmValue that contains the rectangle to use for cropping.
pResultImage
Pointer to a MoaMmValue that will receive the new cropped image object

Returns

MoaError

Description

Creates a cropped image based upon an image object and a rectangle.

Draw()

Syntax

Draw(ConstPMoaMmValue pImage, ConstPMoaMmValue pRect, ConstPMoaMmValue pPropList)

Parameters

pImage
Pointer to a MoaMmValue that contains the image object
pRect
Pointer to a MoaMmValue that contains the rectangle to use for drawing.
pPropList
Pointer to a MoaMmValue that contains a property list with various parameters used for modifiying the drawing. Use NULL for a missing property list

Returns

MoaError

Description

Performs a drawing operation on a lingo image object. The property list can contain the following items:

#color - lingo color object
#lineSize - line width
#shapeType - #rect, #roundRect, #oval, #line


Fill()

Syntax

Fill(ConstPMoaMmValue pImage, ConstPMoaMmValue pRect, ConstPMoaMmValue pPropList)

Parameters

pImage
Pointer to a MoaMmValue that contains the image object
pRect
Pointer to a MoaMmValue that contains the rectangle to use for drawing.
pPropList
Pointer to a MoaMmValue that contains a property list with various parameters used for modifiying the drawing. Use NULL for a missing property list

Returns

MoaError

Description

Performs a drawing operation with a filled shape on a lingo image object. The property list can contain the following items:

#color - lingo color object
#bgColor - lingo color object
#lineSize - line width
#shapeType - #rect, #roundRect, #oval, #line

CreateMatte()

Syntax

CreateMatte(ConstPMoaMmValue pSourceImage, PMoaMmValue pResultImage)

Parameters

pSourceImage
Pointer to a MoaMmValue that contains the source image object
pResultImage
Pointer to a MoaMmValue that will receive the new destination image object with the matte

Returns

MoaError

Description

Creates a matte image based upon the source image object.

CreateMask()

Syntax

CreateMask(ConstPMoaMmValue pSourceImage, PMoaMmValue pResultImage)

Parameters

pSourceImage
Pointer to a MoaMmValue that contains the source image object
pResultImage
Pointer to a MoaMmValue that will receive the new destination image object with the mask

Returns

MoaError

Description

Creates a mask image based upon the source image object.

TrimWhiteSpace()

Syntax

TrimWhiteSpace(ConstPMoaMmValue pSourceImage, PMoaMmValue pResultImage)

Parameters

pSourceImage
Pointer to a MmValue that contains the source image object
pResultImage
Pointer to a MmValue that will receive the new trimmed image object

Returns

MoaError

Description

Creates a new image with trimmed white edges based upon an existing image object.

SetAlpha()

Syntax

SetAlpha(ConstPMoaMmValue pImage, ConstPMoaMmValue pAlphaImageOrAlphaValue)

Parameters

pImage
Pointer to a MmValue that contains the original image object and will receive the alpha channel. This image must be 32 bit.
pAlphaImageOrAlphaValue
Pointer to a MmValue that contains either a an integer or an alpha channel image. The alpha channel image must be 8 bit.

Returns

MoaError

Description

For integer version, sets the alpha channel of an 32-bit image to a constant value. For image object version, inserts 8-bit image into the alpha channel of a 32-bit image.

ExtractAlpha()

Syntax

ExtractAlpha(ConstPMoaMmValue pSourceImage, ConstPMoaMmValue pResultImage)

Parameters

pSourceImage
Pointer to a MmValue that contains the source image object. This image must be 32 bit.
pResultImage
Pointer to a MmValue that will receive a new 8 bit image object.

Returns

MoaError

Description

Creates a new image 8-bit grayscale image object that is only the alpha channel plane from the existing image object, as long as the existing image object is a 32:8 image.

GetPixel()

Syntax

GetPixel(ConstPMoaMmValue pImage, MoaLong iXCoordinate, MoaLong iYCoordinate,
  PMoaMmValue pResultPixelValue)

Parameters

pImage
Pointer to a MmValue that contains the image object
iXCoordinate
Integer with the pixel's X coordinate
iYCoordinate
Integer with the pixel's Y coordinate
pResultPixelValue
Pointer to a MmValue that will receive a color object value for the pixel.

Returns

MoaError

Description

Finds the pixel value for a particular pixel location in a lingo image object. This value is returned as a new color object.

SetPixel()

Syntax

SetPixel(ConstPMoaMmValue pImage, MoaLong iXCoordinate, MoaLong iYCoordinate,
  ConstPMoaMmValue pPixelValue)

Parameters

pImage
Pointer to a MmValue that contains the image object
iXCoordinate
Integer with the pixel's X coordinate
iYCoordinate
Integer with the pixel's Y coordinate
pPixelValue
Pointer to a MmValue that contains the new color object value to be used for the pixel.

Returns

MoaError

Description

Sets a specific pixel in a lingo image object using the passed in color object.

GetPixellnteger()

Syntax

GetPixellnteger(ConstPMoaMmValue pImage, MoaLong iXCoordinate, MoaLong iYCoordinate,
  PMoaLong pResultPixelValue)

Parameters

pImage
Pointer to a MmValue that contains the image object
iXCoordinate
Integer with the pixel's X coordinate
iYCoordinate
Integer with the pixel's Y coordinate
pResultPixelValue
Pointer to a MoaLong that will receive an integer value for the pixel.

Returns

MoaError

Description

Finds the pixel value for a particular pixel location in a lingo image object. This value is returned as an integer.

SetPixelInteger()

Syntax

SetPixelInteger(ConstPMoaMmValue pImage, MoaLong iXCoordinate, MoaLong iYCoordinate,
  MoaLong iPixelValue)

Parameters

pImage
Pointer to a MmValue that contains the image object
iXCoordinate
Integer with the pixel's X coordinate
iYCoordinate
Integer with the pixel's Y coordinate
iPixelValue
Integer with the new value to be used for the pixel.

Returns

MoaError

Description

Sets a specific pixel in a lingo image object using the passed in integer.

LockPixels()

Syntax

LockPixels(ConstPMoaMmValue pImage, PMoaVoid * ppPixels)

Parameters

pSourceImage
Pointer to a MmValue that contains the image object
ppPixels
Pointer to a location that will receive the pointer to the pixels.

Returns

MoaError

Description

Given a lingo image object, locks down an image handle and returns a pixel pointer. Must be matched with a later call to UnlockPixels

UnlockPixels()

Syntax

UnlockPixels(ConstPMoaMmValue pImage)

Parameters

pSourceImage
Pointer to a MmValue that contains the image object which had a previous call to LockPixels.

Returns

MoaError

Description

Given a lingo image object with previously locked pixels, unlocks an image handle. Must be matched with a previous call to LockPixels

Copyright © 1995-2008 Adobe Macromedia Software LLC, Inc.