예제 #1
0
        public void SaveAdd()
        {
            string          filename = @"saveadd.tif";
            FreeImageBitmap fib      = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb);

            try
            {
                fib.SaveAdd();
                Assert.Fail();
            }
            catch { }
            Assert.IsFalse(File.Exists(filename));
            fib.Save(filename);
            fib.AdjustBrightness(0.3d);
            fib.SaveAdd();
            FreeImageBitmap other = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb);

            foreach (Scanline <RGBTRIPLE> scanline in other)
            {
                for (int i = 0; i < scanline.Length; i++)
                {
                    scanline[i] = new RGBTRIPLE(Color.FromArgb(0x339955));
                }
            }
            fib.SaveAdd(other);
            other.SaveAdd(filename);
            other.Dispose();
            fib.Dispose();

            fib = new FreeImageBitmap(filename);
            Assert.AreEqual(4, fib.FrameCount);
            fib.Dispose();
            File.Delete(filename);
            Assert.IsFalse(File.Exists(filename));
        }
예제 #2
0
파일: Program.cs 프로젝트: uwx/Sharpico
        public static void Main(string[] args)
        {
            var icoFile  = args[1];
            var fiBitmap = new FreeImageBitmap(args[0]);

            var first = true;

            foreach (var size in Sizes)
            {
                if (fiBitmap.Width < size || fiBitmap.Height < size)
                {
                    continue;
                }

                fiBitmap.Rescale(size, size, FREE_IMAGE_FILTER.FILTER_BICUBIC);
                if (first)
                {
                    first = false;
                    fiBitmap.Save(icoFile);
                }
                else
                {
                    fiBitmap.SaveAdd(icoFile);
                }
            }
        }
예제 #3
0
        public void SaveAdd()
        {
            string filename = @"saveadd.tif";
            FreeImageBitmap fib = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb);
            try
            {
                fib.SaveAdd();
                Assert.Fail();
            }
            catch { }
            Assert.IsFalse(File.Exists(filename));
            fib.Save(filename);
            fib.AdjustBrightness(0.3d);
            fib.SaveAdd();
            FreeImageBitmap other = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb);
            foreach (Scanline<RGBTRIPLE> scanline in other)
            {
                for (int i = 0; i < scanline.Length; i++)
                {
                    scanline[i] = new RGBTRIPLE(Color.FromArgb(0x339955));
                }
            }
            fib.SaveAdd(other);
            other.SaveAdd(filename);
            other.Dispose();
            fib.Dispose();

            fib = new FreeImageBitmap(filename);
            Assert.AreEqual(4, fib.FrameCount);
            fib.Dispose();
            File.Delete(filename);
            Assert.IsFalse(File.Exists(filename));
        }