All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nervousync.beans.image.CutOptions Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
/*
 * Licensed to the Nervousync Studio (NSYC) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.nervousync.beans.image;

import org.nervousync.commons.Globals;

/**
 * 

Cut options of image cut operate

*

用于图片剪切操作的剪切选项

* * @author Steven Wee [email protected] * @version $Revision: 1.1.0 $ $Date: Sep 22, 2022 17:36:55 $ */ public final class CutOptions { /** *

Begin position X, default value is 0

*

起始X坐标值,默认为0

*/ private final int positionX; /** *

Begin position Y, default value is 0

*

起始Y坐标值,默认为0

*/ private final int positionY; /** *

Cut width value

*

剪切后的宽度

*/ private final int cutWidth; /** *

Cut height value

*

剪切后的高度

*/ private final int cutHeight; /** *

Constructor for CutOptions

*

CutOptions的构造方法

* * @param positionX Begin position X, default value is 0 * 起始X坐标值,默认为0 * @param positionY Begin position Y, default value is 0 * * 起始Y坐标值,默认为0 * @param cutWidth Cut width value * 剪切后的宽度 * @param cutHeight Cut height value * 剪切后的高度 */ private CutOptions(final int positionX, final int positionY, final int cutWidth, final int cutHeight) { this.positionX = positionX < 0 ? Globals.INITIALIZE_INT_VALUE : positionX; this.positionY = positionY < 0 ? Globals.INITIALIZE_INT_VALUE : positionY; this.cutWidth = cutWidth; this.cutHeight = cutHeight; } /** *

Static method for initialize CutOptions from default position (0, 0)

*

用于初始化CutOptions的静态方法,使用默认起始坐标(0,0)

* * @param cutWidth Cut width value * 剪切后的宽度 * @param cutHeight Cut height value * 剪切后的高度 * @return Initialized CutOptions instance * 初始化的CutOptions实例对象 */ public static CutOptions newInstance(final int cutWidth, final int cutHeight) { return newInstance(Globals.DEFAULT_VALUE_INT, Globals.DEFAULT_VALUE_INT, cutWidth, cutHeight); } /** *

Static method for initialize CutOptions by given begin position (positionX, positionY)

*

用于初始化CutOptions的静态方法,使用给定的起始坐标(positionX,positionY)

* * @param positionX Begin position X, default value is 0 * 起始X坐标值,默认为0 * @param positionY Begin position Y, default value is 0 * * 起始Y坐标值,默认为0 * @param cutWidth Cut width value * 剪切后的宽度 * @param cutHeight Cut height value * 剪切后的高度 * @return Initialized CutOptions instance * 初始化的CutOptions实例对象 */ public static CutOptions newInstance(final int positionX, final int positionY, final int cutWidth, final int cutHeight) { return new CutOptions(positionX, positionY, cutWidth, cutHeight); } /** *

Getter method for position X

*

起始X坐标的Getter方法

* * @return Value of begin position X * 起始X坐标值 */ public int getPositionX() { return positionX; } /** *

Getter method for position Y

*

起始Y坐标的Getter方法

* * @return Value of begin position Y * 起始Y坐标值 */ public int getPositionY() { return positionY; } /** *

Getter method for cut width

*

剪切宽度的Getter方法

* * @return Value of cut width * 剪切宽度值 */ public int getCutWidth() { return cutWidth; } /** *

Getter method for cut height

*

剪切高度的Getter方法

* * @return Value of cut height * 剪切高度值 */ public int getCutHeight() { return cutHeight; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy