Bug 105938 - [Print] PrinterGraphics.rotate() doesn't work properly
Summary: [Print] PrinterGraphics.rotate() doesn't work properly
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-03 11:54 EDT by Wayne CLA
Modified: 2010-11-04 07:36 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne CLA 2005-08-03 11:54:30 EDT
The rotate method of PrinterGraphics does not work properly.  For example, in 
PrintFigureOperation.printPages(), add
  graphics.rotate(90);
right before
  figure.paint(graphics);

You will see this error in the log
!MESSAGE The class: class org.eclipse.draw2d.PrinterGraphics has not 
implemented this new graphics function
!STACK 0
java.lang.RuntimeException: The class: class org.eclipse.draw2d.PrinterGraphics 
has not implemented this new graphics function
	at org.eclipse.draw2d.Graphics.subclassFunctionMission
(Graphics.java:897)
	at org.eclipse.draw2d.Graphics.rotate(Graphics.java:702)
	at 
org.eclipse.gef.examples.logicdesigner.actions.RotatePrintGraphicalViewerOperati
on.printPages(RotatePrintGraphicalViewerOperation.java)
	at org.eclipse.draw2d.PrintOperation.run(PrintOperation.java:155)
	at org.eclipse.gef.examples.logicdesigner.actions.LogicPrintAction.run
(LogicPrintAction.java)
	at org.eclipse.ui.internal.PluginAction.runWithEvent
(PluginAction.java:246)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:538)
	at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent
(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3070)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2703)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Comment 1 Randy Hudson CLA 2005-08-08 11:21:00 EDT
rotate is a new function and it doesn't work for ScaledGraphics and its 
subclasses.

You could try applying a Transform to SWT's GC prior to handing it off to the 
draw2d graphics.
Comment 2 Wayne CLA 2005-11-04 15:25:27 EST
Hi Randy, I tried your suggestion but it doesn't seem to work.  I just get 
blank pages.  Is PrinterGraphics never going to support rotate()?
Comment 3 Randy Hudson CLA 2005-11-05 11:12:52 EST
Maybe you rotated everything in to the negative Y coordinates. You probably 
need to rotate about the bottom left corner of the page and not the origin. 
Can't the user just switch between landscape and portrait orientation?
Comment 4 Wayne CLA 2005-11-07 10:46:52 EST
Hi Randy, actually, setting even the default transform into the GC and then 
passing it into the Graphics results in a distorted image.

gc.setTransform(new Transform(device));
Graphics g = new SWTGraphics(gc);

The scaling and clipping performed on the graphics is completely off.  So, 
unfortunately, this suggestion doesn't seem to work.



The user can switch between landscape and orientation, but this is what we were 
trying to avoid! :)
Comment 5 Randy Hudson CLA 2005-11-07 12:05:17 EST
If the identity transform doesn't work then you can imagine that rotating is 
not going to be very successful either. Both trigger the use of GDI+ on win32.

We have tried printing with GDI+ and it works in some scenarios and with some 
printer drivers. I think bidi doesn't work though.
Comment 6 Rich Naylor CLA 2010-09-14 15:35:41 EDT
This defect has been open for 5 years now, are there any plans to fix this issue ?
Comment 7 Alex Boyko CLA 2010-09-15 14:39:32 EDT
There is no target milestone, so I guess there is no plan to fix it yet. My guess is it would be fixed for 3.7. If you can provide a patch that'd be great.