FC3Editor.Nomad.ObjectRenderer.WritePNG C# (CSharp) 메소드

WritePNG() 개인적인 정적인 메소드

private static WritePNG ( string filename, Bitmap bmp ) : void
filename string
bmp System.Drawing.Bitmap
리턴 void
        private static void WritePNG(string filename, Bitmap bmp)
        {
            BitmapData bitmapData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
            Binding.FCE_ObjectRenderer_WritePNG(bitmapData.Scan0, bmp.Width, bmp.Height, filename);
            bmp.UnlockBits(bitmapData);
        }

Usage Example

예제 #1
0
        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)
            {
            }
        }