public static void AddColorProfileReader(PipelineContext ctx) { var mode = ctx.Settings.ColorProfileMode; if (mode == ColorProfileMode.Ignore) { return; } var fmt = ctx.ImageFrame is IYccImageFrame ? PixelFormat.Bgr24Bpp : ctx.Source.Format; if (ctx.ImageFrame is WicImageFrame wicFrame) { var profile = WicColorProfile.GetSourceProfile(wicFrame.ColorProfileSource, mode); ctx.SourceColorProfile = profile.ParsedProfile; ctx.WicContext.SourceColorContext = profile.WicColorContext; ctx.WicContext.DestColorContext = WicColorProfile.GetDestProfile(wicFrame.ColorProfileSource, mode).WicColorContext; } else { var profile = ColorProfile.Cache.GetOrAdd(ctx.ImageFrame.IccProfile); ctx.SourceColorProfile = profile.IsValid && profile.IsCompatibleWith(fmt) ? ColorProfile.GetSourceProfile(profile, mode) : ColorProfile.GetDefaultFor(fmt); } ctx.DestColorProfile = ColorProfile.GetDestProfile(ctx.SourceColorProfile, mode); }
private static void TestEmbeddedResource(ColorProfile profile) { Assert.IsNotNull(profile); Assert.AreEqual("icc", profile.Name); }
private static void TestProfile(ColorProfile profile, string name) { Assert.IsNotNull(profile); Assert.AreEqual(name, profile.Name); Assert.AreEqual(3144, profile.ToByteArray().Length); }
public bool PrepareTransform(COLORMODE srccolormode, ColorProfile srcprofile, COLORMODE dstcolormode, ColorProfile dstprofile, bool bgr) { bool ret = C4dApiPINVOKE.ColorProfileConvert_PrepareTransform(swigCPtr, (int)srccolormode, ColorProfile.getCPtr(srcprofile), (int)dstcolormode, ColorProfile.getCPtr(dstprofile), bgr); return(ret); }
public void SetColorProfile(ColorProfile value) { }
public GraphEditDialogViewModel(ColorProfile colorProfile) { this.colorProfile = colorProfile; }
public ICCProfile(string name, ColorProfile profile) { this.Name = name; this.Profile = profile; }
public static T To <T>(this Color color, ColorProfile destinationProfile = null, ColorManagementEngine engine = ColorManagementEngine.LittleCms, ColorProfile targetDeviceProfile = null, ColorTransformationIntent transformationIntent = ColorTransformationIntent.Perceptual) where T : Color, new() { return(ColorExtension.ConvertColor <T>(color, destinationProfile, engine, targetDeviceProfile, transformationIntent)); }
internal static T ConvertColor <T>(Color color, string destinationProfile, ColorManagementEngine engine = ColorManagementEngine.LittleCms, ColorProfile targetDeviceProfile = null, ColorTransformationIntent transformationIntent = ColorTransformationIntent.Perceptual) where T : Color, new() { return(ConvertColor <T>(color, new ColorProfile(destinationProfile), engine, targetDeviceProfile, transformationIntent)); }
internal static T ConvertColor <T>(Color color, ColorProfile destinationProfile, ColorManagementEngine engine = ColorManagementEngine.LittleCms, ColorProfile targetDeviceProfile = null, ColorTransformationIntent transformationIntent = ColorTransformationIntent.Perceptual) where T : Color, new() { if (destinationProfile == null) { Type colorType = typeof(T); if (colorType != typeof(LabColor) && colorType != typeof(Lab16Color)) { throw new ArgumentException("Destination profile should be specified for converting to non-absolute color space (LabColor or Lab16Color)", "destinationProfile"); } } using (var cc = new Aurigma.GraphicsMill.Transforms.ColorConverter()) { cc.DestinationProfile = destinationProfile; cc.TargetDeviceProfile = targetDeviceProfile; cc.ColorManagementEngine = engine; cc.TransformationIntent = transformationIntent; T tempColor = new T(); cc.DestinationPixelFormat = tempColor.PixelFormat; return((T)cc.ConvertColor(color, color.Profile)); } }