c# screen transfer over socket efficient improve ways

后端 未结 3 820
有刺的猬
有刺的猬 2020-12-20 00:21

thats how i wrote your beautiful code(some simple changes for me for easier understanding)

     private void Form1_Load(object sender, EventArgs e)
    {

           


        
3条回答
  •  情书的邮戳
    2020-12-20 00:54

    Instead of handling data as an array of bytes, you can handle it as an array of integers.

    int* p = (int*)((byte*)scan0.ToPointer() + y * stride);
    int* p2 = (int*)((byte*)scan02.ToPointer() + y * stride2);
    
    for (int x = 0; x < nWidth; x++)
    {
        //always get the complete pixel when differences are found
        if (*p2 != 0)
          *p = *p2
    
        ++p;
        ++p2;
    }
    

提交回复
热议问题