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

#include <PNGCombineManager.h>

+ PNGCombineManager에 대한 협력 다이어그램:

Public 멤버 함수

void CombinePNG ()
 

상세한 설명

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

멤버 함수 문서화

◆ CombinePNG()

void PNGCombineManager::CombinePNG ( )

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

10{
11 // std::string outputPath = argv[1];
12 //
13 // // 입력 이미지 경로
14 // std::vector<std::string> imagePaths;
15 // for (int i = 2; i < argc; ++i) {
16 // imagePaths.push_back(argv[i]);
17 // }
18
19 int totalWidth = 0;
20 int maxHeight = 0;
21 int channels = 0;
22
23 struct ImageData {
24 unsigned char* data;
25 int width;
26 int height;
27 int channels;
28 };
29 std::vector<ImageData> images;
30
31 // PNG 로드
32 // for (const auto& path : imagePaths) {
33 // int w, h, c;
34 // // 원하는 채널 수를 4로 강제 (RGBA)하면 다루기 편함
35 // unsigned char* data = stbi_load(path.c_str(), &w, &h, &c, 4);
36 // if (!data) {
37 // std::cerr << "이미지 로드 실패: " << path << "\n";
38 // // 지금까지 로드한 이미지들 해제
39 // for (auto& img : images) {
40 // stbi_image_free(img.data);
41 // }
42 // return -1;
43 // }
44 //
45 // // 실제 채널은 4를 사용
46 // c = 4;
47 //
48 // images.push_back({ data, w, h, c });
49 //
50 // totalWidth += w;
51 // if (h > maxHeight) maxHeight = h;
52 // channels = c; // 어차피 4로 통일
53 // }
54
55 int outWidth = totalWidth;
56 int outHeight = maxHeight;
57 int outChannels = channels; // 4
58 size_t outSize = (size_t)outWidth * outHeight * outChannels;
59
60 // 최종 이미지 버퍼
61 std::vector<unsigned char> output(outSize, 0);
62
63 // 오른쪽으로 이어 붙이기
64 int xOffset = 0;
65 for (const auto& img : images) {
66 for (int y = 0; y < img.height; ++y) {
67 // 목적지 시작 위치
68 unsigned char* dstRow = &output[(y * outWidth + xOffset) * outChannels];
69 // 소스 시작 위치
70 const unsigned char* srcRow = &img.data[y * img.width * img.channels];
71
72 std::memcpy(dstRow, srcRow, (size_t)img.width * outChannels);
73 }
74 xOffset += img.width;
75 }
76
77 // PNG로 저장
78 // if (!stbi_write_png(outputPath.c_str(), outWidth, outHeight, outChannels,
79 // output.data(), outWidth * outChannels)) {
80 // std::cerr << "PNG 저장 실패: " << outputPath << "\n";
81 // }
82
83}

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