Пример #1
0
        public void LoadGifFromDisk(string path)
        {
            DisposeGarbage();

            GifLoadParameters data = new GifLoadParameters();

            data.path = path;

            gifLoader.RunWorkerAsync(data);
        }
Пример #2
0
        void LoadGifAsyncComplete(object sender, RunWorkerCompletedEventArgs e)
        {
            GifLoadParameters data = e.Result as GifLoadParameters;

            workingBitmaps = new Bitmap[data.workingBitmaps.Length];
            workingBitmaps = data.workingBitmaps;
            previewBitmaps = new Bitmap[workingBitmaps.Length];
            ImgType        = imType.gif;
            anyImageLoaded = true;
            form.LoadGifComplete();
        }
Пример #3
0
        void LoadGifAsync(object sender, DoWorkEventArgs e)
        {
            GifLoadParameters data = e.Argument as GifLoadParameters;

            using (Image gifImg = Image.FromFile(data.path))
            {
                FrameDimension fd         = new FrameDimension(gifImg.FrameDimensionsList[0]);
                int            FrameCount = gifImg.GetFrameCount(fd);

                Bitmap[] workingBitm = new Bitmap[FrameCount];

                for (int i = 0; i < FrameCount; i++)
                {
                    gifImg.SelectActiveFrame(fd, i);
                    workingBitm[i] = (Bitmap)gifImg.Clone();
                    if (workingBitm[i].Width < form.pixlx || workingBitm[i].Height < form.pixly)
                    {
                        workingBitm[i] = new Bitmap(workingBitm[i], form.pixlx, form.pixly);
                    }
                }
                data.workingBitmaps = workingBitm;
                e.Result            = data;
            }
        }