I'm working on a part of a program which I thought would be easiy, loading a jpg into an image object and then putting text over it, the only problem is that I can't seem to get the text to be black or any color other than grey.
I Built an example to make sure I wasn't doing something wrong in the main program but get the same problem. I'm guessing it's something stupid but for the life of me I'm not seeing what the problem is.
Here is the code.
unit Unit1;
{$mode objfpc}{$H+}unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Invoice: TImage;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
with Invoice do
begin
Picture.LoadFromFile('Images\test.jpg');
Picture.Bitmap.Canvas.Font.Color := clBlack;
Picture.Bitmap.Canvas.Font.Size := 20;
Picture.Bitmap.Canvas.Brush.Style := bsClear;
Picture.Bitmap.Canvas.TextOut(20, 20, 'HELLO WORLD');
end;
end;
end.
What I expected to see is HELLO WORLD in black on the upper left of the image when I click the button and the TImage object is loaded with the picture and written to with textout but what I get is very light grey text. I thought it might be something with the image itself, I converted it from a pdf of a blank invoice, so I grabbed a sample Blank Invoice image off the web and tried it and got the same thing.
So what stupid thing am I doing????