当前位置: 首页>>代码示例>>C#>>正文


C# PaintDotNet.RenderArgs类代码示例

本文整理汇总了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]);
                        }
                    }
                }
            }
        }
开发者ID:TheDwarfHorde,项目名称:DHShapeMaker,代码行数:28,代码来源:EffectPlugin.cs

示例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);
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:7,代码来源:ReduceNoiseEffect.cs

示例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);
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:32,代码来源:EmbossEffect.cs

示例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;
            }
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:28,代码来源:EffectBenchmark.cs

示例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);
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:7,代码来源:MedianEffect.cs

示例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);
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:8,代码来源:AddNoiseEffect.cs

示例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);
 }
开发者ID:TheDwarfHorde,项目名称:DHShapeMaker,代码行数:8,代码来源:EffectPlugin.cs

示例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);
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:8,代码来源:AutoLevelEffect.cs

示例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);
        }
开发者ID:thennequin,项目名称:InitialProject,代码行数:8,代码来源:ITXPlugin.cs

示例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;
                    }
                }
            }
        }
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:58,代码来源:EmbossEffect.cs

示例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);
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:9,代码来源:RedEyeRemoveEffect.cs

示例12: Render

 public override sealed void Render(Surface dst, Point offset)
 {
     if (ShouldRender())
     {
         using (RenderArgs ra = new RenderArgs(dst))
         {
             RenderToGraphics(ra.Graphics, offset);
         }
     }
 }
开发者ID:metadeta96,项目名称:openpdn,代码行数:10,代码来源:SurfaceBoxGraphicsRenderer.cs

示例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);
        }
开发者ID:bbowyersmyth,项目名称:ComputeShaderEffects,代码行数:12,代码来源:TiledComputeShaderBase.cs

示例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);
            }
        }
开发者ID:nkaligin,项目名称:paint-mono,代码行数:51,代码来源:GifFileType.cs

示例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);
            }
        }
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:15,代码来源:AutoLevelEffect.cs


注:本文中的PaintDotNet.RenderArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。