Class MeteringRectangle¶
- java.lang.Object
-
- com.iristick.smartglass.support.camera2.params.MeteringRectangle
com.iristick.smartglass.core.camera
package instead.@Deprecated public abstract class MeteringRectangle extends Object
An immutable class to represent a rectangle (x, y, width, height)
with an additional
weight component.
The rectangle is defined to be inclusive of the specified coordinates.
When used with a CaptureRequest
,
the coordinate system is based on the active pixel array, with (0,0)
being the top-lef
pixel in the
active pixel array
, and (android.sensor.info.activeArraySize.width - 1,
android.sensor.info.activeArraySize.height - 1)
being the bottom-right pixel
in the active pixel array.
The weight must range from 0 to 1000 inclusively, and represents a weight for every pixel in the area. This means that a large metering area with the same weight as a smaller area will have more effect in the metering result. Metering areas can partially overlap and the camera device will add the weights in the overlap rectangle.
If all rectangles have 0 weight, then no specific metering area needs to be used by the camera device. If the metering rectangle is outside the used android.scaler.cropRegion returned in capture result metadata, the camera device will ignore the sections outside the rectangle and output the used sections in the result metadata.
- Since:
- Android API level 21
Field Summary¶
Modifier and Type | Field and Description |
---|---|
static int |
METERING_WEIGHT_DONT_CARE
Deprecated.
Weights set to this value will cause the camera device to ignore this rectangle.
|
static int |
METERING_WEIGHT_MAX
Deprecated.
The maximum value of valid metering weight.
|
static int |
METERING_WEIGHT_MIN
Deprecated.
The minimum value of valid metering weight.
|
Constructor Summary¶
Constructor and Description |
---|
MeteringRectangle()
Deprecated.
|
Method Summary¶
Modifier and Type | Method and Description |
---|---|
static MeteringRectangle |
create(int x,
int y,
int width,
int height,
int meteringWeight)
Deprecated.
Create a new metering rectangle.
|
static MeteringRectangle |
create(Point xy,
Size dimensions,
int meteringWeight)
Deprecated.
Create a new metering rectangle.
|
static MeteringRectangle |
create(Rect rect,
int meteringWeight)
Deprecated.
Create a new metering rectangle.
|
abstract boolean |
equals(MeteringRectangle other)
Deprecated.
Compare two metering rectangles to see if they are equal.
|
abstract boolean |
equals(Object other)
Deprecated.
|
abstract int |
getHeight()
Deprecated.
Return the height of the rectangle.
|
abstract int |
getMeteringWeight()
Deprecated.
Return the metering weight of the rectangle.
|
abstract Rect |
getRect()
Deprecated.
Convenience method to create a
Rect from this metering rectangle. |
abstract Size |
getSize()
Deprecated.
Convenience method to create the size from this metering rectangle.
|
abstract Point |
getUpperLeftPoint()
Deprecated.
Convenience method to create the upper-left (X,Y) coordinate as a
Point . |
abstract int |
getWidth()
Deprecated.
Return the width of the rectangle.
|
abstract int |
getX()
Deprecated.
Return the X coordinate of the left side of the rectangle.
|
abstract int |
getY()
Deprecated.
Return the Y coordinate of the upper side of the rectangle.
|
abstract int |
hashCode()
Deprecated.
|
abstract String |
toString()
Deprecated.
Return the metering rectangle as a string representation
"(x:%d, y:%d, w:%d, h:%d, wt:%d)" where each %d respectively represents
the x, y, width, height, and weight points. |
Methods inherited from class java.lang.Object¶
getClass, notify, notifyAll, wait, wait, wait
Field Detail¶
METERING_WEIGHT_MIN¶
public static final int METERING_WEIGHT_MIN
METERING_WEIGHT_MAX¶
public static final int METERING_WEIGHT_MAX
METERING_WEIGHT_DONT_CARE¶
public static final int METERING_WEIGHT_DONT_CARE
Constructor Detail¶
MeteringRectangle¶
public MeteringRectangle()
Method Detail¶
create¶
public static MeteringRectangle create(int x, int y, int width, int height, int meteringWeight)
- Parameters:
x
- coordinate ≥ 0y
- coordinate ≥ 0width
- width ≥ 0height
- height ≥ 0meteringWeight
- weight between 0 and 1000 inclusively- Returns:
- A new
MeteringRectangle
instance. - Throws:
IllegalArgumentException
- if any of the parameters were negative
create¶
public static MeteringRectangle create(Point xy, Size dimensions, int meteringWeight)
The point xy
's data is copied; the reference is not retained.
- Parameters:
xy
- a non-null
Point
with both x,y ≥ 0dimensions
- a non-null
Size
with width, height ≥ 0meteringWeight
- weight ≥ 0- Returns:
- A new
MeteringRectangle
instance. - Throws:
IllegalArgumentException
- if any of the parameters were negativeNullPointerException
- if any of the arguments were null
create¶
public static MeteringRectangle create(Rect rect, int meteringWeight)
The rectangle data is copied; the reference is not retained.
- Parameters:
rect
- a non-null
rectangle with all x,y,w,h dimensions ≥ 0meteringWeight
- weight ≥ 0- Returns:
- A new
MeteringRectangle
instance. - Throws:
IllegalArgumentException
- if any of the parameters were negativeNullPointerException
- if any of the arguments were null
getX¶
public abstract int getX()
- Returns:
- x coordinate ≥ 0
getY¶
public abstract int getY()
- Returns:
- y coordinate ≥ 0
getWidth¶
public abstract int getWidth()
- Returns:
- width ≥ 0
getHeight¶
public abstract int getHeight()
- Returns:
- height ≥ 0
getMeteringWeight¶
public abstract int getMeteringWeight()
- Returns:
- weight ≥ 0
getUpperLeftPoint¶
public abstract Point getUpperLeftPoint()
Point
.- Returns:
- a new
(x,y)
Point
with both x,y ≥ 0
getSize¶
public abstract Size getSize()
This strips away the X,Y,weight from the rectangle.
- Returns:
- a new
Size
with non-negative width and height
getRect¶
public abstract Rect getRect()
Rect
from this metering rectangle.
This strips away the weight from the rectangle.
- Returns:
- a new
Rect
with non-negative x1, y1, x2, y2
equals¶
public abstract boolean equals(Object other)
equals¶
public abstract boolean equals(MeteringRectangle other)
- Parameters:
other
- Another MeteringRectangle- Returns:
true
if the metering rectangles are equal,false
otherwise
hashCode¶
public abstract int hashCode()
toString¶
public abstract String toString()
"(x:%d, y:%d, w:%d, h:%d, wt:%d)"
where each %d
respectively represents
the x, y, width, height, and weight points.