Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualachild

Posted 01 May 2013 - 02:52 PM

Concrete example for reinterpret cast:

You create an image buffer of x number of bytes. You calculate by bytes just in case there are issues with scan line alignment in this example. However, when you access each scanline, you know you are working with 32 bit data in your case, so you want to reference each scanline's memory using an unsigned int *.

 

Definitely want reinterpret_cast for that.

 

Example: unsigned int *pScan = reinterpret_cast<unsigned int *>(pBuffer8 + y * scanBytes);

 

Now you can address the pixels on that scan.


#1achild

Posted 01 May 2013 - 02:51 PM

Concrete example for reinterpret cast:

You create an image buffer of x number of bytes. You calculate by bytes just in case there are issues with scan line alignment in this example. However, when you access each scanline, you know you are working with 32 bit data in your case, so you want to reference each scanline's memory using an unsigned int *.

 

Definitely want reinterpret_cast for that.


PARTNERS