Package com.iizix.prop.image
Class RuntimeImageDefinition.Builder
java.lang.Object
com.iizix.prop.image.RuntimeImageDefinition.Builder
- Enclosing class:
RuntimeImageDefinition
The builder class.
Method Summary
Modifier and TypeMethodDescriptionAdds a new resolution for the image.Returns as a RuntimeImageDefinition instance.withBaseImage(String resource, int width, int height) Sets the base image that is normally considered as DPR=1.withBaseImage(String resource, int width, int height, int imageWidth, int imageHeight) Sets the base image that is normally considered as DPR=1.
Method Details
withBaseImage
Sets the base image that is normally considered as DPR=1.- Parameters:
resource- The resource name of the base image with the client side URL style.width- The width of the base image.height- The height of the base image.- Returns:
- This same builder instance, can be used for concatenating more methods.
- Throws:
IllegalStateException- If the base image is already set.IllegalArgumentException- If the width or height are not greater than zero.
withBaseImage
public RuntimeImageDefinition.Builder withBaseImage(String resource, int width, int height, int imageWidth, int imageHeight) Sets the base image that is normally considered as DPR=1.- Parameters:
resource- The resource name of the base image with the client side URL style.width- The width of the base image.height- The height of the base image.imageWidth- The width of this image for DPR setting.imageHeight- The height of this image for DPR setting.- Returns:
- This same builder instance, can be used for concatenating more methods.
- Throws:
IllegalStateException- If the base image is already set.IllegalArgumentException- If the width or height are not greater than zero, or if the DPR is not consistent with the base image.
addImage
Adds a new resolution for the image. This resolution may have a different DPR and is calculated automatically. No checking is done if an image with the same DPR already has been added.- Parameters:
resource- The resource name of the image to add.width- The width of the base image.height- The height of the base image.- Returns:
- This same builder instance, can be used for concatenating more methods.
- Throws:
IllegalStateException- If the base image is not set.IllegalArgumentException- If the width or height are not greater than zero, or if the DPR is not consistent with the base image.
asRuntimeImageDefinition
Returns as a RuntimeImageDefinition instance.- Returns:
- The runtime image definition.
- Throws:
IllegalStateException- If the base image is not set.