当前位置: 首页>>代码示例>>Java>>正文


Java GraphicsConfigTemplate类代码示例

本文整理汇总了Java中java.awt.GraphicsConfigTemplate的典型用法代码示例。如果您正苦于以下问题:Java GraphicsConfigTemplate类的具体用法?Java GraphicsConfigTemplate怎么用?Java GraphicsConfigTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GraphicsConfigTemplate类属于java.awt包,在下文中一共展示了GraphicsConfigTemplate类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCanvas3D

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Creates the Canvas3D to visualize the 3D World. Used only in the creation
 * phase.
 */
private void createCanvas3D() {
	GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
	template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
	GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
	// create canvas
	canvas3d = new Canvas3D(config);
	canvas3d.setDoubleBufferEnable(true);

	// display j3d info
	Map map = canvas3d.queryProperties();
	System.out.println("doubleBufferAvailable = " + map.get("doubleBufferAvailable"));
	System.out.println("sceneAntialiasingNumPasses = " + map.get("sceneAntialiasingNumPasses"));
	System.out.println("sceneAntialiasingAvailable = " + map.get("sceneAntialiasingAvailable"));
	System.out.println("texture3DAvailable = " + map.get("texture3DAvailable"));

}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:21,代码来源:World.java

示例2: getOffScreenCanvas

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
private Canvas3D getOffScreenCanvas() {
	if (offScreenCanvas3D != null) return offScreenCanvas3D;

	final GraphicsConfigTemplate3D templ = new GraphicsConfigTemplate3D();
	templ.setDoubleBuffer(GraphicsConfigTemplate.UNNECESSARY);
	final GraphicsConfiguration gc =
		GraphicsEnvironment.getLocalGraphicsEnvironment()
			.getDefaultScreenDevice().getBestConfiguration(templ);

	offScreenCanvas3D = new Canvas3D(gc, true);
	final Screen3D sOn = canvas3D.getScreen3D();
	final Screen3D sOff = offScreenCanvas3D.getScreen3D();
	sOff.setSize(sOn.getSize());
	sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth());
	sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight());

	universe.getViewer().getView().addCanvas3D(offScreenCanvas3D);

	return offScreenCanvas3D;
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:21,代码来源:ImageWindow3D.java

示例3: createCanvas3D

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Creates the Canvas3D to visualize the 3D World. Used only in the creation
 * phase.
 */
private void createCanvas3D() {
  GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
  template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
  GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
  // create canvas
  canvas3d = new Canvas3D(config);
  canvas3d.setDoubleBufferEnable(true);

  // display j3d info
  Map map = canvas3d.queryProperties();
  System.out.println("doubleBufferAvailable = " + map.get("doubleBufferAvailable"));
  System.out.println("sceneAntialiasingNumPasses = " + map.get("sceneAntialiasingNumPasses"));
  System.out.println("sceneAntialiasingAvailable = " + map.get("sceneAntialiasingAvailable"));
  System.out.println("texture3DAvailable = " + map.get("texture3DAvailable"));

}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:21,代码来源:World.java

示例4: createGraphicsConfigurationTemplate3D

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Returns the template to configure the graphics of canvas 3D.
 */
private GraphicsConfigTemplate3D createGraphicsConfigurationTemplate3D()
{
	if (System.getProperty("j3d.implicitAntialiasing") == null)
	{
		System.setProperty("j3d.implicitAntialiasing", "true");
	}
	// Retrieve graphics configuration once 
	GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
	// Try to get antialiasing
	template.setSceneAntialiasing(GraphicsConfigTemplate3D.PREFERRED);
	if (OperatingSystem.isMacOSX() && OperatingSystem.isJavaVersionGreaterOrEqual("1.7"))
	{
		// Request depth size equal to 24 with Java 3D 1.6
		template.setDepthSize(24);
	}
	
	// From http://www.java.net/node/683852
	// Check if the user has set the Java 3D stereo option.
	String stereo = System.getProperty("j3d.stereo");
	if (stereo != null)
	{
		if ("REQUIRED".equals(stereo))
			template.setStereo(GraphicsConfigTemplate.REQUIRED);
		else if ("PREFERRED".equals(stereo))
			template.setStereo(GraphicsConfigTemplate.PREFERRED);
	}
	return template;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:32,代码来源:Component3DManager.java

示例5: createViewPlatform

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
void createViewPlatform() {
	// viewplatform
	viewPlatform = new ViewPlatform();
	viewPlatform.setActivationRadius(100f);
	viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
	// view
	view = new View();

	view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
	view.setViewPolicy(View.SCREEN_VIEW);
	view.attachViewPlatform(viewPlatform);
	// physical body
	PhysicalBody phyBody = new PhysicalBody();
	view.setPhysicalBody(phyBody);
	// physical environment
	PhysicalEnvironment phyEnv = new PhysicalEnvironment();
	view.setPhysicalEnvironment(phyEnv);
	// ???? pas compris , pour l'antiliasing
	GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
	template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
	GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
	// antialiasing
	view.setSceneAntialiasingEnable(true);
	/*
	 * to add a onscreen canvas canvas3d = new Canvas3D(config);
	 * view.addCanvas3D(canvas3d);
	 */
	// attach offscreen canvas to the view
	offscreenCanvas3D = new OffScreenCanvas3D(config);
	offscreenCanvas3D.getScreen3D().setSize(imageWidth, imageWidth);
	offscreenCanvas3D.getScreen3D().setPhysicalScreenHeight(0.5);
	offscreenCanvas3D.getScreen3D().setPhysicalScreenWidth(0.5);
	view.addCanvas3D(offscreenCanvas3D);
	addChild(viewPlatform);
	// turn canvas in front of X axis
	rotateY(-Math.PI / 2);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:38,代码来源:Eye.java

示例6: takeSnapshot

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Returns a snapshot of the given size.
 */
public ImagePlus takeSnapshot(final int w, final int h) {
	final GraphicsConfigTemplate3D templ = new GraphicsConfigTemplate3D();
	templ.setDoubleBuffer(GraphicsConfigTemplate.UNNECESSARY);
	final Canvas3D onCanvas = getCanvas();
	if (offCanvas == null) {
		final GraphicsConfiguration gc =
			GraphicsEnvironment.getLocalGraphicsEnvironment()
				.getDefaultScreenDevice().getBestConfiguration(templ);
		offCanvas = new Canvas3D(gc, true);
		System.out.println("construct canvas");
	}
	final Screen3D sOn = onCanvas.getScreen3D();
	final Screen3D sOff = offCanvas.getScreen3D();
	sOff.setSize(sOn.getSize());
	sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth());
	sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight());
	getViewer().getView().addCanvas3D(offCanvas);

	final Color3f bg = new Color3f();
	((ImageCanvas3D) onCanvas).getBG().getColor(bg);

	BufferedImage bImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
	final ImageComponent2D ic2d =
		new ImageComponent2D(ImageComponent.FORMAT_RGBA, bImage);

	offCanvas.setOffScreenBuffer(ic2d);
	offCanvas.renderOffScreenBuffer();
	offCanvas.waitForOffScreenRendering();
	bImage = offCanvas.getOffScreenBuffer().getImage();

	getViewer().getView().removeCanvas3D(offCanvas);
	return new ImagePlus("Snapshot", bImage);
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:37,代码来源:DefaultUniverse.java

示例7: createViewPlatform

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
void createViewPlatform() {
  // viewplatform
  viewPlatform = new ViewPlatform();
  viewPlatform.setActivationRadius(100f);
  viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
  // view
  view = new View();

  view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
  view.setViewPolicy(View.SCREEN_VIEW);
  view.attachViewPlatform(viewPlatform);
  // physical body
  PhysicalBody phyBody = new PhysicalBody();
  view.setPhysicalBody(phyBody);
  // physical environment
  PhysicalEnvironment phyEnv = new PhysicalEnvironment();
  view.setPhysicalEnvironment(phyEnv);
  // ???? pas compris , pour l'antiliasing
  GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
  template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
  GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
  // antialiasing
  view.setSceneAntialiasingEnable(true);
  /*
   * to add a onscreen canvas canvas3d = new Canvas3D(config);
   * view.addCanvas3D(canvas3d);
   */
  // attach offscreen canvas to the view
  offscreenCanvas3D = new OffScreenCanvas3D(config);
  offscreenCanvas3D.getScreen3D().setSize(imageWidth, imageWidth);
  offscreenCanvas3D.getScreen3D().setPhysicalScreenHeight(0.5);
  offscreenCanvas3D.getScreen3D().setPhysicalScreenWidth(0.5);
  view.addCanvas3D(offscreenCanvas3D);
  addChild(viewPlatform);
  // turn canvas in front of X axis
  rotateY(-Math.PI / 2);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:38,代码来源:Eye.java

示例8: getBestConfiguration

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
public GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct)
{
  return config;
}
 
开发者ID:vilie,项目名称:javify,代码行数:5,代码来源:QtScreenDevice.java

示例9: createUniverse

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Creates the universe to attach the scenegraph. Used only in the creation
 * phase.
 * 
 * @param ed
 *            the environment description.
 */
private void createUniverse(EnvironmentDescription ed) {
	System.out.println("create Universe");
	// show infos
	Map map = VirtualUniverse.getProperties();
	System.out.println("----------------------------------------");
	System.out.println("j3d.version = " + map.get("j3d.version"));
	System.out.println("j3d.vendor = " + map.get("j3d.vendor"));
	System.out.println("j3d.specification.version = " + map.get("j3d.specification.version"));
	System.out.println("j3d.specification.vendor = " + map.get("j3d.specification.vendor"));
	System.out.println("j3d.renderer = " + map.get("j3d.renderer"));
	System.out.println("J3DThreadPriority = " + VirtualUniverse.getJ3DThreadPriority());
	System.out.println("----------------------------------------");

	createCanvas3D();
	createSceneBranch(ed);

	universe = new VirtualUniverse();

	Locale locale = new Locale(universe);

	// Create and add VIEW branch
	// locale->viewBranch->viewTransformGroup->viewPlatform
	viewBranch = new BranchGroup();
	viewTransformGroup = new TransformGroup();
	viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
	viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	Transform3D t3d = new Transform3D();
	t3d.setIdentity();
	viewTransformGroup.setTransform(t3d);
	viewBranch.addChild(viewTransformGroup);

	// Creates View and viewplatform
	viewPlatform = new ViewPlatform();
	viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
	viewPlatform.setActivationRadius(100);
	view = new View();
	view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);

	view.setViewPolicy(View.SCREEN_VIEW);
	view.setVisibilityPolicy(View.VISIBILITY_DRAW_ALL);

	view.setFrontClipDistance(0.02);

	GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
	template.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
	template.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
	/*
	 * GraphicsConfiguration config = GraphicsEnvironment
	 * .getLocalGraphicsEnvironment().getDefaultScreenDevice()
	 * .getBestConfiguration(template);
	 */
	// request antialiasing
	view.setSceneAntialiasingEnable(true);

	view.addCanvas3D(canvas3d);
	PhysicalBody phyBody = new PhysicalBody();
	PhysicalEnvironment phyEnv = new PhysicalEnvironment();
	view.setPhysicalBody(phyBody);
	view.setPhysicalEnvironment(phyEnv);
	view.attachViewPlatform(viewPlatform);
	viewTransformGroup.addChild(viewPlatform);

	// Add both branch to the unique locale
	locale.addBranchGraph(viewBranch);
	locale.addBranchGraph(sceneBranch);

	// Add mouse control in the canvas3d
	mouseOrbiter = new MouseOrbiter(canvas3d, viewTransformGroup);

	// sets initial viewpoint
	changeViewPoint(ed.worldViewPoint, null);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:80,代码来源:World.java

示例10: init1

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
public void init1() {
    ngView = NeuGenView.getInstance();
    C3DScrollPane = ngView.getVisualScrollPane();
    C3DSplitPane = ngView.getVisualDensSplitPane();
    C3DScrollPane.setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
    C3DSplitPane.setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
    /*if (C3DSplitPane.getDividerLocation() < PWIDTH) {
    C3DSplitPane.setDividerLocation(PWIDTH);
    }*/
    if (C3DSplitPane.getRightComponent() != null) {
        C3DSplitPane.remove(C3DSplitPane.getRightComponent());
    }
    bounds = new BoundingSphere(new Point3d(0, 0, 0), BOUNDSIZE);

    /*
    //GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    //canvas3D = new Canvas3D(config);
    GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
    template.setSceneAntialiasing(GraphicsConfigTemplate3D.PREFERRED);

    canvas3D = new Canvas3D(GraphicsEnvironment.getLocalGraphicsEnvironment().
            getDefaultScreenDevice().
            getBestConfiguration(template));

    canvas3D.setFocusable(true);
    canvas3D.requestFocus();
    simpleU = new SimpleUniverse(canvas3D);
    simpleU.getViewer().getView().setMinimumFrameCycleTime(5);
    simpleU.getViewer().getView().setLocalEyeLightingEnable(true);

    //canvas3D.getView().setSceneAntialiasingEnable(true);
     *
     */
    GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D();

    if (NeuGenApp.antiAliasing) {
        gc3D.setSceneAntialiasing(GraphicsConfigTemplate3D.PREFERRED);
    }

    gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
    GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
    canvas3D = new Canvas3D(gd[0].getBestConfiguration(gc3D));
    simpleU = new SimpleUniverse(canvas3D);

    orbitControls(canvas3D);

    synBehavior = new SynchronBehavior(simpleU.getViewingPlatform().getViewPlatformTransform(), null);
    synBehavior.setSchedulingBounds(bounds);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:50,代码来源:NeuGenVisualization.java

示例11: createUniverse

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Creates the universe to attach the scenegraph. Used only in the creation
 * phase.
 * 
 * @param ed
 *          the environment description.
 */
private void createUniverse(EnvironmentDescription ed) {
  System.out.println("create Universe");
  // show infos
  Map map = VirtualUniverse.getProperties();
  System.out.println("----------------------------------------");
  System.out.println("j3d.version = " + map.get("j3d.version"));
  System.out.println("j3d.vendor = " + map.get("j3d.vendor"));
  System.out.println("j3d.specification.version = " + map.get("j3d.specification.version"));
  System.out.println("j3d.specification.vendor = " + map.get("j3d.specification.vendor"));
  System.out.println("j3d.renderer = " + map.get("j3d.renderer"));
  System.out.println("J3DThreadPriority = " + VirtualUniverse.getJ3DThreadPriority());
  System.out.println("----------------------------------------");

  createCanvas3D();
  createSceneBranch(ed);

  universe = new VirtualUniverse();

  Locale locale = new Locale(universe);

  // Create and add VIEW branch
  // locale->viewBranch->viewTransformGroup->viewPlatform
  viewBranch = new BranchGroup();
  viewTransformGroup = new TransformGroup();
  viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
  viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  Transform3D t3d = new Transform3D();
  t3d.setIdentity();
  viewTransformGroup.setTransform(t3d);
  viewBranch.addChild(viewTransformGroup);

  // Creates View and viewplatform
  viewPlatform = new ViewPlatform();
  viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
  viewPlatform.setActivationRadius(100);
  view = new View();
  view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);

  view.setViewPolicy(View.SCREEN_VIEW);
  view.setVisibilityPolicy(View.VISIBILITY_DRAW_ALL);

  view.setFrontClipDistance(0.02);

  GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
  template.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
  template.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
  /*
   * GraphicsConfiguration config = GraphicsEnvironment
   * .getLocalGraphicsEnvironment().getDefaultScreenDevice()
   * .getBestConfiguration(template);
   */
  // request antialiasing
  view.setSceneAntialiasingEnable(true);

  view.addCanvas3D(canvas3d);
  PhysicalBody phyBody = new PhysicalBody();
  PhysicalEnvironment phyEnv = new PhysicalEnvironment();
  view.setPhysicalBody(phyBody);
  view.setPhysicalEnvironment(phyEnv);
  view.attachViewPlatform(viewPlatform);
  viewTransformGroup.addChild(viewPlatform);

  // Add both branch to the unique locale
  locale.addBranchGraph(viewBranch);
  locale.addBranchGraph(sceneBranch);

  // Add mouse control in the canvas3d
  mouseOrbiter = new MouseOrbiter(canvas3d, viewTransformGroup);

  // sets initial viewpoint
  changeViewPoint(ed.worldViewPoint, null);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:80,代码来源:World.java

示例12: getBestConfiguration

import java.awt.GraphicsConfigTemplate; //导入依赖的package包/类
/**
 * Ignore template and return the only config we have
 *
 * @param gct the template configuration
 * @return the best configuration which is the only one
 */
public GraphicsConfiguration getBestConfiguration(
  GraphicsConfigTemplate gct) {
    return gc;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:11,代码来源:PDFGraphicsDevice.java


注:本文中的java.awt.GraphicsConfigTemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。