Cita:
Empezado por ecfisa
Hola look.
Gracias por poner la función  . Y me alegra que te sirviera el código.
Saludos 
|
Hola, he mejorado la funcion:
Código Delphi
[-]
procedure TForm1.ConvertNamePng(sName:string ; Path:string ; img:TImage);
var
bmp: TBitmap;
aPng : array of TPNGObject;
i,pngWidth : Integer;
begin
SetLength(aPng,Length(sName));
bmp := TBitmap.Create;
for i:=0 to Length(sName)-1 do
begin
aPng[i] := TPNGObject.Create;
aPng[i].LoadFromFile(PATH+copy(sName,i+1,1)+'.png');
end;
bmp.Width := (aPng[0].Width*Length(sName))-1;
bmp.Height := aPng[0].Height;
bmp.PixelFormat:= pf32bit;
bmp.Canvas.Brush.Color := clWhite;
bmp.Canvas.FillRect(Rect(0, 0, bmp.Width, bmp.Height));
bmp.TransparentColor := clWhite;
bmp.Transparent := True;
pngWidth := 0;
for i:=0 to Length(sName)-1 do
begin
aPng[i].Draw(bmp.Canvas, Rect(pngWidth , 0, aPng[i].Width + pngWidth , aPng[0].Height));
pngWidth := aPng[i].Width+pngWidth;
end;
bmp.SaveToFile(PATH+'abc.png');
img.Picture.Assign(bmp);
ConvertToPNG(bmp,'c:\res.png');
bmp.Free;
for i := 0 to Length(sName)-1 do aPng[i].Free;
end;
ahora le mandas una cadena de texto y esta devuelve una imagen correspondiente al texto partiendo de un directorio en donde cada imagen represente una letra.
