Hi
I need to take an existing BMP, add text to the bottom of the image, and save it again as a bitmap or jpeg.
Does anybody have any ideas how to do this?
Thank you
Johan Fourie
Systems Architect
I use this code to force my users desktop to comply to a company standard:
Procedure MakeBMP(Colour:Integer);
var
R1,R2:tRect;
BM1,BM2,Pic:tBitMap;
PosX,PosY,Margin:integer;
H:Variant;
t,l,r,b:integer;
begin
t:=Screen.Height div 2;
l:=Screen.Width div 2;
margin:=20;
BM1:=tBitMap.Create;
BM2:=tBitMap.Create;
with BM1 do
Begin
LoadFromFile('S:\System\NetLogon\5R-002.bmp'); // Recycle logo
End;with BM2 Do
Begin
Height:=BM1.Height div 6;
Width:=BM1.Width div 6;
End;With R2 do
Begin
Top :=0;
Left := 0;
Right := BM2.Width;
Bottom := BM2.Height;
End;With BM2 do
Begin
Canvas.StretchDraw(R2, BM1);
Transparent:=true;
TransparentColor:=BM2.canvas.pixels[1,1];
End;pic:=tBitMap.Create;
pic.Width:=screen.Width;
pic.Height:=screen.Height;
pic.Canvas.Brush.Color:=Colour;
pic.Canvas.FloodFill(0,0,clBlack,fsBorder);
pic.Canvas.Font.Name:='Helvetica'; //Arial Rounded MT Bold
//pic.Canvas.Font.Color:=FontColour(Colour);
pic.Canvas.Font.Color:=clWhite;
H:=((screen.Height*2.6)/100);
pic.Canvas.Font.size:=H;
if pic.Canvas.TextWidth(Form1.PC)>pic.Canvas.TextWidth(Form1.user) then
if pic.Canvas.TextWidth(Form1.PC)>pic.Canvas.TextWidth(Form1.ToDay) then
PosX:=pic.Width-(pic.Canvas.TextWidth(Form1.PC))
else
PosX:=pic.Width-(pic.Canvas.TextWidth(Form1.ToDay))
else
if pic.Canvas.TextWidth(Form1.user)>pic.Canvas.TextWidth(Form1.ToDay) then
PosX:=pic.Width-(pic.Canvas.TextWidth(Form1.User))
else
PosX:=pic.Width-(pic.Canvas.TextWidth(Form1.ToDay));pic.Canvas.TextOut(PosX-margin,20, Form1.PC); // Write PC name on screen
pic.Canvas.TextOut(PosX-margin,50, Form1.User); // Write Username on screen
pic.Canvas.TextOut(PosX-margin,80, Form1.ToDay); // Write logon date on screen
pic.Canvas.Font.Name:='Brother - At Your Side';
H:=((screen.Height*10.4)/100);
pic.Canvas.Font.size:=H;
PosX:=(pic.Width-(pic.Canvas.TextWidth('abc')+5))-margin;
PosY:=pic.Height-(pic.Canvas.TextHeight('abc')+40);
pic.Canvas.TextOut(posX,PosY,'abc'); // Write Brother Logo on screen
PosX:=pic.Width-(BM2.width);
PosY:=(pic.Height-BM2.Height)-30;
pic.Canvas.Draw(PosX-(BM2.Width div 2)+90,PosY-((BM2.Height div 2)+10),BM2); // Tokyo Expo mascot images
with BM1 do
Begin
LoadFromFile('S:\System\NetLogon\I&S1.bmp');
Transparent:=true;
TransparentColor:=BM1.canvas.pixels[1,1];
End;
PosX:=pic.Width-(BM1.width)-350; PosY:=(pic.Height-BM1.Height)+70; pic.Canvas.Draw(PosX-(BM2.Width div 2),PosY-((BM2.Height div 2)+10),BM1);
pic.SaveToFile('C:\Temp\BrotherBG.bmp');
pic.Free;
BM1.Free;
FrigRegistry;
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,Nil,SPIF_SENDWININICHANGE); //Reset the screen
end;
Mr Chris Moore Systems Engineer
Brother Industries (UK) Limited Tel: +44(0) 1978 813 425 Fax: +44(0) 1978 813 495
_______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

