コード例 #1
0
        public void MetafileUtilitySaveMetaFile_EMF_PNG()
        {
            using (var emf = typeof(MetafileUtilityTest).Assembly.GetManifestResourceStream("KeesTalksTech.Utilities.UnitTests.Resources.MetafileUtility_EMF.emf"))
            {
                using (var test = typeof(MetafileUtilityTest).Assembly.GetManifestResourceStream("KeesTalksTech.Utilities.UnitTests.Resources.MetafileUtility_EMF_PNG.png"))
                {
                    using (var converted = new MemoryStream())
                    {
                        MetafileUtility.SaveMetaFile(emf, converted);

                        var equals = StreamUtility.Equals(test, converted);
                        Assert.IsTrue(equals, "Streams are not equal.");
                    }
                }
            }
        }
コード例 #2
0
        public void MetafileUtilitySaveMetaFile_EMF_JPG()
        {
            using (var emf = typeof(MetafileUtilityTest).Assembly.GetManifestResourceStream("KeesTalksTech.Utilities.UnitTests.Resources.MetafileUtility_EMF.emf"))
            {
                using (var test = typeof(MetafileUtilityTest).Assembly.GetManifestResourceStream("KeesTalksTech.Utilities.UnitTests.Resources.MetafileUtility_EMF_JPG.jpg"))
                {
                    using (var converted = new MemoryStream())
                    {
                        var parameters = new EncoderParameters(1);
                        parameters.Param[0] = new EncoderParameter(Encoder.Quality, 80L);

                        MetafileUtility.SaveMetaFile(emf, converted, format: ImageFormat.Jpeg, parameters: parameters);

                        var equals = StreamUtility.Equals(test, converted);
                        Assert.IsTrue(equals, "Streams are not equal.");
                    }
                }
            }
        }