Example #1
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            var size = new Size((int)this.sizex, (int)this.sizey);

            this.pbuf = new RGBPixel[sizex, sizey];

            Font font  = null;
            var  fonts = new FontCollection();

            foreach (var f in fontpfade)
            {
                if (System.IO.File.Exists(f))
                {
                    fonts.Install(f);
                }
            }
            try{
                font = SystemFonts.CreateFont(this.FontFamily, this.Size, this.Style);
            }
            catch (Exception d) {}
            FontRectangle sz     = TextMeasurer.Measure(this.Text, new RendererOptions(font));
            Size          _tsize = new Size(Convert.ToInt32(sz.Width + 1), Convert.ToInt32(sz.Height + 1));

            this._image = new Image <Rgba32>(_tsize.Width, _tsize.Height);
            _image.Mutate(ctx =>
            {
                //ctx.Fill(Rgba32.Black);
                ctx.DrawText(this.Text, font, Brushes.Solid(Color.White), Pens.Solid(Color.Beige, 1), PointF.Empty);
            });

            _tpos = _image.Width / 2;
            return(Task.CompletedTask);
        }
Example #2
0
 public Task Initialize(MatrixParams mparams)
 {
     this.sizex = mparams.SizeX;
     this.sizey = mparams.SizeY;
     this.pbuf  = new RGBPixel[sizex, sizey];
     return(Task.CompletedTask);
 }
Example #3
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            this.pbuf  = new RGBPixel[sizex, sizey];

            _startbild = DiamondBrick(N);
            _zielbild  = DiamondBrick(N);

            return(Task.CompletedTask);
        }
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            var size = new Size((int)this.sizex, (int)this.sizey);

            this.pbuf   = new RGBPixel[sizex, sizey];
            this._image = new Image <RgbaVector>(size.Width, size.Height);

            // Blasenanzahl etwa 10% der pixelzahl ?!?!
            this._maxBlasen = (size.Height * size.Width) / 10;
            this._maxR      = Math.Min(size.Height, size.Width) / 8;
            return(Task.CompletedTask);
        }
Example #5
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            var size = new Size((int)this.sizex, (int)this.sizey);

            this.pbuf = new RGBPixel[sizex, sizey];

            // HACK: N>1 nicht gut
            this.N = 1;

            _malbild = new Image <Rgba32>(size.Width, size.Height);

            return(Task.CompletedTask);
        }
Example #6
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            this.pbuf  = new RGBPixel[sizex, sizey];

            // Faktor bestimmen. F soll sizey-3 mal multipliziert werden, ehe 1 zu 0,05 wird
            if (sizey < 4)
            {
                _f = .5f;
            }
            {
                _f = (float)Math.Pow(0.05, 1.0 / (sizey - 3));
            }
            return(Task.CompletedTask);
        }
Example #7
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            switch (this.Wanderweg)
            {
            case WanderOrder.Zeilenweise:
                this.weg = GenZeilenweise(this.StartEcke).GetEnumerator();
                break;

            default:
                this.weg = GenSpaltenweise(this.StartEcke).GetEnumerator();
                break;
            }
            pposx = pposy = 0;
            return(Task.CompletedTask);
        }
Example #8
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            this.pbuf  = new RGBPixel[sizex, sizey];

            kittRes      = new float[this.KittWidth];
            kittGradient = new float[this.KittWidth * 2 / 3];
            for (int i = 0; i < kittGradient.Length; i++)
            {
                kittGradient[i] = (1.0f - (i * (0.15f))).LimitTo(KittMinLum, 1f);
            }

            //kittGradient = new float[this.KittWidth * 2 / 3];
            //for(int i=0; i<kittGradient.Length; i++)
            //{
            //    kittGradient[i] = (float)((1d - Math.Log(i) / Math.Log(kittGradient.Length)) / Math.E);
            //    kittGradient[i] = kittGradient[i].LimitTo(KittMinLum, 1.0f);
            //}

            return(Task.CompletedTask);
        }
Example #9
0
        public Task Initialize(MatrixParams mparams)
        {
            this.sizex = mparams.SizeX;
            this.sizey = mparams.SizeY;
            var size = new Size((int)this.sizex, (int)this.sizey);

            this.pbuf = new RGBPixel[sizex, sizey];

            if (!string.IsNullOrEmpty(Pfad))
            {
                using (FileStream pngStream = new FileStream(Pfad, FileMode.Open, FileAccess.Read))
                {
                    using (var image = SixLabors.ImageSharp.Image.Load(pngStream))
                    {
                        _resized       = image.Clone((IImageProcessingContext ctx) => ctx.Resize(size, new BoxResampler(), true));
                        _imgframeCount = _resized.Frames.Count.LimitTo(1, int.MaxValue);
                    }
                }
            }

            return(Task.CompletedTask);
        }
Example #10
0
        public virtual Task Initialize(MatrixParams matrixParameters)
        {
            _kern = InitKernel();
            if (_kern.Length != 9)
            {
                throw new ArgumentException("Feld von InitKernel muss float[9] sein!");
            }

            // 0  1  2
            // 3  4  5
            // 6  7  8
            _sEol  = _kern[0] + _kern[1] + _kern[3] + _kern[4];
            _sEor  = _kern[1] + _kern[2] + _kern[4] + _kern[5];
            _sEul  = _kern[3] + _kern[4] + _kern[6] + _kern[7];
            _sEur  = _kern[4] + _kern[5] + _kern[7] + _kern[8];
            _sKo   = _kern[0] + _kern[1] + _kern[2] + _kern[3] + _kern[4] + _kern[5];
            _sKu   = _kern[3] + _kern[4] + _kern[5] + _kern[6] + _kern[7] + _kern[8];
            _sKl   = _kern[0] + _kern[1] + _kern[3] + _kern[4] + _kern[6] + _kern[7];
            _sKr   = _kern[1] + _kern[2] + _kern[4] + _kern[5] + _kern[7] + _kern[8];
            _sVoll = _kern.Sum();
            return(Task.CompletedTask);
        }
Example #11
0
 public Task Initialize(MatrixParams matrixParameters)
 {
     return(Task.CompletedTask);
 }
Example #12
0
 public Task Initialize(MatrixParams matrixParameters)
 {
     ErzeugeNextSprung();
     return(Task.CompletedTask);
 }
Example #13
0
 public Task Initialize(MatrixParams mparams)
 {
     this.sizex = mparams.SizeX;
     this.sizey = mparams.SizeY;
     return(Task.CompletedTask);
 }