ID2D1DeviceContext::GetImageWorldBounds method (d2d1_1.h)

Gets the bounds of an image with the world transform of the context applied.

Syntax

HRESULT GetImageWorldBounds(
  [in]  ID2D1Image  *image,
  [out] D2D1_RECT_F *worldBounds
);

Parameters

[in] image

Type: ID2D1Image*

The image whose bounds will be calculated.

[out] worldBounds

Type: D2D1_RECT_F[1]

When this method returns, contains a pointer to the bounds of the image in device independent pixels (DIPs).

Return value

Type: HRESULT

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

HRESULT Description
S_OK No error occurred.
E_OUTOFMEMORY Direct2D could not allocate sufficient memory to complete the call.
E_INVALIDARG An invalid parameter was passed to the returning function.

Remarks

The image bounds reflect the current DPI, unit mode, and world transform of the context. To get bounds which don't include the world transform, use ID2D1DeviceContext::GetImageLocalBounds.

The returned bounds reflect which pixels would be impacted by calling DrawImage with the same image and a target offset of (0,0). They do not reflect the current clip rectangle set on the device context or the extent of the context’s current target image.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1_1.h
DLL D2d1.dll

See also

D2D1_RECT_F

ID2D1DeviceContext

ID2D1DeviceContext::CreateBitmap

ID2D1DeviceContext::GetImageLocalBounds

ID2D1Image