Ejemplo n.º 1
0
        public EmugenImage Filter(EmugenPlaneImage plane, UInt64 div)
        {
            var hw = plane.width / 2;
            var hh = plane.height / 2;

            var newImage = new EmugenImage(this.width, this.height);

            for (var x = 0; x < width; x++)
            {
                for (var y = 0; y < height; y++)
                {
                    //var pos = (x + y * width);
                    //colors[pos].WriteUnityEngineColor(ref ucolors[pos]);
                    var col = new Color(0, 0, 0, 0);
                    for (var fx = 0; fx < plane.width; fx++)
                    {
                        for (var fy = 0; fy < plane.height; fy++)
                        {
                            //var fi = fx + fy * plane.width;
                            //Debug.Log($"DD {fx} {fy}");
                            var fcol   = plane.At(fx, fy);
                            var tx     = x + fx - hw;
                            var ty     = y + fy - hh;
                            var colSrc = At(tx, ty);
                            //var col = new Color(  )
                            col.a += colSrc.a * (UInt64)fcol;
                            col.r += colSrc.r * (UInt64)fcol;
                            col.g += colSrc.g * (UInt64)fcol;
                            col.b += colSrc.b * (UInt64)fcol;
                        }
                    }
                    col.a = col.a / div; if (col.a > 255)
                    {
                        col.a = 255;
                    }
                    col.r = col.r / div; if (col.r > 255)
                    {
                        col.r = 255;
                    }
                    col.g = col.g / div; if (col.g > 255)
                    {
                        col.g = 255;
                    }
                    col.b = col.b / div; if (col.b > 255)
                    {
                        col.b = 255;
                    }
                    newImage.SetColor(x, y, col);
                }
            }
            return(newImage);
        }
Ejemplo n.º 2
0
        public ImageStringOne(FontFamily fontFamily, string text, double fontSize, int bitmap_bounds_margin, Color bodyColor, double frameSize, Color frameColor)
        {
            this.fontFamily = fontFamily;
            var plane = new EmugenPlaneImage((int)(frameSize * 2 + 1), (int)(frameSize * 2 + 1));

            plane.DrawCircle(frameSize, frameSize, frameSize, 1);

            var image  = new EmugenImage(fontFamily.CreateBitmap(text, fontSize, new Color(255, 0, 0, 255), (int)frameSize + 1, out info));
            var image2 = image.Filter(plane, 255);

            image.FillRGB(bodyColor);
            image2.FillRGB(frameColor);
            image2.DrawImage(image);

            this.image = image2;
        }