本文整理汇总了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;
}
示例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;
}
}
示例3: TestConstructor
public void TestConstructor()
{
var img1 = new Image(ImagePath);
Assert.AreEqual("png", img1.ExtensionName);
Assert.AreEqual(File.ReadAllBytes(ImagePath), img1.GetData());
}