KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UWriteBoard 클래스 참조

#include <WriteBoard.h>

+ UWriteBoard에 대한 상속 다이어그램 :
+ UWriteBoard에 대한 협력 다이어그램:

Public 멤버 함수

 UWriteBoard ()
 
 UWriteBoard (class UPopup_WriteBoard *parent)
 
FVector2D GetLocalMousePos (UImage *Image_Canvas, UTextureRenderTarget2D *RT_Canvas, FVector2D mousePos)
 
void SaveCanvas (int32 Qid, UTextureRenderTarget2D *RT_Canvas)
 
bool SaveRenderTargetToPNG (class UTextureRenderTarget2D *RenderTarget, const FString &FullFilePath)
 

Private 속성

const FString filePath = FPaths::ProjectSavedDir() / TEXT("WriteImage/")
 
TObjectPtr< class UPopup_WriteBoardparentWritePopup
 

상세한 설명

WriteBoard.h 파일의 14 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ UWriteBoard() [1/2]

UWriteBoard::UWriteBoard ( )
inline

WriteBoard.h 파일의 19 번째 라인에서 정의되었습니다.

19{}

◆ UWriteBoard() [2/2]

UWriteBoard::UWriteBoard ( class UPopup_WriteBoard parent)

WriteBoard.cpp 파일의 15 번째 라인에서 정의되었습니다.

16{
17 parentWritePopup = parent;
18}
TObjectPtr< class UPopup_WriteBoard > parentWritePopup
Definition WriteBoard.h:30

다음을 참조함 : parentWritePopup.

멤버 함수 문서화

◆ GetLocalMousePos()

FVector2D UWriteBoard::GetLocalMousePos ( UImage *  Image_Canvas,
UTextureRenderTarget2D *  RT_Canvas,
FVector2D  mousePos 
)

WriteBoard.cpp 파일의 19 번째 라인에서 정의되었습니다.

20{
21 // Get Absolute Local Pos
22 const FGeometry& geometry = Image_Canvas->GetCachedGeometry();
23 FVector2D localPos = geometry.AbsoluteToLocal(mousePos);
24
25 // Get Canvas Size
26 const FVector2D canvasSize = geometry.GetLocalSize();
27 // Transform localPos(in Image_Canvas Coord) to RT_Canvas Coord && Clamp upto RT_Canvas' Border
28 localPos.X = FMath::Clamp((localPos.X / canvasSize.X * RT_Canvas->SizeX), 0.f, RT_Canvas->SizeX);
29 localPos.Y = FMath::Clamp((localPos.Y / canvasSize.Y * RT_Canvas->SizeY), 0.f, RT_Canvas->SizeY);
30 return localPos;
31}

◆ SaveCanvas()

void UWriteBoard::SaveCanvas ( int32  Qid,
UTextureRenderTarget2D *  RT_Canvas 
)

WriteBoard.cpp 파일의 83 번째 라인에서 정의되었습니다.

84{
85 // File Path
86 IFileManager::Get().MakeDirectory(*filePath, true);
87 // File Name
88 // FString fileName = FDateTime::Now().ToString(TEXT("%Y_%m_%d_%H_%M_%S.png"));
89 FString fileName = FString::Printf(TEXT("Answer%d.PNG"), Qid);
90
91 // Export Render Target to png
92 SaveRenderTargetToPNG(RT_Canvas, filePath / fileName);
93}
bool SaveRenderTargetToPNG(class UTextureRenderTarget2D *RenderTarget, const FString &FullFilePath)
const FString filePath
Definition WriteBoard.h:31

다음을 참조함 : filePath, SaveRenderTargetToPNG().

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ SaveRenderTargetToPNG()

bool UWriteBoard::SaveRenderTargetToPNG ( class UTextureRenderTarget2D *  RenderTarget,
const FString &  FullFilePath 
)

WriteBoard.cpp 파일의 33 번째 라인에서 정의되었습니다.

34{
35 FTextureRenderTargetResource* RTResource = RenderTarget->GameThread_GetRenderTargetResource();
36 if (!RTResource)
37 {
38 return false;
39 }
40
41 // Get Width & Height
42 const int32 Width = RenderTarget->SizeX;
43 const int32 Height = RenderTarget->SizeY;
44
45 // Set Bitmap array
46 TArray<FColor> Bitmap;
47 Bitmap.AddUninitialized(Width * Height);
48
49 // Read BGRA8 pixels in RenderTarget
50 RTResource->ReadPixels(Bitmap);
51
52 // PNG Encoder
53 IImageWrapperModule& ImageWrapperModule =
54 FModuleManager::LoadModuleChecked<IImageWrapperModule>("ImageWrapper");
55
56 TSharedPtr<IImageWrapper> ImageWrapper =
57 ImageWrapperModule.CreateImageWrapper(EImageFormat::PNG);
58
59 if (!ImageWrapper.IsValid())
60 {
61 return false;
62 }
63
64 ImageWrapper->SetRaw(
65 Bitmap.GetData(),
66 Bitmap.GetAllocatedSize(),
67 Width,
68 Height,
69 ERGBFormat::BGRA,
70 8
71 );
72
73 // Compress to PNG
74 const TArray64<uint8>& PNGData = ImageWrapper->GetCompressed(100);
75
76 // Make Directory
77 const FString Directory = FPaths::GetPath(FullFilePath);
78 IFileManager::Get().MakeDirectory(*Directory, true);
79
80 return FFileHelper::SaveArrayToFile(PNGData, *FullFilePath);
81}

다음에 의해서 참조됨 : SaveCanvas().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ filePath

const FString UWriteBoard::filePath = FPaths::ProjectSavedDir() / TEXT("WriteImage/")
private

WriteBoard.h 파일의 31 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : SaveCanvas().

◆ parentWritePopup

TObjectPtr<class UPopup_WriteBoard> UWriteBoard::parentWritePopup
private

WriteBoard.h 파일의 30 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : UWriteBoard().


이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: