derenotes.frame module¶
デレステ動画を扱うモジュール。
デレステ動画データの画像フレームを表示するウィジットを扱う。
- class FrameView(**kwargs)¶
ベースクラス:
Imageデレステ動画データの画像フレームを表示するウィジェット。
デレステ動画データを保持し、インデックスで指定された画像フレームを表示する。
- 変数:
frame_index (NumericProperty) -- 画像フレームのインデックス。
colorfmt (str) -- 画像フレームの色フォーマット。初期値は、 rgb 。
bufferfmt (str) -- 画像フレームのバッファーフォーマット。初期値は、 ubyte 。
- frame_index¶
NumericProperty(defaultvalue=0, **kw) Property that represents a numeric value.
It only accepts the int or float numeric data type or a string that can be converted to a number as shown below. For other numeric types use ObjectProperty or use errorhandler to convert it to an int/float.
It does not support numpy numbers so they must be manually converted to int/float. E.g.
widget.num = np.arange(4)[0]will raise an exception. Numpy arrays are not supported at all, even by ObjectProperty because their comparison does not return a bool. But if you must use a Kivy property, use a ObjectProperty withcomparatorset tonp.array_equal. E.g.:>>> class A(EventDispatcher): ... data = ObjectProperty(comparator=np.array_equal) >>> a = A() >>> a.bind(data=print) >>> a.data = np.arange(2) <__main__.A object at 0x000001C839B50208> [0 1] >>> a.data = np.arange(3) <__main__.A object at 0x000001C839B50208> [0 1 2]
- Parameters:
- defaultvalue: int or float, defaults to 0
Specifies the default value of the property.
>>> wid = Widget() >>> wid.x = 42 >>> print(wid.x) 42 >>> wid.x = "plop" Traceback (most recent call last): File "<stdin>", line 1, in <module> File "properties.pyx", line 93, in kivy.properties.Property.__set__ File "properties.pyx", line 111, in kivy.properties.Property.set File "properties.pyx", line 159, in kivy.properties.NumericProperty.check ValueError: NumericProperty accept only int/float
バージョン 1.4.1 で変更: NumericProperty can now accept custom text and tuple value to indicate a type, like "in", "pt", "px", "cm", "mm", in the format: '10pt' or (10, 'pt').
- colorfmt: str = 'rgb'¶
- bufferfmt: str = 'ubyte'¶
- reset()¶
デレステ動画データを破棄し、表示をリセットする。
- 戻り値の型:
None
- setup(video_filename, video_filetype='mp4', video_accelerator=None)¶
設定を行う。
デレステ動画ファイルを読み込んでデレステ動画データを生成し、 デレステ動画データから取得したフレームサイズで画像フレームを確保する。 グラフィックスコンテキスト全体が再読み込みされた時のコールバック関数を登録する。
- パラメータ:
video_filename (str) -- デレステ動画ファイルのパス名。
video_filetype (str)
video_accelerator (str)
- 戻り値の型:
None
- update()¶
画像フレームを表示する。
ウィジットが準備済みでなければ、何もしない。 指定された
frame_indexでフレームバッファを画像フレームに転送する(表示される)。 グラフィックスコンテキスト全体が再読み込みされた時のためにフレームバッファをバックアップする。- 戻り値の型:
None
- reload_buffer(texture)¶
コールバック関数。
グラフィックスコンテキスト全体が再読み込みされた時のコールバック関数で、バックアップされたフレームのバッファを転送する。
- パラメータ:
texture (Texture) -- 呼び出し元のグラフィックスコンテキスト。
- 戻り値の型:
None
- property total_frames: int¶
総フレーム数。
- property elapsed_time: tuple[int, Fraction]¶
フレームの経過時間。