Shape (クラス)
public abstract Shape {inherits ShapeContainerBase, EventForwarder}
パッケージ: CURL.GUI.SHAPES
直接継承しているサブクラス: RoundedRectangleShape, TextShape, GraphicShape, ImageShape, EllipseShape, ShapeGroup, PathShape, RectangleShape, Chart, PieSet, AxisLineShape, PiePlotArea, ChartLayer, TickShape, LayeredPlotArea

任意の形状を表す抽象基本クラス。通常、ShapeCanvas 内に含まれます。

説明

このクラスをサブクラス化して、独自の形状を実装できます。組み込みの実装のリストとその使用例については、CURL.GUI.SHAPES を参照してください。

コンストラクタ
clone-appearance-from:新規オブジェクトを生成するためのコンストラクタ。
コンストラクタ protected {Shape.clone-appearance-from
other:Shape,
fixup:#{proc-type {Visual, Visual}:Visual}
}
default:この型の新しいオブジェクトを作成します。
コンストラクタ public {Shape.default ...}

プロパティ
as-Shape:Shape オブジェクトとして self を返すか、Shape でない場合は null を返します。
アクセサ public final Shape.as-Shape:#Shape
border-color:この (または子の) 形状に含まれる境界線またはアウトラインの色。
非ローカル オプション public Shape.border-color:FillPattern
color:この形状とその子の色。
非ローカル オプション public Shape.color:FillPattern
draw-operation:この Shape およびその子のすべてを描画する DrawOperation
ローカル オプション public Shape.draw-operation:DrawOperation =DrawOperation.blend
graphical-parent:Boxであるもっとも近い祖先を返します。
アクセサ public final Shape.graphical-parent:#Box
option-parent:オブジェクトのオプションの親を返します。
アクセサ public Shape.option-parent:#OptionListInterface
possibly-displayed?:このオブジェクトが表示されているかどうかを伝えます。
アクセサ public final Shape.possibly-displayed?:bool
selection-context:この ShapeContainerBase とその Shape 子孫に関連付けられた SelectionContext です。
非ローカル オプション public Shape.selection-context:#SelectionContext
shape-parent:この Shape の直属の親です。Shape が親を持たない場合、このフィールドは null になります。
フィールド public-get private-set Shape.shape-parent:#ShapeContainerBase
shape-selectable:この ShapeDiscreteGraphicSelectionContext 内で選択可能にする場合は、このオプションを ShapeSelectable に設定する必要があります。
ローカル オプション public Shape.shape-selectable:#ShapeSelectable =null
stroke-thickness:Shape オブジェクト内の線の太さです。
非ローカル オプション public Shape.stroke-thickness:any
transformation:この Shape の座標系からその親の座標系へのマッピングを行う Transformation2d
フィールド public constant Shape.transformation:Transformation2d
visible?:このオプションが false に設定されている場合、この Shape は描画されず、ポインタ イベントも受信しません。ShapeContainerBase.get-child-at-point および同様のメソッドは、visible? が false の場合は形状を返しません。
ローカル オプション public Shape.visible?:bool =true
プロパティ 継承 ShapeContainerBase: as-ShapeRoot, shape-children
プロパティ 継承 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
プロパティ 継承 DataBindingTarget: data-binding-context, data-bindings
プロパティ 継承 EventTarget: event-handlers
プロパティ 継承 OptionListInterface: option-register-proc, options-present-here, registered-option-keys

メソッド
apply-rotation:回転を適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-rotation angle:Angle}:void
apply-scale:スケールを適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-scale scale-x:double, scale-y:double}:void
apply-transformation:このオブジェクトの transformation を別の Transformation2d で構成して変更します。
public final {Shape.apply-transformation
transformation:Transformation2d
}:void
apply-translation:平行移動を適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-translation
offset-x:Distance,
offset-y:Distance
}:void
apply-translation-in-parent:平行移動を適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-translation-in-parent
offset-x:Distance,
offset-y:Distance
}:void
constrain-own-layout-bounds:境界制約 (ローカル座標系) をこの Shape に適用します。
public {Shape.constrain-own-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void
constrain-shape-layout-bounds:境界制約 (ローカル座標系) をこの Shape とその子すべてに適用します。
public {Shape.constrain-shape-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void
contains-point?:この形状またはそのいずれかの子にポイントが含まれているかどうかを判定します。
public {Shape.contains-point? x:Distance, y:Distance}:bool
detach:この形状を親から切り離します。
public {Shape.detach}:void
draw:このオブジェクトの可視表現を描画します。
public abstract {Shape.draw renderer2d:Renderer2d}:void
find-graphical-ancestor:与えられた述語に適合する最も近いグラフィックの祖先を返します。
public final {Shape.find-graphical-ancestor
p:{proc-type {Graphic}:bool}
}:#Graphic
fire-crossing-event:他のイベントから PointerCrossing を初期化して、子 Visual をターゲットとして、そのイベントを発生させます。
public {Shape.fire-crossing-event}:void
fire-in-child:イベントの座標を修正して、子 Visual をターゲットとしてそのイベントを発生させ、その後、座標を復元します。
public {Shape.fire-in-child e:PointerEnvelopeEvent}:void
get-display-context:このオブジェクトの現在の DisplayContext を返します。
public {Shape.get-display-context}:DisplayContext
get-down-orientation-in-shape-parent:このオブジェクトの座標系をその親の座標系に変換した場合の、「下」向きベクトルの方向を計算します。
public final {Shape.get-down-orientation-in-shape-parent}:Double2d
get-graphical-root:Visual のグラフィック階層のルートで、オブジェクトを取得します。
public final {Shape.get-graphical-root}:#Graphic
get-gui-path:ソート目的で位置の配列を提供します。
public {Shape.get-gui-path root:Box}:{Array-of int}
get-gui-path-to-child:指定されたBoxから、指定されたこのオブジェクトの子に向かうGUIパスを計算します。
public {Shape.get-gui-path-to-child
child:Visual,
root:Box
}:{Array-of int}
get-local-device-pixel-size:ピクセルのサイズをローカル座標単位で取得します。
public final {Shape.get-local-device-pixel-size}:Distance
get-origin-in-graphical-ancestor:グラフィック階層内における指定された祖先に対する Visual の相対的位置を見つけます。
public final {Shape.get-origin-in-graphical-ancestor
ancestor:Graphic
}:(x:Distance, y:Distance, found?:bool)
get-origin-in-root:グラフィック階層のルートにあるオブジェクトを基準とし、Visual の位置を取得します。
public final {Shape.get-origin-in-root
}:(x:Distance, y:Distance, root:Graphic)
get-origin-in-shape-parent:親の座標系におけるこの Shape の起点を計算します。
public final {Shape.get-origin-in-shape-parent
}:(x:Distance, y:Distance)
get-origin-in-shape-root:形状ルートである祖先の座標系における、このオブジェクトの起点を取得します。
public final {Shape.get-origin-in-shape-root}:(x:Distance, y:Distance)
get-own-bounds:ローカル座標系におけるこの Shape の四角形のレンダリング境界を計算します。
public abstract {Shape.get-own-bounds dest:GRect = {GRect.empty}}:GRect
get-own-bounds-in-shape-root:形状ルートである祖先の座標系における、この形状の四角形のレンダリング境界を計算します。
public {Shape.get-own-bounds-in-shape-root
dest:GRect = {GRect.empty}
}:GRect
get-own-layout-bounds:ローカル座標系におけるこの Shape の四角形のレイアウト境界を計算します。
public {Shape.get-own-layout-bounds
lc:LayoutContext,
width-first?:bool = true,
dest:GRect = {GRect.empty}
}:GRect
get-right-orientation-in-shape-parent:このオブジェクトの座標系をその親の座標系に変換した場合の、「右」向きベクトルの方向を計算します。
public final {Shape.get-right-orientation-in-shape-parent}:Double2d
get-shape-bounds:このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレンダリング境界を計算します。
public {Shape.get-shape-bounds dest:GRect = {GRect.empty}}:GRect
get-shape-bounds-in-shape-root:形状ルートである祖先の座標系における、このオブジェクトと子の四角形のレンダリング境界を取得します。
public {Shape.get-shape-bounds-in-shape-root
dest:GRect = {GRect.empty}
}:GRect
get-shape-layout-bounds:このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレイアウト境界を計算します。
public {Shape.get-shape-layout-bounds
lc:LayoutContext,
width-first?:bool = true,
dest:GRect = {GRect.empty}
}:GRect
get-top-left-in-ancestor:グラフィック階層に含まれる指定上位オブジェクトの座標フレームでこのオブジェクトの左上隅のロケーションを見つけます。
public final {Shape.get-top-left-in-ancestor
ancestor:Graphic
}:(x:Distance, y:Distance, found?:bool)
get-transformation-to-shape-root:このオブジェクトの座標系から形状ルートである祖先の座標系への累積変換を返します。
public final {Shape.get-transformation-to-shape-root}:Transformation2d
keyword-init-arg: InitRestArgParser.process-rest-args でキーワード引数が検出されると呼び出されます。
protected {Shape.keyword-init-arg key:String, value:any}:void
option-change-notify:このオブジェクトで値が変更されたオプションについて、オプションの変更ハンドラを呼び出します。
protected {Shape.option-change-notify
item:OptionItem,
removed?:bool
}:void
overdraw-for-selection:このオブジェクトの上に選択アフォーダンスを描画します。
public {Shape.overdraw-for-selection}:void
quantize-line-thickness:線の太さの値を数量化するユーティリティ プロシージャです。
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)
request-draw:描画する Visual に属するピクセルを確認します。
public {Shape.request-draw
layout-context:LayoutContext = {self.get-layout-context}
}:void
request-draw-self:再描画する Shape に属するピクセルを要求します。
public {Shape.request-draw-self
layout-context:LayoutContext = {self.get-layout-context}
}:void
reset-transformation:このオブジェクトの transformation を恒等変換にリセットします。
public final {Shape.reset-transformation}:void
self-contains-point?:ポイントがこの Shape 内にあるかどうかを判定します。
public abstract {Shape.self-contains-point?}:bool
self-intersects-polygon?:ポリゴンがこの Shape と交差するかどうかを判定します。
public abstract {Shape.self-intersects-polygon?}:bool
set-rotation:回転を設定してこのオブジェクトの transformation を変更します。
public final {Shape.set-rotation angle:Angle}:void
set-scale:スケールを設定してこのオブジェクトの transformation を変更します。
public final {Shape.set-scale scale-x:double, scale-y:double}:void
set-transformation:このオブジェクトの transformation を別の Transformation2d に置き換えて変更します。
public final {Shape.set-transformation
transformation:Transformation2d
}:void
set-translation-in-parent:親を基準にした平行移動を設定してこのオブジェクトの transformation を変更します。
public final {Shape.set-translation-in-parent}:void
to-Graphic:このオブジェクトに値する Graphic を返します。
public {Shape.to-Graphic}:Graphic
transform-from-display-coordinates:このオブジェクトの Display の座標系からこのオブジェクトの座標系に座標を変換します。
public final {Shape.transform-from-display-coordinates}:(new-x:Distance, new-y:Distance)
transform-from-graphical-root-coordinates:このオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系からこのオブジェクトの座標系に座標を変換します。
public final {Shape.transform-from-graphical-root-coordinates}:(new-x:Distance, new-y:Distance, root:Graphic)
transform-point-from-shape-root:このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された point を返します。
public final {Shape.transform-point-from-shape-root
point:Distance2d
}:Distance2d
transform-point-to-shape-root:このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された point を返します。
public final {Shape.transform-point-to-shape-root
point:Distance2d
}:Distance2d
transform-to-display-coordinates:このオブジェクトの座標系から Display の座標系に座標を変換します。
public final {Shape.transform-to-display-coordinates}:(new-x:Distance, new-y:Distance)
transform-to-graphical-root-coordinates:このオブジェクトの座標系からこのオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系に座標を変換します。
public final {Shape.transform-to-graphical-root-coordinates}:(new-x:Distance, new-y:Distance, root:Graphic)
transform-vector-from-shape-root:このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された vector を返します。
public final {Shape.transform-vector-from-shape-root
vector:Distance2d
}:Distance2d
transform-vector-to-shape-root:このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された vector を返します。
public final {Shape.transform-vector-to-shape-root
vector:Distance2d
}:Distance2d
transformation-changed:Shape.transformation が変更されたことの通知。
public {Shape.transformation-changed}:void
transformation-changing:Shape.transformation が変更されることの通知。
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
メソッド 継承 GraphicOptions: any-to-Distance
メソッド 継承 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
メソッド 継承 DataBindingTarget: add-data-binding, get-data-binding, refresh-data-binding, remove-data-binding, unset-property, update-data-binding, validate-data-binding
メソッド 継承 EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, remove-event-handler, verify-event
メソッド 継承 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
メソッド 継承 BasicEventTarget: enqueue-event
メソッド 継承 InitRestArgParser: process-rest-args
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
clone-appearance-from (コンストラクタ)
protected {Shape.clone-appearance-from
other:Shape,
fixup:#{proc-type {Visual, Visual}:Visual}
}

新規オブジェクトを生成するためのコンストラクタ。

other: クローンする Shape
fixup:
各クローンを作成するために呼び出されるプロシージャ。クローン化する時に使用され Shape.clone-children に渡されます。
このプロシージャは二つの引数と共に呼び出されます。元のオブジェクトと 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}
}


default (コンストラクタ)
public {Shape.default ...}

この型の新しいオブジェクトを作成します。

...:
渡される非キーワード引数は、このオブジェクトの子として追加される Shape であると解釈されます。すべての Visual クラスと同様に、オプション (color など) を初期化するために残余引数が使用される場合もあります。
さらに、次の特別なキーワード引数が渡される場合があり、渡された順に処理されます。
これらの引数のすべては Shape.apply-rotationShape.apply-scaleShape.apply-translation と同じ方法で現在の Shape.transformation に反映されます。これらの引数は累積され、何度でも指定できます。引数が表示される順序は、変換が適用される順序です。



プロパティ詳細
as-Shape (アクセサ)
アクセサ public final Shape.as-Shape:#Shape

Shape オブジェクトとして self を返すか、Shape でない場合は null を返します。

注意事項

Canvas は、Shape ではない ShapeContainerBase の例です。


border-color (非ローカル オプション)
public Shape.border-color:FillPattern

この (または子の) 形状に含まれる境界線またはアウトラインの色。

注意事項

すべての形状オブジェクトにこのオプションがあり、継承されるか、またはオブジェクトに直接設定されます。
形状オブジェクトによっては、このプロパティを直接使用しないものがあります。たとえば、ShapeGroup はこのプロパティを使用しません。しかし、ShapeGroup オブジェクトにこのようなプロパティを設定すると、形状オブジェクトのすべての子が既定でプロパティを継承するので便利です。


color (非ローカル オプション)
public Shape.color:FillPattern

この形状とその子の色。

説明

形状を塗りつぶさない場合は、このオプションを FillPattern.transparent に設定できます。通常、この設定は、Shape.self-contains-point? の結果または形状に渡されるマウス イベントには影響を与えません。

注意事項

すべての形状オブジェクトにこのオプションがあり、継承されるか、またはオブジェクトに直接設定されます。
形状オブジェクトによっては、このプロパティを直接使用しないものがあります。たとえば、ShapeGroup はこのプロパティを使用しません。しかし、ShapeGroup オブジェクトにこのようなプロパティを設定すると、形状オブジェクトのすべての子が既定でプロパティを継承するので便利です。


draw-operation (ローカル オプション)
public Shape.draw-operation:DrawOperation =DrawOperation.blend

この Shape およびその子のすべてを描画する DrawOperation

説明

このオプションが未設定の場合、現在の DrawOperation は変更されません。これは、子 Shape が、既定で、親と同じ DrawOperation で描画することを意味します。したがって、オプションの既定値 (DrawOperation.mask) は重要ではなく、単に Renderer2d の既定の初期 DrawOperation を反映します。
このオプションはさまざまな透過性効果を有効にするために使用できます。適したレンダラを使用する必要があることに注意してください。DrawOperation.mask および DrawOperation.source だけがすべてのレンダラでサポートされています。Shape の描画に使用するレンダラのタイプは変えることができます。
Canvas を使用する場合、その Canvas.use-host-rendering? および Canvas.support-advanced-draw-operations? プロパティを設定することができます。または、AntialiasedFrame の同じプロパティを使用することもできます。
「ホストでない」レンダラが必要な場合、および support-advanced-draw-operations? が必要な場合に関する詳細は、DrawOperation を参照してください。

この例では、さまざまな描画操作の効果を示すため、動いて重なり合う RectangleShape を使用しています。選択した操作は、四角形のすべての形状の親に設定されます。また、このコードがその Canvasuse-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?
    }
}


graphical-parent (アクセサ)
アクセサ public final Shape.graphical-parent:#Box

Boxであるもっとも近い祖先を返します。

導入: バージョン 7.0


option-parent (アクセサ)
アクセサ public Shape.option-parent:#OptionListInterface

オブジェクトのオプションの親を返します。

戻り値

このオブジェクトのオプションの親である OptionListInterface。ただし、このオブジェクトがオプションの親を持たない場合は、null になります。

オーバーライド

既定の実装 OptionListInterface.option-parent は常に null を返します。サブクラスでは、通常は super.option-parent は呼び出さずに、適切な値を返すコードでこのメソッドをオーバーライドします。


possibly-displayed? (アクセサ)
アクセサ public final Shape.possibly-displayed?:bool

このオブジェクトが表示されているかどうかを伝えます。

説明

このオブジェクトがスクリーン上に表示されているかもしれない時、true を返します。オブジェクトが明らかに表示されていない時は、false を返します。解はあくまで"ベストエフォート" を基本にしており、オブジェクトが表示されていない時でも true を返す可能性があります。
導入: バージョン 7.0


selection-context (非ローカル オプション)
public Shape.selection-context:#SelectionContext

この ShapeContainerBase とその Shape 子孫に関連付けられた SelectionContext です。

注意事項

null 以外の場合、通常は DiscreteGraphicSelectionContext になります。


shape-parent (フィールド)
public-get private-set Shape.shape-parent:#ShapeContainerBase

この Shape の直属の親です。Shape が親を持たない場合、このフィールドは null になります。



shape-selectable (ローカル オプション)
public Shape.shape-selectable:#ShapeSelectable =null

この ShapeDiscreteGraphicSelectionContext 内で選択可能にする場合は、このオプションを ShapeSelectable に設定する必要があります。

説明

詳細は ShapeSelectable を参照してください。


stroke-thickness (非ローカル オプション)
public Shape.stroke-thickness:any

Shape オブジェクト内の線の太さです。

説明

stroke-thickness を参照してください。


transformation (フィールド)
public constant Shape.transformation:Transformation2d

この Shape の座標系からその親の座標系へのマッピングを行う Transformation2d

説明

この Transformation2d は直接変更できません。直接変更すると、内部構造の同期がとれなくなります。代わりに、次のいずれかのメソッドを使用して変換を変更します。


visible? (ローカル オプション)
public Shape.visible?:bool =true

このオプションが false に設定されている場合、この Shape は描画されず、ポインタ イベントも受信しません。ShapeContainerBase.get-child-at-point および同様のメソッドは、visible? が false の場合は形状を返しません。






メソッド詳細
apply-rotation (メソッド)
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}}
}


apply-scale (メソッド)
public final {Shape.apply-scale scale-x:double, scale-y:double}: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-scale 1.2, 1.1\}",
    {on Action do {shape.apply-scale 1.2, 1.1}}
}


apply-transformation (メソッド)
public final {Shape.apply-transformation
transformation:Transformation2d
}: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}}
}


apply-translation (メソッド)
public final {Shape.apply-translation
offset-x:Distance,
offset-y:Distance
}: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}}
}


apply-translation-in-parent (メソッド)
public final {Shape.apply-translation-in-parent
offset-x:Distance,
offset-y:Distance
}:void

平行移動を適用してこのオブジェクトの transformation を変更します。

注意事項

Shape.apply-translation とは異なり、offset-xoffset-y はこの形状の親の座標系を基準にして解釈されます。これによって違いが生じるのは、このオブジェクトの 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}}
}


constrain-own-layout-bounds (メソッド)
public {Shape.constrain-own-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void

境界制約 (ローカル座標系) をこの Shape に適用します。

lc: このレイアウト ネゴシエーションに対して有効な LayoutContext
bounds: 適用する制約です。

説明

Shape は制約に従う必要はありません。ただし、制約に従わない場合、Shape の全体を表示することができません。
既定の実装では、制約を無視します。

注意事項

Shape が境界を変更することで制約に対応する場合は、ShapeRoot.invalidate-shape-layout を呼び出す必要があります。無限ループを回避するため、制約とレイアウト境界のサイズの差が1 ピクセル未満の場合は、無視する必要があります。


constrain-shape-layout-bounds (メソッド)
public {Shape.constrain-shape-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void

境界制約 (ローカル座標系) をこの Shape とその子すべてに適用します。

lc: このレイアウト ネゴシエーションで有効な LayoutContext
bounds: 適用する制約です。

説明

このメソッドによって、Shape.constrain-own-layout-bounds の一連の呼び出しが行われます。


contains-point? (メソッド)
public {Shape.contains-point? x:Distance, y:Distance}:bool

この形状またはそのいずれかの子にポイントが含まれているかどうかを判定します。

説明

このメソッドは、このオブジェクトとその子に対して Shape.self-contains-point? を呼び出すために実装されます。

オーバーライド

通常は、Shape の実装でこのメソッドをオーバーライドする必要はありません。代わりに Shape.self-contains-point? をオーバーライドしてください。Shape.self-intersects-polygon? も参照してください。


detach (メソッド)
public {Shape.detach}:void

この形状を親から切り離します。

説明

これは、意味的にはこの形状の親に対して ShapeContainerBase.remove を呼び出すのと同じです。
親を持たない形状に対して detach を呼び出しても効果はありません。


draw (メソッド)
public abstract {Shape.draw renderer2d:Renderer2d}:void

このオブジェクトの可視表現を描画します。

renderer2d: このオブジェクトを使用してそれ自身を描画する Renderer2d

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。


find-graphical-ancestor (メソッド)
public final {Shape.find-graphical-ancestor
p:{proc-type {Graphic}:bool}
}:#Graphic

与えられた述語に適合する最も近いグラフィックの祖先を返します。

p: 述語を指定するプロシージャ。

戻り値

{p a} が true を返す最も近い祖先 a{p self} が true を返す場合、self が返されます。p に適合する祖先が見つからない場合、戻り値は null になります。


fire-crossing-event (メソッド)
public {Shape.fire-crossing-event}:void

他のイベントから PointerCrossing を初期化して、子 Visual をターゲットとして、そのイベントを発生させます。

ce: 初期化して発生させる PointerCrossing
e: ソース イベント。


fire-in-child (メソッド)
public {Shape.fire-in-child e:PointerEnvelopeEvent}:void

イベントの座標を修正して、子 Visual をターゲットとしてそのイベントを発生させ、その後、座標を復元します。

e: 子オブジェクトをターゲットとして発生させるイベント。


get-display-context (メソッド)
public {Shape.get-display-context}:DisplayContext

このオブジェクトの現在の DisplayContext を返します。

戻り値

GraphicOptions.display-context オプションが非 null 値にバインドされる場合、このオプションの値を返します。それ以外の場合、get-default-display-context によって返される値を返します。

オーバーライド

通常はオーバーライドされません。


get-down-orientation-in-shape-parent (メソッド)
public final {Shape.get-down-orientation-in-shape-parent}:Double2d

このオブジェクトの座標系をその親の座標系に変換した場合の、「下」向きベクトルの方向を計算します。

説明

このメソッドは、ベクトル (0, 1) をこのオブジェクトのローカル座標系からその親の座標系に変換した場合の座標を示します。これは、このオブジェクトの方向を親を基準にして決定する方法です。


get-graphical-root (メソッド)
public final {Shape.get-graphical-root}:#Graphic

Visual のグラフィック階層のルートで、オブジェクトを取得します。

戻り値

ルート Graphic オブジェクトです。

オーバーライド

サブクラスは、この値を取得するために Visual.get-origin-in-root を呼び出す。そのメソッドはまずレイアウトを検証します。一方、このメソッドは、たとえレイアウト検証が不可能な場合でも値を返すことができます。


get-gui-path (メソッド)
public {Shape.get-gui-path root:Box}:{Array-of int}

ソート目的で位置の配列を提供します。

root: パスに関係するBox

戻り値

このメソッドは、root配下のグラフィック階層内のVisualの位置を、親の中でのそれぞれの親オブジェクトを表す整数の配列として返します。その配列は、グラフィックオブジェクトの合理的な順序を取得する為に比較されます。

例外のスロー

ChildNotInRootErrorselfrootの子孫でない場合

注意事項

コンテナオブジェクトは、子オブジェクト左から右に並べる為に、合理的なスキーマを使用するかもしれません。その為GUIパスの数値の詳細は、あるCurlセッションと他のセッションで同じであることは保証されません。

オーバーライド

Visual上の子のメソッドの基本定義は、エラーをスローするだけです。Visualの直接のサブクラスの多く、例えばGraphicは、このメソッドに適した定義を提供しています。したがって、Visualから間接的に継承されたユーザー定義のクラスは、一般的にこのメソッドをオーバーライドする必要はありません。
導入: バージョン 7.0


get-gui-path-to-child (メソッド)
public {Shape.get-gui-path-to-child
child:Visual,
root:Box
}:{Array-of int}

指定されたBoxから、指定されたこのオブジェクトの子に向かうGUIパスを計算します。

child: パスが計算されるVisualchildは、selfの直接の子であることが必要です。
root: childへ向かうパスのスタート地点

プログラミング注意事項

このメソッドは、Visual.get-gui-path をオーバーライドする Visual のサブクラスの実装から呼び出されます。

例外のスロー

ChildNotInRootErrorselfrootの子孫でない場合

注意事項

コンテナオブジェクトは、子オブジェクト左から右に並べる為に、合理的なスキーマを使用するかもしれません。その為GUIパスの数値の詳細は、あるCurlセッションと他のセッションで同じであることは保証されません。

オーバーライド

Shape 上のこのメソッドの既定の実装では、selfshape-children において child のインデックスを計算し、root から self までのパスのインデックスを追加します。
導入: バージョン 7.0


get-local-device-pixel-size (メソッド)
public final {Shape.get-local-device-pixel-size}:Distance

ピクセルのサイズをローカル座標単位で取得します。

説明

この Shapetransformation およびその祖先の変換にスケール変更が伴わない限り、つまり、Shape.get-transformation-to-shape-root によって返された変換で単位スケールが保持される限り、この値が {self.get-display-context}.device-pixel-size によって返されます。
それ以外の場合は、この値がこの形状のローカル座標系に変換されてから返されます。

注意事項

これは Shape.get-transformation-to-shape-root の呼び出しを伴うため、高速な操作であるとは限りません。この計算の結果はキャッシュされますが、このオブジェクトまたはその祖先の変換を変更したり、Visual.display-context オプションを変更すると、キャッシュされた値が無効になります。必要以上にこのメソッドを呼び出さないでください。
このオブジェクトのスケーリングが non-uniform の場合 — つまり、X 方向のスケーリングが Y 方向のスケーリングと異なる場合 — 返される値は 2 つのスケール値の大きい方を使用して処理されます。


get-origin-in-graphical-ancestor (メソッド)
public final {Shape.get-origin-in-graphical-ancestor
ancestor:Graphic
}:(x:Distance, y:Distance, found?:bool)

グラフィック階層内における指定された祖先に対する Visual の相対的位置を見つけます。

ancestor: 対象の上位オブジェクトです。

戻り値

対象の座標、ならびに ancestorself の上位オブジェクトである場合は true に、それ以外の場合は false に指定された bool です。この bool が false の場合、返される座標には意味はありません。

オーバーライド

これは Visual のサブクラスに定義されなくてはならない抽象メソッドです。

注意事項

このメソッドは有効なレイアウトを持つオブジェクトで呼び出されなければなりません。そうでなければ、このメソッドの戻り値は有用ではありません。


get-origin-in-root (メソッド)
public final {Shape.get-origin-in-root
}:(x:Distance, y:Distance, root:Graphic)

グラフィック階層のルートにあるオブジェクトを基準とし、Visual の位置を取得します。

戻り値

ロケーションとルート オブジェクトでは次のようになります。
  1. ルートの内側起点を基準とした、Visual内側起点の x 座標。
  2. ルートの内側起点を基準とした、Visual の内側起点の y 座標。
  3. ルート オブジェクトそのもの ( Graphic)。

注意事項

このメソッドは、起点座標を正しく変換するために、レイアウト検証を実行する必要があります。ここで必要とされるのがグラフィカル ルートのみである場合、代わりに Visual.get-graphical-root を呼び出します。


get-origin-in-shape-parent (メソッド)
public final {Shape.get-origin-in-shape-parent
}:(x:Distance, y:Distance)

親の座標系におけるこの Shape の起点を計算します。

説明

self.transformation.dx, self.transformation.dy として定義されているため、これは高速な操作です。


get-origin-in-shape-root (メソッド)
public final {Shape.get-origin-in-shape-root}:(x:Distance, y:Distance)

形状ルートである祖先の座標系における、このオブジェクトの起点を取得します。

説明

これは {self.transform-point-to-shape-root {Distance2d 0m, 0m} の省略形です。


get-own-bounds (メソッド)
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

説明

返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があります。ただし、このオブジェクトのすべての子を含んでいません

注意事項

レンダリング境界 (get-own-bounds) とレイアウト境界 (get-own-layout-bounds) は、通常似ていますが、同じではありません。特に、レンダリング境界は非常に包括的ですが、レイアウト境界はそれぞれが整然と隣接するため、Shape を厳密に記述しなければならなりません。

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。データを返すには、dest パラメータを使用する必要があります。


get-own-bounds-in-shape-root (メソッド)
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.get-own-bounds を呼び出して境界を正しい座標系に変換するために実装されます。

注意事項

形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。

オーバーライド

軸平行の四角形を使用するよりも厳密な方法でオブジェクトの境界を変換できる場合は、このメソッドを独自の Shape 実装でオーバーライドすることをお勧めします。


get-own-layout-bounds (メソッド)
public {Shape.get-own-layout-bounds
lc:LayoutContext,
width-first?:bool = true,
dest:GRect = {GRect.empty}
}:GRect

ローカル座標系におけるこの Shape の四角形のレイアウト境界を計算します。

lc: このレイアウト ネゴシエーションで有効な LayoutContext
width-first?: GraphicShape の場合、width-first レイアウト ネゴシエーションを使用して計算されるべき境界であるかを示します。このパラメータは、通常他のサブクラスでは使用されません。
dest: データを返すために使用されるオプションの GRect オブジェクト。

戻り値

境界を含む GRect オブジェクト。これは、常に dest と同じオブジェクトになります。この GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。 -dest.lextent <= dest.rextent and -dest.ascent <= dest.descent

説明

返された境界には、レイアウトの使用について、オブジェクトに関する詳細な記述があります。ただし、このオブジェクトのすべての子は含まれていません

注意事項

レンダリング境界 (get-own-bounds) とレイアウト境界 (get-own-layout-bounds) は、通常似ていますが、同じではありません。特に、レンダリング境界は非常に包括的ですが、レイアウト境界はそれぞれが整然と隣接するため、Shape を厳密に記述しなければならなりません。

オーバーライド

既定の実装では、get-own-bounds を呼び出すだけです。データを返すには、dest パラメータを使用する必要があります。


get-right-orientation-in-shape-parent (メソッド)
public final {Shape.get-right-orientation-in-shape-parent}:Double2d

このオブジェクトの座標系をその親の座標系に変換した場合の、「右」向きベクトルの方向を計算します。

説明

このメソッドは、ベクトル (1, 0) をこのオブジェクトのローカル座標系からその親の座標系に変換した場合の座標を示します。これは、このオブジェクトの方向を親を基準にして決定する方法です。


get-shape-bounds (メソッド)
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

説明

返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があり、このオブジェクトのすべての子を含んでいます


get-shape-bounds-in-shape-root (メソッド)
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

説明

返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があり、このオブジェクトのすべての子を含んでいます

注意事項

形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。


get-shape-layout-bounds (メソッド)
public {Shape.get-shape-layout-bounds
lc:LayoutContext,
width-first?:bool = true,
dest:GRect = {GRect.empty}
}:GRect

このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレイアウト境界を計算します。

lc: このレイアウト ネゴシエーションに対して有効な LayoutContext
width-first?: GraphicShape の場合、width-first レイアウト ネゴシエーションを使用して計算されるべき境界であるかを示します。このパラメータは、通常他のサブクラスでは使用されません。
dest: データを返すために使用されるオプションの GRect オブジェクト。

戻り値

境界を含む GRect オブジェクト。これは、常に dest と同じオブジェクトになります。この GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。 -dest.lextent <= dest.rextent and -dest.ascent <= dest.descent

説明

返された境界には、レイアウトの使用について、オブジェクトに関する詳細な記述があります。また、このオブジェクトのすべての子も含まれています


get-top-left-in-ancestor (メソッド)
public final {Shape.get-top-left-in-ancestor
ancestor:Graphic
}:(x:Distance, y:Distance, found?:bool)

グラフィック階層に含まれる指定上位オブジェクトの座標フレームでこのオブジェクトの左上隅のロケーションを見つけます。

ancestor: 対象の上位オブジェクトです。

戻り値

対象の座標、ならびに ancestorself の上位オブジェクトである場合は true に、それ以外の場合は false に指定された bool です。この bool が false の場合、返される座標には意味はありません。

オーバーライド

これは Visual のサブクラスに定義されなくてはならない抽象メソッドです。

注意事項

レイアウトが現在有効ではないオブジェクトでの、このメソッドの呼び出しについては、Layout.get-bounds に含まれる注意を参照してください。


get-transformation-to-shape-root (メソッド)
public final {Shape.get-transformation-to-shape-root}:Transformation2d

このオブジェクトの座標系から形状ルートである祖先の座標系への累積変換を返します。

注意事項

このメソッドは処理に時間がかかるため、頻繁には使用しないでください。
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。


keyword-init-arg (メソッド)
protected {Shape.keyword-init-arg key:String, value:any}:void

InitRestArgParser.process-rest-args でキーワード引数が検出されると呼び出されます。

key: キーワード引数でキーとして表示される String
value: キーワード引数で表示される値。

オーバーライド

既定の実装 InitRestArgParser.keyword-init-arg は、呼び出されるとエラーをレポートします。このメソッドは、 InitRestArgParser.process-rest-args に渡される引数リストのキーワード引数を受け入れるサブクラスによってオーバーライドされます。


option-change-notify (メソッド)
protected {Shape.option-change-notify
item:OptionItem,
removed?:bool
}:void

このオブジェクトで値が変更されたオプションについて、オプションの変更ハンドラを呼び出します。

item: 追加または削除されたバインディング オプション。
removed?: item が削除された場合は true、それ以外の場合は false。

説明

item で表されるオプション バインドについて、このオブジェクトのすべての変更ハンドラを見つけて呼び出します。さらに、このオブジェクトの OptionListInterface.option-changed メソッドを呼び出します。

オーバーライド

通常はオーバーライドされません。


overdraw-for-selection (メソッド)
public {Shape.overdraw-for-selection}:void

このオブジェクトの上に選択アフォーダンスを描画します。

説明

このメソッドは、内部の形状描画メカニズムにより呼び出されます。通常は、直接呼び出す必要はありません。

オーバーライド

このメソッドの既定の実装では、オブジェクトの境界を Shape.get-own-bounds によって返されるものとみなしています。draw-styleinvert の場合は、DrawOperation.invert-destination を使用して四角形をレンダリングします。mask の場合は、Renderer2d.render-stippled-rectangle が使用されます。
Shape の実装でこのメソッドをオーバーライドする必要はありませんが、形状のレンダリングされたプリミティブの真上に選択アフォーダンスを描画したほうが選択が見やすくなる場合があります。


quantize-line-thickness (メソッド)
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 つの値を返します。

説明

このプロシージャでは、any-to-Distance を使用して thickness を実際の Distance 値に変換します。そして DisplayContext.device-pixel-size を使用して値をピクセルの偶数の倍数に丸めます。ただし、ゼロより小さい値はゼロに変換され、ゼロとデバイス ピクセル サイズ (Shape.get-local-device-pixel-size を使用してスケーリングに合わせて調整される) の間の値は単一のデバイス ピクセル幅に丸められます。


request-draw (メソッド)
public {Shape.request-draw
layout-context:LayoutContext = {self.get-layout-context}
}:void

描画する Visual に属するピクセルを確認します。

layout-context: このオブジェクトを含むグラフィック階層のサブツリーに対応する LayoutContext オブジェクト。このキーワード引数が提供されない場合、Visual.get-layout-context を呼び出して、適切な値を取得します。

注意事項

このメソッドは、View.request-draw-rect-in-root の呼び出しを必要な回数だけ発行し (通常はビジュアルの境界で Graphic.request-draw-rect への呼び出しを実行することにより)、再ペイントが必要なすべてのピクセルをカバーする責任があります。

プログラミング注意事項

このオブジェクトのピクセルの再ペイントが必要になる何らかの理由があったとき、このメソッドが呼び出されます。このような状況が発生するのは、オブジェクトが初めて表示されるとき、ビューから削除されるとき、移動やサイズ変更が行なわれるとき (この場合、移動やサイズ変更の前と後でこのメソッドを呼び出す必要があります) などがあります。


request-draw-self (メソッド)
public {Shape.request-draw-self
layout-context:LayoutContext = {self.get-layout-context}
}:void

再描画する Shape に属するピクセルを要求します。

説明

このメソッドは、すべての子を再描画する必要がないという点を除けば、Shape.request-draw と同じです。


reset-transformation (メソッド)
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}}
}


self-contains-point? (メソッド)
public abstract {Shape.self-contains-point?}:bool

ポイントがこの Shape 内にあるかどうかを判定します。

x: 点の X 座標。
y: 点の Y 座標。

戻り値

この Shape が (xy) を含む場合は、true

説明

ポイントは、このオブジェクトのローカル座標系にあります。このメソッドは、その子を考慮しません。

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。このメソッドは、PointerMotion などのマウス イベントをこのオブジェクトにいつ送信するかなどを決定します。
通常は、このメソッドを実装して、ポイントが形状の境界内にあるかどうかだけでなく、ポイントが形状のレンダリングされたプリミティブ内にあるどうかを確認する必要があります。このメソッドは必要なメトリックを使用して自在に実装できます。


self-intersects-polygon? (メソッド)
public abstract {Shape.self-intersects-polygon?}:bool

ポリゴンがこの Shape と交差するかどうかを判定します。

polygon: この形状のローカル座標空間にポリゴンを記述するポイント セットを含むオブジェクト。このポリゴンは必ず凸型であり、反時計回りのワインディング順に従います。

説明

このメソッドは、ポイントではなく領域を処理する点を除けば、Shape.self-contains-point? とよく似ています。主に領域ベースの選択をサポートするために使用されますが、直接呼び出すこともできます。

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。子を考慮する必要はありません。
通常は、このメソッドを実装して、領域が形状の境界内にあるかどうかだけでなく、領域が形状のレンダリングされたプリミティブと交差するかどうかを確認する必要があります。このメソッドは、必要なメトリックを使用して自在に実装できます。このメソッドの実装が Shape.self-contains-point? と調和しない場合は、このオブジェクトを選択すると予期しない結果になります。
選択機能を使用しない場合は、このメソッドを単純に false を返すように実装できます。


set-rotation (メソッド)
public final {Shape.set-rotation angle:Angle}:void

回転を設定してこのオブジェクトの transformation を変更します。

説明

このメソッドは、回転を以前適用された回転に追加するのではなくそれと置き換えるという点で Shape.apply-rotation とは異なります


{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}}
}


set-scale (メソッド)
public final {Shape.set-scale scale-x:double, scale-y:double}:void

スケールを設定してこのオブジェクトの transformation を変更します。

説明

このメソッドは、以前適用されたスケーリングをかけあわせるのではなく置き換えるという点で Shape.apply-scale とは異なります

注意事項

このメソッドには制限が一部あることに留意してください。現在の変換を分解して実装するため、現在の変換が 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}}
}


set-transformation (メソッド)
public final {Shape.set-transformation
transformation:Transformation2d
}:void

このオブジェクトの transformation を別の Transformation2d に置き換えて変更します。

説明

このメソッドは、以前適用された変換で構成するのではなくそれらの変換を置き換えるという点で Shape.apply-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 = "\{set-transformation transformation\}",
    {on Action do {shape.set-transformation transformation}}
}


set-translation-in-parent (メソッド)
public final {Shape.set-translation-in-parent}:void

親を基準にした平行移動を設定してこのオブジェクトの transformation を変更します。

説明

このメソッドは、以前適用された平行移動に追加するのではなくその平行移動を置き換えるという点で Shape.apply-translation-in-parent とは異なります


{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}}
}


to-Graphic (メソッド)
public {Shape.to-Graphic}:Graphic

このオブジェクトに値する Graphic を返します。

説明

既定では、このメソッドはこの Shape を含む ShapeBox を返します。
Shape がグラフィカル階層に追加されると、Curl レイアウト システムによってこのメソッドが呼び出されます。通常、直接呼び出されません。
導入: バージョン 6.0


transform-from-display-coordinates (メソッド)
public final {Shape.transform-from-display-coordinates}:(new-x:Distance, new-y:Distance)

このオブジェクトの Display の座標系からこのオブジェクトの座標系に座標を変換します。

x, y: Display の座標系の座標。

戻り値

このオブジェクトの座標系の座標。

注意事項

このメソッドが成功するためには、このオブジェクトの座標が Display を基準にしている必要があり、View をルートとするグラフィック階層内になければなりません。変換の操作に失敗した場合は、TransformationExceptionがスローされます。


transform-from-graphical-root-coordinates (メソッド)
public final {Shape.transform-from-graphical-root-coordinates}:(new-x:Distance, new-y:Distance, root:Graphic)

このオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系からこのオブジェクトの座標系に座標を変換します。

x, y: グラフィカル ルートの座標系の座標。

戻り値

  1. このオブジェクトの起点を基準とする x 座標。
  2. このオブジェクトの起点を基準とする y 座標。
  3. グラフィカル ルート自体。

注意事項

このメソッドは、起点座標を正しく変換するために、レイアウト検証を実行する必要があります。ここで必要とされるのがグラフィカル ルートのみである場合、代わりに Visual.get-graphical-root を呼び出します。


transform-point-from-shape-root (メソッド)
public final {Shape.transform-point-from-shape-root
point:Distance2d
}:Distance2d

このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された point を返します。

注意事項

多数のポイントを変換する場合、通常は代わりに Shape.get-transformation-to-shape-root を呼び出して Transformation2d.inverse-transform-point メソッドを使用する方が効率的です。
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。


transform-point-to-shape-root (メソッド)
public final {Shape.transform-point-to-shape-root
point:Distance2d
}:Distance2d

このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された point を返します。

注意事項

多数のポイントを変換する場合、通常は代わりに Shape.get-transformation-to-shape-root を呼び出して Transformation2d.transform-point メソッドを使用する方が効率的です。
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。


transform-to-display-coordinates (メソッド)
public final {Shape.transform-to-display-coordinates}:(new-x:Distance, new-y:Distance)

このオブジェクトの座標系から Display の座標系に座標を変換します。

x, y: このオブジェクトの座標系の座標。

戻り値

表示の座標系の起点を基準とする座標です。

注意事項

このメソッドが成功するためには、このオブジェクトの座標が Display を基準にしている必要があり、View をルートとするグラフィック階層内になければなりません。変換の操作に失敗した場合は、TransformationExceptionがスローされます。


transform-to-graphical-root-coordinates (メソッド)
public final {Shape.transform-to-graphical-root-coordinates}:(new-x:Distance, new-y:Distance, root:Graphic)

このオブジェクトの座標系からこのオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系に座標を変換します。

x, y: このオブジェクトの座標系の座標。

戻り値

  1. オブジェクトのグラフィカル ルートの起点を基準とする x 座標。
  2. オブジェクトのグラフィカル ルートの起点を基準とする y 座標。
  3. グラフィカル ルート自体。

注意事項

このメソッドは、起点座標を正しく変換するために、レイアウト検証を実行する必要があります。ここで必要とされるのがグラフィカル ルートのみである場合、代わりに Visual.get-graphical-root を呼び出します。


transform-vector-from-shape-root (メソッド)
public final {Shape.transform-vector-from-shape-root
vector:Distance2d
}:Distance2d

このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された vector を返します。

説明

ベクトル変換は、平行移動の影響を受けないという点で、ポイント変換とは異なります。

注意事項

多数のベクトルを変換する場合、通常は代わりに Shape.get-transformation-to-shape-root を呼び出して Transformation2d.inverse-transform-vector メソッドを使用する方が効率的です。
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。


transform-vector-to-shape-root (メソッド)
public final {Shape.transform-vector-to-shape-root
vector:Distance2d
}:Distance2d

このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された vector を返します。

説明

ベクトル変換は、平行移動の影響を受けないという点で、ポイント変換とは異なります。

注意事項

多数のベクトルを変換する場合、通常は代わりに Shape.get-transformation-to-shape-root を呼び出して Transformation2d.transform-vector を使用するほうが効率的です。
形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。


transformation-changed (メソッド)
public {Shape.transformation-changed}:void

Shape.transformation が変更されたことの通知。

オーバーライド

重要:このメソッドのオーバーライド実装にスーパークラス実装の呼び出しを含めて、オブジェクトの新しい領域を無効にする必要があります。


transformation-changing (メソッド)
public {Shape.transformation-changing}:void

Shape.transformation が変更されることの通知。

オーバーライド

重要:このメソッドのオーバーライド実装にスーパークラス実装の呼び出しを含めて、オブジェクトの現在の領域を無効にし、変換変更の通知が Shape 階層全体に適切に送信されるようにする必要があります。