title: How to color the border and the rectangle of different colors? SDL
body: <p>I have a responsible function for drawing a rectangle on the screen, it is inside the main loop of my program, it does this:</p>
  
  <pre><code>DrawRetangle (SDL_Renderer * Renderer, SDL_Rect MyRect) {
  
      // Clean the renderer
      SDL_RenderClear (Renderer);
  
     // Position x, y, width and height of the rectangle.
      MyRect = {x, y, width, height};
  
      // Rectangle border color
      SDL_SetRenderDrawColor (Renderer, 0, 0, 0, 255);
  
      // Draw the edges of the rectangle
      SDL_RenderDrawRect (Renderer, &amp; MyRect);
  
      // Color from within the rectangle
      SDL_SetRenderDrawColor (Renderer, 255, 255, 255, 255);
  
      // Fill in the rectangle
      SDL_RenderFillRect (Renderer, &amp; MyRect);
  
      // Show in window
      SDL_RenderPresent (Renderer);
  
  }
  </code></pre>
  
  <p>Note that I am trying to draw a rectangle with a black border and filled with white, but it gets all black, I know I can solve this, cleaning, drawing the border, showing, cleaning, drawing the interior and showing, however if I tier many rectangle , This would be bad, is there a better way to do this?</p>
  
  <blockquote>
    <p><strong>Up 1:</strong></p>
  </blockquote>
  
  <p>To function would it be just this way, as below?</p>
  
  <pre><code>DrawRetangle (SDL_Renderer * Renderer, SDL_Rect MyRect) {
  
      // Clean the renderer 1
      SDL_RenderClear (Renderer);
  
     // Position x, y, width and height of the rectangle.
      MyRect = {x, y, width, height};
  
      // Rectangle border color
      SDL_SetRenderDrawColor (Renderer, 0, 0, 0, 255);
  
      // Draw the edges of the rectangle
      SDL_RenderDrawRect (Renderer, &amp; MyRect);
  
      // Show in window 1
      SDL_RenderPresent (Renderer);
  
      // Clean the renderer 2
      SDL_RenderClear (Renderer);
  
      // Color from within the rectangle
      SDL_SetRenderDrawColor (Renderer, 255, 255, 255, 255);
  
      // Fill in the rectangle
      SDL_RenderFillRect (Renderer, &amp; MyRect);
  
      // Show in window 2
      SDL_RenderPresent (Renderer);
  
  }
  </code></pre>
  
  <blockquote>
    <p><strong>Up 2:</strong></p>
  </blockquote>
  
  <p>Another solution I found was to call the function below twice, creating a rectangle on top of another, the one inside a little smaller, thus looking like a border. But I still do not think it should be the best way to do it.</p>
  
  <pre><code>DrawRetangle (SDL_Renderer * Renderer, SDL_Rect MyRect, int x, int, y, int width, int height, int r, int g, int b, int a) {
  
         // Position x, y, width and height of the rectangle.
          MyRect = {x, y, width, height};
  
  
          // Color from within the rectangle
          SDL_SetRenderDrawColor (Renderer, r, g, b, a);
  
             // Clean the renderer
          SDL_RenderClear (Renderer);
  
          // Fill in the rectangle
          SDL_RenderFillRect (Renderer, &amp; MyRect);
  
          // Show in window
          SDL_RenderPresent (Renderer);
  
      }
  </code></pre>