mirror of https://github.com/SixLabors/ImageSharp
123 changed files with 4714 additions and 1484 deletions
@ -0,0 +1,50 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Common utility methods for working with enums.
|
|||
/// </summary>
|
|||
internal static class EnumUtils |
|||
{ |
|||
/// <summary>
|
|||
/// Converts the numeric representation of the enumerated constants to an equivalent enumerated object.
|
|||
/// </summary>
|
|||
/// <typeparam name="TEnum">The type of enum </typeparam>
|
|||
/// <param name="value">The value to parse</param>
|
|||
/// <param name="defaultValue">The default value to return.</param>
|
|||
/// <returns>The <typeparamref name="TEnum"/>.</returns>
|
|||
public static TEnum Parse<TEnum>(int value, TEnum defaultValue) |
|||
where TEnum : Enum |
|||
{ |
|||
foreach (TEnum enumValue in Enum.GetValues(typeof(TEnum))) |
|||
{ |
|||
TEnum current = enumValue; |
|||
if (value == Unsafe.As<TEnum, int>(ref current)) |
|||
{ |
|||
return enumValue; |
|||
} |
|||
} |
|||
|
|||
return defaultValue; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns a value indicating whether the given enum has a flag of the given value.
|
|||
/// </summary>
|
|||
/// <typeparam name="TEnum">The type of enum.</typeparam>
|
|||
/// <param name="value">The value.</param>
|
|||
/// <param name="flag">The flag.</param>
|
|||
/// <returns>The <see cref="bool"/>.</returns>
|
|||
public static bool HasFlag<TEnum>(TEnum value, TEnum flag) |
|||
where TEnum : Enum |
|||
{ |
|||
uint flagValue = Unsafe.As<TEnum, uint>(ref flag); |
|||
return (Unsafe.As<TEnum, uint>(ref value) & flagValue) == flagValue; |
|||
} |
|||
} |
|||
} |
|||
Binary file not shown.
@ -0,0 +1,45 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal static class ExifDataTypes |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the size in bytes of the given data type.
|
|||
/// </summary>
|
|||
/// <param name="dataType">The data type.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="uint"/>.
|
|||
/// </returns>
|
|||
/// <exception cref="NotSupportedException">
|
|||
/// Thrown if the type is unsupported.
|
|||
/// </exception>
|
|||
public static uint GetSize(ExifDataType dataType) |
|||
{ |
|||
switch (dataType) |
|||
{ |
|||
case ExifDataType.Ascii: |
|||
case ExifDataType.Byte: |
|||
case ExifDataType.SignedByte: |
|||
case ExifDataType.Undefined: |
|||
return 1; |
|||
case ExifDataType.Short: |
|||
case ExifDataType.SignedShort: |
|||
return 2; |
|||
case ExifDataType.Long: |
|||
case ExifDataType.SignedLong: |
|||
case ExifDataType.SingleFloat: |
|||
return 4; |
|||
case ExifDataType.DoubleFloat: |
|||
case ExifDataType.Rational: |
|||
case ExifDataType.SignedRational: |
|||
return 8; |
|||
default: |
|||
throw new NotSupportedException(dataType.ToString()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,281 +1,275 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using static SixLabors.ImageSharp.Metadata.Profiles.Exif.ExifTag; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal static class ExifTags |
|||
{ |
|||
/// <summary>
|
|||
/// The collection if Image File Directory tags
|
|||
/// </summary>
|
|||
public static readonly ExifTag[] Ifd = |
|||
public static ExifParts GetPart(ExifTag tag) |
|||
{ |
|||
SubfileType, |
|||
OldSubfileType, |
|||
ImageWidth, |
|||
ImageLength, |
|||
BitsPerSample, |
|||
Compression, |
|||
PhotometricInterpretation, |
|||
Thresholding, |
|||
CellWidth, |
|||
CellLength, |
|||
FillOrder, |
|||
DocumentName, |
|||
ImageDescription, |
|||
Make, |
|||
Model, |
|||
StripOffsets, |
|||
Orientation, |
|||
SamplesPerPixel, |
|||
RowsPerStrip, |
|||
StripByteCounts, |
|||
MinSampleValue, |
|||
MaxSampleValue, |
|||
XResolution, |
|||
YResolution, |
|||
PlanarConfiguration, |
|||
PageName, |
|||
XPosition, |
|||
YPosition, |
|||
FreeOffsets, |
|||
FreeByteCounts, |
|||
GrayResponseUnit, |
|||
GrayResponseCurve, |
|||
T4Options, |
|||
T6Options, |
|||
ResolutionUnit, |
|||
PageNumber, |
|||
ColorResponseUnit, |
|||
TransferFunction, |
|||
Software, |
|||
DateTime, |
|||
Artist, |
|||
HostComputer, |
|||
Predictor, |
|||
WhitePoint, |
|||
PrimaryChromaticities, |
|||
ColorMap, |
|||
HalftoneHints, |
|||
TileWidth, |
|||
TileLength, |
|||
TileOffsets, |
|||
TileByteCounts, |
|||
BadFaxLines, |
|||
CleanFaxData, |
|||
ConsecutiveBadFaxLines, |
|||
InkSet, |
|||
InkNames, |
|||
NumberOfInks, |
|||
DotRange, |
|||
TargetPrinter, |
|||
ExtraSamples, |
|||
SampleFormat, |
|||
SMinSampleValue, |
|||
SMaxSampleValue, |
|||
TransferRange, |
|||
ClipPath, |
|||
XClipPathUnits, |
|||
YClipPathUnits, |
|||
Indexed, |
|||
JPEGTables, |
|||
OPIProxy, |
|||
ProfileType, |
|||
FaxProfile, |
|||
CodingMethods, |
|||
VersionYear, |
|||
ModeNumber, |
|||
Decode, |
|||
DefaultImageColor, |
|||
T82ptions, |
|||
JPEGProc, |
|||
JPEGInterchangeFormat, |
|||
JPEGInterchangeFormatLength, |
|||
JPEGRestartInterval, |
|||
JPEGLosslessPredictors, |
|||
JPEGPointTransforms, |
|||
JPEGQTables, |
|||
JPEGDCTables, |
|||
JPEGACTables, |
|||
YCbCrCoefficients, |
|||
YCbCrSubsampling, |
|||
YCbCrSubsampling, |
|||
YCbCrPositioning, |
|||
ReferenceBlackWhite, |
|||
StripRowCounts, |
|||
XMP, |
|||
Rating, |
|||
RatingPercent, |
|||
ImageID, |
|||
CFARepeatPatternDim, |
|||
CFAPattern2, |
|||
BatteryLevel, |
|||
Copyright, |
|||
MDFileTag, |
|||
MDScalePixel, |
|||
MDLabName, |
|||
MDSampleInfo, |
|||
MDPrepDate, |
|||
MDPrepTime, |
|||
MDFileUnits, |
|||
PixelScale, |
|||
IntergraphPacketData, |
|||
IntergraphRegisters, |
|||
IntergraphMatrix, |
|||
ModelTiePoint, |
|||
SEMInfo, |
|||
ModelTransform, |
|||
ImageLayer, |
|||
FaxRecvParams, |
|||
FaxSubaddress, |
|||
FaxRecvTime, |
|||
ImageSourceData, |
|||
XPTitle, |
|||
XPComment, |
|||
XPAuthor, |
|||
XPKeywords, |
|||
XPSubject, |
|||
GDALMetadata, |
|||
GDALNoData |
|||
}; |
|||
switch ((ExifTagValue)(ushort)tag) |
|||
{ |
|||
case ExifTagValue.SubfileType: |
|||
case ExifTagValue.OldSubfileType: |
|||
case ExifTagValue.ImageWidth: |
|||
case ExifTagValue.ImageLength: |
|||
case ExifTagValue.BitsPerSample: |
|||
case ExifTagValue.Compression: |
|||
case ExifTagValue.PhotometricInterpretation: |
|||
case ExifTagValue.Thresholding: |
|||
case ExifTagValue.CellWidth: |
|||
case ExifTagValue.CellLength: |
|||
case ExifTagValue.FillOrder: |
|||
case ExifTagValue.DocumentName: |
|||
case ExifTagValue.ImageDescription: |
|||
case ExifTagValue.Make: |
|||
case ExifTagValue.Model: |
|||
case ExifTagValue.StripOffsets: |
|||
case ExifTagValue.Orientation: |
|||
case ExifTagValue.SamplesPerPixel: |
|||
case ExifTagValue.RowsPerStrip: |
|||
case ExifTagValue.StripByteCounts: |
|||
case ExifTagValue.MinSampleValue: |
|||
case ExifTagValue.MaxSampleValue: |
|||
case ExifTagValue.XResolution: |
|||
case ExifTagValue.YResolution: |
|||
case ExifTagValue.PlanarConfiguration: |
|||
case ExifTagValue.PageName: |
|||
case ExifTagValue.XPosition: |
|||
case ExifTagValue.YPosition: |
|||
case ExifTagValue.FreeOffsets: |
|||
case ExifTagValue.FreeByteCounts: |
|||
case ExifTagValue.GrayResponseUnit: |
|||
case ExifTagValue.GrayResponseCurve: |
|||
case ExifTagValue.T4Options: |
|||
case ExifTagValue.T6Options: |
|||
case ExifTagValue.ResolutionUnit: |
|||
case ExifTagValue.PageNumber: |
|||
case ExifTagValue.ColorResponseUnit: |
|||
case ExifTagValue.TransferFunction: |
|||
case ExifTagValue.Software: |
|||
case ExifTagValue.DateTime: |
|||
case ExifTagValue.Artist: |
|||
case ExifTagValue.HostComputer: |
|||
case ExifTagValue.Predictor: |
|||
case ExifTagValue.WhitePoint: |
|||
case ExifTagValue.PrimaryChromaticities: |
|||
case ExifTagValue.ColorMap: |
|||
case ExifTagValue.HalftoneHints: |
|||
case ExifTagValue.TileWidth: |
|||
case ExifTagValue.TileLength: |
|||
case ExifTagValue.TileOffsets: |
|||
case ExifTagValue.TileByteCounts: |
|||
case ExifTagValue.BadFaxLines: |
|||
case ExifTagValue.CleanFaxData: |
|||
case ExifTagValue.ConsecutiveBadFaxLines: |
|||
case ExifTagValue.InkSet: |
|||
case ExifTagValue.InkNames: |
|||
case ExifTagValue.NumberOfInks: |
|||
case ExifTagValue.DotRange: |
|||
case ExifTagValue.TargetPrinter: |
|||
case ExifTagValue.ExtraSamples: |
|||
case ExifTagValue.SampleFormat: |
|||
case ExifTagValue.SMinSampleValue: |
|||
case ExifTagValue.SMaxSampleValue: |
|||
case ExifTagValue.TransferRange: |
|||
case ExifTagValue.ClipPath: |
|||
case ExifTagValue.XClipPathUnits: |
|||
case ExifTagValue.YClipPathUnits: |
|||
case ExifTagValue.Indexed: |
|||
case ExifTagValue.JPEGTables: |
|||
case ExifTagValue.OPIProxy: |
|||
case ExifTagValue.ProfileType: |
|||
case ExifTagValue.FaxProfile: |
|||
case ExifTagValue.CodingMethods: |
|||
case ExifTagValue.VersionYear: |
|||
case ExifTagValue.ModeNumber: |
|||
case ExifTagValue.Decode: |
|||
case ExifTagValue.DefaultImageColor: |
|||
case ExifTagValue.T82ptions: |
|||
case ExifTagValue.JPEGProc: |
|||
case ExifTagValue.JPEGInterchangeFormat: |
|||
case ExifTagValue.JPEGInterchangeFormatLength: |
|||
case ExifTagValue.JPEGRestartInterval: |
|||
case ExifTagValue.JPEGLosslessPredictors: |
|||
case ExifTagValue.JPEGPointTransforms: |
|||
case ExifTagValue.JPEGQTables: |
|||
case ExifTagValue.JPEGDCTables: |
|||
case ExifTagValue.JPEGACTables: |
|||
case ExifTagValue.YCbCrCoefficients: |
|||
case ExifTagValue.YCbCrPositioning: |
|||
case ExifTagValue.YCbCrSubsampling: |
|||
case ExifTagValue.ReferenceBlackWhite: |
|||
case ExifTagValue.StripRowCounts: |
|||
case ExifTagValue.XMP: |
|||
case ExifTagValue.Rating: |
|||
case ExifTagValue.RatingPercent: |
|||
case ExifTagValue.ImageID: |
|||
case ExifTagValue.CFARepeatPatternDim: |
|||
case ExifTagValue.CFAPattern2: |
|||
case ExifTagValue.BatteryLevel: |
|||
case ExifTagValue.Copyright: |
|||
case ExifTagValue.MDFileTag: |
|||
case ExifTagValue.MDScalePixel: |
|||
case ExifTagValue.MDLabName: |
|||
case ExifTagValue.MDSampleInfo: |
|||
case ExifTagValue.MDPrepDate: |
|||
case ExifTagValue.MDPrepTime: |
|||
case ExifTagValue.MDFileUnits: |
|||
case ExifTagValue.PixelScale: |
|||
case ExifTagValue.IntergraphPacketData: |
|||
case ExifTagValue.IntergraphRegisters: |
|||
case ExifTagValue.IntergraphMatrix: |
|||
case ExifTagValue.ModelTiePoint: |
|||
case ExifTagValue.SEMInfo: |
|||
case ExifTagValue.ModelTransform: |
|||
case ExifTagValue.ImageLayer: |
|||
case ExifTagValue.FaxRecvParams: |
|||
case ExifTagValue.FaxSubaddress: |
|||
case ExifTagValue.FaxRecvTime: |
|||
case ExifTagValue.ImageSourceData: |
|||
case ExifTagValue.XPTitle: |
|||
case ExifTagValue.XPComment: |
|||
case ExifTagValue.XPAuthor: |
|||
case ExifTagValue.XPKeywords: |
|||
case ExifTagValue.XPSubject: |
|||
case ExifTagValue.GDALMetadata: |
|||
case ExifTagValue.GDALNoData: |
|||
return ExifParts.IfdTags; |
|||
|
|||
/// <summary>
|
|||
/// The collection of Exif tags
|
|||
/// </summary>
|
|||
public static readonly ExifTag[] Exif = |
|||
{ |
|||
ExposureTime, |
|||
FNumber, |
|||
ExposureProgram, |
|||
SpectralSensitivity, |
|||
ISOSpeedRatings, |
|||
OECF, |
|||
Interlace, |
|||
TimeZoneOffset, |
|||
SelfTimerMode, |
|||
SensitivityType, |
|||
StandardOutputSensitivity, |
|||
RecommendedExposureIndex, |
|||
ISOSpeed, |
|||
ISOSpeedLatitudeyyy, |
|||
ISOSpeedLatitudezzz, |
|||
ExifVersion, |
|||
DateTimeOriginal, |
|||
DateTimeDigitized, |
|||
OffsetTime, |
|||
OffsetTimeOriginal, |
|||
OffsetTimeDigitized, |
|||
ComponentsConfiguration, |
|||
CompressedBitsPerPixel, |
|||
ShutterSpeedValue, |
|||
ApertureValue, |
|||
BrightnessValue, |
|||
ExposureBiasValue, |
|||
MaxApertureValue, |
|||
SubjectDistance, |
|||
MeteringMode, |
|||
LightSource, |
|||
Flash, |
|||
FocalLength, |
|||
FlashEnergy2, |
|||
SpatialFrequencyResponse2, |
|||
Noise, |
|||
FocalPlaneXResolution2, |
|||
FocalPlaneYResolution2, |
|||
FocalPlaneResolutionUnit2, |
|||
ImageNumber, |
|||
SecurityClassification, |
|||
ImageHistory, |
|||
SubjectArea, |
|||
ExposureIndex2, |
|||
TIFFEPStandardID, |
|||
SensingMethod2, |
|||
MakerNote, |
|||
UserComment, |
|||
SubsecTime, |
|||
SubsecTimeOriginal, |
|||
SubsecTimeDigitized, |
|||
AmbientTemperature, |
|||
Humidity, |
|||
Pressure, |
|||
WaterDepth, |
|||
Acceleration, |
|||
CameraElevationAngle, |
|||
FlashpixVersion, |
|||
ColorSpace, |
|||
PixelXDimension, |
|||
PixelYDimension, |
|||
RelatedSoundFile, |
|||
FlashEnergy, |
|||
SpatialFrequencyResponse, |
|||
FocalPlaneXResolution, |
|||
FocalPlaneYResolution, |
|||
FocalPlaneResolutionUnit, |
|||
SubjectLocation, |
|||
ExposureIndex, |
|||
SensingMethod, |
|||
FileSource, |
|||
SceneType, |
|||
CFAPattern, |
|||
CustomRendered, |
|||
ExposureMode, |
|||
WhiteBalance, |
|||
DigitalZoomRatio, |
|||
FocalLengthIn35mmFilm, |
|||
SceneCaptureType, |
|||
GainControl, |
|||
Contrast, |
|||
Saturation, |
|||
Sharpness, |
|||
DeviceSettingDescription, |
|||
SubjectDistanceRange, |
|||
ImageUniqueID, |
|||
OwnerName, |
|||
SerialNumber, |
|||
LensInfo, |
|||
LensMake, |
|||
LensModel, |
|||
LensSerialNumber |
|||
}; |
|||
case ExifTagValue.ExposureTime: |
|||
case ExifTagValue.FNumber: |
|||
case ExifTagValue.ExposureProgram: |
|||
case ExifTagValue.SpectralSensitivity: |
|||
case ExifTagValue.ISOSpeedRatings: |
|||
case ExifTagValue.OECF: |
|||
case ExifTagValue.Interlace: |
|||
case ExifTagValue.TimeZoneOffset: |
|||
case ExifTagValue.SelfTimerMode: |
|||
case ExifTagValue.SensitivityType: |
|||
case ExifTagValue.StandardOutputSensitivity: |
|||
case ExifTagValue.RecommendedExposureIndex: |
|||
case ExifTagValue.ISOSpeed: |
|||
case ExifTagValue.ISOSpeedLatitudeyyy: |
|||
case ExifTagValue.ISOSpeedLatitudezzz: |
|||
case ExifTagValue.ExifVersion: |
|||
case ExifTagValue.DateTimeOriginal: |
|||
case ExifTagValue.DateTimeDigitized: |
|||
case ExifTagValue.OffsetTime: |
|||
case ExifTagValue.OffsetTimeOriginal: |
|||
case ExifTagValue.OffsetTimeDigitized: |
|||
case ExifTagValue.ComponentsConfiguration: |
|||
case ExifTagValue.CompressedBitsPerPixel: |
|||
case ExifTagValue.ShutterSpeedValue: |
|||
case ExifTagValue.ApertureValue: |
|||
case ExifTagValue.BrightnessValue: |
|||
case ExifTagValue.ExposureBiasValue: |
|||
case ExifTagValue.MaxApertureValue: |
|||
case ExifTagValue.SubjectDistance: |
|||
case ExifTagValue.MeteringMode: |
|||
case ExifTagValue.LightSource: |
|||
case ExifTagValue.Flash: |
|||
case ExifTagValue.FocalLength: |
|||
case ExifTagValue.FlashEnergy2: |
|||
case ExifTagValue.SpatialFrequencyResponse2: |
|||
case ExifTagValue.Noise: |
|||
case ExifTagValue.FocalPlaneXResolution2: |
|||
case ExifTagValue.FocalPlaneYResolution2: |
|||
case ExifTagValue.FocalPlaneResolutionUnit2: |
|||
case ExifTagValue.ImageNumber: |
|||
case ExifTagValue.SecurityClassification: |
|||
case ExifTagValue.ImageHistory: |
|||
case ExifTagValue.SubjectArea: |
|||
case ExifTagValue.ExposureIndex2: |
|||
case ExifTagValue.TIFFEPStandardID: |
|||
case ExifTagValue.SensingMethod2: |
|||
case ExifTagValue.MakerNote: |
|||
case ExifTagValue.UserComment: |
|||
case ExifTagValue.SubsecTime: |
|||
case ExifTagValue.SubsecTimeOriginal: |
|||
case ExifTagValue.SubsecTimeDigitized: |
|||
case ExifTagValue.AmbientTemperature: |
|||
case ExifTagValue.Humidity: |
|||
case ExifTagValue.Pressure: |
|||
case ExifTagValue.WaterDepth: |
|||
case ExifTagValue.Acceleration: |
|||
case ExifTagValue.CameraElevationAngle: |
|||
case ExifTagValue.FlashpixVersion: |
|||
case ExifTagValue.ColorSpace: |
|||
case ExifTagValue.PixelXDimension: |
|||
case ExifTagValue.PixelYDimension: |
|||
case ExifTagValue.RelatedSoundFile: |
|||
case ExifTagValue.FlashEnergy: |
|||
case ExifTagValue.SpatialFrequencyResponse: |
|||
case ExifTagValue.FocalPlaneXResolution: |
|||
case ExifTagValue.FocalPlaneYResolution: |
|||
case ExifTagValue.FocalPlaneResolutionUnit: |
|||
case ExifTagValue.SubjectLocation: |
|||
case ExifTagValue.ExposureIndex: |
|||
case ExifTagValue.SensingMethod: |
|||
case ExifTagValue.FileSource: |
|||
case ExifTagValue.SceneType: |
|||
case ExifTagValue.CFAPattern: |
|||
case ExifTagValue.CustomRendered: |
|||
case ExifTagValue.ExposureMode: |
|||
case ExifTagValue.WhiteBalance: |
|||
case ExifTagValue.DigitalZoomRatio: |
|||
case ExifTagValue.FocalLengthIn35mmFilm: |
|||
case ExifTagValue.SceneCaptureType: |
|||
case ExifTagValue.GainControl: |
|||
case ExifTagValue.Contrast: |
|||
case ExifTagValue.Saturation: |
|||
case ExifTagValue.Sharpness: |
|||
case ExifTagValue.DeviceSettingDescription: |
|||
case ExifTagValue.SubjectDistanceRange: |
|||
case ExifTagValue.ImageUniqueID: |
|||
case ExifTagValue.OwnerName: |
|||
case ExifTagValue.SerialNumber: |
|||
case ExifTagValue.LensInfo: |
|||
case ExifTagValue.LensMake: |
|||
case ExifTagValue.LensModel: |
|||
case ExifTagValue.LensSerialNumber: |
|||
return ExifParts.ExifTags; |
|||
|
|||
/// <summary>
|
|||
/// The collection of GPS tags
|
|||
/// </summary>
|
|||
public static readonly ExifTag[] Gps = |
|||
{ |
|||
GPSVersionID, |
|||
GPSLatitudeRef, |
|||
GPSLatitude, |
|||
GPSLongitudeRef, |
|||
GPSLongitude, |
|||
GPSAltitudeRef, |
|||
GPSAltitude, |
|||
GPSTimestamp, |
|||
GPSSatellites, |
|||
GPSStatus, |
|||
GPSMeasureMode, |
|||
GPSDOP, |
|||
GPSSpeedRef, |
|||
GPSSpeed, |
|||
GPSTrackRef, |
|||
GPSTrack, |
|||
GPSImgDirectionRef, |
|||
GPSImgDirection, |
|||
GPSMapDatum, |
|||
GPSDestLatitudeRef, |
|||
GPSDestLatitude, |
|||
GPSDestLongitudeRef, |
|||
GPSDestLongitude, |
|||
GPSDestBearingRef, |
|||
GPSDestBearing, |
|||
GPSDestDistanceRef, |
|||
GPSDestDistance, |
|||
GPSProcessingMethod, |
|||
GPSAreaInformation, |
|||
GPSDateStamp, |
|||
GPSDifferential |
|||
}; |
|||
case ExifTagValue.GPSVersionID: |
|||
case ExifTagValue.GPSLatitudeRef: |
|||
case ExifTagValue.GPSLatitude: |
|||
case ExifTagValue.GPSLongitudeRef: |
|||
case ExifTagValue.GPSLongitude: |
|||
case ExifTagValue.GPSAltitudeRef: |
|||
case ExifTagValue.GPSAltitude: |
|||
case ExifTagValue.GPSTimestamp: |
|||
case ExifTagValue.GPSSatellites: |
|||
case ExifTagValue.GPSStatus: |
|||
case ExifTagValue.GPSMeasureMode: |
|||
case ExifTagValue.GPSDOP: |
|||
case ExifTagValue.GPSSpeedRef: |
|||
case ExifTagValue.GPSSpeed: |
|||
case ExifTagValue.GPSTrackRef: |
|||
case ExifTagValue.GPSTrack: |
|||
case ExifTagValue.GPSImgDirectionRef: |
|||
case ExifTagValue.GPSImgDirection: |
|||
case ExifTagValue.GPSMapDatum: |
|||
case ExifTagValue.GPSDestLatitudeRef: |
|||
case ExifTagValue.GPSDestLatitude: |
|||
case ExifTagValue.GPSDestLongitudeRef: |
|||
case ExifTagValue.GPSDestLongitude: |
|||
case ExifTagValue.GPSDestBearingRef: |
|||
case ExifTagValue.GPSDestBearing: |
|||
case ExifTagValue.GPSDestDistanceRef: |
|||
case ExifTagValue.GPSDestDistance: |
|||
case ExifTagValue.GPSProcessingMethod: |
|||
case ExifTagValue.GPSAreaInformation: |
|||
case ExifTagValue.GPSDateStamp: |
|||
case ExifTagValue.GPSDifferential: |
|||
return ExifParts.GpsTags; |
|||
|
|||
case ExifTagValue.Unknown: |
|||
case ExifTagValue.SubIFDOffset: |
|||
case ExifTagValue.GPSIFDOffset: |
|||
default: |
|||
return ExifParts.None; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,721 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Globalization; |
|||
using System.Text; |
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <summary>
|
|||
/// Represent the value of the EXIF profile.
|
|||
/// </summary>
|
|||
public sealed class ExifValue : IEquatable<ExifValue>, IDeepCloneable<ExifValue> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ExifValue"/> class.
|
|||
/// </summary>
|
|||
/// <param name="tag">The tag.</param>
|
|||
/// <param name="dataType">The data type.</param>
|
|||
/// <param name="value">The value.</param>
|
|||
/// <param name="isArray">Whether the value is an array.</param>
|
|||
internal ExifValue(ExifTag tag, ExifDataType dataType, object value, bool isArray) |
|||
{ |
|||
this.Tag = tag; |
|||
this.DataType = dataType; |
|||
this.IsArray = isArray && dataType != ExifDataType.Ascii; |
|||
this.Value = value; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ExifValue"/> class
|
|||
/// by making a copy from another exif value.
|
|||
/// </summary>
|
|||
/// <param name="other">The other exif value, where the clone should be made from.</param>
|
|||
/// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
|
|||
private ExifValue(ExifValue other) |
|||
{ |
|||
Guard.NotNull(other, nameof(other)); |
|||
|
|||
this.DataType = other.DataType; |
|||
this.IsArray = other.IsArray; |
|||
this.Tag = other.Tag; |
|||
|
|||
if (!other.IsArray) |
|||
{ |
|||
// All types are value types except for string which is immutable so safe to simply assign.
|
|||
this.Value = other.Value; |
|||
} |
|||
else |
|||
{ |
|||
// All array types are value types so Clone() is sufficient here.
|
|||
var array = (Array)other.Value; |
|||
this.Value = array.Clone(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the data type of the exif value.
|
|||
/// </summary>
|
|||
public ExifDataType DataType { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether the value is an array.
|
|||
/// </summary>
|
|||
public bool IsArray { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the tag of the exif value.
|
|||
/// </summary>
|
|||
public ExifTag Tag { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the value.
|
|||
/// </summary>
|
|||
public object Value { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether the EXIF value has a value.
|
|||
/// </summary>
|
|||
internal bool HasValue |
|||
{ |
|||
get |
|||
{ |
|||
if (this.Value is null) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (this.DataType == ExifDataType.Ascii) |
|||
{ |
|||
return ((string)this.Value).Length > 0; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the length of the EXIF value
|
|||
/// </summary>
|
|||
internal int Length |
|||
{ |
|||
get |
|||
{ |
|||
if (this.Value is null) |
|||
{ |
|||
return 4; |
|||
} |
|||
|
|||
int size = (int)(GetSize(this.DataType) * this.NumberOfComponents); |
|||
|
|||
return size < 4 ? 4 : size; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the number of components.
|
|||
/// </summary>
|
|||
internal int NumberOfComponents |
|||
{ |
|||
get |
|||
{ |
|||
if (this.DataType == ExifDataType.Ascii) |
|||
{ |
|||
return Encoding.UTF8.GetBytes((string)this.Value).Length; |
|||
} |
|||
|
|||
if (this.IsArray) |
|||
{ |
|||
return ((Array)this.Value).Length; |
|||
} |
|||
|
|||
return 1; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Compares two <see cref="ExifValue"/> objects for equality.
|
|||
/// </summary>
|
|||
/// <param name="left">
|
|||
/// The <see cref="ExifValue"/> on the left side of the operand.
|
|||
/// </param>
|
|||
/// <param name="right">
|
|||
/// The <see cref="ExifValue"/> on the right side of the operand.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// True if the <paramref name="left"/> parameter is equal to the <paramref name="right"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
public static bool operator ==(ExifValue left, ExifValue right) => ReferenceEquals(left, right) || left.Equals(right); |
|||
|
|||
/// <summary>
|
|||
/// Compares two <see cref="ExifValue"/> objects for equality.
|
|||
/// </summary>
|
|||
/// <param name="left">
|
|||
/// The <see cref="ExifValue"/> on the left side of the operand.
|
|||
/// </param>
|
|||
/// <param name="right">
|
|||
/// The <see cref="ExifValue"/> on the right side of the operand.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// True if the <paramref name="left"/> parameter is not equal to the <paramref name="right"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
public static bool operator !=(ExifValue left, ExifValue right) => !(left == right); |
|||
|
|||
/// <inheritdoc />
|
|||
public override bool Equals(object obj) => obj is ExifValue other && this.Equals(other); |
|||
|
|||
/// <inheritdoc />
|
|||
public bool Equals(ExifValue other) |
|||
{ |
|||
if (other is null) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, other)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
return |
|||
this.Tag == other.Tag |
|||
&& this.DataType == other.DataType |
|||
&& object.Equals(this.Value, other.Value); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Clones the current value, overwriting the value.
|
|||
/// </summary>
|
|||
/// <param name="value">The value to overwrite.</param>
|
|||
/// <returns><see cref="ExifValue"/></returns>
|
|||
public ExifValue WithValue(object value) |
|||
{ |
|||
this.CheckValue(value); |
|||
|
|||
return new ExifValue(this.Tag, this.DataType, value, this.IsArray); |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override int GetHashCode() |
|||
{ |
|||
return HashCode.Combine(this.Tag, this.DataType, this.Value); |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override string ToString() |
|||
{ |
|||
if (this.Value is null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
if (this.DataType == ExifDataType.Ascii) |
|||
{ |
|||
return (string)this.Value; |
|||
} |
|||
|
|||
if (!this.IsArray) |
|||
{ |
|||
return this.ToString(this.Value); |
|||
} |
|||
|
|||
var sb = new StringBuilder(); |
|||
foreach (object value in (Array)this.Value) |
|||
{ |
|||
sb.Append(this.ToString(value)); |
|||
sb.Append(' '); |
|||
} |
|||
|
|||
return sb.ToString(); |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public ExifValue DeepClone() => new ExifValue(this); |
|||
|
|||
/// <summary>
|
|||
/// Creates a new <see cref="ExifValue"/>
|
|||
/// </summary>
|
|||
/// <param name="tag">The tag.</param>
|
|||
/// <param name="value">The value.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="ExifValue"/>.
|
|||
/// </returns>
|
|||
/// <exception cref="NotSupportedException">
|
|||
/// Thrown if the tag is not supported.
|
|||
/// </exception>
|
|||
internal static ExifValue Create(ExifTag tag, object value) |
|||
{ |
|||
Guard.IsFalse(tag == ExifTag.Unknown, nameof(tag), "Invalid Tag"); |
|||
|
|||
switch (tag) |
|||
{ |
|||
case ExifTag.ImageDescription: |
|||
case ExifTag.Make: |
|||
case ExifTag.Model: |
|||
case ExifTag.Software: |
|||
case ExifTag.DateTime: |
|||
case ExifTag.Artist: |
|||
case ExifTag.HostComputer: |
|||
case ExifTag.Copyright: |
|||
case ExifTag.DocumentName: |
|||
case ExifTag.PageName: |
|||
case ExifTag.InkNames: |
|||
case ExifTag.TargetPrinter: |
|||
case ExifTag.ImageID: |
|||
case ExifTag.MDLabName: |
|||
case ExifTag.MDSampleInfo: |
|||
case ExifTag.MDPrepDate: |
|||
case ExifTag.MDPrepTime: |
|||
case ExifTag.MDFileUnits: |
|||
case ExifTag.SEMInfo: |
|||
case ExifTag.SpectralSensitivity: |
|||
case ExifTag.DateTimeOriginal: |
|||
case ExifTag.DateTimeDigitized: |
|||
case ExifTag.SubsecTime: |
|||
case ExifTag.SubsecTimeOriginal: |
|||
case ExifTag.SubsecTimeDigitized: |
|||
case ExifTag.FaxSubaddress: |
|||
case ExifTag.OffsetTime: |
|||
case ExifTag.OffsetTimeOriginal: |
|||
case ExifTag.OffsetTimeDigitized: |
|||
case ExifTag.SecurityClassification: |
|||
case ExifTag.ImageHistory: |
|||
case ExifTag.ImageUniqueID: |
|||
case ExifTag.OwnerName: |
|||
case ExifTag.SerialNumber: |
|||
case ExifTag.LensMake: |
|||
case ExifTag.LensModel: |
|||
case ExifTag.LensSerialNumber: |
|||
case ExifTag.GDALMetadata: |
|||
case ExifTag.GDALNoData: |
|||
case ExifTag.GPSLatitudeRef: |
|||
case ExifTag.GPSLongitudeRef: |
|||
case ExifTag.GPSSatellites: |
|||
case ExifTag.GPSStatus: |
|||
case ExifTag.GPSMeasureMode: |
|||
case ExifTag.GPSSpeedRef: |
|||
case ExifTag.GPSTrackRef: |
|||
case ExifTag.GPSImgDirectionRef: |
|||
case ExifTag.GPSMapDatum: |
|||
case ExifTag.GPSDestLatitudeRef: |
|||
case ExifTag.GPSDestLongitudeRef: |
|||
case ExifTag.GPSDestBearingRef: |
|||
case ExifTag.GPSDestDistanceRef: |
|||
case ExifTag.GPSDateStamp: |
|||
return new ExifValue(tag, ExifDataType.Ascii, value, true); |
|||
|
|||
case ExifTag.ClipPath: |
|||
case ExifTag.VersionYear: |
|||
case ExifTag.XMP: |
|||
case ExifTag.CFAPattern2: |
|||
case ExifTag.TIFFEPStandardID: |
|||
case ExifTag.XPTitle: |
|||
case ExifTag.XPComment: |
|||
case ExifTag.XPAuthor: |
|||
case ExifTag.XPKeywords: |
|||
case ExifTag.XPSubject: |
|||
case ExifTag.GPSVersionID: |
|||
return new ExifValue(tag, ExifDataType.Byte, value, true); |
|||
|
|||
case ExifTag.FaxProfile: |
|||
case ExifTag.ModeNumber: |
|||
case ExifTag.GPSAltitudeRef: |
|||
return new ExifValue(tag, ExifDataType.Byte, value, false); |
|||
|
|||
case ExifTag.FreeOffsets: |
|||
case ExifTag.FreeByteCounts: |
|||
case ExifTag.ColorResponseUnit: |
|||
case ExifTag.TileOffsets: |
|||
case ExifTag.SMinSampleValue: |
|||
case ExifTag.SMaxSampleValue: |
|||
case ExifTag.JPEGQTables: |
|||
case ExifTag.JPEGDCTables: |
|||
case ExifTag.JPEGACTables: |
|||
case ExifTag.StripRowCounts: |
|||
case ExifTag.IntergraphRegisters: |
|||
case ExifTag.TimeZoneOffset: |
|||
return new ExifValue(tag, ExifDataType.Long, value, true); |
|||
case ExifTag.SubfileType: |
|||
case ExifTag.SubIFDOffset: |
|||
case ExifTag.GPSIFDOffset: |
|||
case ExifTag.T4Options: |
|||
case ExifTag.T6Options: |
|||
case ExifTag.XClipPathUnits: |
|||
case ExifTag.YClipPathUnits: |
|||
case ExifTag.ProfileType: |
|||
case ExifTag.CodingMethods: |
|||
case ExifTag.T82ptions: |
|||
case ExifTag.JPEGInterchangeFormat: |
|||
case ExifTag.JPEGInterchangeFormatLength: |
|||
case ExifTag.MDFileTag: |
|||
case ExifTag.StandardOutputSensitivity: |
|||
case ExifTag.RecommendedExposureIndex: |
|||
case ExifTag.ISOSpeed: |
|||
case ExifTag.ISOSpeedLatitudeyyy: |
|||
case ExifTag.ISOSpeedLatitudezzz: |
|||
case ExifTag.FaxRecvParams: |
|||
case ExifTag.FaxRecvTime: |
|||
case ExifTag.ImageNumber: |
|||
return new ExifValue(tag, ExifDataType.Long, value, false); |
|||
|
|||
case ExifTag.WhitePoint: |
|||
case ExifTag.PrimaryChromaticities: |
|||
case ExifTag.YCbCrCoefficients: |
|||
case ExifTag.ReferenceBlackWhite: |
|||
case ExifTag.PixelScale: |
|||
case ExifTag.IntergraphMatrix: |
|||
case ExifTag.ModelTiePoint: |
|||
case ExifTag.ModelTransform: |
|||
case ExifTag.GPSLatitude: |
|||
case ExifTag.GPSLongitude: |
|||
case ExifTag.GPSTimestamp: |
|||
case ExifTag.GPSDestLatitude: |
|||
case ExifTag.GPSDestLongitude: |
|||
return new ExifValue(tag, ExifDataType.Rational, value, true); |
|||
|
|||
case ExifTag.XPosition: |
|||
case ExifTag.YPosition: |
|||
case ExifTag.XResolution: |
|||
case ExifTag.YResolution: |
|||
case ExifTag.BatteryLevel: |
|||
case ExifTag.ExposureTime: |
|||
case ExifTag.FNumber: |
|||
case ExifTag.MDScalePixel: |
|||
case ExifTag.CompressedBitsPerPixel: |
|||
case ExifTag.ApertureValue: |
|||
case ExifTag.MaxApertureValue: |
|||
case ExifTag.SubjectDistance: |
|||
case ExifTag.FocalLength: |
|||
case ExifTag.FlashEnergy2: |
|||
case ExifTag.FocalPlaneXResolution2: |
|||
case ExifTag.FocalPlaneYResolution2: |
|||
case ExifTag.ExposureIndex2: |
|||
case ExifTag.Humidity: |
|||
case ExifTag.Pressure: |
|||
case ExifTag.Acceleration: |
|||
case ExifTag.FlashEnergy: |
|||
case ExifTag.FocalPlaneXResolution: |
|||
case ExifTag.FocalPlaneYResolution: |
|||
case ExifTag.ExposureIndex: |
|||
case ExifTag.DigitalZoomRatio: |
|||
case ExifTag.LensInfo: |
|||
case ExifTag.GPSAltitude: |
|||
case ExifTag.GPSDOP: |
|||
case ExifTag.GPSSpeed: |
|||
case ExifTag.GPSTrack: |
|||
case ExifTag.GPSImgDirection: |
|||
case ExifTag.GPSDestBearing: |
|||
case ExifTag.GPSDestDistance: |
|||
return new ExifValue(tag, ExifDataType.Rational, value, false); |
|||
|
|||
case ExifTag.BitsPerSample: |
|||
case ExifTag.MinSampleValue: |
|||
case ExifTag.MaxSampleValue: |
|||
case ExifTag.GrayResponseCurve: |
|||
case ExifTag.ColorMap: |
|||
case ExifTag.ExtraSamples: |
|||
case ExifTag.PageNumber: |
|||
case ExifTag.TransferFunction: |
|||
case ExifTag.Predictor: |
|||
case ExifTag.HalftoneHints: |
|||
case ExifTag.SampleFormat: |
|||
case ExifTag.TransferRange: |
|||
case ExifTag.DefaultImageColor: |
|||
case ExifTag.JPEGLosslessPredictors: |
|||
case ExifTag.JPEGPointTransforms: |
|||
case ExifTag.YCbCrSubsampling: |
|||
case ExifTag.CFARepeatPatternDim: |
|||
case ExifTag.IntergraphPacketData: |
|||
case ExifTag.ISOSpeedRatings: |
|||
case ExifTag.SubjectArea: |
|||
case ExifTag.SubjectLocation: |
|||
return new ExifValue(tag, ExifDataType.Short, value, true); |
|||
|
|||
case ExifTag.OldSubfileType: |
|||
case ExifTag.Compression: |
|||
case ExifTag.PhotometricInterpretation: |
|||
case ExifTag.Thresholding: |
|||
case ExifTag.CellWidth: |
|||
case ExifTag.CellLength: |
|||
case ExifTag.FillOrder: |
|||
case ExifTag.Orientation: |
|||
case ExifTag.SamplesPerPixel: |
|||
case ExifTag.PlanarConfiguration: |
|||
case ExifTag.GrayResponseUnit: |
|||
case ExifTag.ResolutionUnit: |
|||
case ExifTag.CleanFaxData: |
|||
case ExifTag.InkSet: |
|||
case ExifTag.NumberOfInks: |
|||
case ExifTag.DotRange: |
|||
case ExifTag.Indexed: |
|||
case ExifTag.OPIProxy: |
|||
case ExifTag.JPEGProc: |
|||
case ExifTag.JPEGRestartInterval: |
|||
case ExifTag.YCbCrPositioning: |
|||
case ExifTag.Rating: |
|||
case ExifTag.RatingPercent: |
|||
case ExifTag.ExposureProgram: |
|||
case ExifTag.Interlace: |
|||
case ExifTag.SelfTimerMode: |
|||
case ExifTag.SensitivityType: |
|||
case ExifTag.MeteringMode: |
|||
case ExifTag.LightSource: |
|||
case ExifTag.FocalPlaneResolutionUnit2: |
|||
case ExifTag.SensingMethod2: |
|||
case ExifTag.Flash: |
|||
case ExifTag.ColorSpace: |
|||
case ExifTag.FocalPlaneResolutionUnit: |
|||
case ExifTag.SensingMethod: |
|||
case ExifTag.CustomRendered: |
|||
case ExifTag.ExposureMode: |
|||
case ExifTag.WhiteBalance: |
|||
case ExifTag.FocalLengthIn35mmFilm: |
|||
case ExifTag.SceneCaptureType: |
|||
case ExifTag.GainControl: |
|||
case ExifTag.Contrast: |
|||
case ExifTag.Saturation: |
|||
case ExifTag.Sharpness: |
|||
case ExifTag.SubjectDistanceRange: |
|||
case ExifTag.GPSDifferential: |
|||
return new ExifValue(tag, ExifDataType.Short, value, false); |
|||
|
|||
case ExifTag.Decode: |
|||
return new ExifValue(tag, ExifDataType.SignedRational, value, true); |
|||
|
|||
case ExifTag.ShutterSpeedValue: |
|||
case ExifTag.BrightnessValue: |
|||
case ExifTag.ExposureBiasValue: |
|||
case ExifTag.AmbientTemperature: |
|||
case ExifTag.WaterDepth: |
|||
case ExifTag.CameraElevationAngle: |
|||
return new ExifValue(tag, ExifDataType.SignedRational, value, false); |
|||
|
|||
case ExifTag.JPEGTables: |
|||
case ExifTag.OECF: |
|||
case ExifTag.ExifVersion: |
|||
case ExifTag.ComponentsConfiguration: |
|||
case ExifTag.MakerNote: |
|||
case ExifTag.UserComment: |
|||
case ExifTag.FlashpixVersion: |
|||
case ExifTag.SpatialFrequencyResponse: |
|||
case ExifTag.SpatialFrequencyResponse2: |
|||
case ExifTag.Noise: |
|||
case ExifTag.CFAPattern: |
|||
case ExifTag.DeviceSettingDescription: |
|||
case ExifTag.ImageSourceData: |
|||
case ExifTag.GPSProcessingMethod: |
|||
case ExifTag.GPSAreaInformation: |
|||
return new ExifValue(tag, ExifDataType.Undefined, value, true); |
|||
|
|||
case ExifTag.FileSource: |
|||
case ExifTag.SceneType: |
|||
return new ExifValue(tag, ExifDataType.Undefined, value, false); |
|||
|
|||
case ExifTag.StripOffsets: |
|||
case ExifTag.TileByteCounts: |
|||
case ExifTag.ImageLayer: |
|||
return CreateNumber(tag, value, true); |
|||
|
|||
case ExifTag.ImageWidth: |
|||
case ExifTag.ImageLength: |
|||
case ExifTag.TileWidth: |
|||
case ExifTag.TileLength: |
|||
case ExifTag.BadFaxLines: |
|||
case ExifTag.ConsecutiveBadFaxLines: |
|||
case ExifTag.PixelXDimension: |
|||
case ExifTag.PixelYDimension: |
|||
return CreateNumber(tag, value, false); |
|||
|
|||
default: |
|||
throw new NotSupportedException(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the size in bytes of the given data type.
|
|||
/// </summary>
|
|||
/// <param name="dataType">The data type.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="uint"/>.
|
|||
/// </returns>
|
|||
/// <exception cref="NotSupportedException">
|
|||
/// Thrown if the type is unsupported.
|
|||
/// </exception>
|
|||
internal static uint GetSize(ExifDataType dataType) |
|||
{ |
|||
switch (dataType) |
|||
{ |
|||
case ExifDataType.Ascii: |
|||
case ExifDataType.Byte: |
|||
case ExifDataType.SignedByte: |
|||
case ExifDataType.Undefined: |
|||
return 1; |
|||
case ExifDataType.Short: |
|||
case ExifDataType.SignedShort: |
|||
return 2; |
|||
case ExifDataType.Long: |
|||
case ExifDataType.SignedLong: |
|||
case ExifDataType.SingleFloat: |
|||
return 4; |
|||
case ExifDataType.DoubleFloat: |
|||
case ExifDataType.Rational: |
|||
case ExifDataType.SignedRational: |
|||
return 8; |
|||
default: |
|||
throw new NotSupportedException(dataType.ToString()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns an EXIF value with a numeric type for the given tag.
|
|||
/// </summary>
|
|||
/// <param name="tag">The tag.</param>
|
|||
/// <param name="value">The value.</param>
|
|||
/// <param name="isArray">Whether the value is an array.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="ExifValue"/>.
|
|||
/// </returns>
|
|||
private static ExifValue CreateNumber(ExifTag tag, object value, bool isArray) |
|||
{ |
|||
Type type = value?.GetType(); |
|||
if (type?.IsArray == true) |
|||
{ |
|||
type = type.GetElementType(); |
|||
} |
|||
|
|||
if (type is null || type == typeof(ushort)) |
|||
{ |
|||
return new ExifValue(tag, ExifDataType.Short, value, isArray); |
|||
} |
|||
|
|||
if (type == typeof(short)) |
|||
{ |
|||
return new ExifValue(tag, ExifDataType.SignedShort, value, isArray); |
|||
} |
|||
|
|||
if (type == typeof(uint)) |
|||
{ |
|||
return new ExifValue(tag, ExifDataType.Long, value, isArray); |
|||
} |
|||
|
|||
return new ExifValue(tag, ExifDataType.SignedLong, value, isArray); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Checks the value type of the given object.
|
|||
/// </summary>
|
|||
/// <param name="value">The value to check.</param>
|
|||
/// <exception cref="NotSupportedException">
|
|||
/// Thrown if the object type is not supported.
|
|||
/// </exception>
|
|||
private void CheckValue(object value) |
|||
{ |
|||
if (value is null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
Type type = value.GetType(); |
|||
|
|||
if (this.DataType == ExifDataType.Ascii) |
|||
{ |
|||
Guard.IsTrue(type == typeof(string), nameof(value), "Value should be a string."); |
|||
return; |
|||
} |
|||
|
|||
if (type.IsArray) |
|||
{ |
|||
Guard.IsTrue(this.IsArray, nameof(value), "Value should not be an array."); |
|||
type = type.GetElementType(); |
|||
} |
|||
else |
|||
{ |
|||
Guard.IsFalse(this.IsArray, nameof(value), "Value should not be an array."); |
|||
} |
|||
|
|||
switch (this.DataType) |
|||
{ |
|||
case ExifDataType.Byte: |
|||
Guard.IsTrue(type == typeof(byte), nameof(value), $"Value should be a byte{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.DoubleFloat: |
|||
Guard.IsTrue(type == typeof(double), nameof(value), $"Value should be a double{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.Long: |
|||
Guard.IsTrue(type == typeof(uint), nameof(value), $"Value should be an unsigned int{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.Rational: |
|||
Guard.IsTrue(type == typeof(Rational), nameof(value), $"Value should be a Rational{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.Short: |
|||
Guard.IsTrue(type == typeof(ushort), nameof(value), $"Value should be an unsigned short{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.SignedByte: |
|||
Guard.IsTrue(type == typeof(sbyte), nameof(value), $"Value should be a signed byte{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.SignedLong: |
|||
Guard.IsTrue(type == typeof(int), nameof(value), $"Value should be an int{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.SignedRational: |
|||
Guard.IsTrue(type == typeof(SignedRational), nameof(value), $"Value should be a SignedRational{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.SignedShort: |
|||
Guard.IsTrue(type == typeof(short), nameof(value), $"Value should be a short{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.SingleFloat: |
|||
Guard.IsTrue(type == typeof(float), nameof(value), $"Value should be a float{(this.IsArray ? " array." : ".")}"); |
|||
break; |
|||
case ExifDataType.Undefined: |
|||
Guard.IsTrue(type == typeof(byte), nameof(value), "Value should be a byte array."); |
|||
break; |
|||
default: |
|||
throw new NotSupportedException(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts the object value of this instance to its equivalent string representation
|
|||
/// </summary>
|
|||
/// <param name="value">The value</param>
|
|||
/// <returns>The <see cref="string"/></returns>
|
|||
private string ToString(object value) |
|||
{ |
|||
if (ExifTagDescriptionAttribute.GetDescription(this.Tag, value) is string description) |
|||
{ |
|||
return description; |
|||
} |
|||
|
|||
switch (this.DataType) |
|||
{ |
|||
case ExifDataType.Ascii: |
|||
return (string)value; |
|||
case ExifDataType.Byte: |
|||
return ((byte)value).ToString("X2", CultureInfo.InvariantCulture); |
|||
case ExifDataType.DoubleFloat: |
|||
return ((double)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.Long: |
|||
return ((uint)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.Rational: |
|||
return ((Rational)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.Short: |
|||
return ((ushort)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.SignedByte: |
|||
return ((sbyte)value).ToString("X2", CultureInfo.InvariantCulture); |
|||
case ExifDataType.SignedLong: |
|||
return ((int)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.SignedRational: |
|||
return ((Rational)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.SignedShort: |
|||
return ((short)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.SingleFloat: |
|||
return ((float)value).ToString(CultureInfo.InvariantCulture); |
|||
case ExifDataType.Undefined: |
|||
return ((byte)value).ToString("X2", CultureInfo.InvariantCulture); |
|||
default: |
|||
throw new NotSupportedException(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,3 +1,3 @@ |
|||
Adapted from Magick.NET: |
|||
Adapted from Magick.NET: |
|||
|
|||
https://github.com/dlemstra/Magick.NET/tree/784e23b1f5c824fc03d4b95d3387b3efe1ed510b/Magick.NET/Core/Profiles/Exif |
|||
https://github.com/dlemstra/Magick.NET |
|||
|
|||
@ -0,0 +1,24 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the FaxProfile exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte> FaxProfile { get; } = new ExifTag<byte>(ExifTagValue.FaxProfile); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ModeNumber exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte> ModeNumber { get; } = new ExifTag<byte>(ExifTagValue.ModeNumber); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSAltitudeRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte> GPSAltitudeRef { get; } = new ExifTag<byte>(ExifTagValue.GPSAltitudeRef); |
|||
} |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> ClipPath => new ExifTag<byte[]>(ExifTagValue.ClipPath); |
|||
|
|||
/// <summary>
|
|||
/// Gets the VersionYear exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> VersionYear => new ExifTag<byte[]>(ExifTagValue.VersionYear); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XMP exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> XMP => new ExifTag<byte[]>(ExifTagValue.XMP); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CFAPattern2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> CFAPattern2 => new ExifTag<byte[]>(ExifTagValue.CFAPattern2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TIFFEPStandardID exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> TIFFEPStandardID => new ExifTag<byte[]>(ExifTagValue.TIFFEPStandardID); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XPTitle exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> XPTitle => new ExifTag<byte[]>(ExifTagValue.XPTitle); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XPComment exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> XPComment => new ExifTag<byte[]>(ExifTagValue.XPComment); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XPAuthor exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> XPAuthor => new ExifTag<byte[]>(ExifTagValue.XPAuthor); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XPKeywords exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> XPKeywords => new ExifTag<byte[]>(ExifTagValue.XPKeywords); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XPSubject exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> XPSubject => new ExifTag<byte[]>(ExifTagValue.XPSubject); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSVersionID exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> GPSVersionID => new ExifTag<byte[]>(ExifTagValue.GPSVersionID); |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the PixelScale exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<double[]> PixelScale { get; } = new ExifTag<double[]>(ExifTagValue.PixelScale); |
|||
|
|||
/// <summary>
|
|||
/// Gets the IntergraphMatrix exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<double[]> IntergraphMatrix { get; } = new ExifTag<double[]>(ExifTagValue.IntergraphMatrix); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ModelTiePoint exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<double[]> ModelTiePoint { get; } = new ExifTag<double[]>(ExifTagValue.ModelTiePoint); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ModelTransform exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<double[]> ModelTransform { get; } = new ExifTag<double[]>(ExifTagValue.ModelTransform); |
|||
} |
|||
} |
|||
@ -0,0 +1,114 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the SubfileType exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> SubfileType { get; } = new ExifTag<uint>(ExifTagValue.SubfileType); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubIFDOffset exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> SubIFDOffset { get; } = new ExifTag<uint>(ExifTagValue.SubIFDOffset); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSIFDOffset exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> GPSIFDOffset { get; } = new ExifTag<uint>(ExifTagValue.GPSIFDOffset); |
|||
|
|||
/// <summary>
|
|||
/// Gets the T4Options exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> T4Options { get; } = new ExifTag<uint>(ExifTagValue.T4Options); |
|||
|
|||
/// <summary>
|
|||
/// Gets the T6Options exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> T6Options { get; } = new ExifTag<uint>(ExifTagValue.T6Options); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XClipPathUnits exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> XClipPathUnits { get; } = new ExifTag<uint>(ExifTagValue.XClipPathUnits); |
|||
|
|||
/// <summary>
|
|||
/// Gets the YClipPathUnits exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> YClipPathUnits { get; } = new ExifTag<uint>(ExifTagValue.YClipPathUnits); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ProfileType exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> ProfileType { get; } = new ExifTag<uint>(ExifTagValue.ProfileType); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CodingMethods exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> CodingMethods { get; } = new ExifTag<uint>(ExifTagValue.CodingMethods); |
|||
|
|||
/// <summary>
|
|||
/// Gets the T82ptions exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> T82ptions { get; } = new ExifTag<uint>(ExifTagValue.T82ptions); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGInterchangeFormat exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> JPEGInterchangeFormat { get; } = new ExifTag<uint>(ExifTagValue.JPEGInterchangeFormat); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGInterchangeFormatLength exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> JPEGInterchangeFormatLength { get; } = new ExifTag<uint>(ExifTagValue.JPEGInterchangeFormatLength); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDFileTag exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> MDFileTag { get; } = new ExifTag<uint>(ExifTagValue.MDFileTag); |
|||
|
|||
/// <summary>
|
|||
/// Gets the StandardOutputSensitivity exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> StandardOutputSensitivity { get; } = new ExifTag<uint>(ExifTagValue.StandardOutputSensitivity); |
|||
|
|||
/// <summary>
|
|||
/// Gets the RecommendedExposureIndex exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> RecommendedExposureIndex { get; } = new ExifTag<uint>(ExifTagValue.RecommendedExposureIndex); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ISOSpeed exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> ISOSpeed { get; } = new ExifTag<uint>(ExifTagValue.ISOSpeed); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ISOSpeedLatitudeyyy exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> ISOSpeedLatitudeyyy { get; } = new ExifTag<uint>(ExifTagValue.ISOSpeedLatitudeyyy); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ISOSpeedLatitudezzz exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> ISOSpeedLatitudezzz { get; } = new ExifTag<uint>(ExifTagValue.ISOSpeedLatitudezzz); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FaxRecvParams exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> FaxRecvParams { get; } = new ExifTag<uint>(ExifTagValue.FaxRecvParams); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FaxRecvTime exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> FaxRecvTime { get; } = new ExifTag<uint>(ExifTagValue.FaxRecvTime); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageNumber exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint> ImageNumber { get; } = new ExifTag<uint>(ExifTagValue.ImageNumber); |
|||
} |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the FreeOffsets exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> FreeOffsets { get; } = new ExifTag<uint[]>(ExifTagValue.FreeOffsets); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FreeByteCounts exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> FreeByteCounts { get; } = new ExifTag<uint[]>(ExifTagValue.FreeByteCounts); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ColorResponseUnit exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> ColorResponseUnit { get; } = new ExifTag<uint[]>(ExifTagValue.ColorResponseUnit); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TileOffsets exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> TileOffsets { get; } = new ExifTag<uint[]>(ExifTagValue.TileOffsets); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SMinSampleValue exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> SMinSampleValue { get; } = new ExifTag<uint[]>(ExifTagValue.SMinSampleValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SMaxSampleValue exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> SMaxSampleValue { get; } = new ExifTag<uint[]>(ExifTagValue.SMaxSampleValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGQTables exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> JPEGQTables { get; } = new ExifTag<uint[]>(ExifTagValue.JPEGQTables); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGDCTables exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> JPEGDCTables { get; } = new ExifTag<uint[]>(ExifTagValue.JPEGDCTables); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGACTables exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> JPEGACTables { get; } = new ExifTag<uint[]>(ExifTagValue.JPEGACTables); |
|||
|
|||
/// <summary>
|
|||
/// Gets the StripRowCounts exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> StripRowCounts { get; } = new ExifTag<uint[]>(ExifTagValue.StripRowCounts); |
|||
|
|||
/// <summary>
|
|||
/// Gets the IntergraphRegisters exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> IntergraphRegisters { get; } = new ExifTag<uint[]>(ExifTagValue.IntergraphRegisters); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TimeZoneOffset exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<uint[]> TimeZoneOffset { get; } = new ExifTag<uint[]>(ExifTagValue.TimeZoneOffset); |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the ImageWidth exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> ImageWidth { get; } = new ExifTag<Number>(ExifTagValue.ImageWidth); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageLength exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> ImageLength { get; } = new ExifTag<Number>(ExifTagValue.ImageLength); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TileWidth exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> TileWidth { get; } = new ExifTag<Number>(ExifTagValue.TileWidth); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TileLength exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> TileLength { get; } = new ExifTag<Number>(ExifTagValue.TileLength); |
|||
|
|||
/// <summary>
|
|||
/// Gets the BadFaxLines exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> BadFaxLines { get; } = new ExifTag<Number>(ExifTagValue.BadFaxLines); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ConsecutiveBadFaxLines exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> ConsecutiveBadFaxLines { get; } = new ExifTag<Number>(ExifTagValue.ConsecutiveBadFaxLines); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PixelXDimension exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> PixelXDimension { get; } = new ExifTag<Number>(ExifTagValue.PixelXDimension); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PixelYDimension exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number> PixelYDimension { get; } = new ExifTag<Number>(ExifTagValue.PixelYDimension); |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the StripOffsets exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number[]> StripOffsets { get; } = new ExifTag<Number[]>(ExifTagValue.StripOffsets); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TileByteCounts exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number[]> TileByteCounts { get; } = new ExifTag<Number[]>(ExifTagValue.TileByteCounts); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageLayer exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Number[]> ImageLayer { get; } = new ExifTag<Number[]>(ExifTagValue.ImageLayer); |
|||
} |
|||
} |
|||
@ -0,0 +1,176 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the XPosition exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> XPosition { get; } = new ExifTag<Rational>(ExifTagValue.XPosition); |
|||
|
|||
/// <summary>
|
|||
/// Gets the YPosition exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> YPosition { get; } = new ExifTag<Rational>(ExifTagValue.YPosition); |
|||
|
|||
/// <summary>
|
|||
/// Gets the XResolution exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> XResolution { get; } = new ExifTag<Rational>(ExifTagValue.XResolution); |
|||
|
|||
/// <summary>
|
|||
/// Gets the YResolution exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> YResolution { get; } = new ExifTag<Rational>(ExifTagValue.YResolution); |
|||
|
|||
/// <summary>
|
|||
/// Gets the BatteryLevel exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> BatteryLevel { get; } = new ExifTag<Rational>(ExifTagValue.BatteryLevel); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExposureTime exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> ExposureTime { get; } = new ExifTag<Rational>(ExifTagValue.ExposureTime); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FNumber exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FNumber { get; } = new ExifTag<Rational>(ExifTagValue.FNumber); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDScalePixel exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> MDScalePixel { get; } = new ExifTag<Rational>(ExifTagValue.MDScalePixel); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CompressedBitsPerPixel exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> CompressedBitsPerPixel { get; } = new ExifTag<Rational>(ExifTagValue.CompressedBitsPerPixel); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ApertureValue exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> ApertureValue { get; } = new ExifTag<Rational>(ExifTagValue.ApertureValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MaxApertureValue exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> MaxApertureValue { get; } = new ExifTag<Rational>(ExifTagValue.MaxApertureValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubjectDistance exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> SubjectDistance { get; } = new ExifTag<Rational>(ExifTagValue.SubjectDistance); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalLength exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FocalLength { get; } = new ExifTag<Rational>(ExifTagValue.FocalLength); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FlashEnergy2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FlashEnergy2 { get; } = new ExifTag<Rational>(ExifTagValue.FlashEnergy2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalPlaneXResolution2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FocalPlaneXResolution2 { get; } = new ExifTag<Rational>(ExifTagValue.FocalPlaneXResolution2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalPlaneYResolution2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FocalPlaneYResolution2 { get; } = new ExifTag<Rational>(ExifTagValue.FocalPlaneYResolution2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExposureIndex2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> ExposureIndex2 { get; } = new ExifTag<Rational>(ExifTagValue.ExposureIndex2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Humidity exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> Humidity { get; } = new ExifTag<Rational>(ExifTagValue.Humidity); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Pressure exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> Pressure { get; } = new ExifTag<Rational>(ExifTagValue.Pressure); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Acceleration exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> Acceleration { get; } = new ExifTag<Rational>(ExifTagValue.Acceleration); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FlashEnergy exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FlashEnergy { get; } = new ExifTag<Rational>(ExifTagValue.FlashEnergy); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalPlaneXResolution exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FocalPlaneXResolution { get; } = new ExifTag<Rational>(ExifTagValue.FocalPlaneXResolution); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalPlaneYResolution exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> FocalPlaneYResolution { get; } = new ExifTag<Rational>(ExifTagValue.FocalPlaneYResolution); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExposureIndex exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> ExposureIndex { get; } = new ExifTag<Rational>(ExifTagValue.ExposureIndex); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DigitalZoomRatio exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> DigitalZoomRatio { get; } = new ExifTag<Rational>(ExifTagValue.DigitalZoomRatio); |
|||
|
|||
/// <summary>
|
|||
/// Gets the LensInfo exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> LensInfo { get; } = new ExifTag<Rational>(ExifTagValue.LensInfo); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSAltitude exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSAltitude { get; } = new ExifTag<Rational>(ExifTagValue.GPSAltitude); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDOP exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSDOP { get; } = new ExifTag<Rational>(ExifTagValue.GPSDOP); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSSpeed exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSSpeed { get; } = new ExifTag<Rational>(ExifTagValue.GPSSpeed); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSTrack exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSTrack { get; } = new ExifTag<Rational>(ExifTagValue.GPSTrack); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSImgDirection exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSImgDirection { get; } = new ExifTag<Rational>(ExifTagValue.GPSImgDirection); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestBearing exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSDestBearing { get; } = new ExifTag<Rational>(ExifTagValue.GPSDestBearing); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestDistance exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational> GPSDestDistance { get; } = new ExifTag<Rational>(ExifTagValue.GPSDestDistance); |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the WhitePoint exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> WhitePoint { get; } = new ExifTag<Rational[]>(ExifTagValue.WhitePoint); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PrimaryChromaticities exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> PrimaryChromaticities { get; } = new ExifTag<Rational[]>(ExifTagValue.PrimaryChromaticities); |
|||
|
|||
/// <summary>
|
|||
/// Gets the YCbCrCoefficients exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> YCbCrCoefficients { get; } = new ExifTag<Rational[]>(ExifTagValue.YCbCrCoefficients); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ReferenceBlackWhite exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> ReferenceBlackWhite { get; } = new ExifTag<Rational[]>(ExifTagValue.ReferenceBlackWhite); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSLatitude exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> GPSLatitude { get; } = new ExifTag<Rational[]>(ExifTagValue.GPSLatitude); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSLongitude exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> GPSLongitude { get; } = new ExifTag<Rational[]>(ExifTagValue.GPSLongitude); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSTimestamp exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> GPSTimestamp { get; } = new ExifTag<Rational[]>(ExifTagValue.GPSTimestamp); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestLatitude exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> GPSDestLatitude { get; } = new ExifTag<Rational[]>(ExifTagValue.GPSDestLatitude); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestLongitude exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<Rational[]> GPSDestLongitude { get; } = new ExifTag<Rational[]>(ExifTagValue.GPSDestLongitude); |
|||
} |
|||
} |
|||
@ -0,0 +1,239 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the OldSubfileType exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> OldSubfileType { get; } = new ExifTag<ushort>(ExifTagValue.OldSubfileType); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Compression exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Compression { get; } = new ExifTag<ushort>(ExifTagValue.Compression); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PhotometricInterpretation exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> PhotometricInterpretation { get; } = new ExifTag<ushort>(ExifTagValue.PhotometricInterpretation); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Thresholding exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Thresholding { get; } = new ExifTag<ushort>(ExifTagValue.Thresholding); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CellWidth exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> CellWidth { get; } = new ExifTag<ushort>(ExifTagValue.CellWidth); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CellLength exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> CellLength { get; } = new ExifTag<ushort>(ExifTagValue.CellLength); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FillOrder exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> FillOrder { get; } = new ExifTag<ushort>(ExifTagValue.FillOrder); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Orientation exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Orientation { get; } = new ExifTag<ushort>(ExifTagValue.Orientation); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SamplesPerPixel exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SamplesPerPixel { get; } = new ExifTag<ushort>(ExifTagValue.SamplesPerPixel); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PlanarConfiguration exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> PlanarConfiguration { get; } = new ExifTag<ushort>(ExifTagValue.PlanarConfiguration); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GrayResponseUnit exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> GrayResponseUnit { get; } = new ExifTag<ushort>(ExifTagValue.GrayResponseUnit); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ResolutionUnit exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> ResolutionUnit { get; } = new ExifTag<ushort>(ExifTagValue.ResolutionUnit); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CleanFaxData exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> CleanFaxData { get; } = new ExifTag<ushort>(ExifTagValue.CleanFaxData); |
|||
|
|||
/// <summary>
|
|||
/// Gets the InkSet exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> InkSet { get; } = new ExifTag<ushort>(ExifTagValue.InkSet); |
|||
|
|||
/// <summary>
|
|||
/// Gets the NumberOfInks exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> NumberOfInks { get; } = new ExifTag<ushort>(ExifTagValue.NumberOfInks); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DotRange exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> DotRange { get; } = new ExifTag<ushort>(ExifTagValue.DotRange); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Indexed exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Indexed { get; } = new ExifTag<ushort>(ExifTagValue.Indexed); |
|||
|
|||
/// <summary>
|
|||
/// Gets the OPIProxy exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> OPIProxy { get; } = new ExifTag<ushort>(ExifTagValue.OPIProxy); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGProc exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> JPEGProc { get; } = new ExifTag<ushort>(ExifTagValue.JPEGProc); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGRestartInterval exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> JPEGRestartInterval { get; } = new ExifTag<ushort>(ExifTagValue.JPEGRestartInterval); |
|||
|
|||
/// <summary>
|
|||
/// Gets the YCbCrPositioning exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> YCbCrPositioning { get; } = new ExifTag<ushort>(ExifTagValue.YCbCrPositioning); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Rating exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Rating { get; } = new ExifTag<ushort>(ExifTagValue.Rating); |
|||
|
|||
/// <summary>
|
|||
/// Gets the RatingPercent exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> RatingPercent { get; } = new ExifTag<ushort>(ExifTagValue.RatingPercent); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExposureProgram exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> ExposureProgram { get; } = new ExifTag<ushort>(ExifTagValue.ExposureProgram); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Interlace exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Interlace { get; } = new ExifTag<ushort>(ExifTagValue.Interlace); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SelfTimerMode exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SelfTimerMode { get; } = new ExifTag<ushort>(ExifTagValue.SelfTimerMode); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SensitivityType exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SensitivityType { get; } = new ExifTag<ushort>(ExifTagValue.SensitivityType); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MeteringMode exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> MeteringMode { get; } = new ExifTag<ushort>(ExifTagValue.MeteringMode); |
|||
|
|||
/// <summary>
|
|||
/// Gets the LightSource exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> LightSource { get; } = new ExifTag<ushort>(ExifTagValue.LightSource); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalPlaneResolutionUnit2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> FocalPlaneResolutionUnit2 { get; } = new ExifTag<ushort>(ExifTagValue.FocalPlaneResolutionUnit2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SensingMethod2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SensingMethod2 { get; } = new ExifTag<ushort>(ExifTagValue.SensingMethod2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Flash exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Flash { get; } = new ExifTag<ushort>(ExifTagValue.Flash); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ColorSpace exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> ColorSpace { get; } = new ExifTag<ushort>(ExifTagValue.ColorSpace); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalPlaneResolutionUnit exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> FocalPlaneResolutionUnit { get; } = new ExifTag<ushort>(ExifTagValue.FocalPlaneResolutionUnit); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SensingMethod exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SensingMethod { get; } = new ExifTag<ushort>(ExifTagValue.SensingMethod); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CustomRendered exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> CustomRendered { get; } = new ExifTag<ushort>(ExifTagValue.CustomRendered); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExposureMode exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> ExposureMode { get; } = new ExifTag<ushort>(ExifTagValue.ExposureMode); |
|||
|
|||
/// <summary>
|
|||
/// Gets the WhiteBalance exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> WhiteBalance { get; } = new ExifTag<ushort>(ExifTagValue.WhiteBalance); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FocalLengthIn35mmFilm exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> FocalLengthIn35mmFilm { get; } = new ExifTag<ushort>(ExifTagValue.FocalLengthIn35mmFilm); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SceneCaptureType exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SceneCaptureType { get; } = new ExifTag<ushort>(ExifTagValue.SceneCaptureType); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GainControl exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> GainControl { get; } = new ExifTag<ushort>(ExifTagValue.GainControl); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Contrast exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Contrast { get; } = new ExifTag<ushort>(ExifTagValue.Contrast); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Saturation exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Saturation { get; } = new ExifTag<ushort>(ExifTagValue.Saturation); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Sharpness exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> Sharpness { get; } = new ExifTag<ushort>(ExifTagValue.Sharpness); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubjectDistanceRange exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> SubjectDistanceRange { get; } = new ExifTag<ushort>(ExifTagValue.SubjectDistanceRange); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDifferential exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort> GPSDifferential { get; } = new ExifTag<ushort>(ExifTagValue.GPSDifferential); |
|||
} |
|||
} |
|||
@ -0,0 +1,114 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the BitsPerSample exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> BitsPerSample { get; } = new ExifTag<ushort[]>(ExifTagValue.BitsPerSample); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MinSampleValue exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> MinSampleValue { get; } = new ExifTag<ushort[]>(ExifTagValue.MinSampleValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MaxSampleValue exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> MaxSampleValue { get; } = new ExifTag<ushort[]>(ExifTagValue.MaxSampleValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GrayResponseCurve exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> GrayResponseCurve { get; } = new ExifTag<ushort[]>(ExifTagValue.GrayResponseCurve); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ColorMap exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> ColorMap { get; } = new ExifTag<ushort[]>(ExifTagValue.ColorMap); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExtraSamples exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> ExtraSamples { get; } = new ExifTag<ushort[]>(ExifTagValue.ExtraSamples); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PageNumber exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> PageNumber { get; } = new ExifTag<ushort[]>(ExifTagValue.PageNumber); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TransferFunction exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> TransferFunction { get; } = new ExifTag<ushort[]>(ExifTagValue.TransferFunction); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Predictor exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> Predictor { get; } = new ExifTag<ushort[]>(ExifTagValue.Predictor); |
|||
|
|||
/// <summary>
|
|||
/// Gets the HalftoneHints exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> HalftoneHints { get; } = new ExifTag<ushort[]>(ExifTagValue.HalftoneHints); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SampleFormat exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> SampleFormat { get; } = new ExifTag<ushort[]>(ExifTagValue.SampleFormat); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TransferRange exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> TransferRange { get; } = new ExifTag<ushort[]>(ExifTagValue.TransferRange); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DefaultImageColor exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> DefaultImageColor { get; } = new ExifTag<ushort[]>(ExifTagValue.DefaultImageColor); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGLosslessPredictors exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> JPEGLosslessPredictors { get; } = new ExifTag<ushort[]>(ExifTagValue.JPEGLosslessPredictors); |
|||
|
|||
/// <summary>
|
|||
/// Gets the JPEGPointTransforms exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> JPEGPointTransforms { get; } = new ExifTag<ushort[]>(ExifTagValue.JPEGPointTransforms); |
|||
|
|||
/// <summary>
|
|||
/// Gets the YCbCrSubsampling exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> YCbCrSubsampling { get; } = new ExifTag<ushort[]>(ExifTagValue.YCbCrSubsampling); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CFARepeatPatternDim exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> CFARepeatPatternDim { get; } = new ExifTag<ushort[]>(ExifTagValue.CFARepeatPatternDim); |
|||
|
|||
/// <summary>
|
|||
/// Gets the IntergraphPacketData exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> IntergraphPacketData { get; } = new ExifTag<ushort[]>(ExifTagValue.IntergraphPacketData); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ISOSpeedRatings exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> ISOSpeedRatings { get; } = new ExifTag<ushort[]>(ExifTagValue.ISOSpeedRatings); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubjectArea exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> SubjectArea { get; } = new ExifTag<ushort[]>(ExifTagValue.SubjectArea); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubjectLocation exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<ushort[]> SubjectLocation { get; } = new ExifTag<ushort[]>(ExifTagValue.SubjectLocation); |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational> ShutterSpeedValue { get; } = new ExifTag<SignedRational>(ExifTagValue.ShutterSpeedValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational> BrightnessValue { get; } = new ExifTag<SignedRational>(ExifTagValue.BrightnessValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational> ExposureBiasValue { get; } = new ExifTag<SignedRational>(ExifTagValue.ExposureBiasValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational> AmbientTemperature { get; } = new ExifTag<SignedRational>(ExifTagValue.AmbientTemperature); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational> WaterDepth { get; } = new ExifTag<SignedRational>(ExifTagValue.WaterDepth); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ClipPath exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational> CameraElevationAngle { get; } = new ExifTag<SignedRational>(ExifTagValue.CameraElevationAngle); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the Decode exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<SignedRational[]> Decode { get; } = new ExifTag<SignedRational[]>(ExifTagValue.Decode); |
|||
} |
|||
} |
|||
@ -0,0 +1,279 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the ImageDescription exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> ImageDescription { get; } = new ExifTag<string>(ExifTagValue.ImageDescription); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Make exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> Make { get; } = new ExifTag<string>(ExifTagValue.Make); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Model exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> Model { get; } = new ExifTag<string>(ExifTagValue.Model); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Software exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> Software { get; } = new ExifTag<string>(ExifTagValue.Software); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DateTime exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> DateTime { get; } = new ExifTag<string>(ExifTagValue.DateTime); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Artist exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> Artist { get; } = new ExifTag<string>(ExifTagValue.Artist); |
|||
|
|||
/// <summary>
|
|||
/// Gets the HostComputer exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> HostComputer { get; } = new ExifTag<string>(ExifTagValue.HostComputer); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Copyright exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> Copyright { get; } = new ExifTag<string>(ExifTagValue.Copyright); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DocumentName exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> DocumentName { get; } = new ExifTag<string>(ExifTagValue.DocumentName); |
|||
|
|||
/// <summary>
|
|||
/// Gets the PageName exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> PageName { get; } = new ExifTag<string>(ExifTagValue.PageName); |
|||
|
|||
/// <summary>
|
|||
/// Gets the InkNames exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> InkNames { get; } = new ExifTag<string>(ExifTagValue.InkNames); |
|||
|
|||
/// <summary>
|
|||
/// Gets the TargetPrinter exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> TargetPrinter { get; } = new ExifTag<string>(ExifTagValue.TargetPrinter); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageID exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> ImageID { get; } = new ExifTag<string>(ExifTagValue.ImageID); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDLabName exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> MDLabName { get; } = new ExifTag<string>(ExifTagValue.MDLabName); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDSampleInfo exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> MDSampleInfo { get; } = new ExifTag<string>(ExifTagValue.MDSampleInfo); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDPrepDate exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> MDPrepDate { get; } = new ExifTag<string>(ExifTagValue.MDPrepDate); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDPrepTime exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> MDPrepTime { get; } = new ExifTag<string>(ExifTagValue.MDPrepTime); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MDFileUnits exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> MDFileUnits => new ExifTag<string>(ExifTagValue.MDFileUnits); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SEMInfo exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SEMInfo { get; } = new ExifTag<string>(ExifTagValue.SEMInfo); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SpectralSensitivity exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SpectralSensitivity { get; } = new ExifTag<string>(ExifTagValue.SpectralSensitivity); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DateTimeOriginal exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> DateTimeOriginal { get; } = new ExifTag<string>(ExifTagValue.DateTimeOriginal); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DateTimeDigitized exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> DateTimeDigitized { get; } = new ExifTag<string>(ExifTagValue.DateTimeDigitized); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubsecTime exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SubsecTime { get; } = new ExifTag<string>(ExifTagValue.SubsecTime); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubsecTimeOriginal exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SubsecTimeOriginal { get; } = new ExifTag<string>(ExifTagValue.SubsecTimeOriginal); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SubsecTimeDigitized exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SubsecTimeDigitized { get; } = new ExifTag<string>(ExifTagValue.SubsecTimeDigitized); |
|||
|
|||
/// <summary>
|
|||
/// Gets the RelatedSoundFile exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> RelatedSoundFile { get; } = new ExifTag<string>(ExifTagValue.RelatedSoundFile); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FaxSubaddress exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> FaxSubaddress { get; } = new ExifTag<string>(ExifTagValue.FaxSubaddress); |
|||
|
|||
/// <summary>
|
|||
/// Gets the OffsetTime exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> OffsetTime { get; } = new ExifTag<string>(ExifTagValue.OffsetTime); |
|||
|
|||
/// <summary>
|
|||
/// Gets the OffsetTimeOriginal exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> OffsetTimeOriginal { get; } = new ExifTag<string>(ExifTagValue.OffsetTimeOriginal); |
|||
|
|||
/// <summary>
|
|||
/// Gets the OffsetTimeDigitized exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> OffsetTimeDigitized { get; } = new ExifTag<string>(ExifTagValue.OffsetTimeDigitized); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SecurityClassification exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SecurityClassification { get; } = new ExifTag<string>(ExifTagValue.SecurityClassification); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageHistory exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> ImageHistory { get; } = new ExifTag<string>(ExifTagValue.ImageHistory); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageUniqueID exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> ImageUniqueID { get; } = new ExifTag<string>(ExifTagValue.ImageUniqueID); |
|||
|
|||
/// <summary>
|
|||
/// Gets the OwnerName exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> OwnerName { get; } = new ExifTag<string>(ExifTagValue.OwnerName); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SerialNumber exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> SerialNumber { get; } = new ExifTag<string>(ExifTagValue.SerialNumber); |
|||
|
|||
/// <summary>
|
|||
/// Gets the LensMake exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> LensMake { get; } = new ExifTag<string>(ExifTagValue.LensMake); |
|||
|
|||
/// <summary>
|
|||
/// Gets the LensModel exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> LensModel { get; } = new ExifTag<string>(ExifTagValue.LensModel); |
|||
|
|||
/// <summary>
|
|||
/// Gets the LensSerialNumber exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> LensSerialNumber { get; } = new ExifTag<string>(ExifTagValue.LensSerialNumber); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GDALMetadata exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GDALMetadata { get; } = new ExifTag<string>(ExifTagValue.GDALMetadata); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GDALNoData exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GDALNoData { get; } = new ExifTag<string>(ExifTagValue.GDALNoData); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSLatitudeRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSLatitudeRef { get; } = new ExifTag<string>(ExifTagValue.GPSLatitudeRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSLongitudeRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSLongitudeRef { get; } = new ExifTag<string>(ExifTagValue.GPSLongitudeRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSSatellites exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSSatellites { get; } = new ExifTag<string>(ExifTagValue.GPSSatellites); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSStatus exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSStatus { get; } = new ExifTag<string>(ExifTagValue.GPSStatus); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSMeasureMode exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSMeasureMode { get; } = new ExifTag<string>(ExifTagValue.GPSMeasureMode); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSSpeedRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSSpeedRef { get; } = new ExifTag<string>(ExifTagValue.GPSSpeedRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSTrackRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSTrackRef { get; } = new ExifTag<string>(ExifTagValue.GPSTrackRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSImgDirectionRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSImgDirectionRef { get; } = new ExifTag<string>(ExifTagValue.GPSImgDirectionRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSMapDatum exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSMapDatum { get; } = new ExifTag<string>(ExifTagValue.GPSMapDatum); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestLatitudeRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSDestLatitudeRef { get; } = new ExifTag<string>(ExifTagValue.GPSDestLatitudeRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestLongitudeRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSDestLongitudeRef { get; } = new ExifTag<string>(ExifTagValue.GPSDestLongitudeRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestBearingRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSDestBearingRef { get; } = new ExifTag<string>(ExifTagValue.GPSDestBearingRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDestDistanceRef exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSDestDistanceRef { get; } = new ExifTag<string>(ExifTagValue.GPSDestDistanceRef); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSDateStamp exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<string> GPSDateStamp { get; } = new ExifTag<string>(ExifTagValue.GPSDateStamp); |
|||
} |
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the JPEGTables exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> JPEGTables { get; } = new ExifTag<byte[]>(ExifTagValue.JPEGTables); |
|||
|
|||
/// <summary>
|
|||
/// Gets the OECF exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> OECF { get; } = new ExifTag<byte[]>(ExifTagValue.OECF); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ExifVersion exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> ExifVersion { get; } = new ExifTag<byte[]>(ExifTagValue.ExifVersion); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ComponentsConfiguration exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> ComponentsConfiguration { get; } = new ExifTag<byte[]>(ExifTagValue.ComponentsConfiguration); |
|||
|
|||
/// <summary>
|
|||
/// Gets the MakerNote exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> MakerNote { get; } = new ExifTag<byte[]>(ExifTagValue.MakerNote); |
|||
|
|||
/// <summary>
|
|||
/// Gets the UserComment exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> UserComment { get; } = new ExifTag<byte[]>(ExifTagValue.UserComment); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FlashpixVersion exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> FlashpixVersion { get; } = new ExifTag<byte[]>(ExifTagValue.FlashpixVersion); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SpatialFrequencyResponse exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> SpatialFrequencyResponse { get; } = new ExifTag<byte[]>(ExifTagValue.SpatialFrequencyResponse); |
|||
|
|||
/// <summary>
|
|||
/// Gets the SpatialFrequencyResponse2 exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> SpatialFrequencyResponse2 { get; } = new ExifTag<byte[]>(ExifTagValue.SpatialFrequencyResponse2); |
|||
|
|||
/// <summary>
|
|||
/// Gets the Noise exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> Noise { get; } = new ExifTag<byte[]>(ExifTagValue.Noise); |
|||
|
|||
/// <summary>
|
|||
/// Gets the CFAPattern exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> CFAPattern { get; } = new ExifTag<byte[]>(ExifTagValue.CFAPattern); |
|||
|
|||
/// <summary>
|
|||
/// Gets the DeviceSettingDescription exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> DeviceSettingDescription { get; } = new ExifTag<byte[]>(ExifTagValue.DeviceSettingDescription); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageSourceData exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> ImageSourceData { get; } = new ExifTag<byte[]>(ExifTagValue.ImageSourceData); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSProcessingMethod exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> GPSProcessingMethod { get; } = new ExifTag<byte[]>(ExifTagValue.GPSProcessingMethod); |
|||
|
|||
/// <summary>
|
|||
/// Gets the GPSAreaInformation exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte[]> GPSAreaInformation { get; } = new ExifTag<byte[]>(ExifTagValue.GPSAreaInformation); |
|||
|
|||
/// <summary>
|
|||
/// Gets the FileSource exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte> FileSource { get; } = new ExifTag<byte>(ExifTagValue.FileSource); |
|||
|
|||
/// <summary>
|
|||
/// Gets the ImageDescription exif tag.
|
|||
/// </summary>
|
|||
public static ExifTag<byte> SceneType { get; } = new ExifTag<byte>(ExifTagValue.SceneType); |
|||
} |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <summary>
|
|||
/// Class that represents an exif tag from the Exif standard 2.31.
|
|||
/// </summary>
|
|||
public abstract partial class ExifTag : IEquatable<ExifTag> |
|||
{ |
|||
private readonly ushort value; |
|||
|
|||
internal ExifTag(ushort value) => this.value = value; |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="ExifTag"/> to a <see cref="ushort"/>.
|
|||
/// </summary>
|
|||
/// <param name="tag">The <see cref="ExifTag"/> to convert.</param>
|
|||
public static explicit operator ushort(ExifTag tag) => tag?.value ?? (ushort)ExifTagValue.Unknown; |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the specified <see cref="ExifTag"/> instances are considered equal.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="ExifTag"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="ExifTag"/> to compare.</param>
|
|||
public static bool operator ==(ExifTag left, ExifTag right) => Equals(left, right); |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the specified <see cref="ExifTag"/> instances are not considered equal.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="ExifTag"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="ExifTag"/> to compare.</param>
|
|||
public static bool operator !=(ExifTag left, ExifTag right) => !Equals(left, right); |
|||
|
|||
/// <inheritdoc/>
|
|||
public override bool Equals(object obj) |
|||
{ |
|||
if (obj is ExifTag value) |
|||
{ |
|||
return this.Equals(value); |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public bool Equals(ExifTag other) |
|||
{ |
|||
if (other is null) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, other)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
return this.value == other.value; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override int GetHashCode() => this.value.GetHashCode(); |
|||
|
|||
/// <inheritdoc/>
|
|||
public override string ToString() => ((ExifTagValue)this.value).ToString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <summary>
|
|||
/// Class that represents an exif tag from the Exif standard 2.31 with <typeparamref name="TValueType"/> as the data type of the tag.
|
|||
/// </summary>
|
|||
/// <typeparam name="TValueType">The data type of the tag.</typeparam>
|
|||
public sealed class ExifTag<TValueType> : ExifTag |
|||
{ |
|||
internal ExifTag(ExifTagValue value) |
|||
: base((ushort)value) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class UnkownExifTag : ExifTag |
|||
{ |
|||
internal UnkownExifTag(ExifTagValue value) |
|||
: base((ushort)value) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal abstract class ExifArrayValue<TValueType> : ExifValue, IExifValue<TValueType[]> |
|||
{ |
|||
protected ExifArrayValue(ExifTag<TValueType[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
protected ExifArrayValue(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
internal ExifArrayValue(ExifArrayValue<TValueType> value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override bool IsArray => true; |
|||
|
|||
public TValueType[] Value { get; set; } |
|||
|
|||
public override object GetValue() => this.Value; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (value is null) |
|||
{ |
|||
this.Value = null; |
|||
return true; |
|||
} |
|||
|
|||
Type type = value.GetType(); |
|||
if (value.GetType() == typeof(TValueType[])) |
|||
{ |
|||
this.Value = (TValueType[])value; |
|||
return true; |
|||
} |
|||
|
|||
if (type == typeof(TValueType)) |
|||
{ |
|||
this.Value = new TValueType[] { (TValueType)value }; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifByte : ExifValue<byte> |
|||
{ |
|||
public ExifByte(ExifTag<byte> tag, ExifDataType dataType) |
|||
: base(tag) => this.DataType = dataType; |
|||
|
|||
public ExifByte(ExifTagValue tag, ExifDataType dataType) |
|||
: base(tag) => this.DataType = dataType; |
|||
|
|||
private ExifByte(ExifByte value) |
|||
: base(value) => this.DataType = value.DataType; |
|||
|
|||
public override ExifDataType DataType { get; } |
|||
|
|||
protected override string StringValue => this.Value.ToString("X2", CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
if (intValue >= byte.MinValue && intValue <= byte.MaxValue) |
|||
{ |
|||
this.Value = (byte)intValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
default: |
|||
return base.TrySetValue(value); |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifByte(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifByteArray : ExifArrayValue<byte> |
|||
{ |
|||
public ExifByteArray(ExifTag<byte[]> tag, ExifDataType dataType) |
|||
: base(tag) => this.DataType = dataType; |
|||
|
|||
public ExifByteArray(ExifTagValue tag, ExifDataType dataType) |
|||
: base(tag) => this.DataType = dataType; |
|||
|
|||
private ExifByteArray(ExifByteArray value) |
|||
: base(value) => this.DataType = value.DataType; |
|||
|
|||
public override ExifDataType DataType { get; } |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (value is int[] intArrayValue) |
|||
{ |
|||
return this.TrySetSignedIntArray(intArrayValue); |
|||
} |
|||
|
|||
if (value is int intValue) |
|||
{ |
|||
if (intValue >= byte.MinValue && intValue <= byte.MaxValue) |
|||
{ |
|||
this.Value = new byte[] { (byte)intValue }; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifByteArray(this); |
|||
|
|||
private bool TrySetSignedIntArray(int[] intArrayValue) |
|||
{ |
|||
if (Array.FindIndex(intArrayValue, x => x < byte.MinValue || x > byte.MaxValue) > -1) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var value = new byte[intArrayValue.Length]; |
|||
for (int i = 0; i < intArrayValue.Length; i++) |
|||
{ |
|||
int s = intArrayValue[i]; |
|||
value[i] = (byte)s; |
|||
} |
|||
|
|||
this.Value = value; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifDouble : ExifValue<double> |
|||
{ |
|||
public ExifDouble(ExifTag<double> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifDouble(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifDouble(ExifDouble value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.DoubleFloat; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
this.Value = intValue; |
|||
return true; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifDouble(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifDoubleArray : ExifArrayValue<double> |
|||
{ |
|||
public ExifDoubleArray(ExifTag<double[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifDoubleArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifDoubleArray(ExifDoubleArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.DoubleFloat; |
|||
|
|||
public override IExifValue DeepClone() => new ExifDoubleArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifFloat : ExifValue<float> |
|||
{ |
|||
public ExifFloat(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifFloat(ExifFloat value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SingleFloat; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
this.Value = intValue; |
|||
return true; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifFloat(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifFloatArray : ExifArrayValue<float> |
|||
{ |
|||
public ExifFloatArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifFloatArray(ExifFloatArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SingleFloat; |
|||
|
|||
public override IExifValue DeepClone() => new ExifFloatArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifLong : ExifValue<uint> |
|||
{ |
|||
public ExifLong(ExifTag<uint> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifLong(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifLong(ExifLong value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Long; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
if (intValue >= uint.MinValue) |
|||
{ |
|||
this.Value = (uint)intValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifLong(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifLongArray : ExifArrayValue<uint> |
|||
{ |
|||
public ExifLongArray(ExifTag<uint[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifLongArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifLongArray(ExifLongArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Long; |
|||
|
|||
public override IExifValue DeepClone() => new ExifLongArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifNumber : ExifValue<Number> |
|||
{ |
|||
public ExifNumber(ExifTag<Number> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifNumber(ExifNumber value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType |
|||
{ |
|||
get |
|||
{ |
|||
if (this.Value > ushort.MaxValue) |
|||
{ |
|||
return ExifDataType.Long; |
|||
} |
|||
|
|||
return ExifDataType.Short; |
|||
} |
|||
} |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
if (intValue >= uint.MinValue) |
|||
{ |
|||
this.Value = (uint)intValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
case uint uintValue: |
|||
this.Value = uintValue; |
|||
return true; |
|||
case short shortValue: |
|||
if (shortValue >= uint.MinValue) |
|||
{ |
|||
this.Value = (uint)shortValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
case ushort ushortValue: |
|||
this.Value = ushortValue; |
|||
return true; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifNumber(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifNumberArray : ExifArrayValue<Number> |
|||
{ |
|||
public ExifNumberArray(ExifTag<Number[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifNumberArray(ExifNumberArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType |
|||
{ |
|||
get |
|||
{ |
|||
if (this.Value is null) |
|||
{ |
|||
return ExifDataType.Short; |
|||
} |
|||
|
|||
for (int i = 0; i < this.Value.Length; i++) |
|||
{ |
|||
if (this.Value[i] > ushort.MaxValue) |
|||
{ |
|||
return ExifDataType.Long; |
|||
} |
|||
} |
|||
|
|||
return ExifDataType.Short; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifNumberArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifRational : ExifValue<Rational> |
|||
{ |
|||
public ExifRational(ExifTag<Rational> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifRational(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifRational(ExifRational value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Rational; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case SignedRational signed: |
|||
|
|||
if (signed.Numerator >= uint.MinValue && signed.Denominator >= uint.MinValue) |
|||
{ |
|||
this.Value = new Rational((uint)signed.Numerator, (uint)signed.Denominator); |
|||
} |
|||
|
|||
return true; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifRational(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifRationalArray : ExifArrayValue<Rational> |
|||
{ |
|||
public ExifRationalArray(ExifTag<Rational[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifRationalArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifRationalArray(ExifRationalArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Rational; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (value is SignedRational[] signedArray) |
|||
{ |
|||
return this.TrySetSignedArray(signedArray); |
|||
} |
|||
|
|||
if (value is SignedRational signed) |
|||
{ |
|||
if (signed.Numerator >= 0 && signed.Denominator >= 0) |
|||
{ |
|||
this.Value = new[] { new Rational((uint)signed.Numerator, (uint)signed.Denominator) }; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifRationalArray(this); |
|||
|
|||
private bool TrySetSignedArray(SignedRational[] signed) |
|||
{ |
|||
if (Array.FindIndex(signed, x => x.Numerator < 0 || x.Denominator < 0) > -1) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var unsigned = new Rational[signed.Length]; |
|||
for (int i = 0; i < signed.Length; i++) |
|||
{ |
|||
SignedRational s = signed[i]; |
|||
unsigned[i] = new Rational((uint)s.Numerator, (uint)s.Denominator); |
|||
} |
|||
|
|||
this.Value = unsigned; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifShort : ExifValue<ushort> |
|||
{ |
|||
public ExifShort(ExifTag<ushort> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifShort(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifShort(ExifShort value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Short; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
if (intValue >= ushort.MinValue && intValue <= ushort.MaxValue) |
|||
{ |
|||
this.Value = (ushort)intValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
case short shortValue: |
|||
if (shortValue >= ushort.MinValue) |
|||
{ |
|||
this.Value = (ushort)shortValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifShort(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifShortArray : ExifArrayValue<ushort> |
|||
{ |
|||
public ExifShortArray(ExifTag<ushort[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifShortArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifShortArray(ExifShortArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Short; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (value is int[] signedIntArray) |
|||
{ |
|||
return this.TrySetSignedIntArray(signedIntArray); |
|||
} |
|||
|
|||
if (value is short[] signedShortArray) |
|||
{ |
|||
return this.TrySetSignedShortArray(signedShortArray); |
|||
} |
|||
|
|||
if (value is int signedInt) |
|||
{ |
|||
if (signedInt >= ushort.MinValue && signedInt <= ushort.MaxValue) |
|||
{ |
|||
this.Value = new ushort[] { (ushort)signedInt }; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
if (value is short signedShort) |
|||
{ |
|||
if (signedShort >= ushort.MinValue) |
|||
{ |
|||
this.Value = new ushort[] { (ushort)signedShort }; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifShortArray(this); |
|||
|
|||
private bool TrySetSignedIntArray(int[] signed) |
|||
{ |
|||
if (Array.FindIndex(signed, x => x < ushort.MinValue || x > ushort.MaxValue) > -1) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var unsigned = new ushort[signed.Length]; |
|||
for (int i = 0; i < signed.Length; i++) |
|||
{ |
|||
int s = signed[i]; |
|||
unsigned[i] = (ushort)s; |
|||
} |
|||
|
|||
this.Value = unsigned; |
|||
return true; |
|||
} |
|||
|
|||
private bool TrySetSignedShortArray(short[] signed) |
|||
{ |
|||
if (Array.FindIndex(signed, x => x < ushort.MinValue) > -1) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var unsigned = new ushort[signed.Length]; |
|||
for (int i = 0; i < signed.Length; i++) |
|||
{ |
|||
short s = signed[i]; |
|||
unsigned[i] = (ushort)s; |
|||
} |
|||
|
|||
this.Value = unsigned; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedByte : ExifValue<sbyte> |
|||
{ |
|||
public ExifSignedByte(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedByte(ExifSignedByte value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedByte; |
|||
|
|||
protected override string StringValue => this.Value.ToString("X2", CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
if (intValue >= sbyte.MinValue && intValue <= sbyte.MaxValue) |
|||
{ |
|||
this.Value = (sbyte)intValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedByte(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedByteArray : ExifArrayValue<sbyte> |
|||
{ |
|||
public ExifSignedByteArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedByteArray(ExifSignedByteArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedByte; |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedByteArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedLong : ExifValue<int> |
|||
{ |
|||
public ExifSignedLong(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedLong(ExifSignedLong value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedLong; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedLong(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedLongArray : ExifArrayValue<int> |
|||
{ |
|||
public ExifSignedLongArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedLongArray(ExifSignedLongArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedLong; |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedLongArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedRational : ExifValue<SignedRational> |
|||
{ |
|||
internal ExifSignedRational(ExifTag<SignedRational> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
internal ExifSignedRational(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedRational(ExifSignedRational value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedRational; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedRational(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Primitives; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedRationalArray : ExifArrayValue<SignedRational> |
|||
{ |
|||
public ExifSignedRationalArray(ExifTag<SignedRational[]> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifSignedRationalArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedRationalArray(ExifSignedRationalArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedRational; |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedRationalArray(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedShort : ExifValue<short> |
|||
{ |
|||
public ExifSignedShort(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedShort(ExifSignedShort value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedShort; |
|||
|
|||
protected override string StringValue => this.Value.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
if (intValue >= short.MinValue && intValue <= short.MaxValue) |
|||
{ |
|||
this.Value = (short)intValue; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedShort(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifSignedShortArray : ExifArrayValue<short> |
|||
{ |
|||
public ExifSignedShortArray(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifSignedShortArray(ExifSignedShortArray value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.SignedShort; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (value is int[] intArray) |
|||
{ |
|||
return this.TrySetSignedArray(intArray); |
|||
} |
|||
|
|||
if (value is int intValue) |
|||
{ |
|||
if (intValue >= short.MinValue && intValue <= short.MaxValue) |
|||
{ |
|||
this.Value = new short[] { (short)intValue }; |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifSignedShortArray(this); |
|||
|
|||
private bool TrySetSignedArray(int[] intArray) |
|||
{ |
|||
if (Array.FindIndex(intArray, x => x < short.MinValue || x > short.MaxValue) > -1) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
var value = new short[intArray.Length]; |
|||
for (int i = 0; i < intArray.Length; i++) |
|||
{ |
|||
int s = intArray[i]; |
|||
value[i] = (short)s; |
|||
} |
|||
|
|||
this.Value = value; |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Globalization; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifString : ExifValue<string> |
|||
{ |
|||
public ExifString(ExifTag<string> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifString(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifString(ExifString value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Ascii; |
|||
|
|||
protected override string StringValue => this.Value; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
switch (value) |
|||
{ |
|||
case int intValue: |
|||
this.Value = intValue.ToString(CultureInfo.InvariantCulture); |
|||
return true; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifString(this); |
|||
} |
|||
} |
|||
@ -0,0 +1,83 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal abstract class ExifValue : IExifValue, IEquatable<ExifTag> |
|||
{ |
|||
protected ExifValue(ExifTag tag) => this.Tag = tag; |
|||
|
|||
protected ExifValue(ExifTagValue tag) => this.Tag = new UnkownExifTag(tag); |
|||
|
|||
internal ExifValue(ExifValue other) |
|||
{ |
|||
Guard.NotNull(other, nameof(other)); |
|||
|
|||
this.DataType = other.DataType; |
|||
this.IsArray = other.IsArray; |
|||
this.Tag = other.Tag; |
|||
|
|||
if (!other.IsArray) |
|||
{ |
|||
// All types are value types except for string which is immutable so safe to simply assign.
|
|||
this.TrySetValue(other.GetValue()); |
|||
} |
|||
else |
|||
{ |
|||
// All array types are value types so Clone() is sufficient here.
|
|||
var array = (Array)other.GetValue(); |
|||
this.TrySetValue(array.Clone()); |
|||
} |
|||
} |
|||
|
|||
public virtual ExifDataType DataType { get; } |
|||
|
|||
public virtual bool IsArray { get; } |
|||
|
|||
public ExifTag Tag { get; } |
|||
|
|||
public static bool operator ==(ExifValue left, ExifTag right) => Equals(left, right); |
|||
|
|||
public static bool operator !=(ExifValue left, ExifTag right) => !Equals(left, right); |
|||
|
|||
public override bool Equals(object obj) |
|||
{ |
|||
if (obj is null) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
if (ReferenceEquals(this, obj)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (obj is ExifTag tag) |
|||
{ |
|||
return this.Equals(tag); |
|||
} |
|||
|
|||
if (obj is ExifValue value) |
|||
{ |
|||
return this.Tag.Equals(value.Tag) && Equals(this.GetValue(), value.GetValue()); |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public bool Equals(ExifTag other) => this.Tag.Equals(other); |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public override int GetHashCode() => HashCode.Combine(this.Tag, this.GetValue()); |
|||
|
|||
public abstract object GetValue(); |
|||
|
|||
public abstract bool TrySetValue(object value); |
|||
|
|||
public abstract IExifValue DeepClone(); |
|||
} |
|||
} |
|||
@ -0,0 +1,307 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal static partial class ExifValues |
|||
{ |
|||
public static ExifValue Create(ExifTagValue tag) => (ExifValue)CreateValue(tag); |
|||
|
|||
public static ExifValue Create(ExifTag tag) => (ExifValue)CreateValue((ExifTagValue)(ushort)tag); |
|||
|
|||
public static ExifValue Create(ExifTagValue tag, ExifDataType dataType, uint numberOfComponents) |
|||
{ |
|||
bool isArray = numberOfComponents != 1; |
|||
|
|||
switch (dataType) |
|||
{ |
|||
case ExifDataType.Byte: return isArray ? (ExifValue)new ExifByteArray(tag, dataType) : new ExifByte(tag, dataType); |
|||
case ExifDataType.DoubleFloat: return isArray ? (ExifValue)new ExifDoubleArray(tag) : new ExifDouble(tag); |
|||
case ExifDataType.SingleFloat: return isArray ? (ExifValue)new ExifFloatArray(tag) : new ExifFloat(tag); |
|||
case ExifDataType.Long: return isArray ? (ExifValue)new ExifLongArray(tag) : new ExifLong(tag); |
|||
case ExifDataType.Rational: return isArray ? (ExifValue)new ExifRationalArray(tag) : new ExifRational(tag); |
|||
case ExifDataType.Short: return isArray ? (ExifValue)new ExifShortArray(tag) : new ExifShort(tag); |
|||
case ExifDataType.SignedByte: return isArray ? (ExifValue)new ExifSignedByteArray(tag) : new ExifSignedByte(tag); |
|||
case ExifDataType.SignedLong: return isArray ? (ExifValue)new ExifSignedLongArray(tag) : new ExifSignedLong(tag); |
|||
case ExifDataType.SignedRational: return isArray ? (ExifValue)new ExifSignedRationalArray(tag) : new ExifSignedRational(tag); |
|||
case ExifDataType.SignedShort: return isArray ? (ExifValue)new ExifSignedShortArray(tag) : new ExifSignedShort(tag); |
|||
case ExifDataType.Ascii: return new ExifString(tag); |
|||
case ExifDataType.Undefined: return isArray ? (ExifValue)new ExifByteArray(tag, dataType) : new ExifByte(tag, dataType); |
|||
default: return null; |
|||
} |
|||
} |
|||
|
|||
private static object CreateValue(ExifTagValue tag) |
|||
{ |
|||
switch (tag) |
|||
{ |
|||
case ExifTagValue.FaxProfile: return new ExifByte(ExifTag.FaxProfile, ExifDataType.Byte); |
|||
case ExifTagValue.ModeNumber: return new ExifByte(ExifTag.ModeNumber, ExifDataType.Byte); |
|||
case ExifTagValue.GPSAltitudeRef: return new ExifByte(ExifTag.GPSAltitudeRef, ExifDataType.Byte); |
|||
|
|||
case ExifTagValue.ClipPath: return new ExifByteArray(ExifTag.ClipPath, ExifDataType.Byte); |
|||
case ExifTagValue.VersionYear: return new ExifByteArray(ExifTag.VersionYear, ExifDataType.Byte); |
|||
case ExifTagValue.XMP: return new ExifByteArray(ExifTag.XMP, ExifDataType.Byte); |
|||
case ExifTagValue.CFAPattern2: return new ExifByteArray(ExifTag.CFAPattern2, ExifDataType.Byte); |
|||
case ExifTagValue.TIFFEPStandardID: return new ExifByteArray(ExifTag.TIFFEPStandardID, ExifDataType.Byte); |
|||
case ExifTagValue.XPTitle: return new ExifByteArray(ExifTag.XPTitle, ExifDataType.Byte); |
|||
case ExifTagValue.XPComment: return new ExifByteArray(ExifTag.XPComment, ExifDataType.Byte); |
|||
case ExifTagValue.XPAuthor: return new ExifByteArray(ExifTag.XPAuthor, ExifDataType.Byte); |
|||
case ExifTagValue.XPKeywords: return new ExifByteArray(ExifTag.XPKeywords, ExifDataType.Byte); |
|||
case ExifTagValue.XPSubject: return new ExifByteArray(ExifTag.XPSubject, ExifDataType.Byte); |
|||
case ExifTagValue.GPSVersionID: return new ExifByteArray(ExifTag.GPSVersionID, ExifDataType.Byte); |
|||
|
|||
case ExifTagValue.PixelScale: return new ExifDoubleArray(ExifTag.PixelScale); |
|||
case ExifTagValue.IntergraphMatrix: return new ExifDoubleArray(ExifTag.IntergraphMatrix); |
|||
case ExifTagValue.ModelTiePoint: return new ExifDoubleArray(ExifTag.ModelTiePoint); |
|||
case ExifTagValue.ModelTransform: return new ExifDoubleArray(ExifTag.ModelTransform); |
|||
|
|||
case ExifTagValue.SubfileType: return new ExifLong(ExifTag.SubfileType); |
|||
case ExifTagValue.SubIFDOffset: return new ExifLong(ExifTag.SubIFDOffset); |
|||
case ExifTagValue.GPSIFDOffset: return new ExifLong(ExifTag.GPSIFDOffset); |
|||
case ExifTagValue.T4Options: return new ExifLong(ExifTag.T4Options); |
|||
case ExifTagValue.T6Options: return new ExifLong(ExifTag.T6Options); |
|||
case ExifTagValue.XClipPathUnits: return new ExifLong(ExifTag.XClipPathUnits); |
|||
case ExifTagValue.YClipPathUnits: return new ExifLong(ExifTag.YClipPathUnits); |
|||
case ExifTagValue.ProfileType: return new ExifLong(ExifTag.ProfileType); |
|||
case ExifTagValue.CodingMethods: return new ExifLong(ExifTag.CodingMethods); |
|||
case ExifTagValue.T82ptions: return new ExifLong(ExifTag.T82ptions); |
|||
case ExifTagValue.JPEGInterchangeFormat: return new ExifLong(ExifTag.JPEGInterchangeFormat); |
|||
case ExifTagValue.JPEGInterchangeFormatLength: return new ExifLong(ExifTag.JPEGInterchangeFormatLength); |
|||
case ExifTagValue.MDFileTag: return new ExifLong(ExifTag.MDFileTag); |
|||
case ExifTagValue.StandardOutputSensitivity: return new ExifLong(ExifTag.StandardOutputSensitivity); |
|||
case ExifTagValue.RecommendedExposureIndex: return new ExifLong(ExifTag.RecommendedExposureIndex); |
|||
case ExifTagValue.ISOSpeed: return new ExifLong(ExifTag.ISOSpeed); |
|||
case ExifTagValue.ISOSpeedLatitudeyyy: return new ExifLong(ExifTag.ISOSpeedLatitudeyyy); |
|||
case ExifTagValue.ISOSpeedLatitudezzz: return new ExifLong(ExifTag.ISOSpeedLatitudezzz); |
|||
case ExifTagValue.FaxRecvParams: return new ExifLong(ExifTag.FaxRecvParams); |
|||
case ExifTagValue.FaxRecvTime: return new ExifLong(ExifTag.FaxRecvTime); |
|||
case ExifTagValue.ImageNumber: return new ExifLong(ExifTag.ImageNumber); |
|||
|
|||
case ExifTagValue.FreeOffsets: return new ExifLongArray(ExifTag.FreeOffsets); |
|||
case ExifTagValue.FreeByteCounts: return new ExifLongArray(ExifTag.FreeByteCounts); |
|||
case ExifTagValue.ColorResponseUnit: return new ExifLongArray(ExifTag.TileOffsets); |
|||
case ExifTagValue.TileOffsets: return new ExifLongArray(ExifTag.TileOffsets); |
|||
case ExifTagValue.SMinSampleValue: return new ExifLongArray(ExifTag.SMinSampleValue); |
|||
case ExifTagValue.SMaxSampleValue: return new ExifLongArray(ExifTag.SMaxSampleValue); |
|||
case ExifTagValue.JPEGQTables: return new ExifLongArray(ExifTag.JPEGQTables); |
|||
case ExifTagValue.JPEGDCTables: return new ExifLongArray(ExifTag.JPEGDCTables); |
|||
case ExifTagValue.JPEGACTables: return new ExifLongArray(ExifTag.JPEGACTables); |
|||
case ExifTagValue.StripRowCounts: return new ExifLongArray(ExifTag.StripRowCounts); |
|||
case ExifTagValue.IntergraphRegisters: return new ExifLongArray(ExifTag.IntergraphRegisters); |
|||
case ExifTagValue.TimeZoneOffset: return new ExifLongArray(ExifTag.TimeZoneOffset); |
|||
|
|||
case ExifTagValue.ImageWidth: return new ExifNumber(ExifTag.ImageWidth); |
|||
case ExifTagValue.ImageLength: return new ExifNumber(ExifTag.ImageLength); |
|||
case ExifTagValue.TileWidth: return new ExifNumber(ExifTag.TileWidth); |
|||
case ExifTagValue.TileLength: return new ExifNumber(ExifTag.TileLength); |
|||
case ExifTagValue.BadFaxLines: return new ExifNumber(ExifTag.BadFaxLines); |
|||
case ExifTagValue.ConsecutiveBadFaxLines: return new ExifNumber(ExifTag.ConsecutiveBadFaxLines); |
|||
case ExifTagValue.PixelXDimension: return new ExifNumber(ExifTag.PixelXDimension); |
|||
case ExifTagValue.PixelYDimension: return new ExifNumber(ExifTag.PixelYDimension); |
|||
|
|||
case ExifTagValue.StripOffsets: return new ExifNumberArray(ExifTag.StripOffsets); |
|||
case ExifTagValue.TileByteCounts: return new ExifNumberArray(ExifTag.TileByteCounts); |
|||
case ExifTagValue.ImageLayer: return new ExifNumberArray(ExifTag.ImageLayer); |
|||
|
|||
case ExifTagValue.XPosition: return new ExifRational(ExifTag.XPosition); |
|||
case ExifTagValue.YPosition: return new ExifRational(ExifTag.YPosition); |
|||
case ExifTagValue.XResolution: return new ExifRational(ExifTag.XResolution); |
|||
case ExifTagValue.YResolution: return new ExifRational(ExifTag.YResolution); |
|||
case ExifTagValue.BatteryLevel: return new ExifRational(ExifTag.BatteryLevel); |
|||
case ExifTagValue.ExposureTime: return new ExifRational(ExifTag.ExposureTime); |
|||
case ExifTagValue.FNumber: return new ExifRational(ExifTag.FNumber); |
|||
case ExifTagValue.MDScalePixel: return new ExifRational(ExifTag.MDScalePixel); |
|||
case ExifTagValue.CompressedBitsPerPixel: return new ExifRational(ExifTag.CompressedBitsPerPixel); |
|||
case ExifTagValue.ApertureValue: return new ExifRational(ExifTag.ApertureValue); |
|||
case ExifTagValue.MaxApertureValue: return new ExifRational(ExifTag.MaxApertureValue); |
|||
case ExifTagValue.SubjectDistance: return new ExifRational(ExifTag.SubjectDistance); |
|||
case ExifTagValue.FocalLength: return new ExifRational(ExifTag.FocalLength); |
|||
case ExifTagValue.FlashEnergy2: return new ExifRational(ExifTag.FlashEnergy2); |
|||
case ExifTagValue.FocalPlaneXResolution2: return new ExifRational(ExifTag.FocalPlaneXResolution2); |
|||
case ExifTagValue.FocalPlaneYResolution2: return new ExifRational(ExifTag.FocalPlaneYResolution2); |
|||
case ExifTagValue.ExposureIndex2: return new ExifRational(ExifTag.ExposureIndex2); |
|||
case ExifTagValue.Humidity: return new ExifRational(ExifTag.Humidity); |
|||
case ExifTagValue.Pressure: return new ExifRational(ExifTag.Pressure); |
|||
case ExifTagValue.Acceleration: return new ExifRational(ExifTag.Acceleration); |
|||
case ExifTagValue.FlashEnergy: return new ExifRational(ExifTag.FlashEnergy); |
|||
case ExifTagValue.FocalPlaneXResolution: return new ExifRational(ExifTag.FocalPlaneXResolution); |
|||
case ExifTagValue.FocalPlaneYResolution: return new ExifRational(ExifTag.FocalPlaneYResolution); |
|||
case ExifTagValue.ExposureIndex: return new ExifRational(ExifTag.ExposureIndex); |
|||
case ExifTagValue.DigitalZoomRatio: return new ExifRational(ExifTag.DigitalZoomRatio); |
|||
case ExifTagValue.LensInfo: return new ExifRational(ExifTag.LensInfo); |
|||
case ExifTagValue.GPSAltitude: return new ExifRational(ExifTag.GPSAltitude); |
|||
case ExifTagValue.GPSDOP: return new ExifRational(ExifTag.GPSDOP); |
|||
case ExifTagValue.GPSSpeed: return new ExifRational(ExifTag.GPSSpeed); |
|||
case ExifTagValue.GPSTrack: return new ExifRational(ExifTag.GPSTrack); |
|||
case ExifTagValue.GPSImgDirection: return new ExifRational(ExifTag.GPSImgDirection); |
|||
case ExifTagValue.GPSDestBearing: return new ExifRational(ExifTag.GPSDestBearing); |
|||
case ExifTagValue.GPSDestDistance: return new ExifRational(ExifTag.GPSDestDistance); |
|||
|
|||
case ExifTagValue.WhitePoint: return new ExifRationalArray(ExifTag.WhitePoint); |
|||
case ExifTagValue.PrimaryChromaticities: return new ExifRationalArray(ExifTag.PrimaryChromaticities); |
|||
case ExifTagValue.YCbCrCoefficients: return new ExifRationalArray(ExifTag.YCbCrCoefficients); |
|||
case ExifTagValue.ReferenceBlackWhite: return new ExifRationalArray(ExifTag.ReferenceBlackWhite); |
|||
case ExifTagValue.GPSLatitude: return new ExifRationalArray(ExifTag.GPSLatitude); |
|||
case ExifTagValue.GPSLongitude: return new ExifRationalArray(ExifTag.GPSLongitude); |
|||
case ExifTagValue.GPSTimestamp: return new ExifRationalArray(ExifTag.GPSTimestamp); |
|||
case ExifTagValue.GPSDestLatitude: return new ExifRationalArray(ExifTag.GPSDestLatitude); |
|||
case ExifTagValue.GPSDestLongitude: return new ExifRationalArray(ExifTag.GPSDestLongitude); |
|||
|
|||
case ExifTagValue.OldSubfileType: return new ExifShort(ExifTag.OldSubfileType); |
|||
case ExifTagValue.Compression: return new ExifShort(ExifTag.Compression); |
|||
case ExifTagValue.PhotometricInterpretation: return new ExifShort(ExifTag.PhotometricInterpretation); |
|||
case ExifTagValue.Thresholding: return new ExifShort(ExifTag.Thresholding); |
|||
case ExifTagValue.CellWidth: return new ExifShort(ExifTag.CellWidth); |
|||
case ExifTagValue.CellLength: return new ExifShort(ExifTag.CellLength); |
|||
case ExifTagValue.FillOrder: return new ExifShort(ExifTag.FillOrder); |
|||
case ExifTagValue.Orientation: return new ExifShort(ExifTag.Orientation); |
|||
case ExifTagValue.SamplesPerPixel: return new ExifShort(ExifTag.SamplesPerPixel); |
|||
case ExifTagValue.PlanarConfiguration: return new ExifShort(ExifTag.PlanarConfiguration); |
|||
case ExifTagValue.GrayResponseUnit: return new ExifShort(ExifTag.GrayResponseUnit); |
|||
case ExifTagValue.ResolutionUnit: return new ExifShort(ExifTag.ResolutionUnit); |
|||
case ExifTagValue.CleanFaxData: return new ExifShort(ExifTag.CleanFaxData); |
|||
case ExifTagValue.InkSet: return new ExifShort(ExifTag.InkSet); |
|||
case ExifTagValue.NumberOfInks: return new ExifShort(ExifTag.NumberOfInks); |
|||
case ExifTagValue.DotRange: return new ExifShort(ExifTag.DotRange); |
|||
case ExifTagValue.Indexed: return new ExifShort(ExifTag.Indexed); |
|||
case ExifTagValue.OPIProxy: return new ExifShort(ExifTag.OPIProxy); |
|||
case ExifTagValue.JPEGProc: return new ExifShort(ExifTag.JPEGProc); |
|||
case ExifTagValue.JPEGRestartInterval: return new ExifShort(ExifTag.JPEGRestartInterval); |
|||
case ExifTagValue.YCbCrPositioning: return new ExifShort(ExifTag.YCbCrPositioning); |
|||
case ExifTagValue.Rating: return new ExifShort(ExifTag.Rating); |
|||
case ExifTagValue.RatingPercent: return new ExifShort(ExifTag.RatingPercent); |
|||
case ExifTagValue.ExposureProgram: return new ExifShort(ExifTag.ExposureProgram); |
|||
case ExifTagValue.Interlace: return new ExifShort(ExifTag.Interlace); |
|||
case ExifTagValue.SelfTimerMode: return new ExifShort(ExifTag.SelfTimerMode); |
|||
case ExifTagValue.SensitivityType: return new ExifShort(ExifTag.SensitivityType); |
|||
case ExifTagValue.MeteringMode: return new ExifShort(ExifTag.MeteringMode); |
|||
case ExifTagValue.LightSource: return new ExifShort(ExifTag.LightSource); |
|||
case ExifTagValue.FocalPlaneResolutionUnit2: return new ExifShort(ExifTag.FocalPlaneResolutionUnit2); |
|||
case ExifTagValue.SensingMethod2: return new ExifShort(ExifTag.SensingMethod2); |
|||
case ExifTagValue.Flash: return new ExifShort(ExifTag.Flash); |
|||
case ExifTagValue.ColorSpace: return new ExifShort(ExifTag.ColorSpace); |
|||
case ExifTagValue.FocalPlaneResolutionUnit: return new ExifShort(ExifTag.FocalPlaneResolutionUnit); |
|||
case ExifTagValue.SensingMethod: return new ExifShort(ExifTag.SensingMethod); |
|||
case ExifTagValue.CustomRendered: return new ExifShort(ExifTag.CustomRendered); |
|||
case ExifTagValue.ExposureMode: return new ExifShort(ExifTag.ExposureMode); |
|||
case ExifTagValue.WhiteBalance: return new ExifShort(ExifTag.WhiteBalance); |
|||
case ExifTagValue.FocalLengthIn35mmFilm: return new ExifShort(ExifTag.FocalLengthIn35mmFilm); |
|||
case ExifTagValue.SceneCaptureType: return new ExifShort(ExifTag.SceneCaptureType); |
|||
case ExifTagValue.GainControl: return new ExifShort(ExifTag.GainControl); |
|||
case ExifTagValue.Contrast: return new ExifShort(ExifTag.Contrast); |
|||
case ExifTagValue.Saturation: return new ExifShort(ExifTag.Saturation); |
|||
case ExifTagValue.Sharpness: return new ExifShort(ExifTag.Sharpness); |
|||
case ExifTagValue.SubjectDistanceRange: return new ExifShort(ExifTag.SubjectDistanceRange); |
|||
case ExifTagValue.GPSDifferential: return new ExifShort(ExifTag.GPSDifferential); |
|||
|
|||
case ExifTagValue.BitsPerSample: return new ExifShortArray(ExifTag.BitsPerSample); |
|||
case ExifTagValue.MinSampleValue: return new ExifShortArray(ExifTag.MinSampleValue); |
|||
case ExifTagValue.MaxSampleValue: return new ExifShortArray(ExifTag.MaxSampleValue); |
|||
case ExifTagValue.GrayResponseCurve: return new ExifShortArray(ExifTag.GrayResponseCurve); |
|||
case ExifTagValue.ColorMap: return new ExifShortArray(ExifTag.ColorMap); |
|||
case ExifTagValue.ExtraSamples: return new ExifShortArray(ExifTag.ExtraSamples); |
|||
case ExifTagValue.PageNumber: return new ExifShortArray(ExifTag.PageNumber); |
|||
case ExifTagValue.TransferFunction: return new ExifShortArray(ExifTag.TransferFunction); |
|||
case ExifTagValue.Predictor: return new ExifShortArray(ExifTag.Predictor); |
|||
case ExifTagValue.HalftoneHints: return new ExifShortArray(ExifTag.HalftoneHints); |
|||
case ExifTagValue.SampleFormat: return new ExifShortArray(ExifTag.SampleFormat); |
|||
case ExifTagValue.TransferRange: return new ExifShortArray(ExifTag.TransferRange); |
|||
case ExifTagValue.DefaultImageColor: return new ExifShortArray(ExifTag.DefaultImageColor); |
|||
case ExifTagValue.JPEGLosslessPredictors: return new ExifShortArray(ExifTag.JPEGLosslessPredictors); |
|||
case ExifTagValue.JPEGPointTransforms: return new ExifShortArray(ExifTag.JPEGPointTransforms); |
|||
case ExifTagValue.YCbCrSubsampling: return new ExifShortArray(ExifTag.YCbCrSubsampling); |
|||
case ExifTagValue.CFARepeatPatternDim: return new ExifShortArray(ExifTag.CFARepeatPatternDim); |
|||
case ExifTagValue.IntergraphPacketData: return new ExifShortArray(ExifTag.IntergraphPacketData); |
|||
case ExifTagValue.ISOSpeedRatings: return new ExifShortArray(ExifTag.ISOSpeedRatings); |
|||
case ExifTagValue.SubjectArea: return new ExifShortArray(ExifTag.SubjectArea); |
|||
case ExifTagValue.SubjectLocation: return new ExifShortArray(ExifTag.SubjectLocation); |
|||
|
|||
case ExifTagValue.ShutterSpeedValue: return new ExifSignedRational(ExifTag.ShutterSpeedValue); |
|||
case ExifTagValue.BrightnessValue: return new ExifSignedRational(ExifTag.BrightnessValue); |
|||
case ExifTagValue.ExposureBiasValue: return new ExifSignedRational(ExifTag.ExposureBiasValue); |
|||
case ExifTagValue.AmbientTemperature: return new ExifSignedRational(ExifTag.AmbientTemperature); |
|||
case ExifTagValue.WaterDepth: return new ExifSignedRational(ExifTag.WaterDepth); |
|||
case ExifTagValue.CameraElevationAngle: return new ExifSignedRational(ExifTag.CameraElevationAngle); |
|||
|
|||
case ExifTagValue.Decode: return new ExifSignedRationalArray(ExifTag.Decode); |
|||
|
|||
case ExifTagValue.ImageDescription: return new ExifString(ExifTag.ImageDescription); |
|||
case ExifTagValue.Make: return new ExifString(ExifTag.Make); |
|||
case ExifTagValue.Model: return new ExifString(ExifTag.Model); |
|||
case ExifTagValue.Software: return new ExifString(ExifTag.Software); |
|||
case ExifTagValue.DateTime: return new ExifString(ExifTag.DateTime); |
|||
case ExifTagValue.Artist: return new ExifString(ExifTag.Artist); |
|||
case ExifTagValue.HostComputer: return new ExifString(ExifTag.HostComputer); |
|||
case ExifTagValue.Copyright: return new ExifString(ExifTag.Copyright); |
|||
case ExifTagValue.DocumentName: return new ExifString(ExifTag.DocumentName); |
|||
case ExifTagValue.PageName: return new ExifString(ExifTag.PageName); |
|||
case ExifTagValue.InkNames: return new ExifString(ExifTag.InkNames); |
|||
case ExifTagValue.TargetPrinter: return new ExifString(ExifTag.TargetPrinter); |
|||
case ExifTagValue.ImageID: return new ExifString(ExifTag.ImageID); |
|||
case ExifTagValue.MDLabName: return new ExifString(ExifTag.MDLabName); |
|||
case ExifTagValue.MDSampleInfo: return new ExifString(ExifTag.MDSampleInfo); |
|||
case ExifTagValue.MDPrepDate: return new ExifString(ExifTag.MDPrepDate); |
|||
case ExifTagValue.MDPrepTime: return new ExifString(ExifTag.MDPrepTime); |
|||
case ExifTagValue.MDFileUnits: return new ExifString(ExifTag.MDFileUnits); |
|||
case ExifTagValue.SEMInfo: return new ExifString(ExifTag.SEMInfo); |
|||
case ExifTagValue.SpectralSensitivity: return new ExifString(ExifTag.SpectralSensitivity); |
|||
case ExifTagValue.DateTimeOriginal: return new ExifString(ExifTag.DateTimeOriginal); |
|||
case ExifTagValue.DateTimeDigitized: return new ExifString(ExifTag.DateTimeDigitized); |
|||
case ExifTagValue.SubsecTime: return new ExifString(ExifTag.SubsecTime); |
|||
case ExifTagValue.SubsecTimeOriginal: return new ExifString(ExifTag.SubsecTimeOriginal); |
|||
case ExifTagValue.SubsecTimeDigitized: return new ExifString(ExifTag.SubsecTimeDigitized); |
|||
case ExifTagValue.RelatedSoundFile: return new ExifString(ExifTag.RelatedSoundFile); |
|||
case ExifTagValue.FaxSubaddress: return new ExifString(ExifTag.FaxSubaddress); |
|||
case ExifTagValue.OffsetTime: return new ExifString(ExifTag.OffsetTime); |
|||
case ExifTagValue.OffsetTimeOriginal: return new ExifString(ExifTag.OffsetTimeOriginal); |
|||
case ExifTagValue.OffsetTimeDigitized: return new ExifString(ExifTag.OffsetTimeDigitized); |
|||
case ExifTagValue.SecurityClassification: return new ExifString(ExifTag.SecurityClassification); |
|||
case ExifTagValue.ImageHistory: return new ExifString(ExifTag.ImageHistory); |
|||
case ExifTagValue.ImageUniqueID: return new ExifString(ExifTag.ImageUniqueID); |
|||
case ExifTagValue.OwnerName: return new ExifString(ExifTag.OwnerName); |
|||
case ExifTagValue.SerialNumber: return new ExifString(ExifTag.SerialNumber); |
|||
case ExifTagValue.LensMake: return new ExifString(ExifTag.LensMake); |
|||
case ExifTagValue.LensModel: return new ExifString(ExifTag.LensModel); |
|||
case ExifTagValue.LensSerialNumber: return new ExifString(ExifTag.LensSerialNumber); |
|||
case ExifTagValue.GDALMetadata: return new ExifString(ExifTag.GDALMetadata); |
|||
case ExifTagValue.GDALNoData: return new ExifString(ExifTag.GDALNoData); |
|||
case ExifTagValue.GPSLatitudeRef: return new ExifString(ExifTag.GPSLatitudeRef); |
|||
case ExifTagValue.GPSLongitudeRef: return new ExifString(ExifTag.GPSLongitudeRef); |
|||
case ExifTagValue.GPSSatellites: return new ExifString(ExifTag.GPSSatellites); |
|||
case ExifTagValue.GPSStatus: return new ExifString(ExifTag.GPSStatus); |
|||
case ExifTagValue.GPSMeasureMode: return new ExifString(ExifTag.GPSMeasureMode); |
|||
case ExifTagValue.GPSSpeedRef: return new ExifString(ExifTag.GPSSpeedRef); |
|||
case ExifTagValue.GPSTrackRef: return new ExifString(ExifTag.GPSTrackRef); |
|||
case ExifTagValue.GPSImgDirectionRef: return new ExifString(ExifTag.GPSImgDirectionRef); |
|||
case ExifTagValue.GPSMapDatum: return new ExifString(ExifTag.GPSMapDatum); |
|||
case ExifTagValue.GPSDestLatitudeRef: return new ExifString(ExifTag.GPSDestLatitudeRef); |
|||
case ExifTagValue.GPSDestLongitudeRef: return new ExifString(ExifTag.GPSDestLongitudeRef); |
|||
case ExifTagValue.GPSDestBearingRef: return new ExifString(ExifTag.GPSDestBearingRef); |
|||
case ExifTagValue.GPSDestDistanceRef: return new ExifString(ExifTag.GPSDestDistanceRef); |
|||
case ExifTagValue.GPSDateStamp: return new ExifString(ExifTag.GPSDateStamp); |
|||
|
|||
case ExifTagValue.FileSource: return new ExifByte(ExifTag.FileSource, ExifDataType.Undefined); |
|||
case ExifTagValue.SceneType: return new ExifByte(ExifTag.SceneType, ExifDataType.Undefined); |
|||
|
|||
case ExifTagValue.JPEGTables: return new ExifByteArray(ExifTag.JPEGTables, ExifDataType.Undefined); |
|||
case ExifTagValue.OECF: return new ExifByteArray(ExifTag.OECF, ExifDataType.Undefined); |
|||
case ExifTagValue.ExifVersion: return new ExifByteArray(ExifTag.ExifVersion, ExifDataType.Undefined); |
|||
case ExifTagValue.ComponentsConfiguration: return new ExifByteArray(ExifTag.ComponentsConfiguration, ExifDataType.Undefined); |
|||
case ExifTagValue.MakerNote: return new ExifByteArray(ExifTag.MakerNote, ExifDataType.Undefined); |
|||
case ExifTagValue.UserComment: return new ExifByteArray(ExifTag.UserComment, ExifDataType.Undefined); |
|||
case ExifTagValue.FlashpixVersion: return new ExifByteArray(ExifTag.FlashpixVersion, ExifDataType.Undefined); |
|||
case ExifTagValue.SpatialFrequencyResponse: return new ExifByteArray(ExifTag.SpatialFrequencyResponse, ExifDataType.Undefined); |
|||
case ExifTagValue.SpatialFrequencyResponse2: return new ExifByteArray(ExifTag.SpatialFrequencyResponse2, ExifDataType.Undefined); |
|||
case ExifTagValue.Noise: return new ExifByteArray(ExifTag.Noise, ExifDataType.Undefined); |
|||
case ExifTagValue.CFAPattern: return new ExifByteArray(ExifTag.CFAPattern, ExifDataType.Undefined); |
|||
case ExifTagValue.DeviceSettingDescription: return new ExifByteArray(ExifTag.DeviceSettingDescription, ExifDataType.Undefined); |
|||
case ExifTagValue.ImageSourceData: return new ExifByteArray(ExifTag.ImageSourceData, ExifDataType.Undefined); |
|||
case ExifTagValue.GPSProcessingMethod: return new ExifByteArray(ExifTag.GPSProcessingMethod, ExifDataType.Undefined); |
|||
case ExifTagValue.GPSAreaInformation: return new ExifByteArray(ExifTag.GPSAreaInformation, ExifDataType.Undefined); |
|||
|
|||
default: return null; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal abstract class ExifValue<TValueType> : ExifValue, IExifValue<TValueType> |
|||
{ |
|||
protected ExifValue(ExifTag<TValueType> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
protected ExifValue(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
internal ExifValue(ExifValue value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public TValueType Value { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the value of the current instance as a string.
|
|||
/// </summary>
|
|||
protected abstract string StringValue { get; } |
|||
|
|||
public override object GetValue() => this.Value; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (value is null) |
|||
{ |
|||
this.Value = default; |
|||
return true; |
|||
} |
|||
|
|||
// We use type comparison here over "is" to avoid compiler optimizations
|
|||
// that equate short with ushort, and sbyte with byte.
|
|||
if (value.GetType() == typeof(TValueType)) |
|||
{ |
|||
this.Value = (TValueType)value; |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override string ToString() |
|||
{ |
|||
if (this.Value == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
string description = ExifTagDescriptionAttribute.GetDescription(this.Tag, this.Value); |
|||
return description ?? this.StringValue; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <summary>
|
|||
/// A value of the exif profile.
|
|||
/// </summary>
|
|||
public interface IExifValue : IDeepCloneable<IExifValue> |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the data type of the exif value.
|
|||
/// </summary>
|
|||
ExifDataType DataType { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether the value is an array.
|
|||
/// </summary>
|
|||
bool IsArray { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the tag of the exif value.
|
|||
/// </summary>
|
|||
ExifTag Tag { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the value of this exif value.
|
|||
/// </summary>
|
|||
/// <returns>The value of this exif value.</returns>
|
|||
object GetValue(); |
|||
|
|||
/// <summary>
|
|||
/// Sets the value of this exif value.
|
|||
/// </summary>
|
|||
/// <param name="value">The value of this exif value.</param>
|
|||
/// <returns>A value indicating whether the value could be set.</returns>
|
|||
bool TrySetValue(object value); |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <summary>
|
|||
/// A value of the exif profile.
|
|||
/// </summary>
|
|||
/// <typeparam name="TValueType">The type of the value.</typeparam>
|
|||
public interface IExifValue<TValueType> : IExifValue |
|||
{ |
|||
/// <summary>
|
|||
/// Gets or sets the value.
|
|||
/// </summary>
|
|||
TValueType Value { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,187 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Globalization; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
namespace SixLabors.ImageSharp.Primitives |
|||
{ |
|||
/// <summary>
|
|||
/// Represents an integral number.
|
|||
/// </summary>
|
|||
[StructLayout(LayoutKind.Explicit)] |
|||
public struct Number : IEquatable<Number>, IComparable<Number> |
|||
{ |
|||
[FieldOffset(0)] |
|||
private readonly int signedValue; |
|||
|
|||
[FieldOffset(0)] |
|||
private readonly uint unsignedValue; |
|||
|
|||
[FieldOffset(4)] |
|||
private readonly bool isSigned; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Number"/> struct.
|
|||
/// </summary>
|
|||
/// <param name="value">The value of the number.</param>
|
|||
public Number(int value) |
|||
: this() |
|||
{ |
|||
this.signedValue = value; |
|||
this.isSigned = true; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Number"/> struct.
|
|||
/// </summary>
|
|||
/// <param name="value">The value of the number.</param>
|
|||
public Number(uint value) |
|||
: this() |
|||
{ |
|||
this.unsignedValue = value; |
|||
this.isSigned = false; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="int"/> to an instance of this type.
|
|||
/// </summary>
|
|||
/// <param name="value">The value.</param>
|
|||
public static implicit operator Number(int value) => new Number(value); |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="uint"/> to an instance of this type.
|
|||
/// </summary>
|
|||
/// <param name="value">The value.</param>
|
|||
public static implicit operator Number(uint value) => new Number(value); |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="ushort"/> to an instance of this type.
|
|||
/// </summary>
|
|||
/// <param name="value">The value.</param>
|
|||
public static implicit operator Number(ushort value) => new Number((uint)value); |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="Number"/> to a <see cref="int"/>.
|
|||
/// </summary>
|
|||
/// <param name="number">The <see cref="Number"/> to convert.</param>
|
|||
public static explicit operator int(Number number) |
|||
{ |
|||
return number.isSigned |
|||
? number.signedValue |
|||
: (int)number.unsignedValue.Clamp(0, int.MaxValue); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="Number"/> to a <see cref="uint"/>.
|
|||
/// </summary>
|
|||
/// <param name="number">The <see cref="Number"/> to convert.</param>
|
|||
public static explicit operator uint(Number number) |
|||
{ |
|||
return number.isSigned |
|||
? (uint)number.signedValue.Clamp(0, int.MaxValue) |
|||
: number.unsignedValue; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts the specified <see cref="Number"/> to a <see cref="ushort"/>.
|
|||
/// </summary>
|
|||
/// <param name="number">The <see cref="Number"/> to convert.</param>
|
|||
public static explicit operator ushort(Number number) |
|||
{ |
|||
return number.isSigned |
|||
? (ushort)number.signedValue.Clamp(ushort.MinValue, ushort.MaxValue) |
|||
: (ushort)number.unsignedValue.Clamp(ushort.MinValue, ushort.MaxValue); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the specified <see cref="Number"/> instances are considered equal.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="Number"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="Number"/> to compare.</param>
|
|||
public static bool operator ==(Number left, Number right) => Equals(left, right); |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the specified <see cref="Number"/> instances are not considered equal.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="Number"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="Number"/> to compare.</param>
|
|||
public static bool operator !=(Number left, Number right) => !Equals(left, right); |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the first <see cref="Number"/> is more than the second <see cref="Number"/>.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="Number"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="Number"/> to compare.</param>
|
|||
public static bool operator >(Number left, Number right) => left.CompareTo(right) == 1; |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the first <see cref="Number"/> is less than the second <see cref="Number"/>.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="Number"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="Number"/> to compare.</param>
|
|||
public static bool operator <(Number left, Number right) => left.CompareTo(right) == -1; |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the first <see cref="Number"/> is more than or equal to the second <see cref="Number"/>.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="Number"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="Number"/> to compare.</param>
|
|||
public static bool operator >=(Number left, Number right) => left.CompareTo(right) >= 0; |
|||
|
|||
/// <summary>
|
|||
/// Determines whether the first <see cref="Number"/> is less than or equal to the second <see cref="Number"/>.
|
|||
/// </summary>
|
|||
/// <param name="left">The first <see cref="Number"/> to compare.</param>
|
|||
/// <param name="right"> The second <see cref="Number"/> to compare.</param>
|
|||
public static bool operator <=(Number left, Number right) => left.CompareTo(right) <= 0; |
|||
|
|||
/// <inheritdoc/>
|
|||
public int CompareTo(Number other) |
|||
{ |
|||
return this.isSigned |
|||
? this.signedValue.CompareTo(other.signedValue) |
|||
: this.unsignedValue.CompareTo(other.unsignedValue); |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override bool Equals(object obj) => obj is Number other && this.Equals(other); |
|||
|
|||
/// <inheritdoc/>
|
|||
public bool Equals(Number other) |
|||
{ |
|||
if (this.isSigned != other.isSigned) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
return this.isSigned |
|||
? this.signedValue.Equals(other.signedValue) |
|||
: this.unsignedValue.Equals(other.unsignedValue); |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override int GetHashCode() |
|||
{ |
|||
return this.isSigned |
|||
? this.signedValue.GetHashCode() |
|||
: this.unsignedValue.GetHashCode(); |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override string ToString() => this.ToString(CultureInfo.InvariantCulture); |
|||
|
|||
/// <summary>
|
|||
/// Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
|
|||
/// </summary>
|
|||
/// <param name="provider">An object that supplies culture-specific formatting information.</param>
|
|||
/// <returns>The string representation of the value of this instance, which consists of a sequence of digits ranging from 0 to 9, without a sign or leading zeros.</returns>
|
|||
public string ToString(IFormatProvider provider) |
|||
{ |
|||
return this.isSigned |
|||
? this.signedValue.ToString(provider) |
|||
: this.unsignedValue.ToString(provider); |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue