本文整理汇总了Java中com.drew.lang.Rational.getDenominator方法的典型用法代码示例。如果您正苦于以下问题:Java Rational.getDenominator方法的具体用法?Java Rational.getDenominator怎么用?Java Rational.getDenominator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.drew.lang.Rational
的用法示例。
在下文中一共展示了Rational.getDenominator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Frame
import com.drew.lang.Rational; //导入方法依赖的package包/类
/**
* @param frameFile
*/
public Frame(final File frameFile) {
try {
path = frameFile.getCanonicalPath();
final Metadata metadata = ImageMetadataReader.readMetadata(frameFile);
final ExifSubIFDDirectory directory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
if (directory != null) {
// Original TS
Date date = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
if (date == null) {
date = directory.getDate(ExifSubIFDDirectory.TAG_DATETIME);
}
if (date != null) {
ts = date.getTime();
} else {
throw new RuntimeException("Unable to load timestamp from image.");
}
// exposure time
final Rational exTimeR = directory.getRational(ExifSubIFDDirectory.TAG_EXPOSURE_TIME);
exposure = (1.0 * exTimeR.getNumerator()) / exTimeR.getDenominator();
} else {
throw new RuntimeException("Unable to load timestamp from image.");
}
} catch (final ImageProcessingException | IOException ex) {
throw new RuntimeException(ex);
}
}
示例2: getFocusDescription
import com.drew.lang.Rational; //导入方法依赖的package包/类
@Nullable
public String getFocusDescription()
{
Rational value = _directory.getRational(TAG_FOCUS);
return value == null
? null
: value.getNumerator() == 1 && value.getDenominator() == 0
? "Infinite"
: value.toSimpleString(true);
}