/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
namespace Tizen.Content.MediaContent
{
///
/// Represents the image media stored in the device.
///
public class ImageInfo : MediaInfo
{
internal ImageInfo(Interop.MediaInfoHandle handle) : base(handle)
{
IntPtr imageHandle = IntPtr.Zero;
try
{
Interop.MediaInfo.GetImage(handle, out imageHandle).ThrowIfError("Failed to retrieve data");
Debug.Assert(imageHandle != IntPtr.Zero);
Width = InteropHelper.GetValue(imageHandle, Interop.ImageInfo.GetWidth);
Height = InteropHelper.GetValue(imageHandle, Interop.ImageInfo.GetHeight);
Orientation = InteropHelper.GetValue(imageHandle, Interop.ImageInfo.GetOrientation);
DateTaken = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetDateTaken);
ExposureTime = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetExposureTime);
FNumber = InteropHelper.GetValue(imageHandle, Interop.ImageInfo.GetFNumber);
Iso = InteropHelper.GetValue(imageHandle, Interop.ImageInfo.GetISO);
Model = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetModel);
}
finally
{
Interop.ImageInfo.Destroy(imageHandle);
}
}
///
/// Gets the image width in pixels.
///
/// The image width in pixels.
public int Width { get; }
///
/// Gets the image height in pixels.
///
/// The image height in pixels.
public int Height { get; }
///
/// Gets the orientation of image.
///
/// The orientation of image.
public Orientation Orientation { get; }
///
/// Gets the date of the creation time as a formatted string.
///
/// The date of the creation time as a formatted string.
public string DateTaken { get; }
///
/// Gets the exposure time from EXIF.
///
/// The exposure time from EXIF.
public string ExposureTime { get; }
///
/// Gets the FNumber from EXIF.
///
/// The FNumber from EXIF.
public double FNumber { get; }
///
/// Gets the ISO from EXIF.
///
/// The iso from EXIF.
public int Iso { get; }
///
/// Gets the model from EXIF.
///
/// The model from EXIF.
public string Model { get; }
}
}