TextureTransformation2d (クラス)
public final TextureTransformation2d {inherits {Transformation2d-of Fraction, double, Fraction2d, 0.0, 0.0, 1.0}}
インポート元: CURL.GUI.STANDARD. package 内で定義されています CURL.GRAPHICS._2D.UTIL.

テクスチャ座標で使用される任意に逆転可能な 2D 変換です。最も一般的には、このクラスは Renderer2d および with-render-properties と関連してテクスチャを操作するために使用されます。

注意事項

2D 変換の一般的な説明だけでなくそれらの操作に使用できるメソッドについても Transformation2d の API ドキュメントを参照してください。TextureTransformation2d は使用される単位を除けば、Transformation2d と同じです。Transformation2dDistance 単位を使用しますが、TextureTransformation2d は単位のない double を使用します。

テクスチャ座標のスケールを 2 だけ変えるように設定されている TextureTransformation2d を使用する例を次に示します。テクスチャ座標 (Renderer2d.render-rectangle の呼び出し内での uv1 および uv2 パラメータ) を変更して、結果を確認してみてください。初期値は既定です。


{define-class package QuickExampleWidget {inherits BaseFrame}
  field private texture-xform:TextureTransformation2d =
      {TextureTransformation2d}

  {constructor package {default
                           texture-xform:TextureTransformation2d,
                           ...
                       }
    set self.texture-xform = texture-xform
    {construct-super ...}
  }

  {method public {draw r2d:Renderer2d}:void
    let bounds:GRect = {self.layout.get-bounds}
    {with-render-properties
        texture-transformation = self.texture-xform
        on r2d do
        
        {r2d.render-rectangle
            -bounds.lextent,
            -bounds.ascent,
            bounds.width,
            bounds.height,
            fill-pattern = {url "curl://install/docs/default/images/adria.jpg"},
            uv1 = {Fraction2d 0, 0}, || try changing this.
            uv2 = {Fraction2d 1, 1}  || try changing this.
        }
    }
  }
}

{let scaled-texture-xform:TextureTransformation2d =
    {TextureTransformation2d}
}
{let identity-texture-xform:TextureTransformation2d =
    {TextureTransformation2d}
}
{scaled-texture-xform.local-uniform-scale 2.0}

|| We have to do this so that we can make sure
|| that we create the graphics at the correct size.
|| (We want the graphic to be exactly the same
|| size as an unscaled image.)  And the easiest
|| way to find the size of adria.jpg is to create
|| a Pixmap from the FillPattern.
{let image:Pixmap = 
    {{FillPattern.from-url {url "curl://install/docs/default/images/adria.jpg"}}.to-Pixmap}}

{HBox
    {VBox
        {QuickExampleWidget
            identity-texture-xform,
            width = image.width,
            height = image.height
        },
        {Fill height = 0.125in},
        {text
            This shows the identity TextureTransformation2d.
        }
    },
    {Fill width = 1in},
    {VBox
        {QuickExampleWidget
            scaled-texture-xform,
            width = image.width,
            height = image.height
        },
        {Fill height = 0.125in},
        {text
            This shows a TextureTransformation2d which has
            been scaled by a factor of 2 in both dimensions.
        }
    }
}

コンストラクタ
default:TextureTransformation2d 型の新しいオブジェクトを作成します。
コンストラクタ public {TextureTransformation2d.default}
from-mapping:四角形の仕様から TextureTransformation2d を作成します。
ファクトリ public {TextureTransformation2d.from-mapping
point0:Distance2d,
point1:Distance2d,
texture-coord0:Fraction2d,
texture-coord1:Fraction2d,
local-compose-with:#TextureTransformation2d = null
}:TextureTransformation2d
from-Transformation2d:マトリックス要素をコピーして Transformation2d から TextureTransformation2d を作成します。TextureTransformation2d.resolution は単位変換が必要なときに使用されます。
ファクトリ public {TextureTransformation2d.from-Transformation2d
transformation:Transformation2d
}:TextureTransformation2d

プロパティ
プロパティ 継承 Transformation2d-of: angle, dx, dy, identity?, inverse, reflects-axes?

クラス変数と定数
resolution:Distance を浮動小数点数値にしてこの変換に入力するために使用される解像度です。
public constant TextureTransformation2d.resolution:Resolution =1(dot/meter)

メソッド
new-like-self:self と同じ型のオブジェクトを作成して返します。
public final {TextureTransformation2d.new-like-self
}:{Transformation2d-of Fraction, double, Fraction2d, 0.0, 0.0, 1.0 }
メソッド 継承 Transformation2d-of: apply-local-transformation, clone, clone-into, compose-clone, float-transform, get-inverse, get-matrix-as-doubles, get-scale-factors, global-translate, identity, inverse-transform, inverse-transform-point, inverse-transform-vector, local-rotate, local-scale, local-translate, local-uniform-scale, output-pretty, transform, transform-point, transform-vector
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
default (コンストラクタ)
public {TextureTransformation2d.default}

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



from-mapping (ファクトリ)
public {TextureTransformation2d.from-mapping
point0:Distance2d,
point1:Distance2d,
texture-coord0:Fraction2d,
texture-coord1:Fraction2d,
local-compose-with:#TextureTransformation2d = null
}:TextureTransformation2d

四角形の仕様から TextureTransformation2d を作成します。

説明

結果の TextureTransformation2dpoint0texture-coord0 に、point1texture-coord1 にマップします。オプションで、TextureTransformation2dlocal-compose-with として渡すことにより始点として提供することができます。この始点は変換の結果で構成されます。


from-Transformation2d (ファクトリ)
public {TextureTransformation2d.from-Transformation2d
transformation:Transformation2d
}:TextureTransformation2d

マトリックス要素をコピーして Transformation2d から TextureTransformation2d を作成します。TextureTransformation2d.resolution は単位変換が必要なときに使用されます。




プロパティ詳細
クラス変数と定数の詳細
resolution (クラス定数)
public constant TextureTransformation2d.resolution:Resolution =1(dot/meter)

Distance を浮動小数点数値にしてこの変換に入力するために使用される解像度です。





メソッド詳細
new-like-self (メソッド)
public final {TextureTransformation2d.new-like-self
}:{Transformation2d-of Fraction, double, Fraction2d, 0.0, 0.0, 1.0 }

self と同じ型のオブジェクトを作成して返します。

注意事項

返されるオブジェクトは self と同じ型ですが、同じデータは含まれていません。新しく返されたオブジェクトは、TextureTransformation2d 型の場合、コンストラクタが直接使用されている場合と同じ状態になります。