Hi,
usually I do have a black background in my universe. I want to change that
for printing. I had a look at PrintCanvas3D.java for my implementation of
printing. Is there a possibility to change the background color of the
OffscreenCanvas3D, without changing the showing Canvas3D? Currently I add
a bachground node just before printing and detach it afterwards,
unfortunately that results in a few seconds white background during the
print operation.

Thanks for your help in advance Desiree

    public void createPrintCanvas() {

        // Background
        Background background = new Background(1,1,1);
        background.setApplicationBounds(mouseBounds);
        BranchGroup backgroundBg = new BranchGroup();
        backgroundBg.setCapability(BranchGroup.ALLOW_DETACH);
        backgroundBg.addChild(background);

        GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
        OffScreenCanvas3D offScreenCanvas3d = new
OffScreenCanvas3D(config,true);

        // Set the off-screen size based on a scale factor times the
        // on-screen size
        Screen3D sOn = c.getScreen3D();
        Screen3D sOff = offScreenCanvas3d.getScreen3D();
        Dimension dim = sOn.getSize();
        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;
        sOff.setSize(dim);
        sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth() *
                                    OFF_SCREEN_SCALE);
        sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight() *
                                         OFF_SCREEN_SCALE);

        // attach the offscreen canvas to the view
        u.getViewer().getView().addCanvas3D(offScreenCanvas3d);
        Point loc = c.getLocationOnScreen();
        offScreenCanvas3d.setOffScreenLocation(loc);
        dim = c.getSize();
        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;
        scene.addChild(backgroundBg);
        bImage = offScreenCanvas3d.doRender(dim.width, dim.height);
        backgroundBg.detach();
    }


oooooooooooooooooooooooooooooooooooooooooooooooo
Desiree Hilbring

Institut fuer Photogrammetrie und Fernerkundung
Universitaet Karlsruhe, Germany
email: [EMAIL PROTECTED]
# 0721 6083676
oooooooooooooooooooooooooooooooooooooooooooooooo

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to