Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

D2D1_SIZE_U

Stores an ordered pair of integers, typically the width and height of a rectangle.


typedef D2D_SIZE_U D2D1_SIZE_U;

Remarks

Like points, sizes are another important graphics concept. In Direct2D, sizes are represented by the D2D1_SIZE_U or D2D1_SIZE_F structures. They both contain an ordered pair of numbers. The D2D1_SIZE_U structure contains an ordered pair of UINT32 values, and the D2D1_SIZE_F structure contains an ordered pair of FLOAT values.

The D2D1_SIZE_U structure provides a convenient way for you to store an ordered pair of numbers, such as the width and height of a rectangle.

D2D1_SIZE_U is a new name for an already defined type D2D_SIZE_U. You can use the D2D1::SizeU function to create a D2D1_SIZE_U structure. A common use for this structure is to specify the pixel size of a D2D1_HWND_RENDER_TARGET_PROPERTIES structure. The following provides an example of using this structure.


    if (!m_pRenderTarget)
    {
        RECT rc;
        GetClientRect(m_hwnd, &rc);

        D2D1_SIZE_U size = D2D1::SizeU(
            rc.right - rc.left,
            rc.bottom - rc.top
            );

        // Create a Direct2D render target.
        hr = m_pD2DFactory->CreateHwndRenderTarget(
            D2D1::RenderTargetProperties(),
            D2D1::HwndRenderTargetProperties(m_hwnd, size),
            &m_pRenderTarget
            );


Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2DBaseTypes.h (include D2d1.h)

See also

D2D_SIZE_U
D2D1_SIZE_F
D2D1::HwndRenderTargetProperties

 

 

Community Additions

ADD
Show:
© 2015 Microsoft