Board index » delphi » emf and wmf displaying

emf and wmf displaying

Hello I am trying to display on screen EMF and WMF formatted images.
I am using windows 98 and Delphi 3.0
Here is in short what I have tried ;
.....
Pict.LoadFromFile(' here filename of EMF or WMF file');
form1.image1.canvas.stretchDraw(Rect(0,0,w,h),Pict.Graphic);
....
Now I get an image allright in the visual component image1, ONLY it does NOT
Look nice!! It looks as if it is transparent or has gone trough a filter...

This method works well with JPG end BMP , so what can I do to have my EMF
,WMF pictures to be drawn correct?

regards,
 Peter Croes

 

Re:emf and wmf displaying


--
MGCSoft Equation Editors
"Where graphics meets mathematics"
http://www.mgcsoft.com/

Quote
colleen croes <sb096...@wolmail.nl> wrote in message

news:39a6bfda_2@dnews...
Quote
> Hello I am trying to display on screen EMF and WMF formatted images.
> I am using windows 98 and Delphi 3.0
> Here is in short what I have tried ;
> .....
> Pict.LoadFromFile(' here filename of EMF or WMF file');
> form1.image1.canvas.stretchDraw(Rect(0,0,w,h),Pict.Graphic);
> ....
> Now I get an image allright in the visual component image1, ONLY it does
NOT
> Look nice!! It looks as if it is transparent or has gone trough a
filter...

> This method works well with JPG end BMP , so what can I do to have my EMF
> ,WMF pictures to be drawn correct?

EMFs/WMFs are always  transparent. Try
Image1.Canvas.FillRect(Image1.ClientRect) with the brush in whatever color
you want before drawing the metafile.

I haven't tried it but it should work.

Gordon.

Re:emf and wmf displaying


Hi Gordon,

I added (before the stretchdraw...)
  image1.canvas.brush.color:=clwhite;
  image1.canvas.FillRect(image1.ClientRect);

But to no avail!
Still the same messy image. You have to try it for yourself

So who does know how to solve this?

=============================================

"Gordon Whittam" <gor...@mgcsoft.com> schreef in bericht
news:39a78250_2@dnews...

Quote

> --
> MGCSoft Equation Editors
> "Where graphics meets mathematics"
> http://www.mgcsoft.com/
> colleen croes <sb096...@wolmail.nl> wrote in message
> news:39a6bfda_2@dnews...
> > Hello I am trying to display on screen EMF and WMF formatted images.
> > I am using windows 98 and Delphi 3.0
> > Here is in short what I have tried ;
> > .....
> > Pict.LoadFromFile(' here filename of EMF or WMF file');
> > form1.image1.canvas.stretchDraw(Rect(0,0,w,h),Pict.Graphic);
> > ....
> > Now I get an image allright in the visual component image1, ONLY it does
> NOT
> > Look nice!! It looks as if it is transparent or has gone trough a
> filter...

> > This method works well with JPG end BMP , so what can I do to have my
EMF
> > ,WMF pictures to be drawn correct?

> EMFs/WMFs are always  transparent. Try
> Image1.Canvas.FillRect(Image1.ClientRect) with the brush in whatever color
> you want before drawing the metafile.

> I haven't tried it but it should work.

> Gordon.

Re:emf and wmf displaying


Hi Peter,

  I'm not sure why you're using stretchdraw to get an image onto the TImage
canvas, but maybe you can try this method.

  I have a thumbnail program that displays the images in a TImage, and the
WMF/EMF look just fine.

  Make the TImage properties Autosize=false and Stretch=true.  Then, instead
of loading into a ? TPicture and stretchdrawing, load the image directly
into the TImage.Picture:
Image1.Picture.LoadFromFile('name.of.emf.or.wmf');

Or, barring that you might try assigning

Image1.Picture.Assign(Pict);

Other ideas:

  First convert to a bitmap, then draw or stretchdraw the bitmap.

HTH,

--
Harm

http://www.users.uswest.net/~sharman1/

Cool Graphics, for free!

Quote
"colleen croes" <sb096...@wolmail.nl> wrote in message

news:39a6bfda_2@dnews...
Quote
> Hello I am trying to display on screen EMF and WMF formatted images.
> I am using windows 98 and Delphi 3.0
> Here is in short what I have tried ;
> .....
> Pict.LoadFromFile(' here filename of EMF or WMF file');
> form1.image1.canvas.stretchDraw(Rect(0,0,w,h),Pict.Graphic);
> ....
> Now I get an image allright in the visual component image1, ONLY it does
NOT
> Look nice!! It looks as if it is transparent or has gone trough a
filter...

> This method works well with JPG end BMP , so what can I do to have my EMF
> ,WMF pictures to be drawn correct?

> regards,
>  Peter Croes

Re:emf and wmf displaying


--
MGCSoft Equation Editors
"Where graphics meets mathematics"
http://www.mgcsoft.com/

Quote
colleen croes <sb096...@wolmail.nl> wrote in message

news:39a98c39_2@dnews...

Quote
> Hi Gordon,

> I added (before the stretchdraw...)
>   image1.canvas.brush.color:=clwhite;
>   image1.canvas.FillRect(image1.ClientRect);

> But to no avail!
> Still the same messy image. You have to try it for yourself

> So who does know how to solve this?

Harms posting may well be a better way of doing what you want, BTW. I do
indirectly do this all the time, I just hadn't tried it exactly as written.

It might depend on what's actually in the metafile. If it isn't true vector
information, ie., it has a bitmap drawn in it, it may well look messy.
Bitmaps in metafiles, particularly if the bitmap has characters or lines on
it, don't stretch any better than ordinary bitmaps. Which for vector and
font/character information, is dire.

Gordon.

Re:emf and wmf displaying


Quote
> Now I get an image allright in the visual component image1, ONLY it does
NOT
> Look nice!! It looks as if it is transparent or has gone trough a

filter...

How does it distort it?

I have Delphi 4 and have a problem with margin removal when loading wmf's or
emf's. I know its fixed in Delphi 5.

Dan Downs

Re:emf and wmf displaying


Hi Harm,

Your Idea works ok,thanks. But I came to do it 'my' way because I had to
have the options to have a thumbnail and a sort of preview image that could
be enlarged, plus I had to do a draw on the Printer.Canvas.

I thought that when I do a Pict.loadfromFile I would have maximum
information
to enlarge the image in the preview and Printer-canvas.
But when I do an Image1.Picture.Loadfromfile I have only the dimensions of
my thumbnail image. And I have to do a
review.canvas.stretchDraw(Rect(  ),image1.picture.graphic); It seems to me
that it will have less resolution..
or .....

Please advise me

regards,
Peter
"Harm" <sharm...@uswest.net> schreef in bericht
news:8oc428$14c7@bornews.borland.com...

Quote
> Hi Peter,

>   I'm not sure why you're using stretchdraw to get an image onto the
TImage
> canvas, but maybe you can try this method.

>   I have a thumbnail program that displays the images in a TImage, and the
> WMF/EMF look just fine.

>   Make the TImage properties Autosize=false and Stretch=true.  Then,
instead
> of loading into a ? TPicture and stretchdrawing, load the image directly
> into the TImage.Picture:

> Image1.Picture.LoadFromFile('name.of.emf.or.wmf');

> Or, barring that you might try assigning

> Image1.Picture.Assign(Pict);

> Other ideas:

>   First convert to a bitmap, then draw or stretchdraw the bitmap.

> HTH,

> --
> Harm

> http://www.users.uswest.net/~sharman1/

> Cool Graphics, for free!
> "colleen croes" <sb096...@wolmail.nl> wrote in message
> news:39a6bfda_2@dnews...
> > Hello I am trying to display on screen EMF and WMF formatted images.
> > I am using windows 98 and Delphi 3.0
> > Here is in short what I have tried ;
> > .....
> > Pict.LoadFromFile(' here filename of EMF or WMF file');
> > form1.image1.canvas.stretchDraw(Rect(0,0,w,h),Pict.Graphic);
> > ....
> > Now I get an image allright in the visual component image1, ONLY it does
> NOT
> > Look nice!! It looks as if it is transparent or has gone trough a
> filter...

> > This method works well with JPG end BMP , so what can I do to have my
EMF
> > ,WMF pictures to be drawn correct?

> > regards,
> >  Peter Croes

Re:emf and wmf displaying


Hi Dan,

I think my problem differs from yours, as I wrote it looks as if it was
altered using a filter, some colors are different from the original and
there are smudges. But then this appearence differs with each EMF-file..

Peter

========================================
"Dan Downs" <d...@laserformsinc.com> schreef in bericht
news:8odsj8$iql8@bornews.borland.com...

Quote
> > Now I get an image allright in the visual component image1, ONLY it does
> NOT
> > Look nice!! It looks as if it is transparent or has gone trough a
> filter...

> How does it distort it?

> I have Delphi 4 and have a problem with margin removal when loading wmf's
or
> emf's. I know its fixed in Delphi 5.

> Dan Downs

Other Threads