Beispiel #1
0
        //导出选定图像
        private void button8_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex < 0 || listBox2.SelectedIndex < 0)
            {
                return;
            }
            Homeworld2.RCF.Image img = _font.Typefaces[listBox1.SelectedIndex].Images[listBox2.SelectedIndex];
            Bitmap bmp = helper.type2img(img);

            using (var dialog = new SaveFileDialog
            {
                Filter = @"PNG image files (*.png)|*.png",
                AddExtension = true
            }
                   )
            {
                if (dialog.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                using (Stream pngStream = dialog.OpenFile())
                {
                    bmp.Save(pngStream, ImageFormat.Png);
                }
            }
        }
Beispiel #2
0
 //修改img信息
 private void button6_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedIndex < 0 || listBox2.SelectedIndex < 0)
     {
         return;
     }
     Homeworld2.RCF.Image img = _font.Typefaces[listBox1.SelectedIndex].Images[listBox2.SelectedIndex];
     img.Name    = textBox3.Text;
     img.Version = int.Parse(textBox10.Text);
 }
Beispiel #3
0
        //选择image
        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex < 0 || listBox2.SelectedIndex < 0)
            {
                return;
            }
            Homeworld2.RCF.Image img = _font.Typefaces[listBox1.SelectedIndex].Images[listBox2.SelectedIndex];
            _form2.pictureBox1.Image = helper.type2img(img);


            textBox3.Text  = img.Name;
            textBox10.Text = img.Version.ToString();
            textBox11.Text = img.Width.ToString();
            textBox12.Text = img.Height.ToString();
        }
Beispiel #4
0
        //选择特定文字
        private void textBox5_TextChanged(object sender, EventArgs e)
        {
            if (
                textBox5.Text == "" ||
                listBox1.SelectedIndex < 0
                )
            {
                return;
            }

            var glyphs = from aGlyph in _font.Typefaces[listBox1.SelectedIndex].Glyphs
                         where aGlyph.Character == textBox5.Text[0]
                         select aGlyph;

            if (!glyphs.Any())
            {
                return;
            }

            Glyph glyph = glyphs.First();

            Homeworld2.RCF.Image img =
                _font.Typefaces[listBox1.SelectedIndex].Images[glyph.ImageIndex];

            Bitmap    bmp  = helper.type2img(img);
            Rectangle rect = new Rectangle(
                glyph.LeftMargin,
                glyph.TopMargin,
                glyph.Width,
                glyph.Height
                );

            _form3.pictureBox1.Image = helper.type2img(img).Clone(rect, bmp.PixelFormat);
            textBox6.Text            = glyph.Height.ToString();
            textBox13.Text           = glyph.Width.ToString();
            textBox14.Text           = glyph.BitmapLeft.ToString(CultureInfo.InvariantCulture);
            textBox15.Text           = glyph.BitmapRight.ToString(CultureInfo.InvariantCulture);
            textBox16.Text           = glyph.AdvanceX.ToString(CultureInfo.InvariantCulture);
            textBox17.Text           = glyph.BitmapTop.ToString(CultureInfo.InvariantCulture);
            textBox18.Text           = glyph.Baseline.ToString(CultureInfo.InvariantCulture);
            textBox19.Text           = glyph.BitmapBottom.ToString(CultureInfo.InvariantCulture);
            textBox20.Text           = glyph.TopMargin.ToString();
            textBox21.Text           = glyph.ImageIndex.ToString();
            textBox22.Text           = glyph.LeftMargin.ToString();
        }