title: SDL read pixels from texture
body: <p>I want to read pixels from a texture using SDL2 library.
  I know that it's not possible to directly read a pixel from a texture, but you can use the following function:</p>
  
  <pre><code>int SDL_RenderReadPixels(SDL_Renderer*   renderer,
                       const SDL_Rect* rect,
                       Uint32          format,
                       void*           pixels,
                       int             pitch)
  </code></pre>
  
  <p>Basically, what I want to do in my application is to read a single pixel from the window screen and detect if it's a transparent pixel or not.
  How can I use that function?
  What is the pitch attribute, how I define the SDL_Rect and how I get the pixel with the correct format? 
  I'm detecting the mouse left click event and passing the x and y coordinates to a method as you can see:</p>
  
  <pre><code>void detectElementOnXandY(SDL_Renderer* renderer, int x, int y){
  
   // x represents the coordinate x.
   // y represents the coordinate y.
  
   // Here i have to call the function
   int result = SDL_RenderReadPixels(renderer, rect, format, pixels, pitch);
  }
  </code></pre>