Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, December 2007
how to load and display emf images?


Message 1 in thread

Hi all,

Is there a way to load and display emf pics? In QPixmap doc, it does not support emf format image.
I don't know how to do this thing.

Raymond




llzhu1984
2007-12-24

Message 2 in thread

On Monday 24 December 2007 07:06:03 pm llzhu1984 wrote:
> Hi all,
>
> Is there a way to load and display emf pics? In QPixmap doc, it does not
> support emf format image. I don't know how to do this thing.
I haven't found anything, but would also appreciate any pointers.
At this stage I'm aware of the various tools and documentation from the wvWare 
project:
http://wvware.sourceforge.net/libwmf.html
http://wvware.sourceforge.net/caolan/index.html
http://wvware.sourceforge.net/caolan/ora-wmf.html

Also http://libemf.sourceforge.net, but that appears to only be an EMF writer 
(i.e. it can't input EMF and generate an image)

To actually get to a QImage or QPixmap, I think you'd need to parse the EMF 
file and convert the various GDI-type operations to operations on a QPainter.  
It may or may not be very difficult - I haven't tried it yet.

If you (or anyone else) does get a start on this, I may be interested in 
collaborating on it.

Brad

--
 [ signature omitted ] 

Message 3 in thread

Hi,

since EMF is rather a vector format it might make sense to import it into a 
QGraphicsScene instead of a QBitmap or QImage.

The format description (windows help file) can be obtained here: 
http://www.wotsit.org/getfile.asp?file=emf&sc=251871739

Moreover, OpenOffice can import EMF files, so example source code should 
also be available.

Regards,
Bernd

On Tuesday 25 December 2007, Brad Hards wrote:
> On Monday 24 December 2007 07:06:03 pm llzhu1984 wrote:
> > Hi all,
> >
> > Is there a way to load and display emf pics? In QPixmap doc, it does
> > not support emf format image. I don't know how to do this thing.
>
> I haven't found anything, but would also appreciate any pointers.
> At this stage I'm aware of the various tools and documentation from the
> wvWare project:
> http://wvware.sourceforge.net/libwmf.html
> http://wvware.sourceforge.net/caolan/index.html
> http://wvware.sourceforge.net/caolan/ora-wmf.html
>
> Also http://libemf.sourceforge.net, but that appears to only be an EMF
> writer (i.e. it can't input EMF and generate an image)
>
> To actually get to a QImage or QPixmap, I think you'd need to parse the
> EMF file and convert the various GDI-type operations to operations on a
> QPainter. It may or may not be very difficult - I haven't tried it yet.
>
> If you (or anyone else) does get a start on this, I may be interested in
> collaborating on it.
>
> Brad

--
 [ signature omitted ] 

Message 4 in thread

On Tuesday 25 December 2007 09:29:44 pm Bernd Brandstetter wrote:
> since EMF is rather a vector format it might make sense to import it into a
> QGraphicsScene instead of a QBitmap or QImage.
I'm interested in what the advantage of this might be over (say) just using a 
QPainter directly on a QImage?

> The format description (windows help file) can be obtained here:
> http://www.wotsit.org/getfile.asp?file=emf&sc=251871739
>
> Moreover, OpenOffice can import EMF files, so example source code should
> also be available.
My previous testing showed that OpenOffice could open some ".emf" files, but 
not all.  It looks like there may be "EMF+" extensions. See:
http://www.protocolfreedom.org/PFIF_agreement.pdf

Brad

--
 [ signature omitted ] 

Message 5 in thread

Hi,

On Tuesday 25 December 2007, Brad Hards wrote:
> On Tuesday 25 December 2007 09:29:44 pm Bernd Brandstetter wrote:
> > since EMF is rather a vector format it might make sense to import it
> > into a QGraphicsScene instead of a QBitmap or QImage.
>
> I'm interested in what the advantage of this might be over (say) just
> using a QPainter directly on a QImage?

the advantage is simply that the view could be zoomed in and out without 
losing details or getting pixelated. If this is not required then using a 
QImage is of course sufficient.

Regards,
Bernd

--
 [ signature omitted ]