Background (クラス)
public abstract shared Background
インポート元: CURL.GUI.STANDARD. package 内で定義されています CURL.GUI.BASE.

すべての背景オブジェクトの (抽象) 基本クラス。

注意事項

Graphic ではない可視オブジェクトは、書式設定されたテキスト (paragraph など) だけです。これは、TextFlowBox の内部にのみ表示されます。Graphic と書式設定されたテキストは、いずれも Visual のサブクラスです。つまり、これはグラフィカルに表示できるオブジェクトすべてに共通のスーパークラスです。

プログラミング注意事項

このクラスは、Curl Background オブジェクトとのインターフェイスを定義します。したがって、任意の Background オブジェクトである値をとる可能性がある変数は、Background タイプとして宣言する必要があります。背景は、ファクトリーを使って作成されます。現時点では、default、from-Color、from-Pixmap、from-Texture、from-Drawable、from-string、from-url、および tiled の 8 つのファクトリーがあります。練習では、default または tiled ファクトリーを使用します。

以下は、それぞれのファクトリーを使用した例です。
例: Default ファクトリー
{value
    let back:Background =
        {Background 
            {url "curl://install/docs/default/images/adria.jpg"}
        }
    let vbox:VBox = {VBox width=2in, height=2in, background=back}
    vbox
}

例: Tiled ファクトリー
{value
    let tiled-back:Background = {Background.tiled
                                    offset-x=0pt, 
                                    offset-y=0pt, 
                                    tile-width=50pt, 
                                    tile-height=50pt, 
                                    from-root?=false,
                                    pattern = {FillPattern.from-url
                                                  {url "curl://install/docs/default/images/adria.jpg"}
                                              }
                                }

    let vbox:VBox = {VBox width=2in, height=2in, background=tiled-back}
    vbox
}

コンストラクタ
default:FillPattern のシンプルなラッパーである Background を作成します。FillPattern または FillPattern に変換されるものをとります。
ファクトリ public implicit {Background.default fp:FillPattern}:Background
from-Color:Color から Background を作成します。
ファクトリ public implicit {Background.from-Color color:Color}:Background
from-Drawable:Drawable から Background を作成します。
ファクトリ public implicit {Background.from-Drawable drawable:Drawable}:Background
from-Pixmap:Pixmap から Background を作成します。
ファクトリ public implicit {Background.from-Pixmap pixmap:Pixmap}:Background
from-string:StringInterface から Background を作成します。
ファクトリ public implicit {Background.from-string}:Background
from-Texture:Texture から Background を作成します。
ファクトリ public implicit {Background.from-Texture}:Background
from-url:Url から Background を作成します。
ファクトリ public implicit {Background.from-url url:Url}:Background
tiled:タイル バックグラウンドを作成します。以下のパラメータをとります。
ファクトリ public {Background.tiled
tile-width:Distance = 0pt,
tile-height:Distance = 0pt,
offset-x:Distance = 0pt,
offset-y:Distance = 0pt,
from-root?:bool = true,
pattern:FillPattern = FillPattern.transparent
}:Background

クラス変数と定数
transparent:透明の背景を指すには、この値を使用します。
public constant Background.transparent:Background ={TransparentBackground}

メソッド
draw:Background オブジェクトを描画します。
public abstract {Background.draw
renderer2d:Renderer2d,
cell-bounds:GRect,
graphic:#Graphic = null
}:void
to-FillPattern:Background オブジェクトを表す FillPattern を作成します。
public {Background.to-FillPattern}:FillPattern
to-Pixel:Background オブジェクトを表すピクセルを生成します。
public {Background.to-Pixel}:Pixel
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
default (ファクトリ)
public implicit {Background.default fp:FillPattern}:Background

FillPattern のシンプルなラッパーである Background を作成します。FillPattern または FillPattern に変換されるものをとります。

fp: 背景を表す FillPattern

戻り値

Background オブジェクト。


from-Color (ファクトリ)
public implicit {Background.from-Color color:Color}:Background

Color から Background を作成します。



from-Drawable (ファクトリ)
public implicit {Background.from-Drawable drawable:Drawable}:Background

Drawable から Background を作成します。



from-Pixmap (ファクトリ)
public implicit {Background.from-Pixmap pixmap:Pixmap}:Background

Pixmap から Background を作成します。



from-string (ファクトリ)
public implicit {Background.from-string}:Background

StringInterface から Background を作成します。



from-Texture (ファクトリ)
public implicit {Background.from-Texture}:Background

Texture から Background を作成します。



from-url (ファクトリ)
public implicit {Background.from-url url:Url}:Background

Url から Background を作成します。

注意事項

デフォルトで、このファクトリはパラメータのUrlより提供されたコンテンツ(画像)がキャッシュされません。該当urlの画像の複数インスタンスが必要な場合、ローカルキャッシュを利用することがより効率的だと考えられる。例えば、urlから画像をPixmapに読み込んでから、BackgroundをそのPixmapから作成する。


tiled (ファクトリ)
public {Background.tiled
tile-width:Distance = 0pt,
tile-height:Distance = 0pt,
offset-x:Distance = 0pt,
offset-y:Distance = 0pt,
from-root?:bool = true,
pattern:FillPattern = FillPattern.transparent
}:Background

タイル バックグラウンドを作成します。以下のパラメータをとります。

pattern: タイル パターンとして使用する FillPattern
tile-width: タイル パターンの幅 (距離)。既定値 0pt は、FillPattern の幅をそのまま使用します。
tile-height: タイル パターンの高さ (距離)。既定値 0pt の場合は、FillPattern の高さをそのまま使用します。
offset-x: 起点 (左上隅) に対するタイル イメージの x オフセット (距離)。正の値を指定すると、タイルが右にシフトされます。既定値は 0pt です。
offset-y: 起点 (左上隅) に対するタイル イメージの y オフセット (距離)。正の値を指定すると、タイルが下にシフトされます。既定値は 0pt です。
from-root?: bool。既定値は true です。

戻り値

Background オブジェクト。




クラス変数と定数の詳細
transparent (クラス定数)
public constant Background.transparent:Background ={TransparentBackground}

透明の背景を指すには、この値を使用します。





メソッド詳細
draw (メソッド)
public abstract {Background.draw
renderer2d:Renderer2d,
cell-bounds:GRect,
graphic:#Graphic = null
}:void

Background オブジェクトを描画します。

renderer2d: 背景を描画するのに使うレンダラー。
cell-bounds: 背景を描く境界ボックス。
graphic: オプションのグラフィック オブジェクトで、Graphic のルート フレームとの関係から描画を補うときに使われます。

オーバーライド

このメソッドは、Background のサブクラスで定義する必要があります。


to-FillPattern (メソッド)
public {Background.to-FillPattern}:FillPattern

Background オブジェクトを表す FillPattern を作成します。

戻り値

オーバーライドされない限り、透明な FillPattern を返します。


to-Pixel (メソッド)
public {Background.to-Pixel}:Pixel

Background オブジェクトを表すピクセルを生成します。

戻り値

Pixel の表現体。

オーバーライド

このメソッドは、Background のサブクラスで定義する必要があります。