本文整理汇总了C#中PaintDotNet.Effects.EffectConfigToken类的典型用法代码示例。如果您正苦于以下问题:C# EffectConfigToken类的具体用法?C# EffectConfigToken怎么用?C# EffectConfigToken使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EffectConfigToken类属于PaintDotNet.Effects命名空间,在下文中一共展示了EffectConfigToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public unsafe override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
Point[] points = ((MotionBlurEffectConfigToken)parameters).LinePoints;
Surface dst = dstArgs.Surface;
Surface src = srcArgs.Surface;
for (int i = startIndex; i < startIndex + length; ++i)
{
Rectangle rect = rois[i];
for (int y = rect.Top; y < rect.Bottom; ++y)
{
ColorBgra *dstPtr = dst.GetPointAddress(rect.Left, y);
for (int x = rect.Left; x < rect.Right; ++x)
{
Point a = new Point(x + points[0].X, y + points[0].Y);
Point b = new Point(x + points[points.Length - 1].X, y + points[points.Length - 1].Y);
// If both ends of this line are in bounds, we don't need to do silly clipping
if (src.Bounds.Contains(a) && src.Bounds.Contains(b))
{
*dstPtr = DoLineAverageUnclipped(points, x, y, dst, src);
}
else
{
*dstPtr = DoLineAverage(points, x, y, dst, src);
}
++dstPtr;
}
}
}
}
示例2: InitDialogFromToken
protected override void InitDialogFromToken(EffectConfigToken effectToken)
{
CloudEffectConfigToken token = (CloudEffectConfigToken)effectToken;
numericUpDownFrequency.Value = (decimal)token.Frequency;
numericUpDownPersistance.Value = (decimal)token.Persistance;
numericUpDownOctaves.Value = (decimal)token.Octaves;
numericUpDownAmplitude.Value = (decimal)token.Amplitude;
trackBarCloudCoverage.Value = (int)(token.CloudCoverage * 10.0);
trackBarCloudDensity.Value = (int)(token.CloudDensity * 10.0);
switch (token.DisplayOption)
{
case CloudEffect.REPLACE_SOURCE:
radioButtonSource.Checked = true;
break;
case CloudEffect.OVERLAY_PRIMARY:
radioButtonPrimary.Checked = true;
break;
case CloudEffect.OVERLAY_SECONDARY:
radioButtonSecondary.Checked = true;
break;
case CloudEffect.REPLACE_TRANSPARENT:
radioButtonTransparent.Checked = true;
break;
default:
break;
}
random1.Text = Convert.ToString(token.R1);
random2.Text = Convert.ToString(token.R2);
random3.Text = Convert.ToString(token.R3);
}
示例3: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, System.Drawing.Rectangle[] rois, int startIndex, int length)
{
TwoAmountsConfigToken tact = (TwoAmountsConfigToken)parameters;
PixelOp redEyeRemove = new UnaryPixelOps.RedEyeRemove(tact.Amount1, tact.Amount2);
redEyeRemove.Apply(dstArgs.Surface, srcArgs.Surface, rois, startIndex, length);
}
示例4: BackgroundEffectRenderer
public BackgroundEffectRenderer(Effect effect,
EffectConfigToken effectToken,
RenderArgs dstArgs,
RenderArgs srcArgs,
PdnRegion renderRegion,
int tileCount,
int workerThreads)
{
this.effect = effect;
this.effectToken = effectToken;
this.dstArgs = dstArgs;
this.srcArgs = srcArgs;
this.renderRegion = renderRegion;
this.renderRegion.Intersect(dstArgs.Bounds);
this.tileRegions = SliceUpRegion(renderRegion, tileCount, dstArgs.Bounds);
this.tilePdnRegions = new PdnRegion[this.tileRegions.Length];
for (int i = 0; i < this.tileRegions.Length; ++i)
{
PdnRegion pdnRegion = Utility.RectanglesToRegion(this.tileRegions[i]);
this.tilePdnRegions[i] = pdnRegion;
}
this.tileCount = tileCount;
this.workerThreads = workerThreads;
if ((effect.EffectDirectives & EffectDirectives.SingleThreaded) != 0)
{
this.workerThreads = 1;
}
this.threadPool = new Threading.ThreadPool(this.workerThreads, false);
}
示例5: OnSetRenderInfo
protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
{
EffectPluginConfigToken token = (EffectPluginConfigToken)parameters;
PGP = token.GP;
Draw = token.Draw;
if (PGP != null) MyRender(dstArgs.Surface, srcArgs.Surface);
base.OnSetRenderInfo(parameters, dstArgs, srcArgs);
}
示例6: EffectBenchmark
public EffectBenchmark(string name, int iterations, Effect effect, EffectConfigToken token, Surface image)
: base(name + " (" + iterations + "x)")
{
this.effect = effect;
this.token = token;
this.image = image;
this.iterations = iterations;
}
示例7: Render
public unsafe override void Render(EffectConfigToken configToken, RenderArgs dstArgs, RenderArgs srcArgs,
Rectangle[] rois, int startIndex, int length)
{
EmbossEffectConfigToken eect = (EmbossEffectConfigToken)configToken;
double[,] weights = eect.Weights;
Surface dst = dstArgs.Surface;
Surface src = srcArgs.Surface;
for (int i = startIndex; i < startIndex + length; ++i)
{
Rectangle rect = rois[i];
// loop through each line of target rectangle
for (int y = rect.Top; y < rect.Bottom; ++y)
{
int fyStart = 0;
int fyEnd = 3;
if (y == src.Bounds.Top) fyStart = 1;
if (y == src.Bounds.Bottom - 1) fyEnd = 2;
// loop through each point in the line
ColorBgra *dstPtr = dst.GetPointAddress(rect.Left, y);
for (int x = rect.Left; x < rect.Right; ++x)
{
int fxStart = 0;
int fxEnd = 3;
if (x == src.Bounds.Left) fxStart = 1;
if (x == src.Bounds.Right - 1) fxEnd = 2;
// loop through each weight
double sum = 0.0;
for (int fy = fyStart; fy < fyEnd; ++fy)
{
for (int fx = fxStart; fx < fxEnd; ++fx)
{
double weight = weights[fy, fx];
ColorBgra c = src.GetPointUnchecked(x - 1 + fx, y - 1 + fy);
double intensity = (double)c.GetIntensityByte();
sum += weight * intensity;
}
}
int iSum = (int)sum;
iSum += 128;
if (iSum > 255) iSum = 255;
if (iSum < 0) iSum = 0;
*dstPtr = ColorBgra.FromBgra((byte)iSum, (byte)iSum, (byte)iSum, 255);
++dstPtr;
}
}
}
}
示例8: Render
public unsafe override void Render(
EffectConfigToken parameters,
RenderArgs dstArgs,
RenderArgs srcArgs,
System.Drawing.Rectangle[] rois,
int startIndex,
int length)
{
AmountEffectConfigToken token = (AmountEffectConfigToken)parameters;
float bulge = token.Amount;
Surface dst = dstArgs.Surface;
Surface src = srcArgs.Surface;
float hw = dst.Width / 2.0f;
float hh = dst.Height / 2.0f;
float maxrad = Math.Min(hw, hh);
float maxrad2 = maxrad * maxrad;
float amt = token.Amount / 100.0f;
for (int n = startIndex; n < startIndex + length; ++n)
{
Rectangle rect = rois[n];
for (int y = rect.Top; y < rect.Bottom; y++)
{
ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
float v = y - hh;
for (int x = rect.Left; x < rect.Right; x++)
{
float u = x - hw;
float r = (float)Math.Sqrt(u * u + v * v);
float rscale;
rscale = (1.0f - (r / maxrad));
if (rscale > 0)
{
rscale = 1 - amt * rscale * rscale;
float xp = u * rscale;
float yp = v * rscale;
*dstPtr = src.GetBilinearSampleWrapped(xp + hw, yp + hh);
}
else
{
*dstPtr = *srcPtr;
}
++dstPtr;
++srcPtr;
}
}
}
}
示例9: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
lock (this)
{
SetRenderInfo(parameters, dstArgs, srcArgs);
}
this.gbEffect.Render(this.gbToken, dstArgs, srcArgs, rois, startIndex, length);
}
示例10: OnSetRenderInfo
protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
{
lock (this)
{
this.gbToken = new PropertyBasedEffectConfigToken(this.gbProps);
this.gbToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, ((AmountEffectConfigToken)parameters).Amount);
this.gbEffect.SetRenderInfo(this.gbToken, dstArgs, srcArgs);
}
base.OnSetRenderInfo(parameters, dstArgs, srcArgs);
}
示例11: Render
public unsafe override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
BrightnessAndContrastAdjustmentConfigToken token = (BrightnessAndContrastAdjustmentConfigToken)parameters;
int contrast = token.Contrast;
int brightness = token.Brightness;
int multiply = token.Multiply;
int divide = token.Divide;
byte[] rgbTable = token.RgbTable;
for (int r = startIndex; r < startIndex + length; ++r)
{
Rectangle rect = rois[r];
for (int y = rect.Top; y < rect.Bottom; ++y)
{
ColorBgra *srcRowPtr = srcArgs.Surface.GetPointAddress(rect.Left, y);
ColorBgra *dstRowPtr = dstArgs.Surface.GetPointAddress(rect.Left, y);
ColorBgra *dstRowEndPtr = dstRowPtr + rect.Width;
if (divide == 0)
{
while (dstRowPtr < dstRowEndPtr)
{
ColorBgra col = *srcRowPtr;
int i = col.GetIntensityByte();
uint c = rgbTable[i];
dstRowPtr->Bgra = (col.Bgra & 0xff000000) | c | (c << 8) | (c << 16);
++dstRowPtr;
++srcRowPtr;
}
}
else
{
while (dstRowPtr < dstRowEndPtr)
{
ColorBgra col = *srcRowPtr;
int i = col.GetIntensityByte();
int shiftIndex = i * 256;
col.R = rgbTable[shiftIndex + col.R];
col.G = rgbTable[shiftIndex + col.G];
col.B = rgbTable[shiftIndex + col.B];
*dstRowPtr = col;
++dstRowPtr;
++srcRowPtr;
}
}
}
}
return;
}
示例12: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
CurvesEffectConfigToken token = parameters as CurvesEffectConfigToken;
if (token != null)
{
UnaryPixelOp uop = token.Uop;
for (int i = startIndex; i < startIndex + length; ++i)
{
uop.Apply(dstArgs.Surface, srcArgs.Surface, rois[i]);
}
}
}
示例13: Render
public unsafe override void Render(
EffectConfigToken parameters,
RenderArgs dstArgs,
RenderArgs srcArgs,
Rectangle[] rois,
int startIndex,
int length)
{
AmountEffectConfigToken token = (AmountEffectConfigToken)parameters;
foreach (Rectangle rect in rois)
{
RenderRect(token.Amount, srcArgs.Surface, dstArgs.Surface, rect);
}
}
示例14: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs,
Rectangle[] rois, int startIndex, int length)
{
if (levels == null)
{
HistogramRgb histogram = new HistogramRgb();
histogram.UpdateHistogram(srcArgs.Surface, this.EnvironmentParameters.GetSelection(dstArgs.Bounds));
levels = histogram.MakeLevelsAuto();
}
if (levels.isValid)
{
levels.Apply(dstArgs.Surface, srcArgs.Surface, rois, startIndex, length);
}
}
示例15: Render
public unsafe override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
int width = srcArgs.Surface.Width;
double[][] diffusion = new double[][] { new double[width], new double[width] };
int currentBuffer = 0;
for (int y = 0; y < srcArgs.Surface.Height; y++)
{
byte* srcRow = (byte*)srcArgs.Surface.Scan0.Pointer + y * srcArgs.Surface.Stride;
byte* dstRow = (byte*)dstArgs.Surface.Scan0.Pointer + y * dstArgs.Surface.Stride;
Array.Clear(diffusion[currentBuffer], 0, width);
currentBuffer = 1 - currentBuffer;
bool forward = y % 2 == 0;
int start = forward ? 0 : width - 1;
int end = forward ? width : -1;
int increment = forward ? 1 : -1;
for (int x = start; x != end; x += increment)
{
double intensity = (0.0721 * srcRow[x * 4] + 0.7154 * srcRow[x * 4 + 1] + 0.2125 * srcRow[x * 4 + 2]) / 255.0;
intensity += diffusion[currentBuffer][x];
double error = 0.0;
if (intensity > 0.5)
{
error = intensity > 1.0 ? 0.0 : intensity - 1.0;
*((uint*)(dstRow + x * 4)) = 0xFFFFFFFF;
}
else
{
error = intensity;
*((uint*)(dstRow + x * 4)) = 0xFF000000;
}
diffusion[1 - currentBuffer][x] += (error * 5 / 16);
if ((forward && x > start) || (!forward && x < start))
diffusion[1 - currentBuffer][x - increment] += (error * 3 / 16);
if ((forward && x < width - 1) || (!forward && x > start + 1))
{
diffusion[currentBuffer][x + increment] += (error * 7 / 16);
diffusion[1 - currentBuffer][x + increment] += (error / 16);
}
}
}
}