下面列出了怎么用android.hardware.camera2.DngCreator的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Take the given RAW image and capture result, convert it to a DNG and
* write it to disk.
*
* @param image the image containing the 16-bit RAW data (RAW_SENSOR)
* @param captureResult the capture result for the image
* @param characteristics the camera characteristics of the camera that took
* the RAW image
* @param dngFile the destination to where the resulting DNG data is written
* to
*/
private static void writeDngBytesAndClose(Image image, TotalCaptureResult captureResult, CameraCharacteristics
characteristics, File dngFile)
{
try (DngCreator dngCreator = new DngCreator(characteristics, captureResult); FileOutputStream outputStream =
new FileOutputStream(dngFile))
{
// TODO: Add DngCreator#setThumbnail and add the DNG to the normal
// filmstrip.
dngCreator.writeImage(outputStream, image);
outputStream.close();
image.close();
} catch (IOException e)
{
Log.e(TAG, "Could not store DNG file", e);
return;
}
Log.i(TAG, "Successfully stored DNG file: " + dngFile.getAbsolutePath());
}