/// <summary> /// Initializes a new instance for the given FITAG that contains /// a palette. /// </summary> /// <param name="tag">The tag containing the palette.</param> /// <exception cref="ArgumentNullException"><paramref name="tag"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="tag"/> is not /// <see cref="FREE_IMAGE_MDTYPE.FIDT_PALETTE"/>.</exception> public Palette(FITAG tag) : base(FreeImage.GetTagValue(tag), (int)FreeImage.GetTagCount(tag)) { if (FreeImage.GetTagType(tag) != FREE_IMAGE_MDTYPE.FIDT_PALETTE) { throw new ArgumentException("tag"); } }
/// <summary> /// Initializes a new instance for the given MetadataTag that contains /// a palette. /// </summary> /// <param name="tag">The tag containing the palette.</param> /// <exception cref="ArgumentException"><paramref name="tag"/> is not /// <see cref="FREE_IMAGE_MDTYPE.FIDT_PALETTE"/>.</exception> public Palette(MetadataTag tag) : base(FreeImage.GetTagValue(tag.tag), (int)tag.Count) { if (FreeImage.GetTagType(tag) != FREE_IMAGE_MDTYPE.FIDT_PALETTE) { throw new ArgumentException("tag"); } }
/// <summary> /// Initializes a new instance based on the specified parameters. /// </summary> /// <param name="tag">The tag to read the data from.</param> public unsafe FIRational(FITAG tag) { switch (FreeImage.GetTagType(tag)) { case FREE_IMAGE_MDTYPE.FIDT_SRATIONAL: int* value = (int*)FreeImage.GetTagValue(tag); numerator = (int)value[0]; denominator = (int)value[1]; Normalize(); return; default: throw new ArgumentException("tag"); } }