Mega Code Archive

 
Categories / Delphi / Examples
 

Text to GIF

Title: Text to GIF Question: How convert my text to a Gif File? Answer: I have been working in an interesting project for me that it has given me the possibility of exploring new roads in DELPHI, from there emerges the need of elaborating a form of converting any text introduced in a corresponding GIF file. In reality I have an application more complex, but for example enough and surplus this Asking and reading could accomplish the following routine.Put in your form an TImage and a Button that call to the following routine.Create a procedure that accepts as parameter a text anyone, and the name of a Gif file. procedure TxtToGif (txt, FileName: String); var temp: TBitmap; GIF : TGIFImage; begin temp:=TBitmap.Create; try temp.Height :=400; temp.Width :=60; temp.Transparent:=True; temp.Canvas.Brush.Color:=colFondo.ColorValue; temp.Canvas.Font.Name:=Fuente.FontName; temp.Canvas.Font.Color:=colFuente.ColorValue; temp.Canvas.TextOut (10,10,txt); Imagen.Picture.Assign(nil); GIF := TGIFImage.Create; try // Convert the bitmap to a GIF GIF.Assign(Temp); // Save the GIF GIF.SaveToFile(FileName); // Display the GIF Imagen.Picture.Assign (GIF); finally GIF.Free; end; Finally temp.Destroy; End; end; CONSIDERATIONS. 1. If You dont wish that the image is shown in your form, remove the TImage and the lines of source code associates. 2. The class TGIFIMAGE does not come included in Delphi 5 with the one which have proven, therefore you can use the classes that come in the RX-LIB (http://www.rxlib.com) or the class specialized TGIFIMAGE (http://www.melander.dk/delphi/gifimage). Both are FREE but too mutually excluding since both have the classes with the same name therefore you must to choose alone 3. The possibilities that are opened with this are infinite, you can read your texts from a file, to provide what many pages give design of banners on-line,........ 4. Read carefully the patent considerations before use this tip. 5. Use PasToWeb utility to conver code to html (only a tip) http://www.marcocantu.com I wait that serve to you Thanks NO HTML ok?