Aspose.Words.Examples.CSharp.Rendering_and_Printing.RenderShape.RenderShapeToStream C# (CSharp) 메소드

RenderShapeToStream() 공개 정적인 메소드

public static RenderShapeToStream ( string dataDir, Shape shape ) : void
dataDir string
shape Shape
리턴 void
        public static void RenderShapeToStream(string dataDir, Shape shape)
        {
            // ExStart:RenderShapeToStream
            ShapeRenderer r = new ShapeRenderer(shape);

            // Define custom options which control how the image is rendered. Render the shape to the vector format EMF.
            ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.Jpeg)
            {
                // Output the image in gray scale
                ImageColorMode = ImageColorMode.Grayscale,

                // Reduce the brightness a bit (default is 0.5f).
                ImageBrightness = 0.45f
            };
            dataDir = dataDir + "TestFile.RenderToStream_out.jpg";
            FileStream stream = new FileStream(dataDir, FileMode.Create);

            // Save the rendered image to the stream using different options.
            r.Save(stream, imageOptions);
            // ExEnd:RenderShapeToStream
            Console.WriteLine("\nShape rendered to stream successfully.\nFile saved at " + dataDir);
        }