private void Check(MainForm form, IWICBitmapDecoderInfo info, Tag tag) { ComponentInfoHelper.CheckNotReserverdGuid(form, info.GetContainerFormat, this); tag.PixelFormats = PixelFormatInfoRule.CheckPixelFormats(form, this, info.GetPixelFormats); ComponentInfoHelper.CheckVersion(form, info.GetColorManagementVersion, this); ComponentInfoHelper.CheckCommaSeparatedString(form, info.GetMimeTypes, ComponentInfoHelper.MimeMask, this); tag.Extensions = ComponentInfoHelper.CheckCommaSeparatedString(form, info.GetFileExtensions, ComponentInfoHelper.ExtensionMask, this); if (!info.DoesSupportMultiframe() && info.DoesSupportAnimation()) { form.Add(this, Resources.DecoderAnimationIfMultiframe); } tag.SupportsMultiframe = info.DoesSupportMultiframe(); uint size = info.GetPatterns(0, IntPtr.Zero, out var count); if (size != 0) { IntPtr p = Marshal.AllocCoTaskMem((int)size); try { info.GetPatterns(size, p, out count); WICBitmapPattern[] patterns = PropVariantMarshaler.ToArrayOf <WICBitmapPattern>(p, (int)count); int index = 0; var dups = new HashSet <int>(); foreach (WICBitmapPattern pattern in patterns) { index++; if (pattern.Length == 0) { form.Add(this, Resources.PatternZeroLength, new DataEntry(Resources.PatternIndex, index)); } else if (index < patterns.Length) { if (Array.FindIndex(patterns, index, delegate(WICBitmapPattern obj) { return(obj.EndOfStream == pattern.EndOfStream && obj.Position == pattern.Position && GetNormalizedMask(obj).ItemsEqual(GetNormalizedMask(pattern))); }) >= 0) { dups.Add(index); } } } if (dups.Count > 0) { form.Add(this, Resources.PatternDuplicated, new DataEntry(Resources.PatternIndices, dups.ToArray())); } } finally { Marshal.FreeCoTaskMem(p); } } if (count == 0 || size == 0) { form.Add(this, Resources.PatternNo); } }
private void Check(MainForm form, IWICFormatConverterInfo info, object tag) { Guid[] pixelFormats = PixelFormatInfoRule.CheckPixelFormats(form, this, info.GetPixelFormats); Type type = Type.GetTypeFromCLSID(Parent.Clsid); if (type == null) { form.Add(this, Resources.PixelFormatConverterNotCreatable); } else { IWICImagingFactory factory = (IWICImagingFactory) new WICImagingFactory(); foreach (Guid g in pixelFormats) { bool supportsTo = false; bool supportsFrom = false; foreach (Guid c in canonical) { supportsTo |= CheckConvertion(form, info, g, c); supportsFrom |= CheckConvertion(form, info, c, g); } if (!supportsTo) { form.Add(this, Resources.ToCannonicalNotSupported, new DataEntry(Resources.PixelFormat, g)); } if (!supportsFrom) { form.Add(this, Resources.FromCannonicalNotSupported, new DataEntry(Resources.PixelFormat, g)); } } } }
void Check(MainForm form, IWICBitmapEncoderInfo info, Tag tag) { ComponentInfoHelper.CheckNotReserverdGuid(form, info.GetContainerFormat, this); tag.PixelFormats = PixelFormatInfoRule.CheckPixelFormats(form, this, info.GetPixelFormats); ComponentInfoHelper.CheckVersion(form, info.GetColorManagementVersion, this); ComponentInfoHelper.CheckCommaSeparatedString(form, info.GetMimeTypes, ComponentInfoHelper.MimeMask, this); tag.Extensions = ComponentInfoHelper.CheckCommaSeparatedString(form, info.GetFileExtensions, ComponentInfoHelper.ExtensionMask, this); if (!info.DoesSupportMultiframe() && info.DoesSupportAnimation()) { form.Add(this, Resources.DecoderAnimationIfMultiframe); } tag.SupportsMultiframe = info.DoesSupportMultiframe(); }