本文整理汇总了Java中javax.media.j3d.ImageComponent2D类的典型用法代码示例。如果您正苦于以下问题:Java ImageComponent2D类的具体用法?Java ImageComponent2D怎么用?Java ImageComponent2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageComponent2D类属于javax.media.j3d包,在下文中一共展示了ImageComponent2D类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doRender
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/**
* render a Image from canvas
*
* @param width
* Image width
* @param height
* Image height
* @return the image
*/
public BufferedImage doRender(BufferedImage image)
{
ImageComponent2D buffer = new ImageComponent2D(
ImageComponent.FORMAT_RGB, image);
// buffer.setYUp(true);
if (getOffScreenBuffer() == null)
{
setOffScreenBuffer(buffer);
renderOffScreenBuffer();
waitForOffScreenRendering();
}
return getOffScreenBuffer().getImage();
}
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:25,代码来源:ScreenShot.java
示例2: getScreenshot
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/**
* Baut einen Screenshot
* @return null wenn nix geladen, sonst Screenshot
* Bsp: ImageIO.write(worldViewer.getScreenshot(), "png", File.createTempFile("screenshot", ".png"));
*/
public BufferedImage getScreenshot() {
/*
* Das hier ist sehr buerokratisch, aber leider hab ich keinen
* einfacheren Weg gefunden. Was man mit Google findet sind i.d.R.
* Beispiele, die java.awt.Robot.createScreenCapture() verwenden -- was
* aber einen "echten Screenshot" macht, d.h. wenn einer ein anderes
* Fenster ueber den ctSim geschoben hat, wird eben das abgelichtet. Die
* Alternative, auf dem Canvas3D oder auf diesem Objekt paint(...)
* aufzurufen, funktioniert nicht (ergibt immer einfarbig schwarze
* Screenshots -- vermutlich ist Canvas3D eben doch keine ganz so
* normale Swing-Komponente).
*/
Screen3D onScr = onScreenCanvas.getScreen3D();
Screen3D offScr = offScreenCanvas.getScreen3D();
offScreenCanvas.setOffScreenBuffer(new ImageComponent2D(ImageComponent2D.FORMAT_RGB, onScr.getSize().width, onScr.getSize().height));
offScr.setSize(onScr.getSize());
offScr.setPhysicalScreenHeight(onScr.getPhysicalScreenHeight());
offScr.setPhysicalScreenWidth(onScr.getPhysicalScreenWidth());
offScreenCanvas.renderOffScreenBuffer();
offScreenCanvas.waitForOffScreenRendering();
return offScreenCanvas.getOffScreenBuffer().getImage();
}
开发者ID:tsandmann,项目名称:ct-sim,代码行数:28,代码来源:WorldViewer.java
示例3: doRender
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
private BufferedImage doRender(int width, int height) {
BufferedImage bImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
ImageComponent2D buffer = new ImageComponent2D(
ImageComponent.FORMAT_RGB, bImage);
//buffer.setYUp(true);
setOffScreenBuffer(buffer);
renderOffScreenBuffer();
waitForOffScreenRendering();
bImage = getOffScreenBuffer().getImage();
return bImage;
}
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:16,代码来源:LineTypes.java
示例4: getColoredImageTexture
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/**
* Returns a texture image of one pixel of the given <code>color</code>.
*/
private Texture getColoredImageTexture(Color color)
{
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(color);
g.drawLine(0, 0, 0, 0);
g.dispose();
Texture texture = new TextureLoader(image).getTexture();
texture.setCapability(Texture.ALLOW_IMAGE_READ);
texture.setCapability(Texture.ALLOW_FORMAT_READ);
texture.getImage(0).setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
texture.getImage(0).setCapability(ImageComponent2D.ALLOW_FORMAT_READ);
return texture;
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:18,代码来源:TextureManager.java
示例5: getImageBits
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/**
* Returns the pixels of the given <code>image</code>.
*/
private int[] getImageBits()
{
int[] imageBits = null;
if (this.imageBits != null)
{
imageBits = this.imageBits.get();
}
if (imageBits == null)
{
BufferedImage image = ((ImageComponent2D) this.texture.getImage(0)).getImage();
if (image.getType() != BufferedImage.TYPE_INT_RGB && image.getType() != BufferedImage.TYPE_INT_ARGB)
{
// Transform as TYPE_INT_ARGB or TYPE_INT_RGB (much faster than calling image.getRGB())
BufferedImage tmp = new BufferedImage(image.getWidth(), image.getHeight(),
this.texture.getFormat() == Texture.RGBA ? BufferedImage.TYPE_INT_ARGB
: BufferedImage.TYPE_INT_RGB);
Graphics2D g = (Graphics2D) tmp.getGraphics();
g.drawImage(image, null, 0, 0);
g.dispose();
image = tmp;
}
imageBits = (int[]) image.getRaster().getDataElements(0, 0, image.getWidth(), image.getHeight(), null);
this.transparent = image.getTransparency() != BufferedImage.OPAQUE;
if (this.transparent)
{
this.transparent = containsTransparentPixels(imageBits);
}
this.imageBits = new WeakReference<int[]>(imageBits);
}
return imageBits;
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:35,代码来源:TextureManager.java
示例6: getOffScreenCanvas3D
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/**
* Returns a new off screen <code>canva3D</code> at the given size.
* @throws IllegalRenderingStateException if the canvas 3D couldn't be created.
* To avoid this exception, call {@link #isOffScreenImageSupported() isOffScreenImageSupported()} first.
*/
public Canvas3D getOffScreenCanvas3D(int width, int height)
{
Canvas3D offScreenCanvas = getCanvas3D(null, true, null);
// Configure canvas 3D for offscreen
Screen3D screen3D = offScreenCanvas.getScreen3D();
screen3D.setSize(width, height);
screen3D.setPhysicalScreenWidth(2f);
screen3D.setPhysicalScreenHeight(2f / width * height);
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
ImageComponent2D imageComponent2D = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, image);
imageComponent2D.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
offScreenCanvas.setOffScreenBuffer(imageComponent2D);
return offScreenCanvas;
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:20,代码来源:Component3DManager.java
示例7: textureUpdated
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public void textureUpdated(Texture texture)
{
floorTextureImagesCache.put(floorRotatedTextureKey,
((ImageComponent2D) texture.getImage(0)).getImage());
if (!waitForTexture)
{
repaint();
}
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:10,代码来源:PlanComponent.java
示例8: OffScreenCanvas3D
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public OffScreenCanvas3D(GraphicsConfiguration gconfig) {
super(gconfig, true);
ImageComponent2D buffer = new ImageComponent2D(ImageComponent.FORMAT_RGB, visionImage);
buffer.setCapability(ImageComponent.ALLOW_IMAGE_READ);
setOffScreenBuffer(buffer);
rendering = false;
}
开发者ID:glaudiston,项目名称:project-bianca,代码行数:9,代码来源:Eye.java
示例9: writeJPEGFile
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/** Writes the current view in a <code>Canvas3D</code> object to an JPG file */
public static void writeJPEGFile(String fName, Canvas3D canvas){
GraphicsContext3D ctx = canvas.getGraphicsContext3D();
// The raster components need all be set!
Raster ras = new Raster(
new Point3f(-1.0f,-1.0f,-1.0f),
Raster.RASTER_COLOR,
0,0,
canvas.getWidth(),canvas.getHeight(),
new ImageComponent2D( ImageComponent.FORMAT_RGB, new BufferedImage(canvas.getWidth(), canvas.getHeight(), BufferedImage.TYPE_INT_RGB)),
null);
ctx.readRaster(ras);
// Now strip out the image info
BufferedImage img = ras.getImage().getImage();
// write that to disk....
try {
FileOutputStream out = new FileOutputStream(fName);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img);
param.setQuality(0.95f,false); // 75% quality for the JPEG
encoder.setJPEGEncodeParam(param);
encoder.encode(img);
out.close();
} catch ( IOException e ) {
e.printStackTrace();
}
}
开发者ID:DIKU-Steiner,项目名称:ProGAL,代码行数:31,代码来源:J3DImageFileWriter.java
示例10: J3dNyARRaster_RGB
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public J3dNyARRaster_RGB(NyARParam i_cparam,VideoFormat i_format) throws NyARRuntimeException
{
super(i_format);
//bufferdimageの種類を決める
if(this.getBufferType()!=NyARBufferType.BYTE1D_B8G8R8_24){
throw new NyARRuntimeException();
}
//RGBのラスタを作る。
this.bufferd_image = new BufferedImage(this._size.w, this._size.h, BufferedImage.TYPE_3BYTE_BGR);
i2d_buf = ((DataBufferByte) bufferd_image.getRaster().getDataBuffer()).getData();
this.imc2d = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, this.bufferd_image, true, true);
imc2d.setCapability(ImageComponent.ALLOW_IMAGE_WRITE);
}
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:14,代码来源:J3dNyARRaster_RGB.java
示例11: captureImage
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
@Override
public void captureImage( int maxSize, RenderingViewer.ImageCapture capture )
{
if ( mCanvas .isOffScreen() )
{
BufferedImage bImage = new BufferedImage( maxSize, maxSize * 4 / 5, BufferedImage.TYPE_INT_ARGB );
ImageComponent2D buffer = new ImageComponent2D( ImageComponent.FORMAT_RGB, bImage );
Screen3D sOff = mCanvas .getScreen3D();
Dimension dim = new Dimension( 1024, 768 );
sOff .setSize( dim );
sOff .setPhysicalScreenWidth( 1024 );
sOff .setPhysicalScreenHeight( 768 );
mCanvas .setOffScreenLocation( 0, 0 );
mCanvas .setOffScreenBuffer( buffer );
mCanvas .renderOffScreenBuffer();
mCanvas .waitForOffScreenRendering();
capture .captureImage( mCanvas .getOffScreenBuffer() .getImage() );
}
else
{
mCanvas .maxImageSize = maxSize;
mCanvas .m_imageHandler = capture;
mCanvas .repaint();
}
//mCanvas .m_imageHandler = null; mCanvas .maxImageSize = -1; // will be done by canvas, on another thread
}
开发者ID:vZome,项目名称:vzome-desktop,代码行数:30,代码来源:Java3dRenderingViewer.java
示例12: render
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public BufferedImage render(int width, int height) {
BufferedImage image =
new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
ImageComponent2D buffer =
new ImageComponent2D(ImageComponent.FORMAT_RGBA, image);
this.setOffScreenBuffer(buffer);
this.renderOffScreenBuffer();
this.waitForOffScreenRendering();
return this.getOffScreenBuffer().getImage();
}
开发者ID:wolfmanstout,项目名称:jene,代码行数:14,代码来源:SurfacePanel.java
示例13: OffScreenCanvas3D
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public OffScreenCanvas3D(GraphicsConfiguration gconfig) {
super(gconfig, true);
ImageComponent2D buffer = new ImageComponent2D(ImageComponent.FORMAT_RGB, visionImage);
buffer.setCapability(ImageComponent.ALLOW_IMAGE_READ);
setOffScreenBuffer(buffer);
// rendering = false;
}
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:8,代码来源:Eye.java
示例14: updateData
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public void updateData(ImageComponent2D imageComponent,
int x,
int y,
int width,
int height) {
// Do nothing for now.
}
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:8,代码来源:J3DText.java
示例15: initTexture
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
private void initTexture()
{
//Debug.trace();
textureImage =
new BufferedImage(textureWidth,
textureHeight,
BufferedImage.TYPE_INT_RGB);
textureImageComponent =
new ImageComponent2D(ImageComponent2D.FORMAT_RGB,
textureImage);
textureImageComponent.setCapability(ImageComponent2D.ALLOW_IMAGE_WRITE);
textureImpl = new Texture2D(Texture2D.BASE_LEVEL,
Texture2D.RGB,
textureWidth,
textureHeight);
textureImpl.setImage(0, textureImageComponent);
// Handle repeatS and repeatT fields
textureImpl.setBoundaryModeS(vfRepeatS ? Texture2D.WRAP : Texture2D.CLAMP);
textureImpl.setBoundaryModeT(vfRepeatT ? Texture2D.WRAP : Texture2D.CLAMP);
textureArray = new Texture[] { textureImpl };
textureAlphaArray = new boolean[] { false };
TextureAttributes attr = new TextureAttributes();
textureAttributeArray = new TextureAttributes[] { attr };
firstFrame = true;
}
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:30,代码来源:J3DMovieTexture.java
示例16: createSceneGraph
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public BranchGroup createSceneGraph(boolean wireFrame) {
int VOV_L = 42; // dimensions of volume of voxels 50
int VOV_W = 42;
int VOV_H = 42;
BranchGroup contentRoot = new BranchGroup();
ColorUtil.addCoordinateSphereAxesToSceneGraph(contentRoot, 0.01f);
VolumeOfVoxels vv = new VolumeOfVoxels(VOV_L, VOV_W, VOV_H);
vv.fillVolumeOfSphere(true);
/* Simple visualization by triangles */
Vector<Triangle> triangleVector = new Vector<Triangle>();
Util.triangulation(vv.getVoxelsValueAsFloatArray(), VOV_L, VOV_W, VOV_H, triangleVector);
Triangle3dCreator triangleCreator = new Triangle3dCreator(ColorUtil.grey);
for (Triangle t : triangleVector) {
triangleCreator.addTriangleToContainer(
t.getP1AsScaledPoint3f(1.0f / VOV_L, 1.0f / VOV_W, 1.0f / VOV_H),
t.getP2AsScaledPoint3f(1.0f / VOV_L, 1.0f / VOV_W, 1.0f / VOV_H),
t.getP3AsScaledPoint3f(1.0f / VOV_L, 1.0f / VOV_W, 1.0f / VOV_H));
//t.printData();
}
contentRoot.addChild(triangleCreator.getTriangleContainer());
/* Simple visualization by boxes */
Material mat = new Material();
mat.setEmissiveColor(ColorUtil.red);
Cube3dCreator cubeCreator = new Cube3dCreator(0.05f, 0.05f, 0.05f, mat, 0.0f);
// vv.addAllTagedVoxelsToContainer(cubeCreator);
contentRoot.addChild(cubeCreator.getCubeContainer());
/* For cube testing */
contentRoot.addChild(cubeCreator.getCubeAsShapeOfQuadArrays(0.1f, 0.1f, 0.1f));
contentRoot.addChild(cubeCreator.getCubeAsBox(0.15f, 0.15f, 0.15f));
Background background = new Background(new ImageComponent2D(ImageComponent2D.FORMAT_RGB,
ColorUtil.createColoredGradientImage(FrameWidth, FrameHeight)));
background.setApplicationBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0));
contentRoot.addChild(background);
contentRoot.compile();
return contentRoot;
}
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:48,代码来源:MainApp.java
示例17: getImageComponent2D
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
public ImageComponent2D getImageComponent2D()
{
return this.imc2d;
}
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:5,代码来源:J3dNyARRaster_RGB.java
示例18: renewImageComponent2D
import javax.media.j3d.ImageComponent2D; //导入依赖的package包/类
/**
* 自身の格納しているImageComponent2Dオブジェクトを作り直します。
* Java3D1.5がDirectXで動いた(らしいとき)に、ImageComponent2Dのインスタンス
* IDが異ならないと、Behavior内でイメージの更新を通知できない事象に対応するために実装してあります。
* Behavior内でgetImageComponent2()関数を実行する直前に呼び出すことで、この事象を回避することができます。
*
*/
public void renewImageComponent2D()
{
this.imc2d = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, this.bufferd_image, true, true);
this.imc2d.setCapability(ImageComponent.ALLOW_IMAGE_WRITE);
}
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:13,代码来源:J3dNyARRaster_RGB.java
注:本文中的javax.media.j3d.ImageComponent2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论