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


C# Image.GetData方法代码示例

本文整理汇总了C#中System.Image.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# Image.GetData方法的具体用法?C# Image.GetData怎么用?C# Image.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Image的用法示例。


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

示例1: AddImage

        public override string AddImage(Image img)
        {
            if (img == null)
            {
                throw new ArgumentNullException("img");
            }

            var fullPath = "Pictures/" + img.DocumentFileName;
            using (var outStream = this.GetEntryOutputStream(fullPath))
            {
                outStream.Write(img.GetData(), 0, img.DataSize);
            }

            var manifestDoc = new OdfManifestDocument();
            using (var manifestInStream = this.GetEntryInputStream(OdfTemplate.ManifestEntryPath))
            {
                manifestDoc.Load(manifestInStream);
            }

            manifestDoc.AppendImageFileEntry(img.ExtensionName, fullPath);
            manifestDoc.CreatePicturesEntryElement();

            using (var manifestOutStream = this.GetEntryOutputStream(OdfTemplate.ManifestEntryPath))
            {
                manifestDoc.Save(manifestOutStream);
            }

            return fullPath;
        }
开发者ID:Sandwych,项目名称:maltreport,代码行数:29,代码来源:OdfTemplate.cs

示例2: calculateLinearMapForNeighbour

        private unsafe void calculateLinearMapForNeighbour(Image<Gray, byte> responseMap, int neigbourRow, int neighbourCol,
            Image<Gray, byte> linearMap)
        {
            Debug.Assert(linearMap.Width == linearMap.Stride); //because linear map should be represented as continous vector

            int neigborhood = this.NeigborhoodSize;

            byte* linMapPtr = (byte*)linearMap.ImageData;
            int linMapStride = linearMap.Stride;

            int width = responseMap.Width;
            int height = responseMap.Height;
            int stride = responseMap.Stride;
            byte* responseMapPtr = (byte*)responseMap.GetData(neigbourRow);

            //Two loops copy every T-th pixel into the linear memory
            for (int r = neigbourRow; r < height; r += neigborhood)
            {
                int linMapIdx = 0;
                for (int c = neighbourCol; c < width; c += neigborhood)
                {
                    linMapPtr[linMapIdx] = responseMapPtr[c];
                    linMapIdx++;
                }

                responseMapPtr += stride * neigborhood; //skip neigborhood rows
                linMapPtr += linMapStride;
            }
        }
开发者ID:remingtonsteel,项目名称:accord-net-extensions,代码行数:29,代码来源:LinearizedMaps.cs

示例3: TestConstructor

 public void TestConstructor()
 {
     var img1 = new Image(ImagePath);
     Assert.AreEqual("png", img1.ExtensionName);
     Assert.AreEqual(File.ReadAllBytes(ImagePath), img1.GetData());
 }
开发者ID:oldrev,项目名称:maltreport,代码行数:6,代码来源:ImageTest.cs


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