本文整理汇总了C#中PaintDotNet.RenderArgs类的典型用法代码示例。如果您正苦于以下问题:C# RenderArgs类的具体用法?C# RenderArgs怎么用?C# RenderArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenderArgs类属于PaintDotNet命名空间,在下文中一共展示了RenderArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyRender
private void MyRender(Surface dst, Surface src)
{
PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor;
int BrushWidth = (int)EnvironmentParameters.BrushWidth;
if (PGP.Length > 0 && Draw )
{
using (Graphics g = new RenderArgs(dst).Graphics)
{
using (Region reg = new Region(selectionRegion.GetRegionData()))
{
g.SetClip(reg, CombineMode.Replace);
}
g.SmoothingMode = SmoothingMode.AntiAlias;
Pen p = new Pen(PrimaryColor);
p.Width = BrushWidth;
for (int i = 0; i < PGP.Length; i++)
{
if (PGP[i].PointCount > 0)
{
g.DrawPath(p, PGP[i]);
}
}
}
}
}
示例2: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.radius = newToken.GetProperty<Int32Property>(PropertyNames.Radius).Value;
this.strength = -0.2 * newToken.GetProperty<DoubleProperty>(PropertyNames.Strength).Value;
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
示例3: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.angle = newToken.GetProperty<DoubleProperty>(PropertyNames.Angle).Value;
// adjust and convert angle to radians
double r = (double)this.angle * 2.0 * Math.PI / 360.0;
// angle delta for each weight
double dr = Math.PI / 4.0;
// for r = 0 this builds an emboss filter pointing straight left
this.weights = new double[3][];
for (int i = 0; i < 3; ++i)
{
this.weights[i] = new double[3];
}
this.weights[0][0] = Math.Cos(r + dr);
this.weights[0][1] = Math.Cos(r + 2.0 * dr);
this.weights[0][2] = Math.Cos(r + 3.0 * dr);
this.weights[1][0] = Math.Cos(r);
this.weights[1][1] = 0;
this.weights[1][2] = Math.Cos(r + 4.0 * dr);
this.weights[2][0] = Math.Cos(r - dr);
this.weights[2][1] = Math.Cos(r - 2.0 * dr);
this.weights[2][2] = Math.Cos(r - 3.0 * dr);
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
示例4: OnExecute
protected sealed override void OnExecute()
{
for (int i = 0; i < this.iterations; ++i)
{
EffectConfigToken localToken;
if (this.token == null)
{
localToken = null;
}
else
{
localToken = (EffectConfigToken)this.token.Clone();
}
RenderArgs srcArgs = new RenderArgs(image);
RenderArgs dstArgs = new RenderArgs(dst);
BackgroundEffectRenderer ber = new BackgroundEffectRenderer(effect, localToken, dstArgs, srcArgs, region,
25 * Processor.LogicalCpuCount, Processor.LogicalCpuCount);
ber.Start();
ber.Join();
ber.Dispose();
ber = null;
}
}
示例5: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.radius = newToken.GetProperty<Int32Property>(PropertyNames.Radius).Value;
this.percentile = newToken.GetProperty<Int32Property>(PropertyNames.Percentile).Value;
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
示例6: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.intensity = newToken.GetProperty<Int32Property>(PropertyNames.Intensity).Value;
this.saturation = newToken.GetProperty<Int32Property>(PropertyNames.Saturation).Value;
this.coverage = 0.01 * newToken.GetProperty<DoubleProperty>(PropertyNames.Coverage).Value;
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
示例7: 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);
}
示例8: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
HistogramRgb histogram = new HistogramRgb();
histogram.UpdateHistogram(srcArgs.Surface, this.EnvironmentParameters.GetSelection(dstArgs.Bounds));
this.levels = histogram.MakeLevelsAuto();
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
示例9: OnSave
protected override void OnSave(Document input, Stream output, SaveConfigToken token,
Surface scratchSurface, ProgressEventHandler callback)
{
RenderArgs ra = new RenderArgs(new Surface(input.Size));
input.Render(ra);
ra.Bitmap.Save(output, ImageFormat.Bmp);
}
示例10: 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;
}
}
}
}
示例11: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.tolerance = newToken.GetProperty<Int32Property>(PropertyNames.Tolerance).Value;
this.saturation = newToken.GetProperty<Int32Property>(PropertyNames.Saturation).Value;
this.redEyeOp = new UnaryPixelOps.RedEyeRemove(this.tolerance, this.saturation);
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
示例12: Render
public override sealed void Render(Surface dst, Point offset)
{
if (ShouldRender())
{
using (RenderArgs ra = new RenderArgs(dst))
{
RenderToGraphics(ra.Graphics, offset);
}
}
}
示例13: OnPreRender
protected override void OnPreRender(RenderArgs dstArgs, RenderArgs srcArgs)
{
KeyValueConfigurationElement displayTimer = GetDllConfig().AppSettings.Settings["Timer"];
if (displayTimer != null && displayTimer.Value == "1")
{
this.tmr = new System.Diagnostics.Stopwatch();
this.tmr.Start();
}
base.OnPreRender(dstArgs, srcArgs);
}
示例14: OnSave
protected override void OnSave(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback)
{
GifSaveConfigToken gsct = (GifSaveConfigToken)token;
// Flatten and pre-process the image
scratchSurface.Clear(ColorBgra.FromBgra(255, 255, 255, 0));
using (RenderArgs ra = new RenderArgs(scratchSurface))
{
input.Render(ra, true);
}
for (int y = 0; y < scratchSurface.Height; ++y)
{
unsafe
{
ColorBgra* ptr = scratchSurface.GetRowAddressUnchecked(y);
for (int x = 0; x < scratchSurface.Width; ++x)
{
if (ptr->A < gsct.Threshold)
{
ptr->Bgra = 0;
}
else
{
if (gsct.PreMultiplyAlpha)
{
int r = ((ptr->R * ptr->A) + (255 * (255 - ptr->A))) / 255;
int g = ((ptr->G * ptr->A) + (255 * (255 - ptr->A))) / 255;
int b = ((ptr->B * ptr->A) + (255 * (255 - ptr->A))) / 255;
int a = 255;
*ptr = ColorBgra.FromBgra((byte)b, (byte)g, (byte)r, (byte)a);
}
else
{
ptr->Bgra |= 0xff000000;
}
}
++ptr;
}
}
}
using (Bitmap quantized = Quantize(scratchSurface, gsct.DitherLevel, 255, progressCallback))
{
quantized.Save(output, ImageFormat.Gif);
}
}
示例15: 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);
}
}