Board index » delphi » I need a program generating Delphi source code

I need a program generating Delphi source code

In my application I need to show some 200 drawings 640x480. I can not get
them from bmp or jpg files (bmp too large, jpg loading too slow), so I came
up with an idea of using a ready program (or making one) that can do things
similar to windows "paint". That is, for each particular line, triangle,
ellipse etc., which graphic artist makes, there is also a delphi code
produced. The generated code can do the same drawing (which the artist
drew) using Tcanvas methods. I cooperate with the graphic artist. He is
supposed to produces drawings and I am to recreate the drawings in my
aplication using the generated source code.
   Does anybody know of such an application (freeware)?  If I can not find
one I will have to write one, which I want to avoid.
 

Re:I need a program generating Delphi source code


Sounds like you could use metafiles to create and store your
drawings. They are very compact and fully supported by Delphi.

Jacques

Quote
=?ISO-8859-2?Q?Mariusz_J=EAdrzejowski?= wrote:

> In my application I need to show some 200 drawings 640x480. I can not get
> them from bmp or jpg files (bmp too large, jpg loading too slow), so I came
> up with an idea of using a ready program (or making one) that can do things
> similar to windows "paint". That is, for each particular line, triangle,
> ellipse etc., which graphic artist makes, there is also a delphi code
> produced. The generated code can do the same drawing (which the artist
> drew) using Tcanvas methods. I cooperate with the graphic artist. He is
> supposed to produces drawings and I am to recreate the drawings in my
> aplication using the generated source code.
>    Does anybody know of such an application (freeware)?  If I can not find
> one I will have to write one, which I want to avoid.

Re:I need a program generating Delphi source code


But which graphic application ready to use can save just made drawings in wmf
format  (conversion is out of the question as bmp ->wmf would produce a large
wmf) ?
Having one I could perhaps store wmf files in resource and load them from
resource ?
Might take just as much time as loading bmp. I need to load one 640x480 image
in half a second.
   Making my own application that can make drawings and save in wmf format is
just as difficult as generating source code because I do have already the
source that generated the drawing so what do I need conversion to wmf for ?

        Here is an example from Delphi help file that states exactly what I
said:
This example shows how to create or augment a metafile using a metafile
canvas object.  This metafile can then be used to draw on the canvas of
another object such as a paintbox or a printer.

MyMetafile := TMetafile.Create;

with TMetafileCanvas.Create(MyMetafile, 0) do
try
  Brush.Color := clRed;
  Ellipse(0,0,100,100);
  ...
finally
  Free;

end;
PaintBox1.Canvas.Draw(0,0,MyMetafile); {1 red circle }

To add to an existing metafile image, create a metafile canvas and play the
source metafile into the metafile canvas:

with TMetafileCanvas.Create(MyMetafile, 0) do

try
  Draw(0,0,MyMetafile);
  Brush.Color := clBlue;
  Ellipse(100,100,200,200);
...
finally
  Free;

end;

Form1.Canvas.Draw(0,0,MyMetafile); {1 red circle and 1 blue circle }

Re:I need a program generating Delphi source code


Quote
>But which graphic application ready to use can save just made
>drawings in wmf format  (conversion is out of the question as
>bmp ->wmf would produce a large wmf) ?

Most vector based illustration software can export to WMF and EMF.  Examples
include CorelDraw, Adobe Illustrator, MS Draw.

Regards,

Wayne

Re:I need a program generating Delphi source code


Quote
Mariusz Jdrzejowski <mruc...@friko7.onet.pl> wrote in message

news:01beffc8$f7bc2fc0$LocalHost@humanizm...

Quote
> But which graphic application ready to use can save just made drawings in
wmf
> format  (conversion is out of the question as bmp ->wmf would produce a
large
> wmf) ?

Most vector-based Windows drawing tools can output metafiles.  Visio and
Corel Draw come to mind.  If you have a choice, use EMF instead of WMF.  EMF
is much more accurate and less error prone than the old 16 bit WMF format.

Quote
> Having one I could perhaps store wmf files in resource and load them from
> resource ?

Sure, works great.

Quote
> Might take just as much time as loading bmp. I need to load one 640x480
image
> in half a second.

It shouldn't take 500 milliseconds to load a 640x480 bmp file, unless you
have 20 or 30 of them running around in memory and thrashing your swap file.

Depending on how complex your drawings are, drawing on the screen with
discreet source code operations could take longer than drawing a bitmap.
Drawing with metafiles will have exactly the same performance as drawing
with source code.  On NT, metafiles may draw a little bit faster than source
code because of fewer round-trip calls into GDI.

-Danny Thorpe

--
Delphi created here:
http://albums.photopoint.com/j/AlbumIndex?u=57458&a=435308

Other Threads