HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2016
0616
Cheesehamburg7273HSPでGIFアニメーションの再生2未解決


Cheesehamburg7273

リンク

2016/6/16(Thu) 20:17:55|NO.75891

HSPでGIFアニメーションを再生したいです
過去のスレ http://hsp.tv/play/pforum.php?mode=pastwch&num=42098
に同じようなサンプルがあったので実行してみたら透明色が使えなかったので
別のサイトでIEで表示したら透明色は使用できたのですがめちゃくちゃ遅くて困ってました
MCIかIE以外で何かいい方法はないでしょうか



この記事に返信する


26℃

リンク

2016/6/17(Fri) 02:18:13|NO.75893

KpanさんのSusieプラグインを使ったGIFアニメを分解するコードで再生させる方法もある
http://hsp.tv/play/pforum.php?mode=pastwch&num=20063
自分の場合そのほうほうでgifアニメのwait値を取得する方法がわからなかったので
gdi+を使って再生させたりしたけど難易度がちょっと高い



nori

リンク

2016/6/17(Fri) 23:25:59|NO.75901

単純に表示するだけなら。

GdipImageGetFrameCountで画像の枚数を取得し、GdipGetPropertyItemでPropertyTagFrameDelayを指定してDerayを取得。
表示する際はGdipImageSelectActiveFrameで表示するフレームを指定してからGdipDrawImageI等で描画してください。
delay値は1/100s単位なのでawaitの1/1000sに揃えるために10倍にしています。
ループ回数はGdipGetPropertyItemでPropertyTagLoopCount(0x5101)を指定して取得可能です。
簡素化してるので、使用する際はエラーチェック等追加してください。


#uselib "gdiplus.dll" #func GdipCreateFromHDC "GdipCreateFromHDC" int, int #func GdipDeleteGraphics "GdipDeleteGraphics" int #func GdipDisposeImage "GdipDisposeImage" int #func GdipDrawImageI "GdipDrawImageI" int, int, int, int #func GdipGetPropertyItemSize "GdipGetPropertyItemSize" int,int,int #func GdipGetPropertyItem "GdipGetPropertyItem" int,int,int,int #func GdipImageGetFrameDimensionsList "GdipImageGetFrameDimensionsList" int,int,int #func GdipImageGetFrameCount "GdipImageGetFrameCount" int,int,int #func GdipImageSelectActiveFrame "GdipImageSelectActiveFrame" int,int,int #func GdiplusShutdown "GdiplusShutdown" int #func GdiplusStartup "GdiplusStartup" int, int, int #func GdipLoadImageFromFile "GdipLoadImageFromFile" wstr,int #define PropertyTagFrameDelay 0x5100 dialog "gif",16,"" : if( stat != 1 ): end file = refstr gsi = 1, 0, 0, 0 GdiplusStartup varptr(gdiplusToken), varptr(gsi), 0 ; GDI+ 開始 if( gdiplusToken == 0 ):dialog "初期化失敗",1: end GdipLoadImageFromFile file, varptr(imgImage); ファイルから読み込み if( imgImage == 0 ): dialog "ロード失敗",1:GdiplusShutdown gdiplusToken: end GdipImageGetFrameDimensionsList imgImage , varptr(guid) , 1;最初のディメンションのGUIDを取得 GdipImageGetFrameCount imgImage , varptr(guid) , varptr(frames);フレーム数を取得 GdipGetPropertyItemSize imgImage , PropertyTagFrameDelay , varptr(nSize);ディレイを格納するサイズを取得 sdim Delay , nSize GdipGetPropertyItem imgImage , PropertyTagFrameDelay , nSize , varptr(Delay);ディレイを取得 GdipCreateFromHDC hdc ,varptr(tmpGraphics) color 255,255,255 repeat frames redraw 0 boxf GdipImageSelectActiveFrame imgImage , varptr(guid) , cnt;アクティヴなフレームを選択 GdipDrawImageI tmpGraphics, imgImage ,0,0 redraw 1 await 10 * lpeek( Delay , cnt * 4 + 16);先頭16byteはPropertyItem loop GdipDeleteGraphics tmpGraphics GdipDisposeImage imgImage GdiplusShutdown gdiplusToken;GDI+ 終了 stop



ONION software Copyright 1997-2023(c) All rights reserved.