Here is a code snippet that may prove helpful to you:
private void addTestGraphic() {
Dimension windowSize=new Dimension(600,150);
Dimension texSize=new Dimension(1024,256);
int offsetY = texSize.height - windowSize.height;
int charHeight = 15;
int borderPad = 3;
int indent = 10;
// create a buffer with an alpha channel
BufferedImage buffer=new
BufferedImage(texSize.width,texSize.height,BufferedImage.TYPE_INT_ARGB);
Graphics g=buffer.getGraphics();
g.setFont(new Font("Dialog",Font.PLAIN,12));
// set everything to 20 percent opaque
g.setColor(new Color(0.0f,0.0f,0.0f,0.2f));
g.fillRect(0,0,texSize.width,texSize.height);
// draw a border
g.setColor(Color.black);
g.drawRect(0,offsetY+1,windowSize.width-1,windowSize.height-2);
g.setColor(Color.yellow);
g.dispose();
// now we are done creating the bitmap we need to make the texture
Texture texture=new
Texture2D(Texture2D.BASE_LEVEL,Texture2D.RGBA,texSize.width,texSize.height);
texture.setImage(0,new
ImageComponent2D(ImageComponent2D.FORMAT_RGBA,buffer));
TransparencyAttributes ta = new
TransparencyAttributes(TransparencyAttributes.BLENDED,1.0f);
ta.setTransparencyMode(ta.BLENDED);
RenderingAttributes ra = new RenderingAttributes();
ra.setIgnoreVertexColors(true);
TextureAttributes texa = new TextureAttributes();
texa.setTextureMode(texa.REPLACE);
texa.setTextureBlendColor(new Color4f(0,0,0,1));
Appearance app=new Appearance();
app.setTexture(texture);
app.setTransparencyAttributes(ta);
app.setTextureAttributes(texa);
app.setRenderingAttributes(ra);
// calculate the texCoords
float texX = (float) windowSize.width / (float) texSize.width;
float texY = (float) windowSize.height / (float) texSize.height;
Shape3D box = getFlatBox( 20,20, windowSize.width,
windowSize.height, texX, texY);
box.setAppearance(app);
consoleTG.addChild(box);
}
----- Original Message -----
From: Karsten Fries <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 10, 2000 6:31 AM
Subject: [JAVA3D] Transparency on bitmaps
Hi there,
could one give my some brief hint how to get my texture background
transparent,
which flags to set, how to modify the alphas of my RGB image aso.
I would be very glad if someone could save me some testing and
documentation
load.
Best regards
Karsten
===========================================================================
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".