(クラス)
直接継承しているサブクラス:
RoundedRectangleShape, TextShape, GraphicShape, ImageShape, EllipseShape, ShapeGroup, PathShape, RectangleShape, Chart, PieSet, AxisLineShape, PiePlotArea, ChartLayer, TickShape, LayeredPlotArea 任意の形状を表す抽象基本クラス。通常、Shape は Canvas 内に含まれます。
説明
このクラスをサブクラス化して、独自の形状を実装できます。組み込みの実装のリストとその使用例については、
CURL.GUI.SHAPES を参照してください。
コンストラクタ protected | {Shape.clone-appearance-from} |
コンストラクタ public | {Shape.default ...} |
アクセサ public final Shape.as-Shape:#
Shape
ローカル オプション public Shape.draw-operation:
DrawOperation =DrawOperation.blend
アクセサ public final Shape.graphical-parent:#
Box
アクセサ public final Shape.possibly-displayed?:
bool
非ローカル オプション public Shape.stroke-thickness:
any
ローカル オプション public Shape.visible?:
bool =true
プロパティ 継承 Visual:
_style-element, clonable-class?, completely-clonable-children?, cursor, data-source, display-context, dragee, font-size, has-key-focus?, input-method-enabled?, input-method-keyboard-mode, name, options, style-class, style-element, style-manager, style-options, test-child?, test-description, test-name, test-parent?, test-type-name, test-visible?, tooltip, user-data, visual-parent
public final | {Shape.apply-rotation angle:Angle}:void |
public final | {Shape.apply-transformation}:void |
public final | {Shape.apply-translation}:void |
public final | {Shape.apply-translation-in-parent}:void |
public | {Shape.constrain-own-layout-bounds}:void |
public | {Shape.constrain-shape-layout-bounds}:void |
public | {Shape.detach}:void |
draw: | このオブジェクトの可視表現を描画します。 |
public final | {Shape.find-graphical-ancestor}:#Graphic |
public | {Shape.fire-crossing-event}:void |
public final | {Shape.get-down-orientation-in-shape-parent}:Double2d |
public final | {Shape.get-graphical-root}:#Graphic |
public | {Shape.get-gui-path-to-child}:{Array-of int} |
public final | {Shape.get-local-device-pixel-size}:Distance |
public abstract | {Shape.get-own-bounds dest:GRect = {GRect.empty}}:GRect |
public | {Shape.get-own-bounds-in-shape-root dest:GRect = {GRect.empty} }:GRect |
public | {Shape.get-own-layout-bounds}:GRect |
public final | {Shape.get-right-orientation-in-shape-parent}:Double2d |
public | {Shape.get-shape-bounds dest:GRect = {GRect.empty}}:GRect |
public | {Shape.get-shape-bounds-in-shape-root dest:GRect = {GRect.empty} }:GRect |
public | {Shape.get-shape-layout-bounds}:GRect |
protected | {Shape.option-change-notify}:void |
public | {Shape.overdraw-for-selection}:void |
public final | {Shape.quantize-line-thickness thickness:any,display-context:DisplayContext = {self.get-display-context},quantum-size:Distance = {self.get-local-device-pixel-size} }:(result:Distance, single-device-pixel?:bool) |
public | {Shape.request-draw}:void |
public | {Shape.request-draw-self}:void |
public final | {Shape.reset-transformation}:void |
public abstract | {Shape.self-contains-point?}:bool |
public abstract | {Shape.self-intersects-polygon?}:bool |
public final | {Shape.set-rotation angle:Angle}:void |
public final | {Shape.set-transformation}:void |
public final | {Shape.set-translation-in-parent}:void |
public final | {Shape.transform-from-display-coordinates}:(new-x:Distance, new-y:Distance) |
public final | {Shape.transform-point-from-shape-root}:Distance2d |
public final | {Shape.transform-point-to-shape-root}:Distance2d |
public final | {Shape.transform-to-display-coordinates}:(new-x:Distance, new-y:Distance) |
public final | {Shape.transform-vector-from-shape-root}:Distance2d |
public final | {Shape.transform-vector-to-shape-root}:Distance2d |
public | {Shape.transformation-changed}:void |
public | {Shape.transformation-changing}:void |
メソッド 継承 ShapeContainerBase:
add, clear, clone-children, draw-shape-child, draw-shape-children, get-all-children-at-point, get-child-at-point, get-leaf-at-point, get-shape-root, note-attached, note-detaching, notify-option-children, on-drag-enter, on-pointer-enter, on-pointer-envelope-event, register-options, remove, set-shape-index, set-shape-index-after, set-shape-index-before, shape-container-fire-inferior-crossing-event, shape-container-handle-crossing, shape-container-pick-child, shape-container-pointer-enter-occurred, shape-container-pointer-leave-occurred メソッド 継承 Visual:
add-from-init-args, animate, change-cursor, clonable-appearance?, clone-appearance, clone-appearance-helper, find-test-children, get-focus-manager, get-layout-context, get-test-parent, get-test-property, get-text, get-view, maybe-fire-attach-event, maybe-fire-detach-event, non-keyword-init-arg, note-caret-position, on-drag-leave, on-pointer-leave, pop-cursor, prepare-test-object, prepare-test-parent, push-cursor, quantize-width, refresh-style-options, release-key-focus, request-key-focus, scroll-to-include, test-record, test-run, xy-offset-to メソッド 継承 GuiEventTarget:
handle-delegate-event, handle-event, on-action, on-cancel-mode, on-command-changed, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-over, on-drag-pointer, on-drag-started, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-gesture, on-gesture-begin, on-gesture-end, on-gesture-magnify, on-gesture-pan, on-gesture-rotate, on-gesture-swipe, on-gesture-tap, on-gesture-touch, on-grab-release, on-gui-event, on-input-method-event, on-inspection, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-event, on-pointer-motion, on-pointer-press, on-pointer-release, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-changed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class メソッド 継承 OptionListInterface:
add-option, add-style-option, change-option-parent-notify, clone-options, get-option, get-option-by-name, local-add-notify, local-remove-notify, name-to-option-key, new-option-item, option-changed, option-lookup, option-lookup-here, option-propagate-notify, option-set?, propagate-option-change, remove-option, remove-style-option, remove-styles, set-option-by-name, set-style-option-by-name, unset-option-by-name, unset-style-option-by-name
(コンストラクタ)
protected | {Shape.clone-appearance-from} |
新規オブジェクトを生成するためのコンストラクタ。
fixup:
このプロシージャは二つの引数と共に呼び出されます。元のオブジェクトと clone-appearance のメカニズムによって生成されたコピーオブジェクトです。このプロシージャによって返された値はクローンとして使用されます。このプロシージャはコピーするオブジェクトに修正を加えて返すことができます。このプロシージャが null を返すことはできません。
説明
クローン化をサポートする
Shape のサブクラスはこのコンストラクタを呼び出すコンストラクタを持たなければなりません。クローンされた子に追加しなければならない情報があるかどうか分からない場合、このコンストラクタはサブクラスの子のクローンを作成しません。このクラスのサブクラスは子のクローンを作成しそれらを追加する必要があります。追加の情報が必要でない場合、単に
Shape.clone-children を呼び出すだけです。そうでない場合は、
Shape.clone-children をオーバーライドしそれを呼び出さなければなりません。通常、clone-apperance-from コンストラクタから呼び出される
Shape.clone-children は以下のようになります。
{if {type-of self} == {compile-time-type-of self} then
{self.clone-children other, fixup}
}
(コンストラクタ)
public | {Shape.default ...} |
この型の新しいオブジェクトを作成します。
...:
渡される非キーワード引数は、このオブジェクトの子として追加される
Shape であると解釈されます。すべての
Visual クラスと同様に、オプション (
color など) を初期化するために残余引数が使用される場合もあります。
さらに、次の特別なキーワード引数が渡される場合があり、渡された順に処理されます。
(アクセサ)
アクセサ public final Shape.as-Shape:#
Shape Shape オブジェクトとして self を返すか、Shape でない場合は null を返します。
注意事項
Canvas は、
Shape ではない
ShapeContainerBase の例です。
(非ローカル オプション)
この (または子の) 形状に含まれる境界線またはアウトラインの色。
注意事項
すべての形状オブジェクトにこのオプションがあり、継承されるか、またはオブジェクトに直接設定されます。
形状オブジェクトによっては、このプロパティを直接使用しないものがあります。たとえば、
ShapeGroup はこのプロパティを使用しません。しかし、
ShapeGroup オブジェクトにこのようなプロパティを設定すると、形状オブジェクトのすべての子が既定でプロパティを継承するので便利です。
(非ローカル オプション)
この形状とその子の色。
説明
注意事項
すべての形状オブジェクトにこのオプションがあり、継承されるか、またはオブジェクトに直接設定されます。
形状オブジェクトによっては、このプロパティを直接使用しないものがあります。たとえば、
ShapeGroup はこのプロパティを使用しません。しかし、
ShapeGroup オブジェクトにこのようなプロパティを設定すると、形状オブジェクトのすべての子が既定でプロパティを継承するので便利です。
(ローカル オプション)
この Shape およびその子のすべてを描画する DrawOperation。
説明
このオプションが未設定の場合、現在の
DrawOperation は変更されません。これは、子
Shape が、既定で、親と同じ
DrawOperation で描画することを意味します。したがって、オプションの既定値 (
DrawOperation.mask) は重要ではなく、単に
Renderer2d の既定の初期
DrawOperation を反映します。
このオプションはさまざまな透過性効果を有効にするために使用できます。適したレンダラを使用する必要があることに注意してください。DrawOperation.mask および DrawOperation.source だけがすべてのレンダラでサポートされています。Shape の描画に使用するレンダラのタイプは変えることができます。
「ホストでない」レンダラが必要な場合、および
support-advanced-draw-operations? が必要な場合に関する詳細は、
DrawOperation を参照してください。
例
この例では、さまざまな描画操作の効果を示すため、動いて重なり合う
RectangleShape を使用しています。選択した操作は、四角形のすべての形状の親に設定されます。また、このコードがその
Canvas の
use-host-rendering? プロパティおよび
support-advanced-draw-operations? プロパティを、選択した操作に適した値に変更することに注意してください。
例:
Shape.draw-operation の使用 |
|
{import * from CURL.GUI.SHAPES}
{import * from CURL.LANGUAGE.MATH-CONSTANT}
{let constant random:Random = {Random}}
{let constant frequency:Frequency = 30fps}
{let constant period:Time = 1 / frequency}
{let constant acceleration:Acceleration2d =
{Acceleration2d 0(m/s^2), 0.1(m/s^2)}
}
{let constant group:ShapeGroup =
{ShapeGroup
draw-operation = DrawOperation.source
}
}
{let constant canvas:Canvas =
{Canvas
width = 6cm,
height = 6cm,
background = "black",
group
}
}
{let constant host-rendering-display:CheckButton =
{CheckButton
label = "use-host-rendering?",
enabled? = false,
value = canvas.use-host-rendering?
}
}
{let constant advanced-operations-display:CheckButton =
{CheckButton
label = "support-advanced-draw-operations?",
enabled? = false,
value = canvas.support-advanced-draw-operations?
}
}
{for i = 0 below 5 do
let constant opacity:float = {random.next-float} * 0.5f + 0.25f
{group.add
{RectangleShape
{GRect 7mm, 7mm, 8mm, 8mm},
color =
{Color.from-rgb
(4 - i) / 4,
0.1,
i / 4,
opacity = opacity
},
user-data = 1 / ({random.next-float} * 1s + 3s),
translation = {Distance2d 0m, i * 5cm / 4 + .5cm},
{TextShape
{format "%0.1f", opacity},
color = "white"
}
}
}
}
{let time:Time = 0s}
{let timer-button:CommandButton =
{CommandButton
label = "Start animation!",
{on Action at cb:CommandButton do
{if timer.enabled? then
set timer.enabled? = false
set cb.label = "Start animation!"
else
set timer.repeat = 600
set timer.enabled? = true
set cb.label = "Stop animation!"
}
}
}
}
{let timer:Timer =
{Timer
enabled? = false,
frequency = frequency,
{on TimerEvent at t:Timer do
{if t.repeat == 0 then
set timer-button.label = "Start animation!"
set timer.enabled? = false
}
{inc time, period}
let constant shapes:{Array-of Shape} =
group.shape-children
{for shape in group.shape-children do
let constant f:Frequency =
shape.user-data asa Frequency
let constant (x:Distance, y:Distance) =
{shape.get-origin-in-shape-parent}
{shape.set-translation-in-parent
((0.5 + 0.5 *
{cos time * 2rad * pi * f + pi * 1rad}) *
canvas.actual-width),
y
}
}
}
}
}
{value canvas}
{VBox
host-rendering-display,
advanced-operations-display
}
{value timer-button}
{RadioFrame
{VBox
spacing = 4pt,
{RadioButton radio-value = DrawOperation.source, value = true},
{RadioButton radio-value = DrawOperation.accumulate},
{RadioButton radio-value = DrawOperation.add},
{RadioButton radio-value = DrawOperation.blend},
{RadioButton radio-value = DrawOperation.blend-premultiply},
{RadioButton radio-value = DrawOperation.invert-destination},
{RadioButton radio-value = DrawOperation.invert-source},
{RadioButton radio-value = DrawOperation.mask}
},
{on ValueFinished at rf:RadioFrame do
let constant op:DrawOperation = rf.value asa DrawOperation
set group.draw-operation = op
{if op == DrawOperation.source or
op == DrawOperation.mask
then
set canvas.use-host-rendering? = true
set canvas.support-advanced-draw-operations? = false
else
set canvas.use-host-rendering? = false
set canvas.support-advanced-draw-operations? =
not (op == DrawOperation.source or
op == DrawOperation.mask or
op == DrawOperation.blend)
}
set host-rendering-display.value =
canvas.use-host-rendering?
set advanced-operations-display.value =
canvas.support-advanced-draw-operations?
}
}
| |
(アクセサ)
アクセサ public final Shape.graphical-parent:#
Box Boxであるもっとも近い祖先を返します。
導入:
バージョン 7.0
(アクセサ)
オブジェクトのオプションの親を返します。
戻り値
オーバーライド
(アクセサ)
アクセサ public final Shape.possibly-displayed?:
bool このオブジェクトが表示されているかどうかを伝えます。
説明
このオブジェクトがスクリーン上に表示されているかもしれない時、true を返します。オブジェクトが明らかに表示されていない時は、false を返します。解はあくまで"ベストエフォート"
を基本にしており、オブジェクトが表示されていない時でも true を返す可能性があります。
導入:
バージョン 7.0
(非ローカル オプション)
(フィールド)
この Shape の直属の親です。Shape が親を持たない場合、このフィールドは null になります。
(ローカル オプション)
(非ローカル オプション)
public Shape.stroke-thickness:
any
(フィールド)
(ローカル オプション)
public Shape.visible?:
bool =true
(メソッド)
public final | {Shape.apply-rotation angle:Angle}:void |
回転を適用してこのオブジェクトの transformation を変更します。
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-rotation 15deg\}",
{on Action do {shape.apply-rotation 15deg}}
}
| |
(メソッド)
スケールを適用してこのオブジェクトの transformation を変更します。
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-scale 1.2, 1.1\}",
{on Action do {shape.apply-scale 1.2, 1.1}}
}
| |
(メソッド)
public final | {Shape.apply-transformation}:void |
このオブジェクトの transformation を別の Transformation2d で構成して変更します。
注意事項
引数に
transformation を指定して
self.transformation.compose-clone を呼び出したときと同じ結果を返します。
ただし、これを直接呼び出すことはできません。内部のデータ構造の同期がとれなくなる可能性があるからです。Shape.transformation を変更するには、このようなメソッドを呼び出す必要があります。
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{let transformation:Transformation2d = {Transformation2d}}
{transformation.local-rotate 15deg}
{transformation.local-translate 1mm, 0mm}
{CommandButton
label = "\{apply-transformation transformation\}",
{on Action do {shape.apply-transformation transformation}}
}
| |
(メソッド)
public final | {Shape.apply-translation}:void |
平行移動を適用してこのオブジェクトの transformation を変更します。
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-translation 2mm, 1mm\}",
{on Action do {shape.apply-translation 2mm, 1mm}}
}
| |
(メソッド)
public final | {Shape.apply-translation-in-parent}:void |
平行移動を適用してこのオブジェクトの transformation を変更します。
注意事項
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
rotation = 45deg,
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-translation 2mm, 0mm\}",
{on Action do {shape.apply-translation 2mm, 0mm}}
}
{CommandButton
label = "\{apply-translation-in-parent 2mm, 0mm\}",
{on Action do {shape.apply-translation-in-parent 2mm, 0mm}}
}
| |
(メソッド)
public | {Shape.constrain-own-layout-bounds}:void |
境界制約 (ローカル座標系) をこの Shape に適用します。
bounds: 適用する制約です。
説明
Shape は制約に従う必要はありません。ただし、制約に従わない場合、Shape の全体を表示することができません。
既定の実装では、制約を無視します。
注意事項
(メソッド)
public | {Shape.constrain-shape-layout-bounds}:void |
境界制約 (ローカル座標系) をこの Shape とその子すべてに適用します。
bounds: 適用する制約です。
説明
(メソッド)
この形状またはそのいずれかの子にポイントが含まれているかどうかを判定します。
説明
オーバーライド
(メソッド)
public | {Shape.detach}:void |
この形状を親から切り離します。
説明
親を持たない形状に対して detach を呼び出しても効果はありません。
(メソッド)
このオブジェクトの可視表現を描画します。
オーバーライド
Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。
(メソッド)
public final | {Shape.find-graphical-ancestor}:#Graphic |
与えられた述語に適合する最も近いグラフィックの祖先を返します。
p: 述語を指定するプロシージャ。
戻り値
{p a} が true を返す最も近い祖先 a。{p self} が true を返す場合、self が返されます。p に適合する祖先が見つからない場合、戻り値は null になります。
(メソッド)
public | {Shape.fire-crossing-event}:void |
(メソッド)
イベントの座標を修正して、子 Visual をターゲットとしてそのイベントを発生させ、その後、座標を復元します。
e: 子オブジェクトをターゲットとして発生させるイベント。
(メソッド)
(メソッド)
public final | {Shape.get-down-orientation-in-shape-parent}:Double2d |
このオブジェクトの座標系をその親の座標系に変換した場合の、「下」向きベクトルの方向を計算します。
説明
このメソッドは、ベクトル (0, 1) をこのオブジェクトのローカル座標系からその親の座標系に変換した場合の座標を示します。これは、このオブジェクトの方向を親を基準にして決定する方法です。
(メソッド)
public final | {Shape.get-graphical-root}:#Graphic |
Visual のグラフィック階層のルートで、オブジェクトを取得します。
戻り値
オーバーライド
(メソッド)
ソート目的で位置の配列を提供します。
戻り値
このメソッドは、root配下のグラフィック階層内のVisualの位置を、親の中でのそれぞれの親オブジェクトを表す整数の配列として返します。その配列は、グラフィックオブジェクトの合理的な順序を取得する為に比較されます。
注意事項
コンテナオブジェクトは、子オブジェクト左から右に並べる為に、合理的なスキーマを使用するかもしれません。その為GUIパスの数値の詳細は、あるCurlセッションと他のセッションで同じであることは保証されません。
オーバーライド
Visual上の子のメソッドの基本定義は、エラーをスローするだけです。
Visualの直接のサブクラスの多く、例えば
Graphicは、このメソッドに適した定義を提供しています。したがって、
Visualから間接的に継承されたユーザー定義のクラスは、一般的にこのメソッドをオーバーライドする必要はありません。
導入:
バージョン 7.0
(メソッド)
public | {Shape.get-gui-path-to-child}:{Array-of int} |
指定されたBoxから、指定されたこのオブジェクトの子に向かうGUIパスを計算します。
child: パスが計算される
Visual。
childは、
selfの直接の子であることが必要です。
root: childへ向かうパスのスタート地点
プログラミング注意事項
注意事項
コンテナオブジェクトは、子オブジェクト左から右に並べる為に、合理的なスキーマを使用するかもしれません。その為GUIパスの数値の詳細は、あるCurlセッションと他のセッションで同じであることは保証されません。
オーバーライド
Shape 上のこのメソッドの既定の実装では、
self の
shape-children において
child のインデックスを計算し、
root から
self までのパスのインデックスを追加します。
導入:
バージョン 7.0
(メソッド)
public final | {Shape.get-local-device-pixel-size}:Distance |
ピクセルのサイズをローカル座標単位で取得します。
説明
それ以外の場合は、この値がこの形状のローカル座標系に変換されてから返されます。
注意事項
このオブジェクトのスケーリングが non-uniform の場合 — つまり、X 方向のスケーリングが Y 方向のスケーリングと異なる場合 — 返される値は 2 つのスケール値の大きい方を使用して処理されます。
(メソッド)
グラフィック階層内における指定された祖先に対する Visual の相対的位置を見つけます。
ancestor: 対象の上位オブジェクトです。
戻り値
対象の座標、ならびに
ancestor が
self の上位オブジェクトである場合は true に、それ以外の場合は false に指定された
bool です。この
bool が false の場合、返される座標には意味はありません。
オーバーライド
これは
Visual のサブクラスに定義されなくてはならない抽象メソッドです。
注意事項
このメソッドは有効なレイアウトを持つオブジェクトで呼び出されなければなりません。そうでなければ、このメソッドの戻り値は有用ではありません。
(メソッド)
グラフィック階層のルートにあるオブジェクトを基準とし、Visual の位置を取得します。
戻り値
ロケーションとルート オブジェクトでは次のようになります。
- ルートの内側起点を基準とした、Visual の内側起点の x 座標。
- ルートの内側起点を基準とした、Visual の内側起点の y 座標。
- ルート オブジェクトそのもの ( Graphic)。
注意事項
(メソッド)
親の座標系におけるこの Shape の起点を計算します。
説明
self.transformation.dx, self.transformation.dy として定義されているため、これは高速な操作です。
(メソッド)
形状ルートである祖先の座標系における、このオブジェクトの起点を取得します。
説明
(メソッド)
public abstract | {Shape.get-own-bounds dest:GRect = {GRect.empty}}:GRect |
ローカル座標系におけるこの Shape の四角形のレンダリング境界を計算します。
dest: データを返すために使用されるオプションの GRect オブジェクト。
戻り値
境界を含む
GRect オブジェクト。これは、常に
dest と同じオブジェクトになります。この
GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。
-dest.lextent <= dest.rextent and -dest.ascent <= dest.descent
説明
返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があります。ただし、このオブジェクトのすべての子を含んでいません。
注意事項
オーバーライド
Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。データを返すには、dest パラメータを使用する必要があります。
(メソッド)
public | {Shape.get-own-bounds-in-shape-root dest:GRect = {GRect.empty} }:GRect |
形状ルートである祖先の座標系における、この形状の四角形のレンダリング境界を計算します。
dest: データを返すために使用されるオプションの GRect オブジェクト。
戻り値
境界を含む
GRect オブジェクト。これは、常に
dest と同じオブジェクトになります。この
GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。
-dest.lextent <= dest.rextent and -dest.ascent <= dest.descent
説明
返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があります。ただし、このオブジェクトのすべての子を含んでいません。
注意事項
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
オーバーライド
軸平行の四角形を使用するよりも厳密な方法でオブジェクトの境界を変換できる場合は、このメソッドを独自の Shape 実装でオーバーライドすることをお勧めします。
(メソッド)
public | {Shape.get-own-layout-bounds}:GRect |
ローカル座標系におけるこの Shape の四角形のレイアウト境界を計算します。
width-first?:
GraphicShape の場合、width-first レイアウト ネゴシエーションを使用して計算されるべき境界であるかを示します。このパラメータは、通常他のサブクラスでは使用されません。
dest: データを返すために使用されるオプションの GRect オブジェクト。
戻り値
境界を含む
GRect オブジェクト。これは、常に
dest と同じオブジェクトになります。この
GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。
-dest.lextent <= dest.rextent and -dest.ascent <= dest.descent
説明
返された境界には、レイアウトの使用について、オブジェクトに関する詳細な記述があります。ただし、このオブジェクトのすべての子は含まれていません。
注意事項
オーバーライド
(メソッド)
public final | {Shape.get-right-orientation-in-shape-parent}:Double2d |
このオブジェクトの座標系をその親の座標系に変換した場合の、「右」向きベクトルの方向を計算します。
説明
このメソッドは、ベクトル (1, 0) をこのオブジェクトのローカル座標系からその親の座標系に変換した場合の座標を示します。これは、このオブジェクトの方向を親を基準にして決定する方法です。
(メソッド)
public | {Shape.get-shape-bounds dest:GRect = {GRect.empty}}:GRect |
このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレンダリング境界を計算します。
dest: データを返すために使用されるオプションの GRect オブジェクト。
戻り値
境界を含む
GRect オブジェクト。これは、常に
dest と同じオブジェクトになります。この
GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。
-dest.lextent <= dest.rextent and -dest.ascent <= dest.descent
説明
返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があり、このオブジェクトのすべての子を含んでいます。
(メソッド)
public | {Shape.get-shape-bounds-in-shape-root dest:GRect = {GRect.empty} }:GRect |
形状ルートである祖先の座標系における、このオブジェクトと子の四角形のレンダリング境界を取得します。
dest: データを返すために使用されるオプションの GRect オブジェクト。
戻り値
境界を含む
GRect オブジェクト。これは、常に
dest と同じオブジェクトになります。この
GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。
-dest.lextent <= dest.rextent and -dest.ascent <= dest.descent
説明
返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があり、このオブジェクトのすべての子を含んでいます。
注意事項
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
(メソッド)
public | {Shape.get-shape-layout-bounds}:GRect |
このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレイアウト境界を計算します。
width-first?:
GraphicShape の場合、width-first レイアウト ネゴシエーションを使用して計算されるべき境界であるかを示します。このパラメータは、通常他のサブクラスでは使用されません。
dest: データを返すために使用されるオプションの GRect オブジェクト。
戻り値
境界を含む
GRect オブジェクト。これは、常に
dest と同じオブジェクトになります。この
GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。
-dest.lextent <= dest.rextent and -dest.ascent <= dest.descent
説明
返された境界には、レイアウトの使用について、オブジェクトに関する詳細な記述があります。また、このオブジェクトのすべての子も含まれています。
(メソッド)
グラフィック階層に含まれる指定上位オブジェクトの座標フレームでこのオブジェクトの左上隅のロケーションを見つけます。
ancestor: 対象の上位オブジェクトです。
戻り値
対象の座標、ならびに
ancestor が
self の上位オブジェクトである場合は true に、それ以外の場合は false に指定された
bool です。この
bool が false の場合、返される座標には意味はありません。
オーバーライド
これは
Visual のサブクラスに定義されなくてはならない抽象メソッドです。
注意事項
(メソッド)
このオブジェクトの座標系から形状ルートである祖先の座標系への累積変換を返します。
注意事項
このメソッドは処理に時間がかかるため、頻繁には使用しないでください。
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
(メソッド)
(メソッド)
protected | {Shape.option-change-notify}:void |
このオブジェクトで値が変更されたオプションについて、オプションの変更ハンドラを呼び出します。
item: 追加または削除されたバインディング オプション。
removed?: item が削除された場合は true、それ以外の場合は false。
説明
オーバーライド
通常はオーバーライドされません。
(メソッド)
public | {Shape.overdraw-for-selection}:void |
このオブジェクトの上に選択アフォーダンスを描画します。
説明
このメソッドは、内部の形状描画メカニズムにより呼び出されます。通常は、直接呼び出す必要はありません。
オーバーライド
Shape の実装でこのメソッドをオーバーライドする必要はありませんが、形状のレンダリングされたプリミティブの真上に選択アフォーダンスを描画したほうが選択が見やすくなる場合があります。
(メソッド)
public final | {Shape.quantize-line-thickness thickness:any,display-context:DisplayContext = {self.get-display-context},quantum-size:Distance = {self.get-local-device-pixel-size} }:(result:Distance, single-device-pixel?:bool) |
線の太さの値を数量化するユーティリティ プロシージャです。
thickness: 数量化される太さ。
display-context: ピクセル サイズを決定するために使用する
DisplayContext。通常はこのパラメータを指定する必要はありません。
quantum-size:
thickness が数量化される
Distance。返される値はこの値の倍数となります。
戻り値
このメソッドは 2 つの値を返します。
- 最初の戻り値は quantum-size の倍数に丸められた thickness です。
- 2 番目の戻り値は、最初の戻り値が単一のデバイス ピクセルのサイズであるかどうかを示すブール値です。この計算はこの Shape の変換を考慮します。この Shape がアンチエイリアス処理が有効な AntialiasMixin 内に含まれている場合は、この値は true にならないことに注意してください。
説明
(メソッド)
public | {Shape.request-draw}:void |
描画する Visual に属するピクセルを確認します。
注意事項
プログラミング注意事項
このオブジェクトのピクセルの再ペイントが必要になる何らかの理由があったとき、このメソッドが呼び出されます。このような状況が発生するのは、オブジェクトが初めて表示されるとき、ビューから削除されるとき、移動やサイズ変更が行なわれるとき (この場合、移動やサイズ変更の前と後でこのメソッドを呼び出す必要があります) などがあります。
(メソッド)
public | {Shape.request-draw-self}:void |
再描画する Shape に属するピクセルを要求します。
説明
(メソッド)
public final | {Shape.reset-transformation}:void |
このオブジェクトの transformation を恒等変換にリセットします。
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
{GRect -.25in, .75in, -.25in, .75in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{let transformation:Transformation2d = {Transformation2d}}
{transformation.local-rotate 15deg}
{transformation.local-translate 1mm, 0mm}
{CommandButton
label = "\{apply-transformation transformation\}",
{on Action do {shape.apply-transformation transformation}}
}
{CommandButton
label = "\{reset-transformation\}",
{on Action do {shape.reset-transformation}}
}
| |
(メソッド)
public abstract | {Shape.self-contains-point?}:bool |
ポイントがこの Shape 内にあるかどうかを判定します。
x: 点の X 座標。
y: 点の Y 座標。
戻り値
この Shape が (x、y) を含む場合は、true。
説明
ポイントは、このオブジェクトのローカル座標系にあります。このメソッドは、その子を考慮しません。
オーバーライド
Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。このメソッドは、
PointerMotion などのマウス イベントをこのオブジェクトにいつ送信するかなどを決定します。
通常は、このメソッドを実装して、ポイントが形状の境界内にあるかどうかだけでなく、ポイントが形状のレンダリングされたプリミティブ内にあるどうかを確認する必要があります。このメソッドは必要なメトリックを使用して自在に実装できます。
(メソッド)
public abstract | {Shape.self-intersects-polygon?}:bool |
ポリゴンがこの Shape と交差するかどうかを判定します。
polygon: この形状のローカル座標空間にポリゴンを記述するポイント セットを含むオブジェクト。このポリゴンは必ず凸型であり、反時計回りのワインディング順に従います。
説明
オーバーライド
Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。子を考慮する必要はありません。
通常は、このメソッドを実装して、領域が形状の境界内にあるかどうかだけでなく、領域が形状のレンダリングされたプリミティブと交差するかどうかを確認する必要があります。このメソッドは、必要なメトリックを使用して自在に実装できます。このメソッドの実装が
Shape.self-contains-point? と調和しない場合は、このオブジェクトを選択すると予期しない結果になります。
選択機能を使用しない場合は、このメソッドを単純に false を返すように実装できます。
(メソッド)
public final | {Shape.set-rotation angle:Angle}:void |
回転を設定してこのオブジェクトの transformation を変更します。
説明
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-rotation 15deg\}",
{on Action do {shape.apply-rotation 15deg}}
}
{CommandButton
label = "\{set-rotation 15deg\}",
{on Action do {shape.set-rotation 15deg}}
}
| |
(メソッド)
スケールを設定してこのオブジェクトの transformation を変更します。
説明
注意事項
このメソッドには制限が一部あることに留意してください。現在の変換を分解して実装するため、現在の変換が X または Y 軸において負のスケーリングであるかを確実に検知できません。スケーリング パラメータに負の値を提供すると、軸を境に反転します。そのため、パラメータの1つまたは両方に負の値を使用して Shape.set-scale を繰り返し呼び出すと、毎回変換が生じます。
1つまたは両方の軸において、事前にスケールをゼロに低減すると、変換は正常な状態に戻りません。set-scale は、このようなシナリオで呼び出すと、妥当な結果を形成しますが、結果となる変換は、軸を折りたたんだ前と同様の変換にはなりません。
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
translation = {Distance2d .5in, .5in},
{GRect .25in, .25in, .25in, .25in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-scale 1.2, 1.1\}",
{on Action do {shape.apply-scale 1.2, 1.1}}
}
{CommandButton
label = "\{set-scale 1.2, 1.1\}",
{on Action do {shape.set-scale 1.2, 1.1}}
}
| |
(メソッド)
public final | {Shape.set-transformation}:void |
このオブジェクトの transformation を別の Transformation2d に置き換えて変更します。
説明
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
{GRect -.25in, .75in, -.25in, .75in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{let transformation:Transformation2d = {Transformation2d}}
{transformation.local-rotate 15deg}
{transformation.local-translate 1mm, 0mm}
{CommandButton
label = "\{apply-transformation transformation\}",
{on Action do {shape.apply-transformation transformation}}
}
{CommandButton
label = "\{set-transformation transformation\}",
{on Action do {shape.set-transformation transformation}}
}
| |
(メソッド)
public final | {Shape.set-translation-in-parent}:void |
親を基準にした平行移動を設定してこのオブジェクトの transformation を変更します。
説明
例
例 |
|
{import * from CURL.GUI.SHAPES}
{let shape:Shape =
{RectangleShape
{GRect -.25in, .75in, -.25in, .75in}
}
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}
{CommandButton
label = "\{apply-translation-in-parent 2mm, 1mm\}",
{on Action do {shape.apply-translation-in-parent 2mm, 1mm}}
}
{CommandButton
label = "\{set-translation-in-parent 2mm, 1mm\}",
{on Action do {shape.set-translation-in-parent 2mm, 1mm}}
}
| |
(メソッド)
このオブジェクトに値する Graphic を返します。
説明
Shape がグラフィカル階層に追加されると、Curl レイアウト システムによってこのメソッドが呼び出されます。通常、直接呼び出されません。
導入:
バージョン 6.0
(メソッド)
public final | {Shape.transform-from-display-coordinates}:(new-x:Distance, new-y:Distance) |
このオブジェクトの Display の座標系からこのオブジェクトの座標系に座標を変換します。
x, y: Display の座標系の座標。
戻り値
このオブジェクトの座標系の座標。
注意事項
(メソッド)
このオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系からこのオブジェクトの座標系に座標を変換します。
x, y: グラフィカル ルートの座標系の座標。
戻り値
- このオブジェクトの起点を基準とする x 座標。
- このオブジェクトの起点を基準とする y 座標。
- グラフィカル ルート自体。
注意事項
(メソッド)
public final | {Shape.transform-point-from-shape-root}:Distance2d |
このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された point を返します。
注意事項
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
(メソッド)
public final | {Shape.transform-point-to-shape-root}:Distance2d |
このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された point を返します。
注意事項
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
(メソッド)
public final | {Shape.transform-to-display-coordinates}:(new-x:Distance, new-y:Distance) |
このオブジェクトの座標系から Display の座標系に座標を変換します。
x, y: このオブジェクトの座標系の座標。
戻り値
表示の座標系の起点を基準とする座標です。
注意事項
(メソッド)
このオブジェクトの座標系からこのオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系に座標を変換します。
x, y: このオブジェクトの座標系の座標。
戻り値
- オブジェクトのグラフィカル ルートの起点を基準とする x 座標。
- オブジェクトのグラフィカル ルートの起点を基準とする y 座標。
- グラフィカル ルート自体。
注意事項
(メソッド)
public final | {Shape.transform-vector-from-shape-root}:Distance2d |
このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された vector を返します。
説明
ベクトル変換は、平行移動の影響を受けないという点で、ポイント変換とは異なります。
注意事項
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
(メソッド)
public final | {Shape.transform-vector-to-shape-root}:Distance2d |
このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された vector を返します。
説明
ベクトル変換は、平行移動の影響を受けないという点で、ポイント変換とは異なります。
注意事項
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。
(メソッド)
public | {Shape.transformation-changed}:void |
Shape.transformation が変更されたことの通知。
オーバーライド
重要:このメソッドのオーバーライド実装にスーパークラス実装の呼び出しを含めて、オブジェクトの新しい領域を無効にする必要があります。
(メソッド)
public | {Shape.transformation-changing}:void |
Shape.transformation が変更されることの通知。
オーバーライド
重要:このメソッドのオーバーライド実装にスーパークラス実装の呼び出しを含めて、オブジェクトの現在の領域を無効にし、変換変更の通知が Shape 階層全体に適切に送信されるようにする必要があります。