Microsoft DirectX 8.1 (C++)

Video Color Source

The Video Color Source creates a continuous video image of a solid color.

Class ID (CLSID): {0CFDD070-581A-11D2-9EE6-006008039E37}

CLSID Variable Name: CLSID_ColorSource

Properties

Property Type Default Description
Color DWORD 0 Specifies the color to generate. See Remarks.

Remarks

The Video Color Source is used with source objects. First, create a new source object. Then set the source object's subobject GUID to CLSID_ColorSource, by calling the IAMTimelineObj::SetSubObjectGUID method.

To set the color, create a Property Setter object and apply the Color property at time zero. The value of this property is a hexadecimal number with the format 0xAARRGGBB, where AA is the alpha value, RR is the red value, GG is the green value, and BB is the blue value. Alpha values range from 0x00 (transparent) to 0xFF (opaque). The property is static and must be applied at time zero.

If you do not specify the alpha value, it defaults to zero (transparent). In a 32-bit-color video project, this will cause transitions or effects that use alpha to render the Video Color Source as completely transparent. To be safe, always specify the alpha. For example, opaque black is 0xFF000000.

The following code example shows how to use this object. For more information about using IPropertySetter, see Setting Properties on Effects and Transitions:

DWORD           dwYellow = 0xFFFF00;
IAMTimelineObj  *pSource = NULL;
IPropertySetter *pProp = NULL;

pTimeline->CreateEmptyNode(&pSourceObj, TIMELINE_MAJOR_TYPE_SOURCE);
pSource->SetStartStop(0, 50000000);
pSource->SetSubObjectGUID(CLSID_ColorSource);

// Create a property setter.
CoCreateInstance(CLSID_PropertySetter, NULL, CLSCTX_INPROC_SERVER, 
    IID_IPropertySetter, (void**) &pProp);

// Set the color.
DEXTER_PARAM param;
DEXTER_VALUE val;

param.Name = SysAllocString(L"Color");
param.dispID = 0;
param.nValues = 1;

val.v.vt = VT_I4;
val.v.lVal = dwYellow;
val.rt = 0;  // Time must be zero.
val.dwInterp = DEXTERF_JUMP;

pProp->AddProp(param, &val);
pSource->SetPropertySetter(pProp);

// Clean up.
SysFreeString(param.Name);
VariantClear(&val.v);
pProp->Release();

The following example shows the XML representation of the object created in the previous example. In this case the param element does not support at or linear elements, because the object does not support dynamic properties:

<clip start="0" stop="5" clsid="{0CFDD070-581A-11D2-9EE6-006008039E37}">
    <param name="Color" value="16776960"/>
</clip>