Class ImageCropStyle
รูปภาพครอบตัดสไตล์
คลาสที่แสดงถึงรูปแบบการครอบตัดซึ่งนําไปใช้กับคอมโพเนนต์รูปภาพได้ คุณไม่สามารถกำหนดขนาดของรูปภาพหรือปรับขนาดรูปภาพได้ แต่สามารถครอบตัดรูปภาพได้
เอกสารประกอบโดยละเอียด
setAspectRatio(ratio)
ตั้งค่าสัดส่วนภาพที่จะใช้หากประเภทการครอบตัดคือ RECTANGLE_CUSTOM
อัตราส่วนต้องเป็นค่าบวก
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
ratio | Number | อัตราส่วนที่จะนําไปใช้ |
รีเทิร์น
ImageCropStyle
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
โยน
Error
— หากอินพุตเป็นค่าลบหรือ 0
setImageCropType(type)
ตั้งค่าประเภทการครอบตัดสำหรับรูปภาพ ค่าเริ่มต้นคือ SQUARE
พารามิเตอร์
รีเทิร์น
ImageCropStyle
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-12-02 UTC
[null,null,["อัปเดตล่าสุด 2024-12-02 UTC"],[[["`ImageCropStyle` allows cropping images within Google Apps Script, but not resizing them directly."],["Two main methods, `setAspectRatio` and `setImageCropType`, provide control over the cropping process."],["`setAspectRatio` is applicable only when using the `RECTANGLE_CUSTOM` crop type and requires a positive ratio value."],["`setImageCropType` lets you choose the shape of the crop, with `SQUARE` being the default option."],["Both methods return the `ImageCropStyle` object, enabling method chaining for streamlined code."]]],["The `ImageCropStyle` class allows users to crop images without resizing them. Key actions include setting the image crop type using `setImageCropType`, which defaults to SQUARE. For a `RECTANGLE_CUSTOM` crop type, you can set the aspect ratio via `setAspectRatio`, which requires a positive numeric value. Both methods return the `ImageCropStyle` object, enabling method chaining. `setAspectRatio` throws an error if the ratio is zero or negative.\n"]]