private void UpdateImages()
 {
     if (string.IsNullOrEmpty(SHPFile))
     {
         return;
     }
     this.uC_ImageCanvas_Left.SetImage(CSHaPer.GetFrame(SHPFile, (int)this.numericUpDown_FrameLeft.Value, _Palette));
     this.uC_ImageCanvas_Right.SetImage(CSHaPer.GetFrame(SHPFile, (int)this.numericUpDown_FrameRight.Value, _Palette));
 }
 void numericUpDown_FrameRight_ValueChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(SHPFile))
     {
         return;
     }
     if (this.numericUpDown_FrameRight.Focused)
     {
         this.uC_ImageCanvas_Right.SetImage(CSHaPer.GetFrame(SHPFile, (int)this.numericUpDown_FrameRight.Value, _Palette));
     }
 }
Пример #3
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);
        }