Пример #1
0
 private static void GetSnapshot(out Image img, out ObjectInventoryEntry 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 ObjectInventoryEntry(Binding.FCE_ObjectRenderer_GetSnapshotEntry());
     Directory.CreateDirectory(ObjectRenderer.cachePath);
     try
     {
         ObjectRenderer.WritePNG(ObjectRenderer.cachePath + entry.Id + ".png", bitmap);
     }
     catch (Exception)
     {
     }
 }
Пример #2
0
 public static void TakeSnapshot(Snapshot snapshot, int sampleFactor)
 {
     Binding.FCE_Document_TakeSnapshot(snapshot.Pointer, sampleFactor);
 }