Device.StretchRectangle Method
Copies the contents of the source rectangle to the destination rectangle.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
Syntax
'Declaration
Public Sub StretchRectangle ( _
sourceSurface As Surface, _
sourceRectangle As Rectangle, _
destSurface As Surface, _
destRectangle As Rectangle, _
filter As TextureFilter _
)
'Usage
Dim instance As Device
Dim sourceSurface As Surface
Dim sourceRectangle As Rectangle
Dim destSurface As Surface
Dim destRectangle As Rectangle
Dim filter As TextureFilter
instance.StretchRectangle(sourceSurface, sourceRectangle, destSurface, destRectangle, filter)
public void StretchRectangle (
Surface sourceSurface,
Rectangle sourceRectangle,
Surface destSurface,
Rectangle destRectangle,
TextureFilter filter
)
public:
void StretchRectangle (
Surface^ sourceSurface,
Rectangle sourceRectangle,
Surface^ destSurface,
Rectangle destRectangle,
TextureFilter filter
)
public void StretchRectangle (
Surface sourceSurface,
Rectangle sourceRectangle,
Surface destSurface,
Rectangle destRectangle,
TextureFilter filter
)
public function StretchRectangle (
sourceSurface : Surface,
sourceRectangle : Rectangle,
destSurface : Surface,
destRectangle : Rectangle,
filter : TextureFilter
)
Parameters
- sourceSurface
A Surface object that represents the source surface.
- sourceRectangle
A Rectangle object that represents the source rectangle. If a null reference (Nothing in Visual Basic), the entire source surface is used.
- destSurface
A Surface object that represents the destination surface.
- destRectangle
A Rectangle object that represents the destination rectangle. If a null reference (Nothing in Visual Basic), the entire destination surface is used.
- filter
Filter type. The allowable values are Point, or Linear. For more information see TextureFilter.
Remarks
The source rectangle can be stretched and filtered by the copy. This method is often used to change the aspect ratio of a video stream.
If the operation results in stretching or shrinking, not all surface combinations are valid for StretchRectangle. Other factors include what types of surfaces are involved and their formats.
The following table shows valid surface destination format combinations:
Source format |
Texture |
RT Texture |
RT |
Off-screen plain |
---|---|---|---|---|
Texture |
No |
Yes |
Yes |
No |
RT Texture |
No |
Yes |
Yes |
No |
RT |
No |
Yes |
Yes |
No |
Off-screen plain |
No |
Yes |
Yes |
Yes, but only with no stretching |
If filtering is specified, StretchRectangle fails unless the driver sets StretchRectangleFilterCaps. If None is specified, the driver chooses a filtering algorithm.
You can use depth stencil surfaces in StretchRectangle calls, provided there is no stretching or shrinking occurring in the call. The following restrictions also apply to DepthStencil surfaces when being copied with a StretchRectangle call:
Both surfaces must be of the same format with no format conversion.
No stretching or shrinking is allowed.
Only the entire surface can be copied. Sub-rectangle copies are not allowed.
Applications should use CopyRects or UpdateTexture rather than StretchRectangle to load texture maps, because they were designed to use internal information and dirt rectangle tables.
Stretching between rectangles on the same surface is not supported. To test the hardware for color conversion, use the CheckDeviceFormatConversion method of a Manager because software emulation for the conversion is not supported. This method also indicates if stretching between surfaces of the same format is supported. Stretching or shrinking is not supported if either of the surfaces has a DXTn compressed format. The source surface must not be multisampled.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Version Information
.NET Compact Framework
Supported in: 2.0
See Also
Reference
Device Class
Device Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace