Share via


IImageEncoder::SetEncoderParameters (Windows CE 5.0)

Send Feedback

This method is used to set encoder parameters.

Your application must call this method prior to calling IImageEncoder::GetEncodeSink.

HRESULT SetEncoderParameters(  const EncoderParameters* Param);

Parameters

  • Param
    [in] A pointer to an EncoderParameters object containing the parameter data that will be set for the encoder.

Return Values

If successful, this method returns S_OK.

This method may return E_NOTIMPL if it fails.

Remarks

If the encoder does not support the combination of the encoding parameters, it ignores the call and returns S_FALSE.

The encoder should define a default set of encoder parameters in case the caller does not call this method, or calls the method with the wrong parameters.

By default, the encoder should save the image in the same color depth if it can support it. If not, the encoder should define the closest color depth for the source.

The following code shows how an application set two 2-parameter values for an encoder.

EncoderParameters* ParamsList;
LONG lCompression = EncoderValueCompressionNone;  // No compression
LONG lColorDepth = 16;                            // 16 bpp

// Allocate enough memory for 2 parameters.
// Note that EncoderParameters automatically has room for one.
ParamsList = CoTaskMemAlloc(sizeof (EncoderParameters) +
                            1 * sizeof(EncoderParameter));
ParamsList->Count = 2;
ParamsList->Parameter[0].Guid           = ENCODER_COMPRESSION;
ParamsList->Parameter[0].NumberOfValues = 1;
ParamsList->Parameter[0].Type           = EncoderParameterValueTypeLong;
ParamsList->Parameter[0].Value          = (void*) &lCompression;
ParamsList->Parameter[1].Guid           = ENCODER_COLORDEPTH;
ParamsList->Parameter[1].NumberOfValues = 1;
ParamsList->Parameter[1].Type           = EncoderParameterValueTypeLong;
ParamsList->Parameter[1].Value          = (void*) &lColorDepth;

SetEncoderParameters(ParamsList);

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Imaging.h.
Link Library: Imaging.lib.

See Also

IImageEncoder

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.