use of android.util.SizeF in project android_frameworks_base by DirtyUnicorns.
the class CameraMetadataTest method testReadWriteSizeF.
@SmallTest
public void testReadWriteSizeF() {
// int32 x n
checkKeyMarshal("android.sensor.info.physicalSize", new SizeF(123f, 456f), toByteArray(123f, 456f));
// int32 x 2 x n
checkKeyMarshal("android.sensor.info.physicalSize", new SizeF[] { new SizeF(123f, 456f), new SizeF(1.234f, 4.567f), new SizeF(999.0f, 555.0f) }, toByteArray(123f, 456f, 1.234f, 4.567f, 999.0f, 555.0f));
}
use of android.util.SizeF in project android_frameworks_base by AOSPA.
the class LegacyMetadataMapper method mapSensor.
private static void mapSensor(CameraMetadataNative m, Parameters p) {
// Use the largest jpeg size (by area) for both active array and pixel array
Size largestJpegSize = getLargestSupportedJpegSizeByArea(p);
/*
* sensor.info.activeArraySize
*/
{
Rect activeArrayRect = ParamsUtils.createRect(largestJpegSize);
m.set(SENSOR_INFO_ACTIVE_ARRAY_SIZE, activeArrayRect);
}
/*
* sensor.availableTestPatternModes
*/
{
// Only "OFF" test pattern mode is available
m.set(SENSOR_AVAILABLE_TEST_PATTERN_MODES, new int[] { SENSOR_TEST_PATTERN_MODE_OFF });
}
/*
* sensor.info.pixelArraySize
*/
m.set(SENSOR_INFO_PIXEL_ARRAY_SIZE, largestJpegSize);
/*
* sensor.info.physicalSize
*/
{
/*
* Assume focal length is at infinity focus and that the lens is rectilinear.
*/
// in mm
float focalLength = p.getFocalLength();
// to radians
double angleHor = p.getHorizontalViewAngle() * Math.PI / 180;
// to radians
double angleVer = p.getVerticalViewAngle() * Math.PI / 180;
float height = (float) Math.abs(2 * focalLength * Math.tan(angleVer / 2));
float width = (float) Math.abs(2 * focalLength * Math.tan(angleHor / 2));
// in mm
m.set(SENSOR_INFO_PHYSICAL_SIZE, new SizeF(width, height));
}
/*
* sensor.info.timestampSource
*/
{
m.set(SENSOR_INFO_TIMESTAMP_SOURCE, SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN);
}
}
use of android.util.SizeF in project platform_frameworks_base by android.
the class CameraMetadataTest method testReadWriteSizeF.
@SmallTest
public void testReadWriteSizeF() {
// int32 x n
checkKeyMarshal("android.sensor.info.physicalSize", new SizeF(123f, 456f), toByteArray(123f, 456f));
// int32 x 2 x n
checkKeyMarshal("android.sensor.info.physicalSize", new SizeF[] { new SizeF(123f, 456f), new SizeF(1.234f, 4.567f), new SizeF(999.0f, 555.0f) }, toByteArray(123f, 456f, 1.234f, 4.567f, 999.0f, 555.0f));
}
use of android.util.SizeF in project platform_frameworks_base by android.
the class LegacyMetadataMapper method mapSensor.
private static void mapSensor(CameraMetadataNative m, Parameters p) {
// Use the largest jpeg size (by area) for both active array and pixel array
Size largestJpegSize = getLargestSupportedJpegSizeByArea(p);
/*
* sensor.info.activeArraySize
*/
{
Rect activeArrayRect = ParamsUtils.createRect(largestJpegSize);
m.set(SENSOR_INFO_ACTIVE_ARRAY_SIZE, activeArrayRect);
}
/*
* sensor.availableTestPatternModes
*/
{
// Only "OFF" test pattern mode is available
m.set(SENSOR_AVAILABLE_TEST_PATTERN_MODES, new int[] { SENSOR_TEST_PATTERN_MODE_OFF });
}
/*
* sensor.info.pixelArraySize
*/
m.set(SENSOR_INFO_PIXEL_ARRAY_SIZE, largestJpegSize);
/*
* sensor.info.physicalSize
*/
{
/*
* Assume focal length is at infinity focus and that the lens is rectilinear.
*/
// in mm
float focalLength = p.getFocalLength();
// to radians
double angleHor = p.getHorizontalViewAngle() * Math.PI / 180;
// to radians
double angleVer = p.getVerticalViewAngle() * Math.PI / 180;
float height = (float) Math.abs(2 * focalLength * Math.tan(angleVer / 2));
float width = (float) Math.abs(2 * focalLength * Math.tan(angleHor / 2));
// in mm
m.set(SENSOR_INFO_PHYSICAL_SIZE, new SizeF(width, height));
}
/*
* sensor.info.timestampSource
*/
{
m.set(SENSOR_INFO_TIMESTAMP_SOURCE, SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN);
}
}
use of android.util.SizeF in project android_frameworks_base by DirtyUnicorns.
the class LegacyMetadataMapper method mapSensor.
private static void mapSensor(CameraMetadataNative m, Parameters p) {
// Use the largest jpeg size (by area) for both active array and pixel array
Size largestJpegSize = getLargestSupportedJpegSizeByArea(p);
/*
* sensor.info.activeArraySize
*/
{
Rect activeArrayRect = ParamsUtils.createRect(largestJpegSize);
m.set(SENSOR_INFO_ACTIVE_ARRAY_SIZE, activeArrayRect);
}
/*
* sensor.availableTestPatternModes
*/
{
// Only "OFF" test pattern mode is available
m.set(SENSOR_AVAILABLE_TEST_PATTERN_MODES, new int[] { SENSOR_TEST_PATTERN_MODE_OFF });
}
/*
* sensor.info.pixelArraySize
*/
m.set(SENSOR_INFO_PIXEL_ARRAY_SIZE, largestJpegSize);
/*
* sensor.info.physicalSize
*/
{
/*
* Assume focal length is at infinity focus and that the lens is rectilinear.
*/
// in mm
float focalLength = p.getFocalLength();
// to radians
double angleHor = p.getHorizontalViewAngle() * Math.PI / 180;
// to radians
double angleVer = p.getVerticalViewAngle() * Math.PI / 180;
float height = (float) Math.abs(2 * focalLength * Math.tan(angleVer / 2));
float width = (float) Math.abs(2 * focalLength * Math.tan(angleHor / 2));
// in mm
m.set(SENSOR_INFO_PHYSICAL_SIZE, new SizeF(width, height));
}
/*
* sensor.info.timestampSource
*/
{
m.set(SENSOR_INFO_TIMESTAMP_SOURCE, SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN);
}
}