Class ImageCropStyle
ImageCropStyle
Một lớp đại diện cho kiểu cắt có thể áp dụng cho các thành phần hình ảnh. Bạn không thể đặt kích thước của hình ảnh hoặc đổi kích thước hình ảnh, nhưng có thể cắt hình ảnh.
Tài liệu chi tiết
setAspectRatio(ratio)
Đặt tỷ lệ khung hình sẽ sử dụng nếu loại ảnh cắt là RECTANGLE_CUSTOM
. Tỷ lệ này phải là một giá trị dương.
Tham số
Tên | Loại | Mô tả |
ratio | Number | Tỷ lệ cần áp dụng. |
Cầu thủ trả bóng
ImageCropStyle
– Đối tượng này, để tạo chuỗi.
Gửi
Error
– nếu giá trị đầu vào là âm hoặc 0.
setImageCropType(type)
Đặt loại cắt cho hình ảnh. Giá trị mặc định là SQUARE.
Tham số
Cầu thủ trả bóng
ImageCropStyle
– Đối tượng này, để tạo chuỗi.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-12-02 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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"]]