当前位置: 首页>>代码示例>>C#>>正文


C# Transformation类代码示例

本文整理汇总了C#中Transformation的典型用法代码示例。如果您正苦于以下问题:C# Transformation类的具体用法?C# Transformation怎么用?C# Transformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Transformation类属于命名空间,在下文中一共展示了Transformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BrightnessBarChanged

 private void BrightnessBarChanged()
 {
     Transformation transform = new Transformation();
     transform.type = TransformationType.BRIGHTNESS_CHANGE;
     transform.argument = getNormalizedBrightnessLevel();
     TransformImage(transform);
 }
开发者ID:jgreenlee24,项目名称:PhotoEditor,代码行数:7,代码来源:EditForm.cs

示例2: CalculateImageAndTransformationMatrix

        private void CalculateImageAndTransformationMatrix(string fileName)
        {
            var zipFile = new Ionic.Zip.ZipFile(fileName);
              var mapSize = new Size();
              Transformation = new Transformation();

              // get entry for kml file and image file
              KmlDocument kmlDocument = null;
              foreach (var entry in zipFile)
              {
            if (entry.FileName == entry.LocalFileName && Path.GetExtension(entry.FileName) == ".kml")
            {
              using (var kmlStream = new MemoryStream())
              {
            entry.Extract(kmlStream);
            kmlStream.Position = 0;
            kmlDocument = new KmlDocument(kmlStream);
              }
              break;
            }
              }

              if (kmlDocument != null)
              {
            // we have got a kml document, get map image file stream from it
            foreach (var entry in zipFile)
            {
              if (entry.FileName == kmlDocument.ImageFileName)
              {
            ImageStream = new MemoryStream();
            entry.Extract(ImageStream);
            ImageStream.Position = 0;
            // check if image is QR jpeg
            var ed = QuickRouteJpegExtensionData.FromStream(ImageStream);
            if(ed != null)
            {
              // get transformation matrix from QR jpeg metadata
              Transformation = ed.Sessions.CalculateAverageTransformation();
              ImageStream.Position = 0;
              return;
            }
            else
            {
              // it is not, use normal image bounds
              ImageStream.Position = 0;
              mapSize = Image.FromStream(ImageStream).Size; // need to get image object to get image size
            }
            ImageStream.Position = 0;
            break;
              }
            }
              }

              if (kmlDocument != null && ImageStream != null)
              {
            // finally, calculate the transformation
            Transformation = new Transformation(kmlDocument.LongLatBox, mapSize);
              }
        }
开发者ID:jarkko,项目名称:quickroute-gps,代码行数:59,代码来源:KmzDocument.cs

示例3: CloudinaryImage_WithAutoAngle_AddsPosition

        public void CloudinaryImage_WithAutoAngle_AddsPosition()
        {
            var transformation = new Transformation(240, 240) {Angle = Angle.Auto};

            string url = Url.CloudinaryImage("angled", transformation).ToString();

            Assert.AreEqual("http://res.cloudinary.com/test/image/upload/w_240,h_240,a_auto/angled.jpg", url);
        }
开发者ID:thomasvm,项目名称:cloudinary-dotnet,代码行数:8,代码来源:CloudinaryUrlHelpersTests.cs

示例4: MeshNode

        public MeshNode(string label, NsNode parent, double[,] initTransform)
            : this(label, parent)
        {
            for (int i = 0; i < 3; i++)
                    initTransform[i, 3] *= 1000;

               m_T = new Transformation(initTransform);
        }
开发者ID:GMTurbo,项目名称:Free-Form-Matcher,代码行数:8,代码来源:MeshNode.cs

示例5: CloudinaryImage_WithEffect_AddsEffect

        public void CloudinaryImage_WithEffect_AddsEffect()
        {
            var transformation = new Transformation(30, 90);
            transformation.Effect = "sepia";

            string url = Url.CloudinaryImage("effected", transformation).ToString();
            Assert.AreEqual("http://res.cloudinary.com/test/image/upload/w_30,h_90,e_sepia/effected.jpg", url);
        }
开发者ID:thomasvm,项目名称:cloudinary-dotnet,代码行数:8,代码来源:CloudinaryUrlHelpersTests.cs

示例6: CloudinaryImage_WithFixedCroppingPositionSet_AddPosition

        public void CloudinaryImage_WithFixedCroppingPositionSet_AddPosition()
        {
            var transformation = new Transformation(240, 240) { Crop = CropMode.Crop };
            transformation.SetFixedCroppingPosition(350, 510);

            string url = Url.CloudinaryImage("cropme", transformation).ToString();

            Assert.AreEqual("http://res.cloudinary.com/test/image/upload/w_240,h_240,x_350,y_510,c_crop/cropme.jpg", url);
        }
开发者ID:sparra,项目名称:cloudinary-dotnet,代码行数:9,代码来源:CloudinaryUrlHelpersTests.cs

示例7: TestBaseTransformationChain

        public void TestBaseTransformationChain()
        {
            // should support base transformation

            Transformation transformation = new Transformation().X(100).Y(100).Crop("fill").Chain().Crop("crop").Width(100);
            string uri = api.UrlImgUp.Transform(transformation).BuildUrl("test");
            Assert.AreEqual("100", transformation.HtmlWidth);
            Assert.AreEqual("http://res.cloudinary.com/testcloud/image/upload/c_fill,x_100,y_100/c_crop,w_100/test", uri);
        }
开发者ID:iitr-ankur,项目名称:CloudinaryMono,代码行数:9,代码来源:ApiTest.cs

示例8: TestBackground

 public void TestBackground()
 {
     // should support background
     Transformation transformation = new Transformation().Background("red");
     String result = m_api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual(m_defaultImgUpPath + "b_red/test", result);
     transformation = new Transformation().Background("#112233");
     result = m_api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual(m_defaultImgUpPath + "b_rgb:112233/test", result);
 }
开发者ID:cloudinary,项目名称:CloudinaryDotNet,代码行数:10,代码来源:ApiTest.cs

示例9: TestBackground

 public void TestBackground()
 {
     // should support background
     Transformation transformation = new Transformation().Background("red");
     String result = api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual("http://res.cloudinary.com/testcloud/image/upload/b_red/test", result);
     transformation = new Transformation().Background("#112233");
     result = api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual("http://res.cloudinary.com/testcloud/image/upload/b_rgb:112233/test", result);
 }
开发者ID:iitr-ankur,项目名称:CloudinaryMono,代码行数:10,代码来源:ApiTest.cs

示例10: EndIf

 public void EndIf()
 {
     Transformation transformation = new Transformation().IfCondition("w_lt_200").Crop("fill").Height(120).Width(80).Effect("sharpen")
         .Chain().Effect("brightness", 50)
         .Chain().Effect("shadow").Color("red")
         .EndIf();
     string sTransform = transformation.ToString();
     Assert.IsTrue(sTransform.EndsWith("if_end"), "should include the if_end as the last parameter in its component");
     Assert.AreEqual("if_w_lt_200/c_fill,e_sharpen,h_120,w_80/e_brightness:50/co_red,e_shadow/if_end", sTransform, "should be proper transformation string");
 }
开发者ID:cloudinary,项目名称:CloudinaryDotNet,代码行数:10,代码来源:TransformationApiTest.cs

示例11: TestAngle

 public void TestAngle()
 {
     // should support angle
     Transformation transformation = new Transformation().Angle(12);
     String result = m_api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual(m_defaultImgUpPath + "a_12/test", result);
     transformation = new Transformation().Angle("exif", "12");
     result = m_api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual(m_defaultImgUpPath + "a_exif.12/test", result);
 }
开发者ID:cloudinary,项目名称:CloudinaryDotNet,代码行数:10,代码来源:ApiTest.cs

示例12: CanInsertCollectionOfItemsToScene

        public void CanInsertCollectionOfItemsToScene()
        {
            var map = new Map();
            var transformation = new Transformation(500, 500);
            var transformation2 = new Transformation(100, 100);

            map.Insert("grass", new List<Transformation> { transformation, transformation2 });

            Assert.AreEqual(map.Scene["grass"].Count, 2);
        }
开发者ID:zumpiez,项目名称:Chopsticks,代码行数:10,代码来源:MapTests.cs

示例13: CanInsertItemToScene

        public void CanInsertItemToScene()
        {
            var map = new Map();

            var transformation = new Transformation(500, 500);

            map.Insert("grass", transformation);

            Assert.AreEqual(map.Scene["grass"].First().Translation, transformation.Translation);
        }
开发者ID:zumpiez,项目名称:Chopsticks,代码行数:10,代码来源:MapTests.cs

示例14: TestAngle

 public void TestAngle()
 {
     // should support angle
     Transformation transformation = new Transformation().Angle(12);
     String result = api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual("http://res.cloudinary.com/testcloud/image/upload/a_12/test", result);
     transformation = new Transformation().Angle("exif", "12");
     result = api.UrlImgUp.Transform(transformation).BuildUrl("test");
     Assert.AreEqual("http://res.cloudinary.com/testcloud/image/upload/a_exif.12/test", result);
 }
开发者ID:iitr-ankur,项目名称:CloudinaryMono,代码行数:10,代码来源:ApiTest.cs

示例15: EndIf2

        public void EndIf2()
        {
            Transformation transformation = new Transformation().IfCondition().Width("gt", 100).And().Width("lt", 200).Then().Width(50).Crop("scale").EndIf();
            Assert.AreEqual("if_w_gt_100_and_w_lt_200/c_scale,w_50/if_end", transformation.ToString(), "should serialize to 'if_end'");

            transformation = new Transformation().IfCondition().Width("gt", 100).And().Width("lt", 200).Then().Width(50).Crop("scale").EndIf();
            Assert.AreEqual("if_w_gt_100_and_w_lt_200/c_scale,w_50/if_end", transformation.ToString(), "force the if clause to be chained");

            transformation = new Transformation().IfCondition().Width("gt", 100).And().Width("lt", 200).Then().Width(50).Crop("scale").IfElse().Width(100).Crop("crop").EndIf();
            Assert.AreEqual("if_w_gt_100_and_w_lt_200/c_scale,w_50/if_else/c_crop,w_100/if_end", transformation.ToString(), "force the if_else clause to be chained");
        }
开发者ID:cloudinary,项目名称:CloudinaryDotNet,代码行数:11,代码来源:TransformationApiTest.cs


注:本文中的Transformation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。