예제 #1
0
        protected virtual Image CreateThumbnail()
        {
            IShip ship = Ship;

            ship.SetAllPositions(ALVector2D.Zero);
            ship.CalcBoundingBox2D();
            BoundingBox2D          box    = ship.BoundingBox2D;
            Vector2D               size   = box.Upper - box.Lower;
            int                    scale  = 10;
            int                    max    = Math.Max((int)size.X, (int)size.Y) * scale;
            Size                   size2  = new Size(max, max);
            Image                  BitMap = new Bitmap(size2.Width, size2.Height);
            List <ICollidableBody> tmp    = new List <ICollidableBody>();

            tmp.Add(ship);
            List <PointF[]> vertexes = HyperMelee.GetVertexes(new WindowState(size2, scale, Vector2D.Zero), tmp);
            Graphics        g        = Graphics.FromImage(BitMap);

            g.Clear(Color.White);
            foreach (PointF[] points in vertexes)
            {
                Pen pen = new Pen(Color.Gray);
                PathGradientBrush brush = new PathGradientBrush(points);
                brush.CenterPoint = new PointF(0, 0);
                brush.CenterColor = Color.Black;
                int     length = points.Length;
                Color[] tmp2   = new Color[length];
                for (int pos = 0; pos < length; ++pos)
                {
                    tmp2[pos] = Color.Gray;
                }
                brush.SurroundColors = tmp2;
                g.DrawPolygon(pen, points);
                g.FillPolygon(brush, points);
            }
            return(BitMap.GetThumbnailImage(200, 200, null, IntPtr.Zero));
        }