ralpha-assets/Plugins/RalphaPlugin/Source/RalphaCore/Public/RalphaScreenCapture.h

59 lines
1.8 KiB
C++

// Copyright Ralpha Team. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "RalphaScreenCapture.generated.h"
/**
* Handles viewport screenshot capture for the style convergence loop.
*/
UCLASS(BlueprintType)
class RALPHACORE_API URalphaScreenCapture : public UObject
{
GENERATED_BODY()
public:
URalphaScreenCapture();
/**
* Capture the current viewport as a PNG image.
* @param Width Desired width (may be clamped to viewport size)
* @param Height Desired height (may be clamped to viewport size)
* @param OutBase64 The captured image as base64-encoded PNG
* @param OutFilePath Path where the image was saved (if saved to disk)
* @return True if capture succeeded
*/
UFUNCTION(BlueprintCallable, Category = "Ralpha")
bool CaptureScreenshot(int32 Width, int32 Height, FString& OutBase64, FString& OutFilePath);
/**
* Capture a high-resolution screenshot.
* @param Width Desired width
* @param Height Desired height
* @param OutBase64 The captured image as base64-encoded PNG
* @return True if capture succeeded
*/
UFUNCTION(BlueprintCallable, Category = "Ralpha")
bool CaptureHighResScreenshot(int32 Width, int32 Height, FString& OutBase64);
/**
* Capture from a specific camera using SceneCapture2D.
* @param Width Desired width
* @param Height Desired height
* @param OutBase64 The captured image as base64-encoded PNG
* @param OutFilePath Path where the image was saved
* @return True if capture succeeded
*/
UFUNCTION(BlueprintCallable, Category = "Ralpha")
bool CaptureFromCamera(int32 Width, int32 Height, FString& OutBase64, FString& OutFilePath);
private:
/** Convert raw pixel data to base64 PNG */
FString PixelsToBase64PNG(const TArray<FColor>& Pixels, int32 Width, int32 Height);
/** Get the screenshot save directory */
FString GetScreenshotDirectory();
};