View previous topic :: View next topic |
Author |
Message |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Mon Mar 11, 2013 11:22 am Post subject: EXPORT_IMAGE@ |
|
|
I am using the EXPORT_IMAGE@ function for exporting my graphics to the different types of image files.
Everything is working fine except the file type .emf. The function returns a zero value for non-successful execution and no .emf file is created. What might be the problem?
By the way: it would be nice, if EXPORT_IMAGE@ could also support the file type .png.
Detlef Pannhorst |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Wed Mar 13, 2013 8:43 am Post subject: EXPORT_IMAGE@ |
|
|
Since there is no answer yet, I repeat my question:
Is the file type .emf supported, as described in the FTN95 help?
Detlef Pannhorst |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Mar 13, 2013 9:22 am Post subject: |
|
|
Sorry I missed your first post.
For me the function creates the file but returns zero.
Also in my sample the background colour of the resulting image is white when it should be black.
What do you get if you ignore the returned zero?
I will log this for further investigation. |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Wed Mar 13, 2013 10:01 am Post subject: |
|
|
Return code is zero and no emf file is created. All other types are working correctly. |
|
Back to top |
|
 |
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: D�sseldorf, Germany
|
Posted: Wed Mar 13, 2013 10:52 am Post subject: |
|
|
Detlef, perhaps you can use WMF instead of EMF. You can export graphics as WMF to the clipboard using something like this:
Code: | j = open_printer1@(7)
if (j .eq. 1) then
j = open_metafile@(7)
if (j .eq. 1) then
c
c display your graphics to screen
c
j = metafile_to_clipboard@()
end if
j = close_metafile@(7)
j = close_printer_only@(7)
end if |
Regards - Wilfried |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Wed Mar 13, 2013 11:51 am Post subject: |
|
|
Wilfried,
thanks for your suggestion. I have an own routine for writing WMF or EMF files already. But I'm also using EXPORT_GRAPHIC@ for the other file formats and it would have been nice and easier if the emf type export would work.
Regards, Detlef |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Wed Mar 13, 2013 11:53 am Post subject: |
|
|
Sorry, the function is named of cause EXPORT_IMAGE@ (not EXPORT_GRAPHIC@). |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Wed Mar 13, 2013 11:54 am Post subject: |
|
|
Paul,
what do you think about my suggestion for the support of file type png?
Detlef |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Mar 20, 2013 5:57 pm Post subject: |
|
|
I have had a brief look at export_graphics@.
Writing to a file requires an open metafile. A quick and nasty way to get some output is illustrated here...
Code: | winapp
program gr3
integer ctrl,i,h
include <clearwin.ins>
i=winio@('%gr[rgb_colours]%lw',320,200,ctrl)
i=open_metafile@(0)
call draw_filled_rectangle@(0,0,320,200,0)
call draw_line_between@(0,0,320,200,RGB@(255,0,0))
call draw_line_between@(0,200,320,0,RGB@(0,255,0))
call draw_ellipse@(160,100,50,30,RGB@(0,0,255))
i=export_image@("file.emf")
i=close_metafile@(0)
end
|
There are at least two problems with this.
1) The background filling does not appear in the file.
2) An internal call to the Windows API function PlayEnhMetaFile fails for some unknown reason.
If you can manage without the background and can tolerate the error code then the result may be useful in some situations.
In theory there is support for bmp, pcx, emf, gif and jpg files.
I can not see anything for png files and I have no idea how much work this would involve. |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Wed Mar 20, 2013 6:40 pm Post subject: |
|
|
Paul,
I will check your proposal for generating metafiles.
The Portable Network Graphics png is a modern replacement for the gif format.
More information you can find in Wikipedia:
http://en.wikipedia.org/wiki/Portable_Network_Graphics
Maybe you can add this feature for the next release?
Regards,
Detlef |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Thu Mar 21, 2013 12:29 am Post subject: |
|
|
The main improvement from .gif to .png is the improved colour palette.
Robert has helped me with trying to adapt the .gif 256 colour pallette.
A much better solution would be a .png format.
I would expect that implementation of a .png file format is not a trivial exercise.
It would be a very welcome addition. If someone wants to try, by first exporting the graphics image to a DIB_Block, it can be supplied as a utility outside clearwin+.
John |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Mar 21, 2013 8:26 am Post subject: |
|
|
I have had an initial look at what would be required to export to a .png file and it looks quite hopeful. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Mar 27, 2013 6:34 pm Post subject: |
|
|
I have fixed two problems regarding export_image@ for .emf files.
The background is now drawn and a false error code has been suppressed.
I have uploaded a beta version of salflibc.dll to http://www.silverfrost.com/beta/salflibc.exe
This is a self-extracting archive and this DLL supersedes the latest release. |
|
Back to top |
|
 |
dpannhorst
Joined: 29 Aug 2005 Posts: 165 Location: Berlin, Germany
|
Posted: Thu Mar 28, 2013 9:54 am Post subject: |
|
|
It's working fine now! Thanks for your help! |
|
Back to top |
|
 |
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Fri Mar 29, 2013 1:56 pm Post subject: Re: |
|
|
PaulLaidler wrote: | I have had an initial look at what would be required to export to a .png file and it looks quite hopeful. |
How about using GDI+ for this one?
I guess, you just need these functions:
GdiplusStartup()
GdipCreateBitmapFromGdiDib()
GdipSaveImageToFile()
GdipDisposeImage()
GdiplusShutdown()
You will also need this info:
image/png CLSID : {557cf406-1a04-11d3-9a73-0000f81ef32e}
If you or someone else provides a little information, how ClearWin+ handles DIB's, then I can probably post something working... |
|
Back to top |
|
 |
|