UE4 保存为bitmap

    TArray<FColor> colorData;
    colorData.Init(FColor(0, 0, 255, 255), 1920 * 1080);

    for (int y = 0; y < 1920; y++)
    {
        for (int x = 0; x < 1080; x++)
        {
            int i = x + (y * 1080);
            colorData[i].R = binaryData[i * 4 + 0];
            colorData[i].G = binaryData[i * 4 + 1];
            colorData[i].B = binaryData[i * 4 + 2];
            colorData[i].A = binaryData[i * 4 + 3];
            count++;
        }
    }

 

TCHAR* d = TEXT("E:/testJigou/b.bmp");


    bool success = FFileHelper::CreateBitmap(d,1920,1080, &colorData[0],nullptr);
    if (success == true)
    {
        GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, TEXT("chenggongla"));
        GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, FString::FromInt(count));

    }
    else
    {
        GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, TEXT("shibaila"));
    }

 

需要include #include "FileHelper.h"

posted @ 2017-09-27 17:19  Litmin  阅读(728)  评论(0编辑  收藏  举报