Ejemplo n.º 1
0
        /// <summary>
        /// Renders the specified scene.
        /// </summary>
        /// <param name="scene">The scene for rendering.</param>
        /// <param name="width">The width of result image.</param>
        /// <param name="height">The height of result image.</param>
        /// <returns>Image with rendering result.</returns>
        public override Bitmap Render(Scene3 scene, int width, int height)
        {
            #region Initialization objects for drawing.

            var bmp = new Bitmap(width, height);
            var context = System.Drawing.Graphics.FromImage(bmp);
            var pen = new Pen(RibColor, RibSize);

            #endregion

            context.Clear(BackgroundColor);
            foreach (var figure in scene.Figures)
                foreach (var rib in figure.Ribs)
                    context.DrawLine(pen,
                        (float)(rib.First.X), (float)(height - rib.First.Y),
                        (float)(rib.Second.X), (float)(height - rib.Second.Y));

            #region Disposing objects for drawing.

            context.Dispose();
            pen.Dispose();

            #endregion

            return bmp;
        }
        /// <summary>
        /// Renders the specified scene.
        /// </summary>
        /// <param name="scene">The scene for rendering.</param>
        /// <param name="width">The width of result image.</param>
        /// <param name="height">The height of result image.</param>
        /// <returns>Image with rendering result.</returns>
        public override Bitmap Render(Scene3 scene, int width, int height)
        {
            #region Initialization objects for drawing.

            var bmp = new Bitmap(width, height);
            var context = System.Drawing.Graphics.FromImage(bmp);
            var pen = new Pen(PointColor);

            #endregion

            context.Clear(BackgroundColor);
            foreach (var figure in scene.Figures)
                foreach (var point in figure.Points)
                    context.DrawEllipse(pen, (float)(point.X), (float)(height - point.Y), (float)PointSize, (float)PointSize);

            #region Disposing objects for drawing.

            context.Dispose();
            pen.Dispose();

            #endregion

            return bmp;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Renders the specified scene.
 /// </summary>
 /// <param name="scene">The scene for rendering.</param>
 /// <param name="width">The width of result image.</param>
 /// <param name="height">The height of result image.</param>
 /// <returns>Image with rendering result.</returns>
 public abstract Bitmap Render(Scene3 scene, int width, int height);