すべてのプロダクト
Search
ドキュメントセンター

:ST_MakeTexture

最終更新日:Mar 24, 2025

このトピックでは、ST_MakeTexture関数について説明します。この関数は、テクスチャ画像を構築します。

構文

texture ST_MakeTexture(integer width,
                       integer height,
                       cstring url,
                       boolean to_internal  default false,
                       integer depth default 3,
                       cstring format default 'JPEG',
                       cstring compression default 'None',
                       cstring wrap default 'Wrap');
texture ST_MakeTexture(cstring table_name,
                       cstring column_name,
                       cstring key_value,
                       cstring schema_name default 'public');
texture ST_MakeTexture(integer width,
                       integer height,
                       bytea data,
                       integer depth  default 3,
                       cstring format  default 'JPEG',
                       cstring compression  default 'None',
                       cstring wrap  default 'Wrap');

パラメーター

項目

説明

width

テクスチャ画像の幅。

height

テクスチャ画像の高さ。

url

テクスチャイメージのURL。

to_internal

内部ストレージモードに切り替えるかどうかを指定します。 デフォルト値:false

depth

テクスチャイメージのビット深度。 有効な値:

  • 1: グレースケール。

  • 3: RGB。 デフォルト値です。

  • 4: RGBA.

compression

テクスチャ画像のデータストリームの圧縮方法。 有効な値:

  • なし: データストリームは圧縮されていません。 デフォルト値です。

  • Zlib: zlibライブラリは、データストリームを圧縮するために使用されます。

format

テクスチャ画像の形式。 有効な値:

  • JPEG: デフォルト値

  • PNG

wrap

テクスチャ画像のラップモード。 有効な値:

  • Wrap: デフォルト値

  • ミラー

table_name

既存のテクスチャが配置されているテーブルの名前。

column_name

既存のテクスチャが配置されている列の名前。

key_value

既存のテクスチャのID。 このパラメーターはWHERE句で使用されます。

schare_name

既存のテクスチャのスキーマの名前。 デフォルト値 : public

data

テクスチャ画像のバイナリデータストリーム。

説明 

テクスチャ画像のバイナリデータストリームは、3つのモードで記憶することができる。 ビジネス要件に基づいて、テクスチャ画像用のストレージソリューションを開発できます。

  • テクスチャ画像のバイナリデータストリームをデータベースに保存します。 このソリューションを使用する場合、外部の関連付けは必要ありません。 しかし、データベース内のデータ量は大きい。

  • テクスチャ画像のバイナリデータストリームを外部ファイルに保存します。 このソリューションを使用すると、データベースのストレージが少なくなります。 しかし、アクセス性能は悪い。

  • テクスチャ画像のバイナリデータストリームをデータベースの別のテーブルに格納します。 このソリューションを使用すると、バイナリデータストリームの格納に使用されるデータベースが参照されます。

-- create texture table
CREATE TABLE textures(id integer, the_texture texture);

-- Insert a 225*225 RGBA PNG file, with internal store binary stream
INSERT INTO textures VALUES (1, ST_MakeTexture(225,225,'path/example.png'::cstring, true, 4, 'PNG'));

-- Insert a 225*255 RGB JPEG file, with binary stream in file
INSERT INTO textures VALUES (2, ST_MakeTexture(225,225,'path/example.jpeg'::cstring, false, 3, 'JPEG'));

-- Insert a 256*256 RGB JPEG file, providing the binary stream
INSERT INTO textures VALUES (3, ST_MakeTexture(256,256, '\x123abcd...'::bytea));

-- insert a reference texture which is id=1 in the same table
INSERT INTO textures VALUES (4, ST_MakeTexture('textures'::cstring, 'the_texture'::cstring, 'id=1'));