void Render(Surface dst, Surface src, Rectangle rect) { // Setup for calling the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PropertyCollection blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(dst), new RenderArgs(clampedSurface)); // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] { rect }, 0, 1); }
void Render(Surface dst, Surface src, Rectangle rect) { // Setup for calling the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PropertyCollection blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(bluredSurface), new RenderArgs(alignedSurface)); // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] { rect }, 0, 1); // Setup for calling the Brightness and Contrast Adjustment function BrightnessAndContrastAdjustment bacAdjustment = new BrightnessAndContrastAdjustment(); PropertyCollection bacProps = bacAdjustment.CreatePropertyCollection(); PropertyBasedEffectConfigToken bacParameters = new PropertyBasedEffectConfigToken(bacProps); bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, Amount2); bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, 0); bacAdjustment.SetRenderInfo(bacParameters, new RenderArgs(lightSurface), new RenderArgs(bluredSurface)); // Call the Brightness and Contrast Adjustment function bacAdjustment.Render(new Rectangle[1] { rect }, 0, 1); for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { if (Amount4) { dst[x, y] = normalOp.Apply(lightSurface[x, y], src[x, y]); } else { dst[x, y] = lightSurface[x, y]; } } } }
void Render(Surface dst, Surface src, Rectangle rect) { if (Amount3 != 0) { // Setup for calling the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PropertyCollection blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount3); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(dst), new RenderArgs(shadowSurface)); // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] { rect }, 0, 1); } else { dst.CopySurface(shadowSurface, rect.Location, rect); } Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra sourcePixel, shadowPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { sourcePixel = src[x, y]; shadowPixel = dst[x, y]; if (x < selection.Left + Amount1 + Amount6 || x > selection.Right - Amount1 - 1 + Amount6|| y < selection.Top + Amount1 + Amount7|| y > selection.Bottom - Amount1 - 1 + Amount7) { // Erase the margins shadowPixel.A = 0; } else { shadowPixel.A = Int32Util.ClampToByte(shadowPixel.A * Amount5 / 255); } dst[x, y] = normalOp.Apply(sourcePixel, shadowPixel); } } }