Exemplo n.º 1
0
        public void LoadGifFromDisk(string path)
        {
            DisposeGarbage();

            GifLoadParameters data = new GifLoadParameters();

            data.path = path;

            gifLoader.RunWorkerAsync(data);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
            }
        }