• Showing Page History #99530

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

BLT graph のマーカーを枠外に描画するサンプル

概要

Tcl/Tk BLT 拡張のgraphでは、マーカーエレメントを用いることでグラフに注釈等を入れることができます。ただし、制限として、マーカーをグラフの枠外に描画することができませんでした。 今回ソースを少しいじって、枠外の描画も実現させることができましたので紹介します。

追加した機能

  • -markerclippingarea オプション : plot または graph を設定 plotは従来どおり、graphが枠外描画

サンプルプログラム

枠外に噴出しをつけるサンプルです。

package require BLT
namespace import blt::*
wm title . "マーカーでお絵かき"

pack [set g [graph .g -plotbackground black]]
$g configure -title "マーカーでお絵かき"
$g configure -markerclippingarea graph -rightmargin 150

$g axis configure x -title {X Axis} -min 0 -max 20
$g axis configure y -title {Y Axis} -min 0 -max 20
$g marker create polygon -fill red -coords { 5 5 5 10 10 10 10 5 }
$g marker create polygon -fill blue -coords { 10 5 10 10 15 10 15 5 }
$g marker create polygon -fill #404080 -coords { 15 5 15 10 20 10 20 5 }
$g marker create text -outline white -text {Hello world!} -rotate 10 -coords { 15 20 }

$g marker create polygon -fill yellow -coords { 17.5 7.5 19.5 5 40 5 40 2 19 2 19 4.5 }
$g marker create text -outline black -text {枠外にふきだし!} -coords { 24 3.5 }

after 100 {$g snap -format emf CLIPBOARD}

blt_marker_20140821_before_after.png

ファイル一覧

下記4ソース差し替え後ビルドすることにより、追加機能が有効となります。