Swing/AnimatedGif のバックアップの現在との差分(No.1)
TITLE:Animated_GIFファイルの消去手段
Animated_GIFファイルの消去手段
編集者:Terai Atsuhiro~
作成日:2007-05-14
更新日:2022-11-07 (月) 17:56:02
概要
JLabel
などで使用できるAnimated GIF
ファイルをテストします。
Screenshot
Advertisement
概要
JLabelなどで使用できるAnimated_GIFファイルをテストします。サンプルコード
#spanend
#spanadd
JLabel label1 = new JLabel(
#spanend
"何もしない",
new ImageIcon(getClass().getResource("no_disposal_specified.gif")),
SwingConstants.LEFT);
#spandel
#screenshot
#spanend
#spanadd
JLabel label2 = new JLabel(
#spanend
"そのまま残す",
new ImageIcon(getClass().getResource("do_not_dispose.gif")),
SwingConstants.LEFT);
#spandel
**サンプルコード [#z30a391c]
#spanend
#spandel
#code{{
#spanend
#spandel
JLabel label1 = new JLabel("何もしない ",
#spanend
new ImageIcon(getClass().getResource("no_disposal_specified.gif")),
JLabel.LEFT);
#spandel
JLabel label2 = new JLabel("そのまま残す ",
#spanend
new ImageIcon(getClass().getResource("do_not_dispose.gif")),
JLabel.LEFT);
#spandel
JLabel label3 = new JLabel("背景色でつぶす ",
#spanend
new ImageIcon(getClass().getResource("restore_to_background_color.gif")),
JLabel.LEFT);
#spandel
JLabel label4 = new JLabel("直前の画像に戻す",
#spanend
new ImageIcon(getClass().getResource("restore_to_previous.gif")),
JLabel.LEFT);
#spanadd
JLabel label3 = new JLabel(
#spanend
"背景色で塗りつぶす",
new ImageIcon(getClass().getResource("restore_to_background_color.gif")),
SwingConstants.LEFT);
#spanadd
#spanend
#spanadd
JLabel label4 = new JLabel(
#spanend
"直前の画像に戻す",
new ImageIcon(getClass().getResource("restore_to_previous.gif")),
SwingConstants.LEFT);
View in GitHub: Java, Kotlin- &jnlp;
- &jar;
- &zip;
解説
それぞれ異なる消去手段のAnimated_GIFファイルをJLabelに貼り付けてアニメーションをテストしています。上記のように透過色を使用する場合、3番目の「背景色でつぶす」にしておかないと残像が残ってしまうようです。解説
Animated GIF
で、次のコマを描画する時、直前の画像を異なる方法で消去するAnimated GIF
ファイルを作成し、これらをJLabel
に貼り付けてアニメーションをテストしています。上記のように透過色を使用する場合、Swing
では3
番目の「背景色で塗りつぶす」にしておかないと残像が出てしまうようです。
- 何もしない
- No disposal specified. The decoder is not required to take any action.
- そのまま残す
- Do not dispose. The graphic is to be left in place.
- 背景色でつぶす
- Restore to background color. The area used by the graphic must be restored to the background color.
- 直前の画像に戻す
- Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic.
- 何もしない
No disposal specified. The decoder is not required to take any action.
参考リンク
- Cover Sheet for the GIF89a Specification
- Giam ダウンロードのページ
- そのまま残す
Do not dispose. The graphic is to be left in place.
コメント
- 背景色で塗りつぶす
Restore to background color. The area used by the graphic must be restored to the background color.
- 直前の画像に戻す
Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic.
参考リンク
- Cover Sheet for the GIF89a Specification
-
23. Graphic Control Extension.
のiv) Disposal Method
から説明を引用
-