Un ejemplo de como dibujar un texto con textura en un canvas.
Código Delphi
[-]
procedure DrawTextTexture(Text: String; Canvas: TCanvas; X, Y: integer; Texture: TBitmap);
var
Bitmap: TBitmap;
begin
Bitmap:= TBitmap.Create;
SetBkMode(Canvas.Handle, TRANSPARENT);
Canvas.TextOut(20, 20, PCHAR(Text));
Canvas.CopyMode:= cmDstInvert;
Canvas.Draw(0,0,Bitmap);
Canvas.CopyMode:= cmSrcPaint;
Canvas.Draw(0,0,Texture);
Bitmap.Free;
end;
Forma de uso:
Código Delphi
[-]
procedure TForm1.Button3Click(Sender: TObject);
var
Texture: TBitmap;
begin
Image1.Canvas.Font.Name:= 'Arial Black';
Image1.Canvas.Font.Size:= 90;
Texture:= TBitmap.Create;
Texture.LoadFromFile('madera.bmp');
DrawTextTexture('TEXTO', Image1.Canvas, 20, 20, Texture);
Texture.Free;
end;
Saludos.