FC3Editor.Nomad.ObjectRenderer.GetSnapshot C# (CSharp) Method

GetSnapshot() private static method

private static GetSnapshot ( Image &img, ObjectInventory &entry ) : void
img Image
entry ObjectInventory
return void
        private static void GetSnapshot(out Image img, out ObjectInventory.Entry entry)
        {
            int num;
            int num2;
            int num3;
            int num4;
            Snapshot snapshot = new Snapshot(Binding.FCE_ObjectRenderer_GetSnapshot(out num, out num2, out num3, out num4));
            int num5 = num3 - num;
            int num6 = num4 - num2;
            if (num5 > num6)
            {
                int num7 = (num5 - num6) / 2;
                num2 -= num7;
                num4 += num7;
            }
            else
            {
                int num8 = (num6 - num5) / 2;
                num -= num8;
                num3 += num8;
            }
            Image image = snapshot.GetImage();
            Bitmap bitmap = new Bitmap(256, 256);
            img = bitmap;
            using (Graphics graphics = Graphics.FromImage(img))
            {
                graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                graphics.DrawImage(image, new Rectangle(3, 3, bitmap.Width - 6, bitmap.Height - 6), new Rectangle(num, num2, num3 - num, num4 - num2), GraphicsUnit.Pixel);
            }
            entry = new ObjectInventory.Entry(Binding.FCE_ObjectRenderer_GetSnapshotEntry());
            Directory.CreateDirectory(ObjectRenderer.cachePath);
            try
            {
                ObjectRenderer.WritePNG(ObjectRenderer.cachePath + entry.Id + ".png", bitmap);
            }
            catch (Exception)
            {
            }
        }