


Surface Types
|
|
|
|
Yes
|
TextureRender Target |
No
|
|
|
|
Render Target Surface |
|
No
|
No
|
|
|
|
|
Yes
|
Yes
|
DirectX 9.0 introduced a new 2D surface copying function called
IDirect3DDevice9::StretchRect. This function is used primarily for
copying images from surfaces to render target surfaces. Unlike the
UpdateSurface function, the pixel formats of the source and destination
pixel formats do not have to match because color conversion will be
applied if necessary. Also, the source and destination rectangles do not
require matching dimensions either. This allows us to magnify/minify the
source image onto the destination surface using a specified filtering
technique. While the function looks simple enough, there are some rules
and restrictions that must be considered. We will discuss these as we
move along.
IDirect3DSurface9 *pSourceSurface
The source surface of the copy operation. This surface must have been
created in the D3DPOOL_DEFAULT memory resource
pool.


CONST RECT *pDestRect
The destination rectange on the destination surface. The pixels that
fall within the source rectangle on the source surface will be copied,
color coverted if necessary, and resized to fit within this rectangle on
the destination surface. If this is set to NULL, the source rectangle
will be resized to fill the entire destination surface.
D3DTEXTUREFILTERTYPE Filter
If the pixels copied from the source image need to be resized to fit the
destination rectangle, this parameter describes one of three possible
filter types used to reduce aliasing. Possible values are
D3DTEXF_NONE, D3DTEXF_POINT or
D3DTEXF_LINEAR. If D3DTEXF_NONE is
specified, the driver will choose a filtering algorithm. If you intend
to explicity set a filter type you should check that the filter type is
supported for the device. The D3DCAPS9 structure has a member called
StretchRectFilterCaps. You can check one of the
following filter flags for support:
|
|
|
|
|
|
www.gameinstitute.com Graphics Programming with
DX9 |
Page 102 of 108 |