#20 howto print Figure

closed-out-of-date
None
5
2007-01-23
2007-01-11
Mark Geib
No

I am trying to print Figure data, and I can not find howto convert to Image, etc.

Would it be possible to provide a FigurePrint class..?

Thanks,
Mark.

Discussion

  • Matthew Hall

    Matthew Hall - 2007-01-11

    Logged In: YES
    user_id=168544
    Originator: NO

    Are you talking about draw2d/GMF?

     
  • Mark Geib

    Mark Geib - 2007-01-11

    Logged In: YES
    user_id=387881
    Originator: YES

    Sorry, yes. org.eclipse.draw2d.IFigure

    I have developed a graphical editor, which I can get IFigure data for, but not Image data.

    Mark.

     
  • Matthew Hall

    Matthew Hall - 2007-01-11

    Logged In: YES
    user_id=168544
    Originator: NO

    It's up to you to decide what size in pixels you want the image to be (between getMinimumSize()/getPreferredSize()/getMaximumSize(), but once you figure that out, I think this is how you would go about it:

    (Disclaimer, I've never used draw2d before so this is just a guess)

    Image image = new Image(display, size.x, size.y);
    GC gc = new GC(image);
    SWTGraphics graphics = new SWTGraphics(gc);
    figure.setSize(size.x, size.y);
    figure.paint(graphics);

    ImageData imageData = image.getImageData();
    graphics.dispose();
    gc.dispose();
    image.dispose();

    From there you can print the figure using an ImagePrint. Make sure to set either the ImagePrint's size or DPI so it comes out at the display aspect you're looking for.

    Let me know if this works.

     
  • Mark Geib

    Mark Geib - 2007-01-11

    Logged In: YES
    user_id=387881
    Originator: YES

    Thanks for the help. I will try this in the next few days.

    I will let you know.

    Mark.

     
  • Matthew Hall

    Matthew Hall - 2007-01-17

    Logged In: YES
    user_id=168544
    Originator: NO

    Any luck?

     
  • Matthew Hall

    Matthew Hall - 2007-01-17
    • assigned_to: nobody --> qualidafial
     
  • Matthew Hall

    Matthew Hall - 2007-01-23

    Logged In: YES
    user_id=168544
    Originator: NO

    No response from submitter, closing as Out of Date

     
  • Matthew Hall

    Matthew Hall - 2007-01-23
    • status: open --> closed-out-of-date
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks