Source/NFX/Media/PDF/Styling/PdfColor.cs
/// <summary>
/// Returns existing color by name or creates and registers a new one
/// </summary>
Returns existing color by name or creates and registers a new one
Returns existing color by name or creates and registers a new one
public static PdfColor ByName(string name, byte r, byte g, byte b)
      {
        if (name.IsNullOrWhiteSpace())
         throw new PdfException(StringConsts.ARGUMENT_ERROR + typeof(PdfColor).Name + ".ByName(name==null|empty)");
        var result = s_Colors.GetOrRegister(name, pts => new PdfColor(name, pts.Item1, pts.Item2, pts.Item3), new Tuple<byte, byte, byte>(r, g, b));
        if (r != result.R || g != result.G || b != result.B)
         throw new PdfException(StringConsts.PDF_COLOR_INCONSISTENCY_ERROR.Args(name));
        return result;
      }
public static PdfColor ByName ( string name , byte r , byte g , byte b ) { if ( name . IsNullOrWhiteSpace ( ) ) throw new PdfException ( StringConsts . ARGUMENT_ERROR + typeof ( PdfColor ) . Name + " " ) ; var result = s_Colors . GetOrRegister ( name , pts => new PdfColor ( name , pts . Item1 , pts . Item2 , pts . Item3 ) , new Tuple < byte , byte , byte > ( r , g , b ) ) ; if ( r != result . R || g != result . G || b != result . B ) throw new PdfException ( StringConsts . PDF_COLOR_INCONSISTENCY_ERROR . Args ( name ) ) ; return result ; }
Returns existing color by name or creates and registers a new one
Returns existing color by name or creates and registers a new one
name
string
r
byte
g
byte
b
byte