Предлагаю русскоязычный вариант эффекта, совместимый с Paint.NET версий 3.5.11 и 4.x.x.
Вы можете найти его в меню Эффекты -> Размытие -> Zoom Blur Deluxe CL.
Ниже приведен результат работы эффекта и его интерфейс.
Как утверждает null54 этот эффект, по сравнению со встроенным эффектом Приближение, работает быстрее, хотя я существенной разницы не заметил. Однако, результаты работы обоих эффектов несколько отличаются. Обновленный эффект имеет больший диапазон размытия и выбор качества.
Сценарий эффекта для СodeLab:
Код: Выделить всё
// Name: Zoom Blur Deluxe CL
// Submenu: Blurs
// Author: Kevin Drapel (и MJW)
// Title: Zoom Blur Deluxe CL
// Desc: CodeLab версия эффекта Zoom Blur Deluxe
// Keywords:
// URL: http://www.getpaint.net/redirect/plugins.html
#region UICode
int Amount1 = 20; // [0,256] Величина
Pair<double, double> Amount2 = Pair.Create( 0.0 , 0.0 ); // Центр
byte Amount3 = 0; // [1] Качество|Низкое|Среднее|Высокое
#endregion
void Render(Surface dst, Surface src, Rectangle rect)
{
long w = dst.Width;
long h = dst.Height;
int amount = Amount1;
int quality = Amount3;
long cx = (long)((0.5 * src.Width) * (Amount2.First + 1.0)) << 8;
long cy = (long)((0.5 * src.Height) * (Amount2.Second + 1.0)) << 8;
long fx, fy;
long fdx, fdy;
long tx, ty;
long rx, ry;
int sa, sg, sb, sr;
byte shiftFactor = 2;
byte shiftFactor2 = 8;
byte steps = 4;
switch (quality)
{
case 0:
shiftFactor = 3;
steps = 8;
break;
case 1:
shiftFactor = 5;
steps = 32;
break;
case 2:
shiftFactor = 6;
steps = 64;
break;
}
shiftFactor2 += shiftFactor;
unsafe
{
for (int y = rect.Top; y < rect.Bottom; ++y)
{
fy = y << 8;
fdy = (amount * (cy - fy)) >> shiftFactor2;
ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
for (int x = rect.Left; x < rect.Right; ++x)
{
fx = x << 8;
fdx = (amount * (cx - fx)) >> shiftFactor2;
tx = fx;
ty = fy;
sr = sg = sb = sa = 0;
for (int n = 0; n < steps; n++)
{
rx = tx >> 8;
ry = ty >> 8;
if (rx < 0) rx = 0;
if (ry < 0) ry = 0;
if (rx >= src.Width) rx = src.Width - 1;
if (ry >= src.Height) ry = src.Height - 1;
ColorBgra* srcPtr2 = src.GetPointAddress((int)rx, (int)ry);
sr += srcPtr2->R * srcPtr2->A;
sg += srcPtr2->G * srcPtr2->A;
sb += srcPtr2->B * srcPtr2->A;
sa += srcPtr2->A;
tx += fdx;
ty += fdy;
}
sr >>= shiftFactor2;
sg >>= shiftFactor2;
sb >>= shiftFactor2;
sa >>= shiftFactor;
*dstPtr++ = ColorBgra.FromBgra((byte)sb, (byte)sg, (byte)sr, (byte)sa);
}
}
}
}