//// This code is part of Document Solutions for Imaging demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem;usingSystem.IO;usingSystem.Drawing;usingGrapeCity.Documents.Imaging;usingGCDRAW = GrapeCity.Documents.Drawing;usingDsImagingWeb.Demos.Common; namespaceDsImagingWeb.Demos{// This example uses the GaussianBlurEffect to draw semi-transparent colored circles ('filters'),// blurring the portion of the image behind them.publicclassGaussianBlur2 {publicGcBitmapGenerateImage(Size pixelSize, float dpi, bool opaque, string[] sampleParams = null) {var colors = newColor[] {Color.Fuchsia,Color.Orange,Color.Black,Color.Blue,Color.Red,Color.Yellow,Color.White,Color.Green,Color.CornflowerBlue }; colors.Shuffle(); var imagePath = Path.Combine("Resources", "ImagesBis", "bahamas.jpg");var bmp = newGcBitmap(imagePath); int xx = bmp.PixelWidth / 3;int yy = bmp.PixelHeight / 3;int maxr = Math.Min(xx / 2, yy / 2);var rnd = Util.NewRandom(); usingvar bmpBk = bmp.Clone(); // Apply blur to a copy of the original bitmap: bmpBk.ApplyEffect(GaussianBlurEffect.Get(24, GaussianBlurBorderMode.RepeatEdge)); usingvar g = bmp.CreateGraphics();var renderer = g.Renderer;for (int i = 0; i < 9; i++) {int r = rnd.Next(maxr / 3, maxr);var center = newPointF(rnd.Next(r, xx - r) + i % 3 * xx + 1, rnd.Next(r, yy - r) + i / 3 * yy + 1);var rect = newRectangleF(center.X - r, center.Y - r, r + r, r + r);var color = colors[i]; // Use the blurred background to fill circles: renderer.BackgroundBitmap = bmpBk; g.FillEllipse(rect, Color.FromArgb(96, color)); // Draw borders normally to hide the artifacts: renderer.BackgroundBitmap = null; g.DrawEllipse(rect, newGCDRAW.Pen(color, 2)); } return bmp; } }}