えムナウ 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!

# Hi i am kavin, its my first occasion to commenting anyplace, when i read this post i thought i could also make comment due to this brilliant post. 2019/10/25 14:38 Hi i am kavin, its my first occasion to commenting

Hi i am kavin, its my first occasion to commenting anyplace, when i read this
post i thought i could also make comment due to this brilliant post.

# I am regular visitor, how are you everybody? This post posted at this web page is in fact pleasant. 2020/01/25 7:23 I am regular visitor, how are you everybody? This

I am regular visitor, how are you everybody? This post
posted at this web page is in fact pleasant.

# Hey there! Someone in my Myspace group shared this website with us so I came to look it over. I'm definitely enjoying the information. I'm book-marking and will be tweeting this to my followers! Great blog and excellent style and design. 2020/06/22 7:32 Hey there! Someone in my Myspace group shared this

Hey there! Someone in my Myspace group shared this website with us so I came to look it over.

I'm definitely enjoying the information. I'm book-marking and will be
tweeting this to my followers! Great blog and excellent style and design.

# Hi there, the whole thing is going sound here and ofcourse every one is sharing information, that's truly good, keep up writing. 2020/06/27 19:03 Hi there, the whole thing is going sound here and

Hi there, the whole thing is going sound here and ofcourse every one is sharing information, that's truly good, keep up writing.

# I got this web page from my buddy who informed me concerning this web page and at the moment this time I am browsing this web site and reading very informative content at this place. 2020/08/07 3:40 I got this web page from my buddy who informed me

I got this web page from my buddy who informed me concerning this web page and at the moment this time I am browsing this
web site and reading very informative content at
this place.

# Very good article! We will be linking to this particularly great post on our website. Keep up the great writing. cheap flights yynxznuh 2020/08/25 10:12 Very good article! We will be linking to this part

Very good article! We will be linking to this particularly great post on our website.
Keep up the great writing. cheap flights yynxznuh

# Everything is very open with a very clear clarification of the issues. It was truly informative. Your website is very useful. Many thanks for sharing! 2020/08/28 18:39 Everything is very open with a very clear clarific

Everything is very open with a very clear clarification of the
issues. It was truly informative. Your website
is very useful. Many thanks for sharing!

タイトル  
名前  
URL
コメント