Metagraphics Media!Lab Media
Classes

Class Summary - Media Classes


 mBitmap. . . . . . bitmap class
 mAudio . . . . . . audio class
 mImage . . . . . . image/video class
 mDirector. . . . . director class
 mRenderer. . . . . renderer class
    mRenderSolid . . . solid fill renderer
 mSprite. . . . . . sprite class
    mSpriteGDI . . . . sprite GDI class
    mSpriteGroup . . . sprite group class
    mSpriteImage . . . sprite image class

(top)

mBitmap Class

The bitmap class, mBitmap, defines a device-independent bitmap object for graphic drawing and image rendering operations. Bitmaps can be located in local system memory, or depending on the capabilities of the operating system and display hardware, optionally in video display memory. mBitmap function methods include:

mBitmap(). . . . . . . . . construct an empty bitmap
mBitmap(). . . . . . . . . construct and allocate a bitmap
mBitmap(). . . . . . . . . construct and allocate a bitmap with Device Context
mBitmap(). . . . . . . . . copy constructor
mBitmap(). . . . . . . . . assignment operator
Build(). . . . . . . . . . allocate or re-allocate a bitmap
BuildDC(). . . . . . . . . allocate or re-allocate a bitmap with Device Context
AttachDIB(). . . . . . . . attach a user defined Device Independent Bitmap (DIB)
SetColors(). . . . . . . . copy a new color table to the bitmap's color table
MapColors(). . . . . . . . copy new color table and re-map pixel colors
GetDefaultColortable() . . return a copy of the default color table
SetTransparentColor(). . . define the transparent color
SetTransparent() . . . . . enable/disable color translation
SetTranslate() . . . . . . enable/disable transparency
ComputeTranslate() . . . . compute color translation table
CreatePalette(). . . . . . create a logical palette
CreateIdentityPalette(). . create a logical identity palette
FindClosestRGB() . . . . . return index of closest matching RGB color
SetTopdown() . . . . . . . convert to bitmap to top-down or bottom-up
Fill() . . . . . . . . . . fill with solid color
BlitDC() . . . . . . . . . blit bitmap image to a Device Context
Blit() . . . . . . . . . . generic bitmap to bitmap blit
BlitS(). . . . . . . . . . low level solid blit
BlitX(). . . . . . . . . . low level transparent blit
BlitTS() . . . . . . . . . low level translated solid blit
BlitTX() . . . . . . . . . low level translated transparent blit
~mBitmap() . . . . . . . . destructor

(top)

mAudio Class

The audio class, mAudio, provides the basic methods for handling audio information. The mAudio class deals with audio streams as a collection of one or more audio tracks specified in time duration, samples or bytes. The audio class takes advantage of enhanced C++ capabilities using methods to access codec-specific derived classes such as AIFF, AU, MIDI and WAV audio. The mAudio class itself operates as an abstract class, from which codec specific classes are derived. Media!Lab provides codec specific audio classes for mAudioAIFF, mAudioAU, mAudioMIDI and mAudioWAV. Once a specific audio stream has been opened, virtual methods such as PlayAudio() and SeekAudio() can access the audio information without needing to know the details of the specific format. Other new derived classes can also be accessed without effecting code working through the virtual mAudio methods. The mAudio class include the following function methods:

mAudio(). . . . . . . . . constructor
~mAudio() . . . . . . . . destructor
ReadAudioHeader() . . . . read track header info
SeekAudio() . . . . . . . seek to selected track position
PlayAudio() . . . . . . . begin audio output
PauseAudio(). . . . . . . pause audio output
StopAudio() . . . . . . . stop audio output
SetVolume() . . . . . . . set audio output loudness
ReadAudio() . . . . . . . read audio data to buffer
SetTrack(). . . . . . . . select audio track
SetTimebase() . . . . . . set units for positions and durations
TimeToSamples() . . . . . convert audio time duration to sample count
TimeToBytes() . . . . . . convert audio time duration to byte count
SamplesToMilliseconds() . convert sample count to time duration
SamplesToBytes(). . . . . convert sample count to byte count
BytesToMilliseconds() . . convert audio byte count to time duration
BytesToSamples(). . . . . convert audio byte count to sample count
AudioToBytes(). . . . . . convert units in the current time base to byte count
BytesToAudio(). . . . . . convert bytes to units in the current time base

Media!Lab includes support for the following mAudio derived codecs:


 mAudioAIFF . . . Mac AIFF audio class
 mAudioAU . . . . Sun/Unix AU audio class
 mAudioMIDI . . . MIDI audio class
 mAudioWAV. . . . WAV audio class

(top)

mImage Class

The image class, mImage, provides the basic methods for handling encoded image data, either from disk or in memory. The mImage class deals with image files as a collection of one or more graphic image "frames". The image class decodes and blits image frames to a destination bitmap, usually the display animation window. The image class takes advantage of C++ capabilities using virtual methods to access codec-specific derived classes such as AVI, BMP, FLC, FLI, GIF, JPEG, PCX and DCX. Both graphic and audio data can be contained in an image frame. The mImage class itself operates as an abstract class, from which codec-specific classes are derived. Media!Lab provides codec-specific image classes including mImageAVI, mImageBMP, mImageFlic mImageGIF, mImageJPEG and mImagePCX. A specialized mImageBitmap class is also supplied for working with sprites and tiled bitmaps. Once a specific image has been opened, virtual methods such as ReadFrame() and SeekFrame() can access the image information without needing to know the details of the encoding format. Other derived classes can also be added later without effecting code working through the virtual mImage methods. The mImage class includes the following methods:

mImage(). . . . . . . . . constructor
~mImage() . . . . . . . . destructor
ReadHeader(). . . . . . . read the image header
ReadFrame() . . . . . . . read next image frame to the bitmap
SeekFrame() . . . . . . . seek to selected image frame
ColorChange() . . . . . . handle bitmap color table change
BuildBitmap() . . . . . . construct a bitmap from the current frame
SetBitmap() . . . . . . . assign a bitmap for reading/writing frames
SetFrameAdvance() . . . . enable/disable frame advance
SetTransparent(). . . . . enable/disable color transparency
SetTransparentColor() . . set transparent color and enable transparency
SetTranslate(). . . . . . enable/disable color translation
PlayImageAudio(). . . . . begin audio output
PauseImageAudio() . . . . pause audio output
StopImageAudio(). . . . . end audio output

Media!Lab includes support for the following mImage derived codecs:


 mImageAVI. . . . AVI video image class
 mImageBitmap . . memory bitmap image class
 mImageBMP. . . . BMP image class
 mImageFlic . . . FLC/FLI video image class
 mImageGIF. . . . GIF image class
 mImageJPEG . . . JPEG image class
 mImagePCX. . . . PCX/DCX image class

(top)

mDirector Class

The director class, mDirector, provides the drawing surface buffer for composing frame animations. The drawing surface bitmap may be located either in video memory or in system memory, dependent on operating system and graphics hardware capabilities. The director class provides the foundation structures and methods for implementing interactive graphic and multimedia programs. The mDirector class supplies the following capabilities:

The mDirector class includes the following function methods:


mDirector() . . . . . constructor
~mDirector(). . . . . destructor
DefWindowProc() . . . handle messages to the Director window
Resize(). . . . . . . resize the Director window
SetColors() . . . . . create a color table and palette for the Director window
Paint() . . . . . . . repaint the screen window from the Director window
Display() . . . . . . sychronize the screen window from the Director window
Invalidate(). . . . . invalidate rectangle(s) of the Director window
Add() . . . . . . . . add a renderer to the Director window
Remove(). . . . . . . remove a renderer from the Director
ChangeZ() . . . . . . change the Z order of a renderer
Cycle() . . . . . . . advance content of all renderers of this Director
Draw(). . . . . . . . make all renderers draw to the Director window
HitCheck(). . . . . . check hit area of all renderers
Frame() . . . . . . . call Cycle(), HitCheck(), Draw(), and Display()
Pick(). . . . . . . . locate top renderer intersecting specified X,Y point
DirtyRectSize() . . . resize the dirty rectangle list
GetDC() . . . . . . . return the Device Context for this Director window
GetPalette(). . . . . return handle of logical identity palette
InformColorChange() . notify renderers of color table change

(top)

mRenderer Class

Renderer class methods are called by the Director to perform drawing and sound operations at required time intervals. mRenderer acts as an abstract class supporting derived type-specific renderers such as sprites, FLC/FLI video, BMP/DCX/PCX imaging, tiled bitmaps, sound and special effects. In C++ you can also write your own renderers to implement additional custom animation types and capabilities. The mRenderer class includes the following functions:


mRenderer() . . . . constructor
~mRenderer(). . . . destructor
Added() . . . . . . do initializations when added to a Director
Removed() . . . . . do close operations when about to be removed
Draw(). . . . . . . draw a rectangle to the director window
Cycle() . . . . . . do things necessary to prepare for next frame
Hit() . . . . . . . perform operations when hitting another renderer
ColorChange() . . . do things necessary when the director color table change
SetZLevel() . . . . set Z position
SetHitDepth() . . . set the Z position hit depth

(top)

mRenderSolid Class

mRenderSolid is a special mRenderer derived class that draws a simple solid-fill background color to the animation bitmap. The mRenderSolid object is typically used to provide a simple solid-color background on the animation bitmap. In addition to the methods inherited from base mRenderer class, the mRenderSolid class includes the following methods:

mRenderer() . . . . constructor
~mRenderer(). . . . destructor
Added() . . . . . . do initializations when added to a Director
Removed() . . . . . do close operations when about to be removed
Draw(). . . . . . . draw a rectangle to the director window
Cycle() . . . . . . do things necessary to prepare for next frame
Hit() . . . . . . . perform operations when hitting another renderer
ColorChange() . . . do things necessary when the director color table change
SetZLevel() . . . . set Z position
SetHitDepth() . . . set the Z position hit depth

(top)

mSprite Class

The mSprite class provides special renderering capabilities that are called by the Director to perform drawing and sound operations for sprite animation. The mSprite class supplies the following capabilities: The mSprite class includes the following function methods:

mSprite() . . . . . . constructor
~mSprite(). . . . . . destructor
Move(). . . . . . . . set the current position of the sprite
MoveRel() . . . . . . move the sprite relative to its last position
SetOrigin() . . . . . set the sprite's origin position
Hide(). . . . . . . . make invisible (decrement display level)
Show(). . . . . . . . make visible (if display level goes positive)
Scroll(). . . . . . . set the scroll offset of the sprite - absolute
ScrollRel() . . . . . set the scroll offset of the sprite - relative
AutoScroll(). . . . . set the auto-scroll offset and frame rate
ViewSize(). . . . . . set the sprite's viewable size
LoadFromScript(). . . load script commands from file
Play(). . . . . . . . play sprite script
Pause() . . . . . . . pause script play
Resume(). . . . . . . resume script play
Speed() . . . . . . . set script speed factor
DropFrames(). . . . . enable/disable dropping frames
Loop(). . . . . . . . set the looping flag
AddSound(). . . . . . add an audio element to the sprite's list
PlaySound() . . . . . play an audio element
GetPosition() . . . . return current sprite position
GetCurrentFrame() . . return current sprite frame number
Added() . . . . . . . perform initializations when added to a Director
Cycle() . . . . . . . process to advance to the next frame
Hit() . . . . . . . . perform operations when hitting another sprite

(top)

mSpriteGroup Class

The sprite group class, mSpriteGroup, serves as a grouping object for containing multiple mSprite objects. The sprite group allows you to group a series of individual sprites and treat them as a single entity. Positioning and display calls to the sprite group affects all sprites in the group at one time. Elements within the group can still also operate and be accessed individually. A sprite group can also contain other sprite groups, and these groups can also be nested to any number of levels. The mSpriteGroup class provides the following capabilities: mSpriteGroup inherits the members and methods of the base mSprite class, and includes the following functions:

mSpriteGroup() . . . constructor
mSpriteGroup() . . . construct from script file
mSpriteGroup() . . . copy constructor
mSpriteGroup& =(). . assignment operator
~mSpriteGroup(). . . destructor
AddSprite(). . . . . add a sprite to the group
RemoveSprite() . . . remove a sprite from the group
Move() . . . . . . . set the current position of the sprite group
Hide() . . . . . . . make all elements in the group invisible
Show() . . . . . . . make all elements in the group visible
Play() . . . . . . . play all elements in the group
Pause(). . . . . . . pause script play of all elements in the group
Resume() . . . . . . resume script play for all elements in the group
Speed(). . . . . . . set script speed factor for all elements in the group
DropFrames() . . . . enable/disable frame dropping for all elements in the group
Loop() . . . . . . . enable/disable frame looping for all elements in the group
Added(). . . . . . . add all elements in the group to the Director
Removed(). . . . . . removed all elements in the group from the Director

(top)

mSpriteImage Class

Derived from the sprite class, the sprite-image class, mSpriteImage, combines sprite capabilities with the image class for performing sprite animation from frames contained in an mImage object. The sprite-image class allows virtually any type of image object - AVI, BMP, bitmap, FLC/FLI, GIF, JPEG, PCX/DCX - to operate as a sprite on the animation bitmap (the mImageBitmap class is especially designed for blitting sprite image frames contained in local memory bitmaps!). mSpriteImage inherits the members and methods of the base mSprite class, and includes the following functions:

mSpriteImage() . . . constructor
mSpriteImage() . . . construct as memory bitmap(s) from image or load-script file
mSpriteImage() . . . copy constructor
mSpriteImage& =(). . assignment operator
~mSpriteImage(). . . destructor
Added(). . . . . . . perform initializations when added to a Director
Removed(). . . . . . perform close when removed from a Director
ColorChange(). . . . process Director color table changes
Draw() . . . . . . . draw rectangle on the Director bitmap
Cycle(). . . . . . . process to advance to the next frame
Move() . . . . . . . set the current sprite position
Play() . . . . . . . execute sprite script
Pause(). . . . . . . pause script play
Resume() . . . . . . resume script play
LoadFromScript() . . load sprite and image script commands from file
ScrollRel(). . . . . set pan offset relative to the previous offset
SetImage() . . . . . set the current frame source
UseFrameOrigins(). . enable use of frame origins
SetTransparent() . . enable/disable image color transparency
SetTranslate() . . . enable/disable image color translation

 

Back     Next

-

© 1997 Metagraphics Software Corporation. All rights reserved.