Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        static public Bitmap CreateBitmap(string text, Emugen.Image.Primitive.Font efont)
        {
            // Todo このままだと 重いので、この情報を記録しておく必要がある
            var frameSize    = 0.0;
            var frameSizeMax = 0.0;
            var rfontFrames  = new List <Emugen.Image.Primitive.Font.FontFrame>();
            var layers       = new List <Layer>();

            var fontFamily = new Emugen.Image.Drawing.FontFamily(efont.fontPath);
            var font       = CreateFont(efont.fontPath, efont.fontSize);
            var fontSize   = efont.fontSize;

            // layerがボディ部分が足りてない
            {
                var layer = new Layer();
                layer.circleSize = frameSizeMax;
                layer.color      = efont.bodyColor.ToSystemDrawingColor();
                //layer.plane = null;
                layer.plane = new EmugenPlaneImage((int)(frameSizeMax * 2 + 1), (int)(frameSizeMax * 2 + 1));
                //layer.plane.DrawCircle(frameSizeMax, frameSizeMax, frameSizeMax, 1);

                layers.Add(layer);
            }

            //var i = 0;
            foreach (var frame in efont.fontFrames)
            {
                frameSizeMax += frame.size;
                rfontFrames.Insert(0, frame);

                var layer = new Layer();
                layer.circleSize = frameSizeMax;
                layer.color      = frame.color.ToSystemDrawingColor();
                layer.plane      = null;

                layer.plane = new EmugenPlaneImage((int)(frameSizeMax * 2 + 1), (int)(frameSizeMax * 2 + 1));
                layer.plane.DrawCircle(frameSizeMax, frameSizeMax, frameSizeMax, 1);

                layers.Add(layer);

                //if(i==0)
                //{
                //    var image = new EmugenImage(fontFamily.CreateBitmap(text, fontSize, layer.color, (int)frameSize + 1, out info));
                //}
                //i++;
            }
            frameSize = frameSizeMax;

            {
                var i = 0;
                foreach (var layer in layers)
                {
                    Emugen.Image.Drawing.FontFamily.FontStringInfo info;
                    layer.image = new EmugenImage(fontFamily.CreateBitmap(text, fontSize, new Emugen.Image.Drawing.Color(0, 0, 0, 255), (int)frameSize + 1, out info));


                    if (i != 0)
                    {
                        layer.image = layer.image.Filter(layer.plane, 255);
                    }


                    i++;
                }
            }

            {
                var i = 0;
                foreach (var layer in layers)
                {
                    layer.image.FillRGB(new Emugen.Image.Drawing.Color(layer.color));
                    i++;
                }
            }

            for (var i = (layers.Count - 2); i >= 0; i--)
            {
                layers[(layers.Count - 1)].image.DrawImage(layers[i].image);
            }

            {
                var image = layers[2].image;
                var bmp   = image.ToBitmap();
                return(bmp);
            }
        }