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


C# ColorBgra.ToColor方法代码示例

本文整理汇总了C#中PaintDotNet.ColorBgra.ToColor方法的典型用法代码示例。如果您正苦于以下问题:C# ColorBgra.ToColor方法的具体用法?C# ColorBgra.ToColor怎么用?C# ColorBgra.ToColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaintDotNet.ColorBgra的用法示例。


在下文中一共展示了ColorBgra.ToColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        protected override ColorBgra Render(int x, int y, ColorBgra initial, Surface source)
        {
            var shade = initial.ToColor().GetBrightness();
            if (Math.Abs(shade - BgShade) > ShadeThreshold) return initial;

            var norm = Normalize(initial);
            if (Math.Abs(BgNormal.R - norm.R) > ColorThreshold
                || Math.Abs(BgNormal.G - norm.G) > ColorThreshold
                || Math.Abs(BgNormal.B - norm.B) > ColorThreshold) {
                return initial;
            }

            var alpha = (byte)(Math.Min(255, Math.Max(0,
                Math.Max(Math.Max(
                    Math.Abs(BgColor.R - initial.R),
                    Math.Abs(BgColor.G - initial.G)),
                    Math.Abs(BgColor.B - initial.B)))
                * (1d - AlphaFalloff)));
            return ColorBgra.FromBgra(initial.B, initial.G, initial.R, alpha);
        }
开发者ID:Sigillatus,项目名称:DinkPDN,代码行数:20,代码来源:Plugin.cs

示例2: Apply

            public override ColorBgra Apply(ColorBgra color)
            {
                //adjust saturation
                byte intensity = color.GetIntensityByte();
                color.R = Utility.ClampToByte((intensity * 1024 + (color.R - intensity) * satFactor) >> 10);
                color.G = Utility.ClampToByte((intensity * 1024 + (color.G - intensity) * satFactor) >> 10);
                color.B = Utility.ClampToByte((intensity * 1024 + (color.B - intensity) * satFactor) >> 10);

                HsvColor hsvColor = HsvColor.FromColor(color.ToColor());
                int hue = hsvColor.Hue;

                hue += hueDelta;

                while (hue < 0)
                {
                    hue += 360;
                }

                while (hue > 360)
                {
                    hue -= 360;
                }

                hsvColor.Hue = hue;

                ColorBgra newColor = ColorBgra.FromColor(hsvColor.ToColor());
                newColor = blendOp.Apply(newColor);
                newColor.A = color.A;

                return newColor;
            }
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:31,代码来源:UnaryPixelOps.cs

示例3: RenderColorAddIcon

        private void RenderColorAddIcon(ColorBgra newColor)
        {
            if (this.colorAddIcon == null)
            {
                this.colorAddIcon = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
            }

            using (Graphics g = Graphics.FromImage(this.colorAddIcon))
            {
                Rectangle rect = new Rectangle(0, 0, this.colorAddIcon.Width - 2, this.colorAddIcon.Height - 2);
                Utility.DrawColorRectangle(g, rect, newColor.ToColor(), true);
                g.DrawImage(this.colorAddOverlay, 0, 0);
            }

            this.colorAddButton.Image = this.colorAddIcon;
            this.colorAddButton.Invalidate();
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:17,代码来源:ColorsForm.cs

示例4: SyncHsvFromRgb

        /// <summary>
        /// Whenever a color is changed via RGB methods, call this and the HSV
        /// counterparts will be sync'd up.
        /// </summary>
        /// <param name="newColor">The RGB color that should be converted to HSV.</param>
        private void SyncHsvFromRgb(ColorBgra newColor)
        {
            if (ignore == 0) 
            {
                ignore++;
                HsvColor hsvColor = HsvColor.FromColor(newColor.ToColor());

                Utility.SetNumericUpDownValue(hueUpDown, hsvColor.Hue);
                Utility.SetNumericUpDownValue(saturationUpDown, hsvColor.Saturation);
                Utility.SetNumericUpDownValue(valueUpDown, hsvColor.Value);

                SetColorGradientValuesHsv(hsvColor.Hue, hsvColor.Saturation, hsvColor.Value);
                SetColorGradientMinMaxColorsHsv(hsvColor.Hue, hsvColor.Saturation, hsvColor.Value);

                colorWheel.HsvColor = hsvColor;
                ignore--;
            }
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:23,代码来源:ColorsForm.cs


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