えムナウ Blog

えムナウ の なすがまま

目次

Blog 利用状況

ニュース


follow mnow at http://twitter.com


えムナウのプログラミングのページ

INETAJ

書庫

日記カテゴリ

ギャラリ

WPF と GIFアニメ

WPFでGIFアニメを表示するとなると、GDI+に逃げてSystem.Drawingを使う例がほとんどです。

いばらの道ですがBitmapDecoderを使ってMetaDataを取得することにより各フレームの画像と必要な情報を取得することができます。

            FileStream imageFileStrm = new FileStream("./Resources/GifAnime.gif",

                FileMode.Open, FileAccess.Read, FileShare.Read);

            BitmapDecoder decoder = BitmapDecoder.Create(imageFileStrm,

                BitmapCreateOptions.PreservePixelFormat,

                BitmapCacheOption.Default);

            BitmapMetadata metadata = (BitmapMetadata)decoder.Frames[0].Metadata;

            var top = metadata.GetQuery("/imgdesc/Top");

            var left = metadata.GetQuery("/imgdesc/Left");

            var width = metadata.GetQuery("/imgdesc/Width");

            var height = metadata.GetQuery("/imgdesc/Height");

            var delay = metadata.GetQuery("/grctlext/Delay");

            var transparencyFlag = metadata.GetQuery("/grctlext/TransparencyFlag");

            var transparentColorIndex = metadata.GetQuery("/grctlext/TransparentColorIndex");

            image.Source = decoder.Frames[0];

 

ここから先もまだ長いのですが、この方法を応用したライブラリが既にあります。

理屈は抑えておくとソースもダウンロードできるし安心してライブラリを使えます。

 

WPF Animated GIF

http://wpfanimatedgif.codeplex.com/

投稿日時 : 2013年5月30日 14:06

コメントを追加

# I have read so many articles about the blogger lovers but this article is in fact a fastidious paragraph, keep it up. 2019/05/14 13:12 I have read so many articles about the blogger lov

I have read so many articles about the blogger lovers but this article is in fact
a fastidious paragraph, keep it up.

# When someone writes an piece of writing he/she keeps the thought of a user in his/her brain that how a user can understand it. Therefore that's why this paragraph is great. Thanks! 2019/09/16 21:43 When someone writes an piece of writing he/she kee

When someone writes an piece of writing he/she keeps the
thought of a user in his/her brain that how a user can understand it.
Therefore that's why this paragraph is great.
Thanks!

# re: WPF ? GIF??? 2021/07/08 22:15 does hydroxychloroquine cause heart problems

choroquine https://chloroquineorigin.com/# hydroclorizine

# re: WPF ? GIF??? 2021/07/15 2:49 hydroxychoroquine

chloroquinine https://chloroquineorigin.com/# hydroxicloriquine

# re: WPF ? GIF??? 2021/08/07 8:58 hydroxychloroquine 400 mg

cloroquina 250 mg https://chloroquineorigin.com/# what is hydrochloroquine

# Awesome Web-site, Stick to the wonderful job. thnx! 2021/11/03 15:53 Awesome Web-site, Stick to the wonderful job. thnx

Awesome Web-site, Stick to the wonderful job. thnx!

# I delight in the details on your internet site. Regards! 2021/11/04 21:52 I delight in the details on your internet site. Re

I delight in the details on your internet site.

Regards!

# jkhviubokpig 2021/11/30 5:06 dwedayoouo

https://chloroquinesab.com/

# nowmtckkwmmz 2021/12/04 9:04 dwedaysohb

hydroxychloroquine prophylaxis https://hydroxychloroquine20.com/

# emigomjimupo 2022/05/25 10:32 jzvktgig

azithromycin and erythromycin https://erythromycinn.com/#

タイトル
名前
URL
コメント