APTR handle = OpenAnim(STRPTR filename, struct LoadAnimCtrl *ctrl);
NULL
. The handle returned by OpenAnim()
is
an opaque datatype that only your plugin knows about. Hollywood will simply pass
this handle back to your LoadFrame() function when it wants to
have the raw pixel data of a single frame.
This function also has to provide certain information about the animation it
has just loaded. This information has to be written to the struct LoadAnimCtrl
that is passed in the second parameter. This structure looks like this:
struct LoadAnimCtrl { int Width; // [out] int Height; // [out] int LineWidth; // [out] int NumFrames; // [out] int AlphaChannel; // [out] int ForceAlphaChannel; // [out] STRPTR Adapter; // [in] -- V6.0 ULONG Flags; // [in] -- V6.0 ULONG *Palette; // [unused] -- V9.0 ULONG TransPen; // [unused] -- V9.0 int Depth; // [unused] -- V9.0 int Type; // [out] -- V9.0 struct hwUserTagList *UserTags; // [in] -- V10.0 }; |
Be careful when accessing above structure members: LoadAnimCtrl has seen several revisions in Hollywood's history. Before accessing members that haven't been there in all Hollywood versions you must make sure that your plugin has been opened by a Hollywood version that has those members or you will access unallocated memory!
The following information has to be written to the struct LoadAnimCtrl
pointer
by OpenAnim()
:
NumFrames:
Width:
Height:
AlphaChannel:
True
or False
, depending on whether or not this animation uses
frames that have an alpha channel.
ForceAlphaChannel:
True
, Hollywood will automatically create an alpha channel for
all objects that load this animation. For example, if the user calls OpenAnim()
on your animation but does not set the LoadAlpha
tag to True
, the animation will still
get an alpha channel if you set ForceAlphaChannel
to True
. Note that this functionality
was broken before Hollywood 6.0.
Adapter:
NULL
, Hollywood wants your plugin to
use the file adapter specified in Adapter
to open the animation. This means that you
have to use hw_FOpenExt() instead of hw_FOpen()
to open the animation. Make sure to check for Hollywood 6.0 before trying to access
this member because it isn't there in previous versions. See hw_FOpenExt for details. (V6.0)
Flags:
HWANMFLAGS_TRANSPARENCY:
LoadTransparency
tag to True
. You
may then choose to write a frame's transparency information to its alpha channel and
set the ForceAlphaChannel
member to True
. See above for more information. (V6.0)
HWANMFLAGS_LOADPALETTE:
LoadPalette
tag to True
. If this
flag is set, your implementation of OpenAnim()
should fail in case the anim does
not have a palette. If it has a palette, you have to return that palette when
Hollywood calls your LoadFrame() implementation. Note that
palette anims must always use HWANIMTYPE_RASTER
. They may not register as vector
anims. (V9.0)
Make sure to check for Hollywood 6.0 before trying to access this member because it isn't there in previous versions. (V6.0)
Type:
HWEXT_ANIM_VECTOR
extension bit has been set, Type
must be set to the
anim type. This may be either HWANIMTYPE_RASTER
or HWANIMTYPE_VECTOR
.
If you set this to HWANIMTYPE_VECTOR
, Hollywood will call your TransformFrame()
function whenever it needs to transform a frame. This allows you to do lossless
transformation of the vector frame. For anim frames of type HWANIMTYPE_RASTER
,
TransformFrame() will never be called. Instead, Hollywood does
all transformations itself. (V9.0)
UserTags:
UserTags
could
also be intended for another plugin, namely the file adapter plugin passed
in Adapter
. See User tags for details. Make sure to check for Hollywood 10.0
before trying to access this member because it isn't there in previous versions.
(V10.0)
Please note that you should not use ANSI C functions like fopen()
to
open the file that is passed to this function because the filename that is passed
to this function can also be a specially formatted filename specification that
Hollywood uses to load files that have been linked to applets or executables. In
order to be able to load these files correctly, you have to use special IO functions
provided by Hollywood. See File IO information for details.
struct LoadAnimCtrl
for storing information
about the animationNULL
if plugin doesn't
want to handle this animation