From: pandeng@telepath.com (Steve Schafer (TeamB)) Subject: Re: Changing the background of a bitmap Date: 04 Mar 1999 00:00:00 GMT Message-ID: <36f53660.57427125@90.0.0.40> Content-Transfer-Encoding: 7bit References: <36DE10F0.6AB5F07A@kb.jcs.co.jp> Content-Type: text/plain; charset=us-ascii Organization: TeamB Mime-Version: 1.0 Reply-To: pandeng@telepath.com Newsgroups: borland.public.delphi.graphics On Thu, 04 Mar 1999 13:49:53 +0900, Graham Stratford wrote: >I have a 256-color bitmap, which has a black image on a white >background. I want to change the background to another color. Is there >any simple way to do this? Assuming the source bitmap is called MyBitmap: var Dest: TBitmap; R: TRect; begin Dest := TBitmap.Create; with Dest do begin Width := MyBitmap.Width; Height := MyBitmap.Height; R := Rect(0, 0, Width, Height); with Canvas do begin with Brush do begin Style := bsSolid; Color := clRed; end; BrushCopy(R, MyBitmap, R, clWhite); end; end; end; The destination bitmap will be the same as the original, except that all white pixels will become red pixels. -Steve