Author: Tomas Rutkauskas How to XOR a font on a bitmap canvas Answer: Write the text to a (temporary) bitmap and copyrect that to the image: 1 2 procedure XORText(sheet: TCanvas; x, y: Integer; text: string); 3 var 4 bmp: TBitmap; 5 r1, r2: TRect; 6 begin 7 bmp := TBitmap.create; 8 try 9 with sheet do 10 begin 11 bmp.Width := textWidth(text); 12 bmp.height := textheight(text); 13 r1 := rect(0, 0, bmp.Width, bmp.Height); 14 r2 := Rect(x, y, x + bmp.Width, y + bmp.Height); 15 bmp.canvas.font.assign(font); 16 bmp.canvas.brush.color := clBlack; 17 bmp.Canvas.fillrect(r1); 18 bmp.canvas.brush.style := bsClear; 19 bmp.canvas.textout(0, 0, text); 20 copymode := cmSrcInvert; 21 copyrect(r2, bmp.canvas, r1); 22 end; 23 finally 24 bmp.free; 25 end; 26 end;