C++経由でNode.js内のシェイプにテクスチャとしてタイル貼りした画像を使用する
Contents
[
Hide
]
可能な使用シナリオ
画像が小さく、品質を失うことなく形状の全体の表面をカバーしない場合、タイリングするオプションがあります。タイリングは、タイルであるかのように小さな画像で形状の表面を埋めるものです。
画像を形状の内部にテクスチャとしてタイル状にする
画像をシェイプの表面に塗りつけて、Shape.isTiling()プロパティをtrueに設定してタイル貼りできます。以下のサンプルコードと、それに付随するサンプルExcelファイルおよびスクリーンショットを参照してください。
スクリーンショット
サンプルコード
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const sourceDir = path.join(__dirname, "data");
const outputDir = path.join(__dirname, "output");
// Load sample Excel file
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "sampleTextureFill_IsTiling.xlsx"));
// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);
// Access first shape inside the worksheet
const shape = worksheet.getShapes().get(0);
// Tile Picture as a Texture inside the Shape
shape.getFill().getTextureFill().setIsTiling(true);
// Save the output Excel file
workbook.save(path.join(outputDir, "outputTextureFill_IsTiling.xlsx"));