// WL-816n — 비교 캡처 합성: ⓐ 데모 | 섬 전 | 섬 후 public static class WL816n_Cmp { public static void Run() { var demo = Load("Screenshots_WL/WL816f/c_demo_vs_island_ground.png"); var bef = Load("Screenshots_WL/WL816n/a_before.png"); var aft = Load("Screenshots_WL/WL816n/b_after.png"); if (demo == null || bef == null || aft == null) { UnityEngine.Debug.LogError("[816n] png 없음"); return; } // 데모 좌측 절반만 잘라 쓴다 int dw = demo.width / 2 - 20, dh = demo.height - 60; var dcrop = Crop(demo, 10, 30, dw, dh); int H = 900; var a = Fit(dcrop, H); var b = Fit(bef, H); var c = Fit(aft, H); int W = a.width + b.width + c.width + 16; var outT = new UnityEngine.Texture2D(W, H, UnityEngine.TextureFormat.RGB24, false); var bg = new UnityEngine.Color32(24, 24, 24, 255); var fill = new UnityEngine.Color32[W * H]; for (int i = 0; i < fill.Length; i++) fill[i] = bg; outT.SetPixels32(fill); Blit(outT, a, 0); Blit(outT, b, a.width + 8); Blit(outT, c, a.width + b.width + 16); outT.Apply(); System.IO.File.WriteAllBytes("Screenshots_WL/WL816n/a_demo_vs_before_after.png", UnityEngine.ImageConversion.EncodeToPNG(outT)); UnityEngine.Debug.Log("[816n] cmp written " + W + "x" + H); } static UnityEngine.Texture2D Load(string p) { if (!System.IO.File.Exists(p)) return null; var t = new UnityEngine.Texture2D(2, 2, UnityEngine.TextureFormat.RGB24, false); UnityEngine.ImageConversion.LoadImage(t, System.IO.File.ReadAllBytes(p)); return t; } static UnityEngine.Texture2D Crop(UnityEngine.Texture2D s, int x, int y, int w, int h) { var t = new UnityEngine.Texture2D(w, h, UnityEngine.TextureFormat.RGB24, false); t.SetPixels(s.GetPixels(x, y, w, h)); t.Apply(); return t; } static UnityEngine.Texture2D Fit(UnityEngine.Texture2D s, int H) { int W = UnityEngine.Mathf.RoundToInt(s.width * (float)H / s.height); var t = new UnityEngine.Texture2D(W, H, UnityEngine.TextureFormat.RGB24, false); for (int y = 0; y < H; y++) for (int x = 0; x < W; x++) t.SetPixel(x, y, s.GetPixelBilinear((x + 0.5f) / W, (y + 0.5f) / H)); t.Apply(); return t; } static void Blit(UnityEngine.Texture2D dst, UnityEngine.Texture2D src, int x0) { for (int y = 0; y < src.height && y < dst.height; y++) for (int x = 0; x < src.width && x0 + x < dst.width; x++) dst.SetPixel(x0 + x, y, src.GetPixel(x, y)); } }