public class ImageViewerCorrector extends ImageMatrixCorrector
This MatrixCorrector implementation defines the default behavior for an image viewer.
It works properly only if the following two conditions are met:
sx and sy are always the same value| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TAG |
| Constructor and Description |
|---|
ImageViewerCorrector() |
ImageViewerCorrector(android.widget.ImageView imageView,
float maxScale) |
| Modifier and Type | Method and Description |
|---|---|
float |
correctAbsolute(int vector,
float x)
* Returns the corrected value of the given absolute vector.
|
static float |
correctTranslation(float translation,
float viewDim,
float imgDim)
Corrects the translation so that it does not exceed the allowed bounds.
|
float |
getMaxScale()
Returns the maximum allowed scale.
|
boolean |
isMaxScaleRelative()
Indicates whether the maximum scale should be relative to the inner fit scale.
|
void |
performAbsoluteCorrections()
Does corrections AFTER matrix operations have been applied.
|
void |
setMaxScale(float maxScale)
Sets the maximum allowed scale.
|
void |
setMaxScaleRelative(boolean maxScaleRelative)
Sets whether the maximum scale should be relative to the inner fit scale.
|
getImageView, getInnerFitScale, getScaledImageHeight, getScaledImageWidth, setImageView, setMatrix, updateScaledImageDimensionscorrectRelative, getMatrix, getValuespublic ImageViewerCorrector()
public ImageViewerCorrector(android.widget.ImageView imageView,
float maxScale)
public float getMaxScale()
Returns the maximum allowed scale.
public void setMaxScale(float maxScale)
Sets the maximum allowed scale.
maxScale - public boolean isMaxScaleRelative()
Indicates whether the maximum scale should be relative to the inner fit scale.
public void setMaxScaleRelative(boolean maxScaleRelative)
Sets whether the maximum scale should be relative to the inner fit scale.
maxScaleRelative - public void performAbsoluteCorrections()
MatrixCorrectorDoes corrections AFTER matrix operations have been applied.
This implementation only copies the values of the matrix into its float array values.
performAbsoluteCorrections in class MatrixCorrectorpublic float correctAbsolute(int vector,
float x)
MatrixCorrectorReturns the corrected value of the given absolute vector.
correctAbsolute in class MatrixCorrectorpublic static final float correctTranslation(float translation,
float viewDim,
float imgDim)
Corrects the translation so that it does not exceed the allowed bounds.
translation - viewDim - imgDim -