Swing/HorizontalFlip のバックアップの現在との差分(No.5)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/HorizontalFlip へ行く。
- 1 (2008-07-28 (月) 12:01:57)
- 2 (2008-08-05 (火) 01:38:47)
- 3 (2010-01-12 (火) 00:15:51)
- 4 (2013-01-19 (土) 20:14:05)
- 5 (2013-05-24 (金) 03:24:54)
- 6 (2014-12-05 (金) 02:16:49)
- 7 (2016-03-05 (土) 21:06:11)
- 8 (2017-07-20 (木) 14:10:09)
- 9 (2018-07-20 (金) 16:49:20)
- 10 (2020-07-16 (木) 16:49:06)
- 11 (2021-12-17 (金) 11:55:08)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:Shapeの反転 #navi(../) #tags(Shape, Font, AffineTransform) RIGHT:Posted by &author(aterai); at 2008-07-28 *Shapeの反転 [#ac299306] ``AffineTransform``で図形や画像を反転します。 --- category: swing folder: HorizontalFlip title: Shapeの反転 tags: [Shape, Font, AffineTransform] author: aterai pubdate: 2008-07-28T12:01:57+09:00 description: AffineTransformで図形や画像を反転して表示します。 image: https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTN731lMzI/AAAAAAAAAbk/Wc0qp3ocR88/s800/HorizontalFlip.png --- * 概要 [#summary] `AffineTransform`で図形や画像を反転して表示します。 -&jnlp; -&jar; -&zip; #download(https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTN731lMzI/AAAAAAAAAbk/Wc0qp3ocR88/s800/HorizontalFlip.png) //#screenshot #ref(http://lh5.ggpht.com/_9Z4BYR88imo/TQTN731lMzI/AAAAAAAAAbk/Wc0qp3ocR88/s800/HorizontalFlip.png) **サンプルコード [#ie746204] * サンプルコード [#sourcecode] #code(link){{ Font font = new Font("Monospace", Font.PLAIN, 200); Font font = new Font(Font.MONOSPACED, Font.PLAIN, 200); FontRenderContext frc = new FontRenderContext(null, true, true); Shape copyright = new TextLayout("\u00a9", font, frc).getOutline(null); AffineTransform at = AffineTransform.getScaleInstance(-1.0, 1.0); //Rectangle r = copyright.getBounds(); //at.translate(r.getWidth(), r.getHeight()); //AffineTransform at = new AffineTransform(-1d,0,0,1d,r.getWidth(), r.getHeight()); AffineTransform at = AffineTransform.getScaleInstance(-1d, 1d); // Rectangle r = copyright.getBounds(); // at.translate(r.getWidth(), r.getHeight()); // AffineTransform at = new AffineTransform( // -1d, 0d, 0d, 1d, r.getWidth(), r.getHeight()); Shape copyleft = at.createTransformedShape(copyright); }} **解説 [#m5fa2d66] 上記のサンプルでは、コピーライトの文字を鏡像(左右)反転して、コピーレフトのアイコンを作成しています。 * 解説 [#explanation] 上記のサンプルでは、コピーライトの文字を鏡像(左右)反転してコピーレフトの文字アイコンを作成しています。 上下反転の場合は、``AffineTransform.getScaleInstance(1.0, -1.0)``を使用します。 - 上下反転の場合は`AffineTransform.getScaleInstance(1d, -1d)`が使用可能 **参考リンク [#fd86c595] * 参考リンク [#reference] - [http://en.wikipedia.org/wiki/Copyleft コピーレフト - Wikipedia] -- アイコン - [[AffineTransformOpで画像を反転する>Swing/AffineTransformOp]] **コメント [#c9ea5267] * コメント [#comment] #comment #comment