title: FMX: Fill whole bitmap with a background color
body: <p>I want to create a <code>TImage</code> component and fill the image with a background color. However my code is a bit longer than I have expected. </p>
  
  <ol>
  <li>I have to set the width and height of bitmap.</li>
  <li>I have to calculate the rectangle of the whole bitmap canvas.</li>
  </ol>
  
  <p>If I remember correctly, in old Delphi versions, I can use <code>FloodFill</code> to fill the whole image with particular color. So I think I have definitively missed something. </p>
  
  <p>Can someone figure out how to fill background color with simpler code?</p>
  
  <pre><code>Image := TImage.Create(nil);
  Image.Position.X := 100;
  Image.Position.Y := 100;
  Image.Width := 500;
  Image.Height := 500;
  Image.Bitmap.Width := Trunc(Image.Width);
  Image.Bitmap.Height := Trunc(Image.Height);
  with Image.Bitmap.Canvas do
  begin
    BeginScene;
    try
      Fill.Color := TAlphaColors.Black;
      FillRect(RectF(0, 0, Image.Bitmap.Width, Image.Bitmap.Height), 0, 0, [], 1.0);
    finally
      EndScene;
    end;
  end;
  </code></pre>