예제 #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            CharControl charControl = (CharControl)panelCharEdit.Controls[0];

            font.hdwc.info[comboChar.SelectedIndex]  = charControl.TileInfo;
            font.plgc.tiles[comboChar.SelectedIndex] = charControl.Tiles;
            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette, ZOOM);
            txtBox_TextChanged(txtBox, null);
        }
예제 #2
0
        private void btnInversePalette_Click(object sender, EventArgs e)
        {
            inversePalette = !inversePalette;
            this.palette   = NFTR.CalculatePalette(this.font.plgc.depth, inversePalette);

            // Update
            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette, ZOOM);
            txtBox_TextChanged(txtBox, null);
        }
예제 #3
0
        private void btnFromImage_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog o = new OpenFileDialog())
            {
                o.Filter = "Portable Network Graphic (*.png)|*.png";

                if (o.ShowDialog() == DialogResult.OK)
                {
                    NFTR.FromImage((Bitmap)Image.FromFile(o.FileName), this.font, this.palette);
                }
            }

            // Update
            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette, ZOOM);
            txtBox_TextChanged(txtBox, null);
        }
예제 #4
0
        private void btnRemoveChar_Click(object sender, EventArgs e)
        {
            int index = comboChar.SelectedIndex;

            font.hdwc.last_code--;
            font.hdwc.info.RemoveAt(index);

            List <byte[]> tiles = new List <byte[]>();

            tiles.AddRange(font.plgc.tiles);
            tiles.RemoveAt(index);
            font.plgc.tiles = tiles.ToArray();

            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette, ZOOM);
            comboChar.Items.RemoveAt(index);
            comboChar.SelectedIndex = index - 1;
        }
예제 #5
0
        private void btnPalette_Click(object sender, EventArgs e)
        {
            if (pluginHost.Get_Palette().Loaded)
            {
                palette = pluginHost.Get_Palette().Palette[0];
            }

            int depth = Convert.ToByte(new String('1', font.plgc.depth), 2);

            Color[] palette2 = new System.Drawing.Color[depth + 1];
            Array.Copy(palette, 0, palette2, 0, palette2.Length);
            palette2 = palette2.Reverse().ToArray();
            palette  = palette2;

            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette);
            txtBox_TextChanged(txtBox, null);
        }
예제 #6
0
        private void btnAddChar_Click(object sender, EventArgs e)
        {
            font.hdwc.last_code++;
            sNFTR.HDWC.Info newInfo = new sNFTR.HDWC.Info();
            newInfo.pixel_start  = 0;
            newInfo.pixel_width  = 9;
            newInfo.pixel_length = 9;
            font.hdwc.info.Add(newInfo);

            List <byte[]> tiles = new List <byte[]>();

            tiles.AddRange(font.plgc.tiles);
            Byte[] newChar = new byte[8 * font.plgc.tile_length];
            tiles.Add(newChar);
            font.plgc.tiles = tiles.ToArray();

            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette, ZOOM);
            comboChar.Items.Add("Char" + comboChar.Items.Count.ToString());
            comboChar.SelectedIndex = comboChar.Items.Count - 1;
        }
예제 #7
0
        public FontControl(IPluginHost pluginHost, sNFTR font)
        {
            InitializeComponent();

            this.pluginHost = pluginHost;
            this.font       = font;
            ReadLanguage();
            this.palette = NFTR.CalculatePalette(font.plgc.depth, inversePalette);
            for (int i = 0; i < font.plgc.tiles.Length; i++)
            {
                comboChar.Items.Add("Char " + i.ToString());
            }

            picFont.Image = NFTR.Get_Chars(font, MAX_WIDTH, palette, ZOOM);

            Fill_CharTile();

            comboChar.SelectedIndex     = 0;
            comboEncoding.SelectedIndex = font.fnif.encoding;
        }