Exemplo n.º 1
0
 private void ExtractFrame(string filePath, int index, bool trans)
 {
     if (mSprite.IsDrawn(index) == false)
     {
         mSprite.DrawImage(index);
     }
     filePath = Path.GetFullPath(filePath) + @"\Image " + (index + 1) + ".png";
     Library.SafeIo.DeleteFile(filePath);
     if (trans)
     {
         mSprite.GetImageTransparent(index).Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
     }
     else
     {
         mSprite[index].Image.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
     }
 }
Exemplo n.º 2
0
        private void UpdateImage()
        {
            imgSprite.Image = Tools.ScalePercent(mSprite.GetImageTransparent(mCurrentIndex, mCurrentTypePal == false), (int)(mZoom * 100));

            if (mCurrentTypePal)
            {
                btnFirst.Enabled = btnPrev.Enabled = (mCurrentIndex > 0);
                btnLast.Enabled  = btnNext.Enabled = (mCurrentIndex + 1 < mSprite.ImagesPal.Count);
            }
            else
            {
                btnFirst.Enabled = btnPrev.Enabled = (mCurrentIndex > 0);
                btnLast.Enabled  = btnNext.Enabled = (mCurrentIndex + 1 < mSprite.ImagesRgba.Count);
            }

            btnZoomIn.Enabled    = (mZoom < 20);
            btnZoomOut.Enabled   = (mZoom > 1);
            btnZoomReset.Enabled = (mZoom != 1);
        }
Exemplo n.º 3
0
        public bool ExportImage(RoGrfFileItem grfItem)
        {
            byte[] spriteData  = grfItem.FileData;
            string sprFilepath = Path.GetTempFileName();

            File.WriteAllBytes(sprFilepath, spriteData);
            spriteData = null;

            try {
                using (RoSprite sprFile = new RoSprite(sprFilepath)) {
                    sprFile.DrawImage(0);

                    using (Bitmap bmp = sprFile.GetImageTransparent(0)) {
                        bmp.Save(Environment.CurrentDirectory + @"\data\mobs\" + ID + ".png");
                    }
                }
            } catch (Exception ex) {
                return(false);
            }

            return(true);
        }