any can explain the function of stride in bitmapdata?

后端 未结 5 427
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 11:25
        Bitmap bit1 = new Bitmap( bmpimg , width , height );
        Bitmap bit2 = new Bitmap( bmp , width , height );

        Bitmap bmpresult = new Bitmap( width          


        
5条回答
  •  情深已故
    2020-12-01 11:56

    Stride is there due to hardware requirements that have unfortunately leaked through to the API layer.

    It is important because Windows drivers sometimes require that scanlines (rows in the image) be memory aligned. That is why they are sometimes larger than they would strictly need to be.

    See for example this MSDN article DIBs and Their Use.

    Every scanline is DWORD-aligned. The scanline is buffered to alignment; the buffering is not necessarily 0.

    Your handling seems to be sufficient.

提交回复
热议问题