Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualAhmed Egyptian

Posted 13 March 2013 - 04:09 PM

Thanks for your answer, I have made an imaginary bitmap, so I got 4*4 pixels assuming 1 Pixel is 3 bytes RGB, and I added them, but how come from two rows I get 4*4 pixels?

Would someone please show me some pics smile.png ?

 

Regarding also those lines:

           

 

                pDest8[0] = (uint8_t)((r + 2)/4); // average with rounding
                pDest8[1] = (uint8_t)((g + 2)/4);
                pDest8[2] = (uint8_t)((b + 2)/4);
                pDest8[3] = (uint8_t)((a + 2)/4);
                pSrc8 += 8; // skip forward 2 source pixels
                pDest8 += 4; // skip forward 1 destination pixel
 

He skipped 4 bytes, but at the second iteration he writes again at 0,1,2,3 at the dest, should be 4,5,6,7 ?


#2Ahmed Egyptian

Posted 13 March 2013 - 04:08 PM

Thanks for your answer, I have made an imaginary bitmap, so I got 4*4 pixels assuming 1 Pixel is 3 bytes RGB, and I added them, but how come from two rows I get 4*4 pixels?

Would someone please show me some pics smile.png ?

 

Regarding also those lines:

           

 

                pDest8[0] = (uint8_t)((r + 2)/4); // average with rounding
                pDest8[1] = (uint8_t)((g + 2)/4);
                pDest8[2] = (uint8_t)((b + 2)/4);
                pDest8[3] = (uint8_t)((a + 2)/4);
                pSrc8 += 8; // skip forward 2 source pixels
                pDest8 += 4; // skip forward 1 destination pixel
 

He skipped 4 bytes, but at the second iteration he writes again at 0,1,2,3 at the dest, should be 4,5,6,7 ?


#1Ahmed Egyptian

Posted 13 March 2013 - 03:59 PM

Thanks for your answer, I have made an imaginary bitmap, so I got 4*4 pixels assuming 1 Pixel is 3 bytes RGB, and I added them, but how come from two rows I get 4*4 pixels?

Would someone please show me some pics :) ?

 

Regarding also those lines:

           

 

                pDest8[0] = (uint8_t)((r + 2)/4); // average with rounding
                pDest8[1] = (uint8_t)((g + 2)/4);
                pDest8[2] = (uint8_t)((b + 2)/4);
                pDest8[3] = (uint8_t)((a + 2)/4);
                pSrc8 += 8; // skip forward 2 source pixels
                pDest8 += 4; // skip forward 1 destination pixel
 

He skipped 4 bytes, but at the second iteration he writes again at 0,1,2,3 at the dest, should be 4,5,6,7 ?


PARTNERS