Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Image rotation part 2 Date: Tue, 30 Jun 2015 16:55:11 +0000 (UTC) Organization: A noiseless patient Spider Lines: 51 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 30 Jun 2015 16:55:11 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="17185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vxe4cIKQSpoki+lpFwWSR0sYUXNOaDk0=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:51Bnr2dbf+G+gypqzdO41VdqGkE= Xref: csiph.com comp.lang.java.programmer:31890 Thanks to help from Knute about five 11 months ago I was able to create JLabel subclasses that could display vertically aligned text, e.g. N a m e by using HTML text, e.g. "N
a
m
e" This works well, except that some of the longer names create very tall instances that use up more screen than I can really spade (the row of names is near the top of a matrix which has 50+ lines below it, so it would be nice to avoid as much scrolling up and down as possible. Having noticed that most Monospaced characters are just over half as wide as they are high, I'm again thinking about somehow standing the character string on end by rotating it through 90 degrees. I'm successfully creating a JPG image containing black 10 pt Monospaced text on a LIGHT_GRAY background within a minimal window (20 pixels high and s.length() * (fontsize * 7 / 10) wide, whenever I try to rotate it, all I'm getting is a solid black image thats rotated so its longest dimension is now vertical. The code looks like this: BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // image created in im BufferedImage om = new BufferedImage(height, width, BufferedImage.TYPE_INT_RGB); AffineTransform at = new AffineTransform(); at.setToQuadrantRotation(-1); AffineTransformOp aop = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); aop.filter(im, om); I've also tried setting the AffineTransformOp to TYPE_BICUBIC but that also gave a black rectangle. I'm obviously doing something stupid or have missed out a vital step, but what? -- martin@ | Martin Gregorie gregorie. | Essex, UK org |