コード例 #1
0
 public void LoadPalette(string filename)
 {
     //_Palette = new CPalette(filename);
     _Palette = PaletteManager.GetPalette(new CPalette(filename));
     UpdatePaletteManager();
     OnPaletteChanged(this, null);
 }
コード例 #2
0
 private void button_Clone_Click(object sender, EventArgs e)
 {
     if (_Palette != null)
     {
         _Palette = PaletteManager.GetPalette(_Palette, true);
         UpdatePaletteManager();
         OnPaletteChanged(this, null);
     }
 }
コード例 #3
0
        private void button_NewCopy_Click(object sender, EventArgs e)
        {
            if (_Palette != null)
            {
                _Palette = PaletteManager.GetPalette(new CPalette(_Palette.PaletteFile));

                UpdatePaletteManager();
                OnPaletteChanged(this, null);
            }
        }
コード例 #4
0
        public void SetPalettes(CPalette[] palettes)
        {
            PaletteManager.ClearAll();
            foreach (CPalette pal in palettes)
            {
                PaletteManager.GetPalette(pal, true);
            }

            _Palette = PaletteManager.GetPalette(0);
            UpdatePaletteManager();
            OnPaletteChanged(this, null);
        }
コード例 #5
0
 private void comboBox_Palette_SelectedIndexChanged(object sender, EventArgs e)
 {
     _Palette = PaletteManager.GetPalette((CPalette)this.comboBox_Palette.SelectedItem);
     UpdatePalettePanel();
 }
コード例 #6
0
        public CImageResult CombineAndConvert(CImageFile[] files2combine)
        {
            CImageResult result = new CImageResult(new Bitmap(1, 1), -1, SHP_TS_EncodingFormat.Undefined, SHP_TS_BitFlags.None, Color.FromArgb(0, 0, 0), "");

            if (files2combine.Length > 0)
            {
                CImageFile basefile           = files2combine[0];
                Bitmap     convertedbaseimage = null;
                if (!basefile.IsSHP)
                {
                    convertedbaseimage = LoadImageWithoutFuckingDPI(basefile.FileName, PaletteManager.GetPalette(basefile.PaletteIndex), basefile.CustomBackgroundColor, basefile.UseCustomBackgroundColor, basefile.CombineTransparentPixel);
                }
                else
                {
                    convertedbaseimage = CSHaPer.GetFrame(basefile.FileName, basefile.SHPFrameNr, PaletteManager.GetPalette(basefile.PaletteIndex));
                }

                //bool stores the Inverted transparency flag
                List <KeyValuePair <Bitmap, bool> > convertedsubimages = new List <KeyValuePair <Bitmap, bool> >();
                if (files2combine.Length > 1)
                {
                    for (int i = 1; i < files2combine.Length; i++)
                    {
                        if (!files2combine[i].IsSHP)
                        {
                            convertedsubimages.Add(new KeyValuePair <Bitmap, bool>(
                                                       LoadImageWithoutFuckingDPI(files2combine[i].FileName, PaletteManager.GetPalette(files2combine[i].PaletteIndex), files2combine[i].CustomBackgroundColor, files2combine[i].UseCustomBackgroundColor, files2combine[i].CombineTransparentPixel),
                                                       files2combine[i].CombineTransparentPixel));
                        }
                        else
                        {
                            convertedsubimages.Add(new KeyValuePair <Bitmap, bool>(
                                                       CSHaPer.GetFrame(files2combine[i].FileName, files2combine[i].SHPFrameNr, PaletteManager.GetPalette(files2combine[i].PaletteIndex)),
                                                       false));
                        }
                    }
                }

                Color avgRadarColor;
                //combine the palette indexed images
                convertedbaseimage = CombineImages(convertedbaseimage, convertedsubimages.ToArray(), basefile.RadarColorAverage, out avgRadarColor);

                result.bmp        = convertedbaseimage;
                result.RadarColor = avgRadarColor;
                result.bitflags   = basefile.BitFlags;
                return(result);
            }
            return(result);// new Bitmap(1, 1);
        }