BitmapData类Scan0和Stride属性的含义

BitmapData类Scan0和Stride属性的含义

本文介绍了C#BitmapData类Scan0和Stride属性的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释C#中BitmapData类的 Scan0 Stride 属性是做什么的?

Can anyone explain what Scan0 and Stride properties of BitmapData class in C# are for?

推荐答案

您是否在谈论 BitmapData 类?如果是这样,我认为文档中的描述相当清楚:

Are you talking about the BitmapData class? If so, the description in the documentation is reasonably clear, I think:

Scan0 :

换句话说,这使您可以找到要检查或更改的数据-甚至可以将位图制作为完全不同的数据.

In other words, this lets you find the data to examine or change - or even lets you make the bitmap to a completely different piece of data.

Stride :

如果要从一行移到另一行,则需要将跨步添加到当前正在查看的行的地址.行与4个字节的边界对齐,以便所有类型的代码都可以更有效地访问它. (对CPU中的各种操作进行了优化,使其可以在4字节或8字节边界上工作.)

If you want to move from one row to the next, you need to add the stride to the address of the row you're currently looking at. Rows are aligned to 4 byte boundaries so that all kinds of code can access it more efficiently. (Various operations in CPUs are optimized to work on 4 byte or 8 byte boundaries.)

这篇关于C#BitmapData类Scan0和Stride属性的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:46