Class CropSettings
Used to describe cropping points for an image.
Inherited Members
Namespace: AdaptiveImages.Core
Assembly: AdaptiveImages.dll
Syntax
public class CropSettings
Constructors
CropSettings()
Creates an empty instance.
Declaration
public CropSettings()
CropSettings(SingleImage)
Creates an instance representing any crop settings for the specified image.
Declaration
public CropSettings(SingleImage image)
Parameters
| Type | Name | Description |
|---|---|---|
| SingleImage | image |
Properties
Bottom
Gets or sets the Y coordinate of crop end in pixels.
Declaration
public int? Bottom { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
ExplicitCoordinates
Gets value indicating whether cropping coordinates are explicit, effectively meaning any default cropping method by image URL provider should be overridden.
Declaration
public bool ExplicitCoordinates { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
For example used to determine whether automatic gravity should be applied for cropping.
HasValue
Gets whether this is valid crop settings.
Declaration
public bool HasValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Height
Gets the image height based on the specified cropping points.
Declaration
public int Height { get; }
Property Value
| Type | Description |
|---|---|
| int |
Left
Gets or sets the X coordinate of crop start in pixels.
Declaration
public int? Left { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Right
Gets or sets the X coordinate of crop end in pixels.
Declaration
public int? Right { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Top
Gets or sets the Y coordinate of crop start in pixels.
Declaration
public int? Top { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Width
Gets the image width based on the specified cropping points.
Declaration
public int Width { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
ToString()
Produces human-readable crop settings.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
WouldAffectImage(SingleImage)
Checks if the current crop settings would indeed crop the specified image, or if it simply includes exactly the whole original image.
Declaration
public bool WouldAffectImage(SingleImage image)
Parameters
| Type | Name | Description |
|---|---|---|
| SingleImage | image |
Returns
| Type | Description |
|---|---|
| bool | True if applying these crop settings would impact rendering of the specified image. |
WouldAffectImage(IImageProviderAsset)
Checks if the current crop settings would indeed crop the specified image, or if it simply includes exactly the whole original image.
Declaration
public bool WouldAffectImage(IImageProviderAsset metadata)
Parameters
| Type | Name | Description |
|---|---|---|
| IImageProviderAsset | metadata |
Returns
| Type | Description |
|---|---|
| bool |
WouldAffectImage(int, int)
Checks if the current cropping would indeed crop an image of the specified size, or if it would simply include the whole original image.
Declaration
public bool WouldAffectImage(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | Original width of an image. |
| int | height | Original height of an image. |
Returns
| Type | Description |
|---|---|
| bool |