> ## 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.

# XUserGetGamerPictureResult

> XUserGetGamerPictureResult

# XUserGetGamerPictureResult

[XUserGetGamerPictureAsync](/ko/reference/system/xuser/functions/xusergetgamerpictureasync.md) 호출 결과를 가져옵니다.

## 구문

```cpp theme={null}
HRESULT XUserGetGamerPictureResult(  
         XAsyncBlock* async,  
         size_t bufferSize,  
         void* buffer,  
         size_t* bufferUsed  
)  
```

### 매개변수

*async*   \_Inout\_\
형식: [XAsyncBlock\*](/ko/reference/system/xasync/structs/xasyncblock.md)

호출의 상태를 폴링하고 호출 결과를 가져오기 위한 [XAsyncBlock](/ko/reference/system/xasync/structs/xasyncblock.md)입니다.

*bufferSize*   \_In\_\
형식: size\_t

*buffer* 매개변수의 버퍼 크기입니다.

*buffer*   \_Out\_writes\_bytes\_to\_(bufferSize,*bufferUsed)\
형식: void*

게이머 사진을 포함하는 버퍼입니다.

*bufferUsed*   \_Out\_opt\_\
형식: size\_t\*

게이머 사진을 담기 위한 버퍼의 양을 포함합니다.

### 반환값

형식: HRESULT

HRESULT 성공 또는 오류 코드입니다.\
오류 코드 목록은 [Error Codes](/ko/reference/errorcodes.md)를 참조하십시오.

## 설명

"Display Name and Gamerpic" XR은 사용자 이름과 아바타 이미지가 어떻게 표시되는지에 대한 특정 요구 사항을 나열합니다.
자세한 내용은 XBOX One 게임 및 허브 앱에 대한 XBOX 요구 사항 [(XBOX 개발자 다운로드->Partner, Publishing 및 Release Management 정보->XGD 파트너 문서)](https://www.microsoft.com/software-download/devcenter)를 참조하십시오.

[XUserGetGamerPictureAsync](/ko/reference/system/xuser/functions/xusergetgamerpictureasync.md) 호출 결과를 가져오려면
[XUserGetGamerPictureResult](/ko/reference/system/xuser/functions/xusergetgamerpictureresult.md)를 호출합니다.

[XUserGetGamerPictureAsync](/ko/reference/system/xuser/functions/xusergetgamerpictureasync.md)가 반환한 게이머 사진을 가져오기 위해 [XUserGetGamerPictureResult](/ko/reference/system/xuser/functions/xusergetgamerpictureresult.md)에서 필요한 버퍼 크기를 가져오려면
[XUserGetGamerPictureResultSize](/ko/reference/system/xuser/functions/xusergetgamerpictureresultsize.md)를 호출합니다.

반환되는 게이머 사진의 형식은 .PNG 형식의 이미지입니다. 사진의 크기는 최대 2^32
바이트가 될 수 있습니다.

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

```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

**라이브러리:** xgameruntime.lib

**지원되는 플랫폼:** Windows, Steam Deck, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 문서

* [비동기 프로그래밍 설계 목표 및 개선 사항](/ko/build/core-features/common/async/async-whitepaper.md)

## 함께 보기

[XUser](/ko/reference/system/xuser/xuser_members.md)

[XUserGetGamerPictureAsync](/ko/reference/system/xuser/functions/xusergetgamerpictureasync.md)

[XUserGetGamerPictureResultSize](/ko/reference/system/xuser/functions/xusergetgamerpictureresultsize.md)


## Related topics

- [XUserGetGamerPictureResultSize](/ko/reference/system/xuser/functions/xusergetgamerpictureresultsize.md)
- [XUserGetGamerPictureAsync](/ko/reference/system/xuser/functions/xusergetgamerpictureasync.md)
- [XUserGamerPictureSize](/ko/reference/system/xuser/enums/xusergamerpicturesize.md)
- [비동기 프로그래밍 설계 목표 및 개선 사항](/ko/build/core-features/common/async/async-whitepaper.md)
- [XUser (API 콘텐츠)](/ko/reference/system/xuser/xuser_members.md)
