'''' This code is part of Document Solutions for Imaging demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystemImportsSystem.IOImportsSystem.DrawingImportsGrapeCity.Documents.ImagingImports GCDRAW = GrapeCity.Documents.Drawing '' This example uses the GaussianBlurEffect to draw semi-transparent colored circles ('filters'),'' blurring the portion of the image behind them.PublicClassGaussianBlur2PublicFunctionGenerateImage(ByVal pixelSize AsSize,ByVal dpi AsSingle,ByVal opaque AsBoolean,OptionalByVal sampleParams AsString() = Nothing) AsGcBitmap Dim colors = NewColor() {Color.Fuchsia,Color.Orange,Color.Black,Color.Blue,Color.Red,Color.Yellow,Color.White,Color.Green,Color.CornflowerBlue } colors.Shuffle() Dim imagePath = Path.Combine("Resources", "ImagesBis", "bahamas.jpg")Dim bmp = NewGcBitmap(imagePath) Dim xx = bmp.PixelWidth \ 3Dim yy = bmp.PixelHeight \ 3Dim maxr = Math.Min(xx \ 2, yy \ 2)Dim rnd = Util.NewRandom() Using bmpBk = bmp.Clone()'' Apply blur to a copy of the original bitmap: bmpBk.ApplyEffect(GaussianBlurEffect.Get(24, GaussianBlurBorderMode.RepeatEdge)) Using g = bmp.CreateGraphics()Dim renderer = g.RendererFor i AsInteger = 0To8Dim r = rnd.Next(maxr \ 3, maxr)Dim center = NewPointF(rnd.Next(r, xx - r) + (i Mod3) * xx + 1, rnd.Next(r, yy - r) + (i \ 3) * yy + 1)Dim rect = NewRectangleF(center.X - r, center.Y - r, r + r, r + r)Dim 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 = Nothing g.DrawEllipse(rect, NewGCDRAW.Pen(color, 2))NextEndUsingEndUsing Return bmpEndFunctionEndClass