History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: FVG-300
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mark Donszelmann
Reporter: Steffen Greiffenberg
Votes: 0
Watchers: 0
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
FreeHEP Vector Graphics

Major improvements for EMFRenderer

Created: 19/Jan/07 09:33 AM   Updated: 10/Jun/07 08:55 AM
Component/s: EMF
Affects Version/s: 2.0
Fix Version/s: 2.1

File Attachments: 1. Text File 2007-01-19.txt (129 kb)
2. Text File 2007-01-20.txt (1 kb)
3. Text File 2007-01-21.txt (275 kb)
4. Text File 2007-01-23.txt (28 kb)
5. Text File 2007-01-30.txt (17 kb)
6. Text File 2007-01-31.txt (29 kb)
7. Java Source File EMF2SVG.java (2 kb)

Issue Links:
Needs
 
See also
 


 Description  « Hide
Improvements of EMFRenderer
=========================
 - added several drawing commands (e.g. PolylineTo16),
   mainly based on what the Office 2003 under XP creates
 - added image handling (AlphaBlend, BitBlt, StretchDIBits)
 - added the ability to draw more than once with that renderer :)
    the tag-map is build at construction time and reused during
   paint
 - added / fixed BeginPath / EndPath this functions redirect
   all drawings to some kind of off-screen-figure which can be later
   used as clip or figure

- fixed SaveDC / StoreDC
 - fixed handling of LineTo, CurveTo etc., a currentFigure stores
   all this drawings from MoveToExt until CloseFigure
 - fix / redesign of clip and transformation handling

- found some interesting (nearly) bugs in EMFGraphics2D, will fix
   that later, e.g. PolylineTo after CloseFigure etc.

EMFImageLoader
==============
 - this class loads a bitmap from byte[]
 - used in AlphaBlend, BitBlt, StretchDIBits
 - supported till now is what Powerpoint 2003 creates :)

EMFViewer
=========

- added a JFrame to view EMF, EMFDisplay now uses this class
 - added an EMFPanel wich uses the EMFRenderer during
   paintCompoment. This is a very simple and reusable panel for
   EMF display

Open
====
 - EMF implements different clipping- and transformation
   concepts like window, viewport and device. They could be
   implemented to make clipping / transformation much clearer
 - We could combine the EMFRenderer and SVGGraphics2D
   in EMF2SVG. With the new functions this should work
   quite well @Mark: will you do so?
 - There could (should?) be a bit more inheritance in the
   GDI classes, e.g. PolylineTo16 and PolylineTo
 - add the other image formats to EMFImageLoader
 - the embedding of EMF in EMF needs a fix. The offset
   and scaling is wrong
 - GDIComment seems to store some image data. I've found
   some strange tags :) and added a
   GDICOMMENT_WINDOWS_METAFILE, but I'm quite sure
   that this will _not_ work

 All   Comments   Change History      Sort Order:
Mark Donszelmann - 19/Jan/07 10:49 AM
Will apply the patch soon.

Did you have a look at EMF+ as well. I wrote a provisional driver for it on a branch in SVN, see one
of our forums. EMF+ is embedded in GDIComments.

Mark Donszelmann - 19/Jan/07 01:45 PM
Ready to apply your patch, but I seem to be missing:

ImageUtilities.createBufferedImage


Steffen Greiffenberg - 20/Jan/07 01:38 AM
Sorry ... simply forgot the "svn diff" for the base trunk.

BTW: what do you think about moving the drawing from the method EMFRenderer.map(Tag, Graphics2D) to a new method EMFTag.map(EMFHandler). This method should contain nothing in the base class

and has to be overloaded be the subclasses, e.g. AlphBlend. Subclasses are responsible for there own drawing. Doing so would led to a simple call of tag.map(this) in the EMFRenderer and

remove that huge map(Tag, Graphics2D) method.

EMFRenderer will still be responsible for storing the persistent informations (clippings, current figure and path etc.). Let me know your thoughts, I'll do this stupid task :)


Regards
Steffen

Mark Donszelmann - 20/Jan/07 07:35 AM
Applied both your diffs with some minor changes. Seems to compile fine now with new freehep-util.

Yes, please go ahead and make the suggested move. My question is if that method should be called "map". What does
it map. Does it not just render the tag, or execute it, or display?

Regards
Mark

Steffen Greiffenberg - 21/Jan/07 01:12 PM
EMF2SVG
=======

- used a combination of SVGraphics2D and
   EMFRenderer
 - some wordart objects still show wrong
   background gradients, SVGGraphics2D
   needs a fix

EMFRenderer
===========

- fixed the drawing of embedded EMF,
   MWT_LEFTMULTIPLY must be set for
   ModifyWorldTransformation
 - fixed drawing if path has opened
 - renamed some local variables in
   EMFRenderer, added getters / setters
   for the EMFTags
 - moved the rendering functions to the
   gdi package, that was a lot of work ...
 - implemented inheritance to avoid code
   duplication


EMFViewer
=========
 
- fixed the file name display

EMFInputStream
==============

- removed IOException from constructors

EMFragphics2D
=============

- removed 2 not needed local variables

Mark Donszelmann - 21/Jan/07 01:58 PM
Hi

just saw your patch. Will apply it tomorrow morning or tonight.

However two remarks:

1. TestSuite already has TestRenderingHints at the alphabetically correct place.
2. We will need to move EMF2SVG to a separate module, since we cannot really have
EMF depend on SVG. What if someone wrote a SVG2EMF converter, SVG would need
to depend on EMF. So I suggest I will create a separate module with name freehep-graphicsio-converters
which can depend on any/all graphicsio modules and we move EMF2SVG in there.
I believe we already have another converter somewhere...

Let me know
Mark

Mark Donszelmann - 22/Jan/07 08:06 AM
patch does not seem to work on file EMF2SVG.java. Could you attach full file here. Other files are ok.

Steffen Greiffenberg - 22/Jan/07 11:00 AM
@1: I still get merging conflicts after you checking in "my" changes. So sorry if this happens.

@2: We can get rid of the dependency and we can convert to all available formats by using "ExportFileTypeRegistry.getDefaultInstance(loader).get(format)" wouldn't this be better?

Do the ExportFileTypes run without a GUI or do we get exceptions in a command-line-only environment because a window server isn't available?


Regards
Steffen

Mark Donszelmann - 22/Jan/07 11:26 AM
@1: Every patch you hand me I need to "normalize line endings" to get something reasonable...I use MacOS X while I think you use windows. Not sure how to handle this...

@2: Sounds ok as well. EFT should work without the windows server.

Checked in the patch, with deps on SVG for now. Feel free to change @2.


Steffen Greiffenberg - 23/Jan/07 06:27 AM
EMFPanel
========

- fixed a NPE if the EMF file was not found

AbstractArc
=========

- added some inheritance
 - added SetArcDirection and an corresponding attribute
   in the EMFRenderer

GDIComment
===========
 
- fixed an error if length == 0

ModifyWorldTransform
==================

- added MWT_IDENTITY
   (not tested)
 - added MWT_RIGHTMULTIPLY
   (tested and uncommented because
   the behaviour is wrong, not clear why)

new functions
===========

- RoundRect, IntersectClipRect


@Mark: do you know what a 4 byte long AlphaDIBBlend (id = 115) contains? It seems to be a setting for a later call to AlphaBlend which is used for image embedding in powerpoint.


Mark Donszelmann - 23/Jan/07 07:44 AM
Applied your latest patch. Revision 10377.

Did you do the part on ExportFileTypeRegistry.getDefaultInstance(loader).get(format), if so I can take out the
dependency on SVG.

I have no idea about the AlphaDIBBlend. Doc on EMF is not very readily available.

Thanks again
Mark

Steffen Greiffenberg - 23/Jan/07 10:07 AM
sorry, not before the end of next week ...

Regards
Steffen

Mark Donszelmann - 23/Jan/07 10:21 AM
Sure, no hurry.

Thanks
Mark

Steffen Greiffenberg - 30/Jan/07 01:17 AM
PrintColor
========

- fixed a NPE if setPaint(null) happens

EMFConverter
===========

- added an "EMF to anything" converter for the command line
 - the class works as good as the drivers, using some
   "complex" EMF files the vector graphic drivers can't hide
   their flaccidities no more :), e.g. try:
   EMFConverter testfile.emf testfile_testfile.emf

EMF2SVG
========

- based on EMFConverter now

AbstractPolyPolyline
================

- added rendering for the EMF tags PolyPolyline and
   PolyPolyline16, which is "often" used by Visio 2003
 - made AbstractPolyPolygon a bit more generic

StretchDIBits
==========

- fixed a NPE


Mark Donszelmann - 30/Jan/07 03:58 PM
Patched 30-1.txt


Steffen Greiffenberg - 31/Jan/07 08:18 AM
EMF tags
========

- added AbstractClipPath as a parent for all clipping tags
 - added ExtSelectClipRgn
 - added InsideFrameStroke in AbstractPen for the handling of
   EMFConstants.PS_INSIDEFRAME
 - added CreateDIBPatternBrushPt for painting bitmap textures
 - added a case in EMFImageLoader for monochrome images,
   this still needs a fix
 - added a warning in SelectObject if the GDIObject was
   not found

EMFRenderer
===========

- fixed getBounds(), the mapModeTransformation is now
   commented out because it does not work. Maybe we can
   reactivate it later

Mark Donszelmann - 06/Feb/07 10:42 AM
Patch 31 applied. Revision 10515

Mark Donszelmann - 08/Jun/07 02:10 PM
Whats is left to be done here is the removal of the dependency on svg from emf.

Steffen Greiffenberg - 10/Jun/07 01:05 AM
There is no dependency. EMF2SVG is based on EMFConverter which uses ExportFileType.exportToFile(...).

Mark Donszelmann - 10/Jun/07 08:55 AM
Quite right.