<<

Clutter Overview 2009/09/11

Youngsik Yoon Software Application Engineer Software and Services Group Confidential Agenda

UI • Clutterの概要 • Clutterプログラミング • まとめ • 参照

*Other names and brands may be claimed as the property of others Software and Services Group 2 Moblin UI Intel Confidential Moblin UI Services

Customer Provided WM + Customer Provided WM + Clutter Clutter toolkit Reference UX UI / Apps Compositor Platform Specific UX

QT 3D User Interface (Clutter) Embed (clutter-QT) Media Playback UI GTK+ (clutter-media) GTK Embed Web Rendering Physics Services GTK Embed (clutter-GTK) (mozilla-clutter) (Box2D) olnCore Moblin Comms Services Internet Services Media Services Graphics Services Other Services Network Mgmt Layout Engine Media Services 3D Graphics Message Bus (OpenGL) (ConnMan) (Mozilla Gecko) (GStreamer, Helix) (OpenGL) (D-Bus) i18N Rendering Telephony APIs Web Services Audio Mgmt i18N Rendering Services (Telepathy, GSM) (REST, Mojito) () (Telepathy, GSM) (REST, Mojito) (PulseAudio) (Glib, GObject) 2D Graphics rd Location Content Mgmt 2D Graphics PIM Services 3rd Party IP () Cellular Bluetooth (Gypsy, GeoClue) (Bickley) (Cairo) (EDS) App Cellular VoIP, IM, (BlueZ) Stack (BlueZ) Presence Device Sync Services Codecs X (SyncML, gUPnP) WiFi / WiMAX (Drivers, OMA-DM)

Linux Base Services WiFi, WiMAX Graphics Power Mgmt Device Drivers Platform Support Kernel Bluetooth, 3G Data system

*Other names and brands may be claimed as the property of others Software and Services Group 4 Intel Confidential MoblinのUIプログラミングモデル

•Moblin CoreがサポートするUIプログラミングモデル: −Native Clutter −GTK (with optional embedded Clutter) −QT (with optional embedded Clutter) – 互換性維持

*Other names and brands may be claimed as the property of others Software and Services Group 5 Intel Confidential UIプログラミングモデル: Native Clutter

•3Dを使ったモダンで直感的なUI開発をサポート •リッチでビジュアルなインターフェイスを持つアプリケーションを新しく開発す る場合、理想的な選択 •GTKアプリの一部としても使用可能(GTKClutterEmbed)

*Other names and brands may be claimed as the property of others Software and Services Group 6 Clutterの概要 Intel Confidential Clutterとは

•3Dエフェクトとアニメーション付きの新しい直感的なUIを手軽に作成するた めのオープンソースソフトウェアライブラリ。 −OpenGLの複雑さに触れることなくその恩恵を受けることができる −2Dオブジェクトを3D空間で操作するためのシンプルで洗練されたobject- oriented APIを提供 −GNOMEのテクノロジを利用 - , , pango −CだけではなくPython, , C#についてバインディングを提供 −GNU LGPLライセンス

*Other names and brands may be claimed as the property of others Software and Services Group 8 Intel Confidential Clutterの主な特徴(1)

•2Dのマルチメディアレイヤーを3D空間に描画することが可能 •画像サポート −SVG, PNG, JPEG等の多様なフォーマットのサポート −その他の画像フォーマットやピクセルデータをインポートできるように拡張可能 •テキスト描画 −Pangoベースのレンダラを利用した、UTF8のアンチエイリアス文字描画 −リッチテキストレイアウト(拡大縮小、スタイル、色、ウェイト等)対応 •アニメーションや特殊効果 −デフォルトで豊富なアニメーション構成要素を持つ −容易に結合、拡張が可能 −フェード、パース、ワイプなどの効果が基本実装されている −ぼかし等の特殊処理ためにシェーダーとフレームバッファーオブジェクトを利用可 能

*Other names and brands may be claimed as the property of others Software and Services Group 9 Intel Confidential Clutterの主な特徴(2)

•レイアウトとアニメーションがスクリプト言語で記述可能 −JSON(JavaScript Object Notation)ベース •Webレンダリング −Mozilla Gecko描画エンジンを組み込み済 −コンテンツのスムーズな拡大縮小表示、ソフトウェアキーボードをサポート −拡張、カスタマイズが可能 •物理エンジン −Box2D物理エンジンを組み込み済 •メディア再生 −Gstreamerをサポート(Helixもサポート予定)

*Other names and brands may be claimed as the property of others Software and Services Group 10 Clutterプログラミング Intel Confidential バージョンヒストリ

• 06/2006 — 0.1 — basic API, GL 1.2 support only • 01/2007 — 0.2 — Pango/OpenGL support, animation framework, fixed point, • 08/2007 — 0.4 — OpenGL ES 1.1, multiple backends, tslib support, simple effects API • 02/2008 — 0.6 — Per-actor event handling, UI definition language, high- precision units, shaders, new Pango Cairo or OpenGL, FBOs, Quartz backend • 07/2008 — 0.8 — Public COGL API, OpenGL 1.4+, OpenGL ES 2.0, size negotiation rework, native win32 backend • the future: 1.0 — Consolidation, toolkit requests, PBOs, light sources, materials, feature requests

*Other names and brands may be claimed as the property of others Software and Services Group 12 Intel Confidential 依存関係

•ClutterはGTK+と同じく以下のライブラリが必要 −GLib – C ユーティリティライブラリ −GObject - Object oriented runtimeタイプシステム −GdkPixbuf – イメージの読み書き −Cairo - 2D vector描画 >Pangoから利用 −Pango – テキストレイアウト

*Other names and brands may be claimed as the property of others Software and Services Group 13 Intel Confidential Clutterのセットアップ

•Ubuntu 8.04 hardy −/etc/apt/sources.listに”deb http://debian.o-hand.com hardy/”を追加 −$sudo apt-get update −$sudo apt-get install libclutter-0.8-dev

•ソースからのインストール −$sudo apt-get install subversion −$svn co http://svn.o-hand.com/repos/clutter/trunk clutter −$cd clutter −$./autogen.sh --prefix=/usr −$make −$sudo make install

*Other names and brands may be claimed as the property of others Software and Services Group 14 Intel Confidential Stage

•Clutterアプリケーションは最低限一つのStageを持つ •Stageは複数のActorを持つCanvas •Clutterは初期化の時、default Stageを作成する −clutter_init() −clutter_stage_get_default()

*Other names and brands may be claimed as the property of others Software and Services Group 15 Intel Confidential Actors

•3D空間に配置される基本的な2Dオブジェクト −ClutterStage – Stage自身もActorの一つ −ClutterRectangle – 四角形 −ClutterLabel – テキスト表示 −ClutterEntry – ユーザーが編集可能なテキスト −ClutterTexture – 画像 •すべてのActorは拡大縮小、回転、透明化が可能 •ユーザーは独自のActorを作成可能 •ActorはContainerに追加され、Containerの変換操作の影響を受ける −ClutterStage −ClutterGroup

*Other names and brands may be claimed as the property of others Software and Services Group 16 Intel Confidential Events

•Actorはユーザーの操作に対応するためいくつかのSignalを持つ −button-press-event – Actor上でマウスボタンを押せば発生 −button-release-event – Actor上でマウスボタンを離せば発生 −motion-event – Actor上でマウスポインターを動かせば発生 −enter-event – マウスポインターがActor領域に入ると発生 −leave-event – マウスポインターがActor領域の外に出ると発生 •最適化のためStage以外のActorはdefaultでSignalを発生しない −clutter_actor_set_reactive() •Signal処理関数はすべての処理が終わるとTRUEを返さなければならない

*Other names and brands may be claimed as the property of others Software and Services Group 17 Intel Confidential Sample(1) – Stage, Actor, Event

*Other names and brands may be claimed as the property of others Software and Services Group 18 Intel Confidential Sample(1)のソース

*Other names and brands may be claimed as the property of others Software and Services Group 19 Intel Confidential Timelines

•Animationの基本となる時間の流れを表すオブジェクト •各frame毎にnew-frame Signalが発生する •効果(effect)と動き(behaviour)と一緒に使用可能 •Scoreを使って複数のTimelineを管理可能 •Actorとは違って浮動参照(floating reference)ではないので、使用後は 必ずg_object_unref()でリソースを解除しなければならない −Timelineの終了時点がはっきりしていない時はcompleted Signalを登録して 処理する

*Other names and brands may be claimed as the property of others Software and Services Group 20 Intel Confidential Behaviours

•Actorの動きを表すオブジェクト •複数のActorに同時適用可能 •Timelineの実行中に動作を制御可能 •Timelineと同じくg_object_unref()でリソースを解除しなければならない •Clutterが提供する基本Behaviourオブジェクト −ClutterBehaviourBspline – スプラインに従ってActorが移動 −ClutterBehaviourDepth – Z軸に従ってActorが移動 −ClutterBehaviourEllipse – 楕円を描きながらActorが移動 −ClutterBehaviourOpacity – Actorの不透明度を変化 −ClutterBehaviourPath – 一連の点で定義された経路に従ってActorが移動 −ClutterBehaviourRotate – Actorの回転 −ClutterBehaviourScale–Actorの拡大・縮小

*Other names and brands may be claimed as the property of others Software and Services Group 21 Intel Confidential Alpha

•ClutterBehaviourはフレーム毎にClutterAlphaオブジェクトの alpha_func() callback関数を呼び出し、経路上の位置を計算する −alpha_func() callback関数は現在フレーム番号と総フレーム数をベースに 0 ~ CLUTTER_ALPHA_MAX_ALPHAの値を返さなければならない −直接計算してもいいが、Clutterで定義されている組み込みcallback関数を使う ことで自然な動きを簡単に実装できる(CLUTTER_ALPHA_SINE_INC, CLUTTER_ALPHA_RAMP_INCなど)

*Other names and brands may be claimed as the property of others Software and Services Group 22 Intel Confidential Sample(2) - Animation

*Other names and brands may be claimed as the property of others Software and Services Group 23 Intel Confidential Sample(2)のソース

*Other names and brands may be claimed as the property of others Software and Services Group 24 Intel Confidential GTKClutterEmbed

•GTKアプリはGTKClutterEmbed widgetを使ってClutterStageオブジェ クトをGTK widgetの一つとして扱うことができる •gtk_clutter_embed_new()を使ってGTKClutterEmbed widgetを作 成し、gtk_clutter_embed_get_stage()を使ってGTKClutterEmbed widgetからClutterStageオブジェクトを取り出す •初期化のためにclutter_init()の代わりにgtk_clutter_init()を使う •clutter_main()の代わりにGTKのgtk_main()を使う

*Other names and brands may be claimed as the property of others Software and Services Group 25 Intel Confidential Sample(3) - GTKClutterEmbed

*Other names and brands may be claimed as the property of others Software and Services Group 26 Intel Confidential Sample(3)のソース

*Other names and brands may be claimed as the property of others Software and Services Group 27 Intel Confidential Sample(4) – Full Example

*Other names and brands may be claimed as the property of others Software and Services Group 28 Intel Confidential まとめ

•Clutterライブラリを利用し開発されたMoblin2 Netbookバージョンをダウ ンロードして使ってみよう!!! −http://moblin.org/downloads

*Other names and brands may be claimed as the property of others Software and Services Group 29 Intel Confidential 参照

• Website −http://www.moblin.org −http://www.clutter-project.org • Mailing list archive −http://lists.o-hand.com/clutter • IRC channel −#clutter on irc..org • Source repository −git clone git://git.clutter-project.org/clutter

*Other names and brands may be claimed as the property of others Software and Services Group 30