DOMAJ DXLIB TIPS
Warning: This is a test only and does not pay attention to the clean-up of resources.
{-----------------------------------------------------------------------------
 Unit Name: v70Unit
 Author: Tony Domigan
 Purpose: Test DXLIB v1.4 beta media.GetBitMap Function
 History: 30Apr02
-----------------------------------------------------------------------------}
Unit v70Unit;
Interface
Uses DXClasses, Windows, sysUtils;
Type
  Tv70=Class(TDXScript)
  Protected
    Procedure ExecuteFunction(FunctionIndex:Cardinal;
Const ArgList:IDXArgList;
      Const Result:IDXValue); override;
  Public
    Class Procedure GetScriptInfo(Var
ScriptInfo:TDXScriptInfo); override;
    Class Procedure InitializeClass(Const
Info:TDXInitializeClassInfo); override;
  End;
Implementation
Const
  CLSID_Script:TGUID='{948E3EA1-5C1F-11D6-9135-004F4900150E}';
Var
  tdWidth, tdHeight : TDXSymbol;
Class Procedure Tv70.GetScriptInfo(Var ScriptInfo:TDXScriptInfo);
Begin
  ScriptInfo.MessageTable:='xtra v70'#10+
    '* tdGetBitmap castNum integer, memberNum integer'#10;
End;
Class Procedure Tv70.InitializeClass(Const Info:TDXInitializeClassInfo);
Begin
 tdWidth := Info.SymbolManager.CreateSymbol('WIDTH');
  tdHeight := Info.SymbolManager.CreateSymbol ('HEIGHT');
End;
Procedure Tv70.ExecuteFunction(FunctionIndex:Cardinal;
  Const ArgList:IDXArgList; Const Result:IDXValue);
Procedure tdGetBitmap(castNum, memberNum:Integer);
Var
  tdValue : IDXValue;
  cast : IDXCast;
  member : IDXCastmember;
  media : IDXCastmemberMedia;
  bitmap : HBitmap;
  DC : HDC;
  rvalue : Boolean;
  Width,Height : Integer;
Begin
 Width:=0;Height:=0;
  cast := Movie.GetCastByIndex(castNum);
  member := cast.CastMember[memberNum];
  tdValue := member.GetProperty(tdWidth);
  sendMessage('Width Property:'+intToStr(tdValue.Integer)+#10);
  tdValue := member.GetProperty(tdHeight);
  sendMessage('Height Property:'+intToStr(tdValue.Integer)+#10);
  media := member.Media;
  rValue := media.GetBitmap(bitmap,DC,Width,Height);
  If rValue Then
  Begin
    sendMessage('Yes, I can Do it I have the handle'+#10);
    sendMessage('Width:'+intToStr(Width)+#10);
    sendMessage('Height:'+intToStr(Height)+#10);
  End
  Else
   sendMessage('No, I cannot get the handle To the DIB'+#10);
End;
Begin
  // Add code to execute the methods declared by the GetScriptInfo
function
  // Methods are indexed in the order that they were declared, starting
from 0
  Case FunctionIndex Of
  0: tdGetBitmap(argList [0].Integer, argList [1].Integer);
  1: ;
  2: ;
  End;
End;
Initialization
  RegisterDXClass(Tv70,CLSID_Script);
End.
//Generated 30Apr02 by DOMAJ
Here is a unit in a separate
window.
DXLIB TIPS INDEX
- When I use sendMessage, the message does not appear in the Director message window. Why?
- How do I return a value to Director?.
- What is the results interface?
- Field properties.
- How do I trigger the mouseUp handler?
- How do I add my own function to an asset?
- How do I add my own function to a sprite?
- How do I manipulate the score?
- How do I show delphi forms?
- How do I define and use my own variables?
- How do I create and and read global variables and their values?
- How do I create a behavior?
- How do I trigger a script in Director?
- How do I get the properties of a cast member?(31Mar03)
- How do I manipulate casts?
- How do I debug an XTRA?
- How do I draw a castmember icon?
- How do I add my own resource file bitmap as the castmember icon?
- How do I add a Director property interface
- Using the bitmap media property of a castmember (30Apr02)
- How do I return a list to Director (09May02)
- How to create, execute and delete a Director script (08Oct02)
- How to create a Director Bitmap (09Oct02)
- How to export a Director Bitmap (15Oct02)
DOMAJ Links

