public abstract class BitmapUtils extends Object
Constructor and Description |
---|
BitmapUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
calculateCroppedSrcRect(int srcW,
int srcH,
int dstW,
int dstH,
int dstSliceH,
int sampleSize,
float horizSliceFrac,
float vertSliceFrac,
boolean absoluteFrac,
float verticalMultiplier,
Rect outRect)
Calculate a rectangle for the given input and output parameters.
|
static void |
calculateCroppedSrcRect(int srcW,
int srcH,
int dstW,
int dstH,
int sampleSize,
Rect outRect) |
static void |
calculateCroppedSrcRect(int srcW,
int srcH,
int dstW,
int dstH,
Rect outRect) |
public static void calculateCroppedSrcRect(int srcW, int srcH, int dstW, int dstH, int dstSliceH, int sampleSize, float horizSliceFrac, float vertSliceFrac, boolean absoluteFrac, float verticalMultiplier, Rect outRect)
srcW
- the source widthsrcH
- the source heightdstW
- the destination widthdstH
- the destination heightdstSliceH
- the height extent (in destination coordinates) to
exclude when cropping. You would typically pass dstH, unless
you are trying to normalize different items to the same
vertical crop range.sampleSize
- a scaling factor that rect calculation will only use if
it's more aggressive than regular scalinghorizSliceFrac
- horizontal slice fraction determines the horizontal
center point for the crop rect. Range is from [0.0, 1.0]. To
perform a horizontally centered crop, use 0.5.vertSliceFrac
- vertical slice fraction determines the vertical
center point for the crop rect. Range is from [0.0, 1.0]. To
perform a vertically centered crop, use 0.5. Otherwise, see
absoluteFrac.absoluteFrac
- determines how the vertSliceFrac affects the vertical
center point. If this parameter is true, the vertical center
of the resulting output rectangle will be exactly
[vertSliceFrac * srcH], with care taken to keep the bounds
within the source rectangle. If this parameter is false, the
vertical center will be calculated so that the values of
vertSliceFrac from 0.0 to 1.0 will linearly cover the entirety
of the source rectangle.verticalMultiplier
- an optional multiplier that will alter the
output Rect's aspect ratio to be this much taller in the event
that y is the limiting dimensionoutRect
- a Rect to write the resulting crop coordinates intopublic static void calculateCroppedSrcRect(int srcW, int srcH, int dstW, int dstH, Rect outRect)
srcW
- srcH
- dstW
- dstH
- outRect
- public static void calculateCroppedSrcRect(int srcW, int srcH, int dstW, int dstH, int sampleSize, Rect outRect)