ActiveCompanionSet xtras for Macromedia DirectorImage Wrapper
Image wrapper is provided by VbScriptXtra as a helper to exchange image data between Director and COM applications.
Image wrapper is free. You may download ActiveCompanionSet and use the Image wrapper. Read the License agreement for more details.
To explicitly create this wrapper use xtra-level CreateWrapper method:
imageWrapper = xtra("VbScriptXtra").CreateWrapper( #Image )
Newly created image wrapper is not initialized.
Use Interface() method to get the short description of methods and properties provided by this object.
Use Image property to access Lingo Image object wrapped by this object.
Use Width, Height, Depth and AlphaDepth to get specific attributes of the wrapped image.
Use InitFromHBitmap(...) method to create the Lingo Image object from Bitmap handle.
Use StdOlePicture property to get wrapped image in a form of StdOle.Picture object, that can be used to pass images to COM Automation components. If you need to pass Bitmap handle to COM Automation component use the Handle property of StdOle.Picture object. See the sample below.
Use StdOlePicture property to initialize wrapped image from StdOle.Picture object, that may be created by some COM Automation components.
The sample below shows how to set overlay image to be shown over video stream of VideoCapX ActiveX control from Fath software.
vid = sprite( "VideoCapX" ).GetObject()
-- Connect to the default video devise (probably web CAM)
vid.connected = true
-- Make it to show anything
vid.preview = true
-- Create an image wrapper
img = xtra("VbScriptXtra").CreateWrapper(#Image)
-- Initialize it with the image of the stage
img.image = the stage.image
-- Get the image in a form of StdOle.Picture object
StdOlePic = img.StdOlePicture
-- Set overlay image for the current video stream
vid.SetBitmapOverlay( StdOlePic.Handle, 0, 0, 0, 100 )
Note: vid.SetBitmapOverlay() expects bitmap handle. To get the Lingo image in a form of Windows bitmap create StdOle.Picture object first. It carries bitmap that you can access via Handle property. Be aware that this bitmap is owned by StdOle.Picture object. It is released when StdOlePic goes out of the current scope.
|