Example #1
0
 /// <summary>
 /// Create a new <see cref="IndexedColorSpaceDetails"/>.
 /// </summary>
 public IndexedColorSpaceDetails(ColorSpaceDetails baseColorSpaceDetails, byte hiVal, IReadOnlyList <byte> colorTable)
     : base(ColorSpace.Indexed)
 {
     BaseColorSpaceDetails = baseColorSpaceDetails ?? throw new ArgumentNullException(nameof(baseColorSpaceDetails));
     HiVal      = hiVal;
     ColorTable = colorTable;
     BaseType   = baseColorSpaceDetails.BaseType;
 }
Example #2
0
 /// <summary>
 /// Create a new <see cref="SeparationColorSpaceDetails"/>.
 /// </summary>
 public SeparationColorSpaceDetails(NameToken name,
                                    ColorSpaceDetails alternateColorSpaceDetails,
                                    Union <DictionaryToken, StreamToken> tintFunction)
     : base(ColorSpace.Separation)
 {
     Name = name;
     AlternateColorSpaceDetails = alternateColorSpaceDetails;
     TintFunction = tintFunction;
 }
Example #3
0
        /// <summary>
        /// Creates a indexed color space useful for exracting stencil masks as black-and-white images,
        /// i.e. with a color palette of two colors (black and white). If the decode parameter array is
        /// [0, 1] it indicates that black is at index 0 in the color palette, whereas [1, 0] indicates
        /// that the black color is at index 1.
        /// </summary>
        internal static ColorSpaceDetails Stencil(ColorSpaceDetails colorSpaceDetails, decimal[] decode)
        {
            var blackIsOne = decode.Length >= 2 && decode[0] == 1 && decode[1] == 0;

            return(new IndexedColorSpaceDetails(colorSpaceDetails, 1, blackIsOne ? new byte[] { 255, 0 } : new byte[] { 0, 255 }));
        }