ピクチャシェイプ

ピクチャシェイプは、画像を表示できるシェイプです。画像のトリミングやサイズの調整ができるほか、他のシェイプと画像をグループ化したり、結合したりもできます。

次のサンプルは、ピクチャシェイプを追加する方法を説明します。 次のサンプルは、画像の透明度を変更する方法を説明します。 次のサンプルは、画像を切り取る方法を説明します。 次のサンプルは、画像の明るさとコントラストを設定する方法を説明します。 次のサンプルは、画像の色を変更する方法を説明します。 次のサンプルは、画像を図の形にトリミングする方法を説明します。 次のサンプルは、画像の境界線を設定する方法を説明します。 画像の一部が透明な場合、画像の背景色を設定できます。
window.onload = function () { window.workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss")); window.sheet = workbook.getActiveSheet(); var pictureProp = document.querySelector(".picture-prop"); var tip = document.querySelector(".tip"); var imgInput = document.querySelector(".img"); var geometryTypeInput = document.querySelector(".geometry-type"); var transparencyInput = document.querySelector(".transparency"); // crop var cropLeftInput = document.querySelector(".crop-left"); var cropRightInput = document.querySelector(".crop-right"); var cropTopInput = document.querySelector(".crop-top"); var cropBottomInput = document.querySelector(".crop-bottom"); // brightness/contrast var brightnessInput = document.querySelector(".brightness"); var contrastInput = document.querySelector(".contrast"); // recolor var recolorTypeInput = document.querySelector(".recolor-type"); var blackAndWhiteInput = document.querySelector(".black-and-white"); var duotoneColor1Input = document.querySelector(".duotone-color1"); var duotoneColor2Input = document.querySelector(".duotone-color2"); var duotoneDivs = document.querySelectorAll(".duotoneContent"); // style var borderColorInput = document.querySelector(".border-color"); var borderWidthInput = document.querySelector(".border-width"); var backColorInput = document.querySelector(".back-color"); function addDefaultShape() { var splogoImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAAjVBMVEUAAACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvACCvAA9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3nrvII+82oaht8gP0jiIatW80FmsEHiNMyohZjQAsxfM6PTK45HB9xNJYK+gAxb8i0egqByKFysp/KajaMoyhACT7jpC5dLjyKzmwW6n2iKNiqLEsHmjnEhZjwODR94xi1HiG5sY0RpfdgP8AM0NBphp8O0MWs2TDFlXLtLAMRwCes6IQpDIQxHU58uzLjfCtdu/6wGu8KAUZEf0qfpPe5smtt2LgtSoy4jjIBB6xnHAmA+Xy/LscKQW+8bHr9XBsSms03lAuRuDcWexiCrlSwrsB/wBTOWUPpOhrV4C62vWIMpU0RU6dOouiKPsZ3k5D0E6dMzBcaOo9RhU6zp0kwMLpHCar1EgEc1HTrFJAVTtsAk+xnTpWEU+ycuxfXbi7ITQEzHU2eb+Z06JNJPAA2BvmHfUKmJVQ23+J06aI0QOTMHfflcux/icMwLDgUOAKnTpUohzBrGwYyEbgA+g9Jo6XXefhVwtHvOnRZ4ahkDI6gkUph9Pp3Vty0L633nToqQrChwMoQmm9oXISuNiOwnTo4DP/AB6Lk25LoAm6uV8zBqgWVQ6noSOonTosJN9gMHVNk0Wqby2A3GwB/uB1WqzanIpzZCxA+wH2E6dDSKIo+JtqMR6WPBvrNzTOPLAJHM6dFZpCvie7K+JMRbJV7kXmB2jafSVI6iqnToshEa2DRsArhhe3pUu4NbUst8Tp0oopIw47tiwFlxlnoUkzMOmbVajNm1a8twE/tHtOnTMyNFUCgBeAJx3EdBOnRjAXO61ZbHcEcRPJ4ficgoWx+9G7nTpJ72Gj/9k="; var pic1 = sheet.shapes.addPictureShape('pic1', splogoImg, 80, 80, 150, 150); var pic2 = sheet.shapes.addPictureShape('pic2', splogoImg, 310, 80, 150, 150); var pic3 = sheet.shapes.addPictureShape('pic3', splogoImg, 540, 80, 150, 150); var pic4 = sheet.shapes.addPictureShape('pic4', foodImg, 80, 300, 285, 180); var pic5 = sheet.shapes.addPictureShape('pic5', foodImg, 420, 300, 285, 180); pic1.isSelected(true); // set pic2 style var style = pic2.style(); style.fill = { type: 1, color: '#666666' }; pic2.style(style); // set pic3 geometry type pic3.geometryType(GC.Spread.Sheets.Shapes.AutoShapeType.roundedRectangle); // set pic3 style var style = pic3.style(); style.fill = { type: 1, color: '#666666' }; pic3.style(style); // set pic5 duotone effect pic5.pictureFormat({ duotone: { color1: 'black', color2: 'rgb(150, 242, 21)' } }); } function getSelectedPictures() { var pictures = []; var shapes = sheet.shapes.all(); for (var i = 0; i < shapes.length; i++) { var shape = shapes[i]; if (shape.isSelected() && shape instanceof GC.Spread.Sheets.Shapes.PictureShape) { pictures.push(shape); } } return pictures; } function getFirstSelectedPicture() { return getSelectedPictures()[0]; } function showPictureProp() { pictureProp.style.display = ''; tip.style.display = 'none'; } function hiddenPictureProp() { pictureProp.style.display = 'none'; tip.style.display = ''; } function rgbToHex(color) { let rgb = color.match(/rgb\((\d+),(\d+),(\d+)\)/); if (!rgb || rgb.length < 4) { return '#000000'; } return '#' + rgb.slice(1, 4).map(function (v) { let hex = Number(v).toString(16); return hex.length === 1 ? "0" + hex : hex; }).join(''); } function syncState(pic) { let format = pic.pictureFormat(); let style = pic.style(); let crop = format.crop; geometryTypeInput.value = pic.geometryType(); cropLeftInput.value = crop.left; cropRightInput.value = crop.right; cropTopInput.value = crop.top; cropBottomInput.value = crop.bottom; transparencyInput.value = format.transparency; brightnessInput.value = format.brightness; contrastInput.value = format.contrast; for (let i = 0; i < duotoneDivs.length; i++) { duotoneDivs[i].style.display = "none"; } let recolorType = 'none'; if (format.grayscale) { recolorType = 'gray-scale'; } else if (format.blackAndWhite !== undefined) { recolorType = 'black-and-white'; blackAndWhiteInput.value = format.blackAndWhite; } else if (format.duotone) { recolorType = 'duotone'; for (let i = 0; i < duotoneDivs.length; i++) { duotoneDivs[i].style.display = "block"; } duotoneColor1Input.value = rgbToHex(format.duotone.color1); duotoneColor2Input.value = rgbToHex(format.duotone.color2); } recolorTypeInput.value = recolorType; backColorInput.value = rgbToHex(style.fill.color); borderColorInput.value = rgbToHex(style.line.color); borderWidthInput.value = style.line.width; } function clearRecolorAndBrightnessContrast(format) { format.grayscale = false; format.blackAndWhite = undefined; format.duotone = undefined; format.brightness = 0; format.contrast = 0; } function onDuotoneColorChange() { recolorTypeInput.value = 'duotone'; let duotone = { color1: duotoneColor1Input.value, color2: duotoneColor2Input.value }; setPictureFormat(function (format) { clearRecolorAndBrightnessContrast(format); format.duotone = duotone; }); } function setPictureFormat(changeFormatFunc) { var pic = getFirstSelectedPicture(); var format = pic.pictureFormat(); changeFormatFunc(format); pic.pictureFormat(format); syncState(pic); } function bindPanelEvent() { sheet.bind(GC.Spread.Sheets.Events.ShapeSelectionChanged, function () { var pictures = getSelectedPictures(); if (pictures.length === 1) { showPictureProp(); syncState(pictures[0]) } else { hiddenPictureProp(); } }); imgInput.addEventListener("change", function () { var blob = imgInput.files[0]; var fileReader = new FileReader(); fileReader.addEventListener('load', function () { getFirstSelectedPicture().src(fileReader.result); }); fileReader.readAsDataURL(blob); }); geometryTypeInput.addEventListener("input", function () { var value = Number(geometryTypeInput.value); getFirstSelectedPicture().geometryType(value); }); cropLeftInput.addEventListener("input", function () { var value = Number(cropLeftInput.value); setPictureFormat(function (format) { format.crop.left = value; }); }); cropRightInput.addEventListener("input", function () { var value = Number(cropRightInput.value); setPictureFormat(function (format) { format.crop.right = value; }); }); cropTopInput.addEventListener("input", function () { var value = Number(cropTopInput.value); setPictureFormat(function (format) { format.crop.top = value; }); }); cropBottomInput.addEventListener("input", function () { var value = Number(cropBottomInput.value); setPictureFormat(function (format) { format.crop.bottom = value; }); }); transparencyInput.addEventListener("input", function () { var value = Number(transparencyInput.value); setPictureFormat(function (format) { format.transparency = value; }); }); brightnessInput.addEventListener("input", function () { var value = Number(brightnessInput.value); setPictureFormat(function (format) { format.brightness = value; }); }); contrastInput.addEventListener("input", function () { var value = Number(contrastInput.value); setPictureFormat(function (format) { format.contrast = value; }); }); recolorTypeInput.addEventListener("change", function () { let type = recolorTypeInput.value; setPictureFormat(function (format) { clearRecolorAndBrightnessContrast(format); if (type === 'gray-scale') { format.grayscale = true; } else if (type === 'black-and-white') { format.blackAndWhite = Number(blackAndWhiteInput.value); } else if (type === 'duotone') { format.duotone = { color1: duotoneColor1Input.value, color2: duotoneColor2Input.value } } }); }); blackAndWhiteInput.addEventListener("input", function () { recolorTypeInput.value = 'black-and-white'; setPictureFormat(function (format) { clearRecolorAndBrightnessContrast(format); format.blackAndWhite = Number(blackAndWhiteInput.value); }); }); duotoneColor1Input.addEventListener("change", onDuotoneColorChange); duotoneColor2Input.addEventListener("change", onDuotoneColorChange); backColorInput.addEventListener("input", function () { var value = backColorInput.value; var picture = getFirstSelectedPicture(); var style = picture.style(); style.fill = { type: 1, color: value, transparency: 0 }; picture.style(style); }); borderColorInput.addEventListener("input", function () { var value = borderColorInput.value; var picture = getFirstSelectedPicture(); var style = picture.style(); style.line.color = value; picture.style(style); }); borderWidthInput.addEventListener("input", function () { var value = Number(borderWidthInput.value); var picture = getFirstSelectedPicture(); var style = picture.style(); style.line.color = borderColorInput.value; style.line.width = value; picture.style(style); }); } function start() { bindPanelEvent(); addDefaultShape(); } start(); }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta name="spreadjs culture" content="ja-jp" /> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets-resources-ja/dist/gc.spread.sheets.resources.ja.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/ja/purejs/node_modules/@mescius/spread-sheets-shapes/dist/gc.spread.sheets.shapes.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div id="ss" class="sample-spreadsheets"></div> <div class="picture-prop options-container" style="display: none;"> <h3>画像フォーマット</h3> <div class="option-row"> <label>画像</label><input class="img" type="file" accept="image/*"> </div> <div class="option-row"> <label>図の形にトリミング</label> <select class="geometry-type"> <option value="1">長方形</option> <option value="5">角丸長方形</option> <option value="9">楕円形</option> <option value="21">ハート</option> <option value="178">雲</option> </select> </div> <div class="option-row"> <label>透明度</label><input class="transparency" type="number" min="0" max="1" step="0.01" value="0"> </div> <div class="divide-line"></div> <details> <summary>切り取り</summary> <div class="option-row"> <label>左</label><input class="crop-left" type="number" max="0.99" step="0.01" value="0"> </div> <div class="option-row"> <label>右</label><input class="crop-right" type="number" max="0.99" step="0.01" value="0"> </div> <div class="option-row"> <label>上</label><input class="crop-top" type="number" max="0.99" step="0.01" value="0"> </div> <div class="option-row"> <label>下</label><input class="crop-bottom" type="number" max="0.99" step="0.01" value="0"> </div> </details> <div class="divide-line"></div> <details> <summary>明るさ/コントラスト</summary> <div class="option-row"> <label>明るさ</label><input class="brightness" type="number" min="-1" max="1" step="0.01" value="0"> </div> <div class="option-row"> <label>コントラスト</label><input class="contrast" type="number" min="-1" max="1" step="0.01" value="0"> </div> </details> <div class="divide-line"></div> <details> <summary>色の変更</summary> <div class="option-row"> <label>変更のタイプ</label> <select class="recolor-type"> <option value="none">なし</option> <option value="gray-scale">グレースケール</option> <option value="black-and-white">黒と白</option> <option value="duotone">デュオトーン</option> </select> </div> <div class="option-row"> <label>黒と白</label><input class="black-and-white" type="number" min="0" max="1" step="0.05" value="0.5"> </div> <div class="option-row duotoneContent"> <label>デュオトーン色1</label><input class="duotone-color1" type="color"> </div> <div class="option-row duotoneContent"> <label>デュオトーン色2</label><input class="duotone-color2" type="color" value="#FF0000"> </div> </details> <div class="divide-line"></div> <details> <summary>スタイル</summary> <div class="option-row"> <label>背景色</label><input class="back-color" type="color"> </div> <div class="option-row"> <label>境界線の色</label><input class="border-color" type="color"> </div> <div class="option-row"> <label>境界線の幅</label><input class="border-width" type="number" min="-1" step="1" value="0"> </div> </details> </div> <div class="tip options-container"> シェイプを選択してください。 </div> </div> </body> </html>
body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } .sample-tutorial { position: relative; height: 100%; /* overflow: hidden; */ } .sample-spreadsheets { width: calc(100% - 300px); height: 100%; /* overflow: hidden; */ } .options-container { position: absolute; top: 0px; right: 0px; width: 300px; height: 100%; padding: 12px; box-sizing: border-box; background: #fbfbfb; overflow: auto; } h3 { text-align: center; } .option-row { background: #fbfbfb; position: relative; margin: 12px 0px; } details { margin: 12px 0px; } .option-row input { position: absolute; box-sizing: border-box; right: 20px; width: 126px; height: 26px; } .option-row select { position: absolute; right: 20px; width: 126px; height: 26px; } .divide-line { width: 100%; height: 1px; background: #cbcbcb; margin-top: 10px; margin-bottom: 3px; }