> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XUserGamerPictureSize

> XUserGamerPictureSize

# XUserGamerPictureSize

게이머 사진의 크기를 픽셀 단위로 지정합니다.

## 구문

```cpp theme={null}
enum class XUserGamerPictureSize  : uint32_t  
{  
    Small = 0,  
    Medium = 1,  
    Large = 2,  
    ExtraLarge = 3,  
}  
```

## 상수

| 상수         | 설명                        |
| ---------- | ------------------------- |
| Small      | 작은 사진 크기: 64x64 픽셀.       |
| Medium     | 중간 사진 크기: 208x208 픽셀.     |
| Large      | 큰 사진 크기: 424x424 픽셀.      |
| ExtraLarge | 매우 큰 사진 크기: 1080x1080 픽셀. |

## 설명

사용자의 게이머 사진을 비동기적으로 가져오려면 [XUserGetGamerPictureAsync](/reference/system/xuser/functions/xusergetgamerpictureasync) 함수를 호출합니다.
[XUserGetGamerPictureAsync](/reference/system/xuser/functions/xusergetgamerpictureasync) 함수는 XUserGamerPictureSize 열거형을 매개변수로 받습니다.
[XUserGetGamerPictureResult](/reference/system/xuser/functions/xusergetgamerpictureresult) 함수는 [XUserGetGamerPictureAsync](/reference/system/xuser/functions/xusergetgamerpictureasync) 함수가 반환하는 결과를 가져옵니다.

다음 예제는 게이머 사진을 로드하는 방법을 보여줍니다.

```cpp theme={null}
HRESULT LoadGamerPicComplete(XAsyncBlock* abResult)
{
    try
    {
        struct CreateTextureContext
        {
            User* This;
            ImTextureID TextureId;
            std::vector<unsigned char> GamerpicBuffer;
        };

        auto context = std::make_unique<CreateTextureContext>();
        context->This = this;
        context->TextureId = IMTEXTUREID_INVALID;

        // Get the buffer size and set up a buffer to contain it
        size_t bufferSize;
        RETURN_IF_FAILED(XUserGetGamerPictureResultSize(abResult, &bufferSize));
        context->GamerpicBuffer.resize(bufferSize);

        size_t bufferUsed;
        RETURN_IF_FAILED(XUserGetGamerPictureResult(
            abResult,
            context->GamerpicBuffer.size(),
            context->GamerpicBuffer.data(),
            &bufferUsed));
        FAIL_FAST_HR_IF(E_UNEXPECTED, bufferSize != bufferUsed);

        // Create some async work to create a dx texture off the UI thread
        // and then set the texture id back on the UI thread
        auto abCreateTexture = std::make_unique<XAsyncBlock>();
        ZeroMemory(abCreateTexture.get(), sizeof(*abCreateTexture));
        abCreateTexture->queue = abResult->queue;
        abCreateTexture->context = context.get();

        // Set the texture id in the completion on the UI thread
        abCreateTexture->callback = [](XAsyncBlock* ab)
        {
            auto context = static_cast<CreateTextureContext*>(ab->context);
            context->This->_textureId = context->TextureId;
            delete context;
            delete ab;
        };

        // Worker will create the texture on a work thread
        auto createTextureWorker = [](XAsyncBlock* ab) -> HRESULT
        {
            auto context = static_cast<CreateTextureContext*>(ab->context);
            auto dimension = GetDimensionFromSize(GamerPicSize);
            RETURN_IF_FAILED(CreateTextureFromPng(context->GamerpicBuffer.data(), context->GamerpicBuffer.size(), &context->TextureId));
            return S_OK;
        };

        // Create the texture on a work thread
        if (SUCCEEDED_LOG(XAsyncRun(abCreateTexture.get(), createTextureWorker)))
        {
            context.release();
            abCreateTexture.release();
        }
    }
    CATCH_RETURN();
    return S_OK;
}

HRESULT LoadGamerPicAsync(XTaskQueueHandle queue, uint32_t cancelTime = 0)
{
    auto asyncBlock = std::make_shared<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = queue;

    struct GamerPicContext
    {
        User* User;
        std::shared_ptr<XAsyncBlock> AsyncBlock;
    };

    auto context = std::make_unique<GamerPicContext>();
    context->User = this;
    context->AsyncBlock = asyncBlock;
    asyncBlock->context = context.get();

    asyncBlock->callback = [](XAsyncBlock* ab)
    {
        std::unique_ptr<GamerPicContext> context(reinterpret_cast<GamerPicContext*>(ab->context));
        LOG_IF_FAILED(context->User->LoadGamerPicComplete(ab));
    };

    if (cancelTime != 0)
    {
        std::thread cancelThread(
            [asyncBlock]()
        {
            std::this_thread::sleep_for(std::chrono::milliseconds(5000));
            XAsyncCancel(asyncBlock.get());
        });

        cancelThread.detach();
    }

    if (SUCCEEDED_LOG(XUserGetGamerPictureAsync(_handle.get(), GamerPicSize, asyncBlock.get())))
    {
        context.release();
    }

    return S_OK;
}
```

## 요구 사항

**헤더:** XUser.h

**지원되는 플랫폼:** Windows, XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[XUser](/reference/system/xuser/xuser_members)

[XUserGetGamerPictureAsync](/reference/system/xuser/functions/xusergetgamerpictureasync)

[XUserGetGamerPictureResult](/reference/system/xuser/functions/xusergetgamerpictureresult)


## Related topics

- [XUser](/ko/reference/system/xuser/xuser_members.md)
- [XUserGetGamerPictureResultSize](/ko/reference/system/xuser/functions/xusergetgamerpictureresultsize.md)
- [XR-046 표시 이름 및 게이머 사진](/ko/publishing/certification/xr/xr-046.md)
- [XblUserProfile](/ko/reference/live/xsapi-c/profile_c/structs/xbluserprofile.md)
- [PC 및 모바일 게임용 XBOX Requirement 테스트 케이스](/ko/publishing/certification/pc-policy-tests.md)
