次の方法で共有


IImageEncoder::SetEncoderParameters (Compact 2013)

3/26/2014

This feature is being deprecated for this release. Refer to this component: Windows Imaging Component.

This method is used to set encoder parameters.

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

Syntax

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 Value

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.

Code Example

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

Header

imaging.h

Library

Imaging.lib

See Also

Reference

IImageEncoder