コード例 #1
0
ファイル: Blend.cs プロジェクト: ErtyHackward/utopia
 /// <summary>
 /// Will blend two noise source together with a LERP alpha from the controlerRange
 /// </summary>
 /// <param name="lowSource">lowSource, MUST be a double or a INoise fct, otherwhile it will raised an error at run time !</param>
 /// <param name="highSource">HighSource, MUST be a double or a INoise fct, otherwhile it will raised an error at run time !</param>
 /// <param name="controler">LERP alpha value source, MUST be a double or a INoise fct, otherwhile it will raised an error at run time !</param>
 /// <param name="controlerRange">The range of the Alpha controler value</param>
 public Blend(object lowSource, object highSource, object controler, RangeD controlerRange)
 {
     _lowSource = new NoiseParam(lowSource);
     _highSource = new NoiseParam(highSource);
     _controler = new NoiseParam(controler);
     _controlerRange = controlerRange;
 }
コード例 #2
0
        // Selection changed in component combo
        private void componentCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            AForge.Math.HistogramD h = null;
            RangeD input             = new RangeD(0, 1);
            RangeD output            = new RangeD(0, 1);

            if (componentCombo.SelectedIndex == 0)
            {
                // satureation
                h      = imgStat.Saturation;
                input  = inSaturation;
                output = outSaturation;
            }
            else
            {
                // luminance
                h      = imgStat.Luminance;
                input  = inLuminance;
                output = outLuminance;
            }

            histogram.Values = h.Values;

            inMinBox.Text  = input.Min.ToString("F3");
            inMaxBox.Text  = input.Max.ToString("F3");
            outMinBox.Text = output.Min.ToString("F3");
            outMaxBox.Text = output.Max.ToString("F3");

            // input slider
            inSlider.Min = (int)(input.Min * 255);
            inSlider.Max = (int)(input.Max * 255);
            // output slider
            outSlider.Min = (int)(output.Min * 255);
            outSlider.Max = (int)(output.Max * 255);
        }
コード例 #3
0
 public HSLFiltering()
 {
     this.hue              = new Range(0, 0x167);
     this.saturation       = new RangeD(0.0, 1.0);
     this.luminance        = new RangeD(0.0, 1.0);
     this.fillOutsideRange = true;
     this.updateH          = true;
     this.updateS          = true;
     this.updateL          = true;
 }
コード例 #4
0
 public void Unite(RangeD another)
 {
     if (min > another.min)
     {
         min = another.min;
     }
     if (max < another.max)
     {
         max = another.max;
     }
 }
コード例 #5
0
        // Selection changed in component combo
        private void componentCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            AForge.Math.HistogramD h = null;
            RangeD input             = new RangeD(0, 1);
            RangeD output            = new RangeD(0, 1);
            double start             = 0;

            switch (componentCombo.SelectedIndex)
            {
            case 0:
                // Y
                h      = imgStat.Y;
                input  = inY;
                output = outY;
                break;

            case 1:
                // Cb
                h      = imgStat.Cb;
                input  = inCb;
                output = outCb;
                start  = -0.5;
                break;

            case 2:
                // Cr
                h      = imgStat.Cr;
                input  = inCr;
                output = outCr;
                start  = -0.5;
                break;
            }

            histogram.Values = h.Values;

            inMinBox.Text  = input.Min.ToString("F3");
            inMaxBox.Text  = input.Max.ToString("F3");
            outMinBox.Text = output.Min.ToString("F3");
            outMaxBox.Text = output.Max.ToString("F3");

            // input slider
            inSlider.Min = (int)((input.Min - start) * 255);
            inSlider.Max = (int)((input.Max - start) * 255);
            // output slider
            outSlider.Min = (int)((output.Min - start) * 255);
            outSlider.Max = (int)((output.Max - start) * 255);
        }
コード例 #6
0
 public HSLFiltering(Range hue, RangeD saturation, RangeD luminance)
 {
     this.hue        = hue;
     this.saturation = saturation;
     this.luminance  = luminance;
 }
コード例 #7
0
 public YCbCrFiltering(RangeD yRange, RangeD cbRange, RangeD crRange)
 {
     this.yRange  = yRange;
     this.cbRange = cbRange;
     this.crRange = crRange;
 }
コード例 #8
0
        private void Project()
        {
            if (geo == null)
            {
                return;
            }
            polygonsPixel = new List <Point[]>();

            const float MARGIN_PERC = 0.05F;

            RangeD range = new RangeD((maxX - minX), (maxY - minY));
            RangeD scale = new RangeD(ClientSize.Width * (1 - 2 * MARGIN_PERC) / range.Width,
                                      ClientSize.Height * (1 - 2 * MARGIN_PERC) / range.Height);
            Point margin;

            if (scale.Width < scale.Height)
            {
                scale  = new RangeD(scale.Width, scale.Width);
                margin = new Point((int)(ClientSize.Width * MARGIN_PERC),
                                   (int)((ClientSize.Height -
                                          (range.Height * scale.Height)) / 2));
            }
            else
            {
                scale  = new RangeD(scale.Height, scale.Height);
                margin = new Point((int)(
                                       (ClientSize.Width -
                                        (range.Width * scale.Width)) / 2),
                                   (int)(ClientSize.Height * MARGIN_PERC));
            }
            List <GeoAPI.Geometries.IGeometry> polygons = new List <GeoAPI.Geometries.IGeometry>();

            if (geo.OgcGeometryType == GeoAPI.Geometries.OgcGeometryType.Polygon)
            {
                polygons.Add(geo);
            }
            else
            {
                NetTopologySuite.Geometries.MultiPolygon mp = geo as NetTopologySuite.Geometries.MultiPolygon;
                polygons.AddRange(mp.Geometries);
            }

            foreach (var polygon in polygons)
            {
                List <Point> points = new List <Point>();
                foreach (var p in polygon.Coordinates)
                {
                    var y = p.Y;
                    if (InvertY)
                    {
                        y *= -1;
                    }

                    Point point = new Point(margin.X +
                                            (int)((p.X - minX) * scale.Width),
                                            margin.Y +
                                            (int)((y - minY) * scale.Height));
                    points.Add(point);
                }
                polygonsPixel.Add(points.ToArray());
            }
        }
コード例 #9
0
 public RectangleD(double x1, double y1, double x2, double y2)
 {
     x = new RangeD(x1, x2);
     y = new RangeD(y1, y2);
 }
コード例 #10
0
 public double Scale(double x, RangeD dst)
 {
     return(dst.min + dst.Length * (x - min) / Length);
 }