Class ImageCropStyle
نمطاقتصاص الصورة
فئة تمثّل نمط اقتصاص يمكن تطبيقه على مكونات الصورة. لا يمكنك تحديد
حجم الصورة أو تغيير حجمها، ولكن يمكنك اقتصاصها.
مستندات تفصيلية
setAspectRatio(ratio)
لضبط نسبة العرض إلى الارتفاع التي سيتم استخدامها إذا كان نوع الاقتصاص هو RECTANGLE_CUSTOM
. يجب أن تكون النسبة
قيمة موجبة.
المعلَمات
الاسم | النوع | الوصف |
ratio | Number | النسبة المراد تطبيقها. |
الإرجاع
ImageCropStyle
: هذا العنصر، لإنشاء سلسلة.
عمليات الرمي
Error
- إذا كانت الإدخال سالبة أو صفرًا.
setImageCropType(type)
لضبط نوع الاقتصاص للصورة. القيمة التلقائية هي SQUARE.
المعلَمات
الإرجاع
ImageCropStyle
: هذا العنصر، لإنشاء سلسلة.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2024-12-02 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-12-02 (حسب التوقيت العالمي المتفَّق عليه)"],[[["`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"]]