예제 #1
0
 public static void RegisterListener(ObjectRenderer.IListener listener)
 {
     if (ObjectRenderer.m_listeners.Contains(listener))
     {
         return;
     }
     ObjectRenderer.m_listeners.Add(listener);
 }
예제 #2
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)
            {
            }
        }
예제 #3
0
 public static void UnregisterListener(ObjectRenderer.IListener listener)
 {
     ObjectRenderer.m_listeners.Remove(listener);
 }
예제 #4
0
 public static void ResizeThumbnails()
 {
     ObjectRenderer.ResizeThumbnails("pc", 256, 256, Color.FromArgb(0, 127, 127, 127));
     ObjectRenderer.ResizeThumbnails("console", 128, 256, Color.FromArgb(0, 32, 32, 32));
 }