The IDXTScale interface is used to control how the transform scales the input data to produce the output surface and what filter type it should use. This interface inherits from the IUnknown interface.
This interface supports the Quality property, which is used to select a filter to use during scaling. If the value for Quality is below 0.333, the scaling operation uses a nearest-neighbor filter to determine the color of the source pixel. For values greater than 0.333, a bilinear filter is used, which results in smoother color transitions. You can access this property through the IDXTransform::SetQuality and IDXTransform::GetQuality methods.
To use the IDXTScale interface, you must first create a scale transform with the DXTransformFactory object (Transform Factory). Then call QueryInterface on the resulting transform with IID_IDXTScale as the interface ID, as shown in the following:
hr = g_pTransFact->CreateTransform( NULL, 0, NULL, 0, NULL, NULL, CLSID_DXTScale, IID_IDXTransform, (void **)&g_pScalerTrans ); hr = g_pScalerTrans->QueryInterface( IID_IDXTScale, (void **)&spScalar );
The returned pointer can be used to access any of the listed methods.
IDXTScale Methods
GetScales Retrieves the x-axis and y-axis scale factors. ScaleFitToSize Sets the scale factors used to fit a portion of the input to match a specified size. SetScales Sets the x-axis and y-axis scale factors.
Retrieves the x-axis and y-axis scale factors.
Syntax
HRESULT GetScales( float Scales[2] );
Parameters
- Scales
- [out] On return, this array is filled with the current x-axis and y-axis scale factors. The DXBNDID enumeration elements can be used to index the array.
Return Value
Returns one of the following HRESULT values.
S_OK Success. E_POINTER Bad pointer.
Sets the scale factors used to fit a portion of the input to match a specified size.
Syntax
HRESULT ScaleFitToSize( DXBNDS *pPortionBounds, SIZE FitToSize, BOOL bMaintainAspect );
Parameters
- pPortionBounds
- [in, out] Pointer to the portion of the input to be mapped. NULL indicates that the entire input is to be used.
- FitToSize
- [in] Size of the desired result.
- bMaintainAspect
- [in] Boolean value indicating how scale factors will be used. If TRUE, this method will set the scale factors to fit the result within the window, maintaining the aspect ratio of the region specified by pPortionBounds. If FALSE, the scale factors will be set to create a result that equals the FitToSize parameter value.
Return Value
Returns one of the following HRESULT values.
S_OK Success. E_INVALIDARG Bad pointer, or one of the FitToSize members is less than 1. E_FAIL Number of transform inputs is zero.
Remarks
This method automatically calculates the scale factors needed to scale a clipped input image to a known size. The scale factors are a simple ratio of the input size and boundary lengths along each dimension.
The values passed to pPortionBounds in this method should be the same as those passed to the IDXTransform::Execute method.
See Also
Sets the X and Y scale factors.
Syntax
HRESULT SetScales( float Scales[2] );
Parameters
- Scales
- [in] Contains the X and Y scale factors that the transform should use. The DXBNDID enumeration elements can be used to index the array.
Return Value
Always returns S_OK.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.