internal static IColorComponents Load(ColorBookReader reader) { ComponentRGB rgb = new ComponentRGB(); rgb.Red = reader.ReadByte(); rgb.Green = reader.ReadByte(); rgb.Blue = reader.ReadByte(); return rgb; }
internal static IColorComponents Load(ColorBookReader reader) { ComponentLab lab = new ComponentLab(); lab.L = (byte)(reader.ReadByte() / 2.55d + 0.5d); lab.a = (sbyte)(reader.ReadByte() - 128); lab.b = (sbyte)(reader.ReadByte() - 128); return lab; }
internal static ColorRecord Load(ColorBookReader reader, ColorSpace colorSpace) { ColorRecord color = new ColorRecord(); color.Name = StringUtil.ReadValue(reader.ReadString()); color.Code = Encoding.ASCII.GetString(reader.ReadBytes(6)); color.Components = BaseColorComponent.LoadComponents(reader, colorSpace); return color; }
internal static IColorComponents Load(ColorBookReader reader) { ComponentCMYK cmyk = new ComponentCMYK(); cmyk.Cyan = (byte)((255d - reader.ReadByte()) / 2.55d + 0.5d); cmyk.Magenta = (byte)((255d - reader.ReadByte()) / 2.55d + 0.5d); cmyk.Yellow = (byte)((255d - reader.ReadByte()) / 2.55d + 0.5d); cmyk.Key = (byte)((255d - reader.ReadByte()) / 2.55d + 0.5d); return cmyk; }
internal static IColorComponents LoadComponents(ColorBookReader reader, ColorSpace colorSpace) { switch (colorSpace) { case ColorSpace.RGB: return ComponentRGB.Load(reader); case ColorSpace.CMYK: return ComponentCMYK.Load(reader); case ColorSpace.Lab: return ComponentLab.Load(reader); default: throw new NotSupportedException(); } }