hi Karl
thanx for the pointer :)
i went through some of 2D graphics tutorial and found the solution.
if you want you can search for "AffineTransform tutorial" on sun's
site.
and then check transforming Text,Images,Shapes tutorial.
i did not understand entirely ;) (still working on it ... inner
details of AffineTransform)
neways
i wrote small test applet to see it work. i picked up bare minimum
required lines from their tutorial code.
if you are interested ... im posting the code below.
their tutorial example is just awesome & worth having a look but i
picked only minimum stuff
cheers n Merry X'mas
amey
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.applet.*;
//<applet code=MyApplet height=300 width=400></applet>
public class MyApplet extends Applet
{
int w,h;
AffineTransform textAt,at;
Shape shape;
TextLayout textTl;
public void init()
{
setBackground(new Color(90,90,180));
at = new AffineTransform();
textAt= new AffineTransform();
textTl= new TextLayout("Game Over!!!", new Font("Helvetica", 1, 46),
new FontRenderContext(null, false, false));
textAt.translate(0, (float)textTl.getBounds().getHeight());
shape= textTl.getOutline(textAt);
}
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
Dimension d = getSize();
w = d.width;
h = d.height;
at.setToIdentity();
at.translate(w/2, h/2);
at.rotate(Math.toRadians(315)); //315 = -45 degrees angle as 0=360
Rectangle rect = shape.getBounds();
at.translate(-(rect.width/2), -(rect.height/2));
g2.setStroke(new BasicStroke(2.0f));
g2.transform(at);
g2.setColor(Color.cyan);
g2.fill(shape);
g2.setColor(Color.darkGray);
g2.draw(shape);
}
}