示例#1
0
 /// <summary>
 /// Creates the PdfRadialShading
 /// </summary>
 /// <param name="x0">The x0.</param>
 /// <param name="y0">The y0.</param>
 /// <param name="r0">The r0.</param>
 /// <param name="x1">The x1.</param>
 /// <param name="y1">The y1.</param>
 /// <param name="r1">The r1.</param>
 /// <param name="startColor">The start color.</param>
 /// <param name="endColor">The end color.</param>
 /// <param name="extendStart">if set to <c>true</c> [extend start].</param>
 /// <param name="extendEnd">if set to <c>true</c> [extend end].</param>
 /// <returns></returns>
 public static PdfRadialShading Create(float x0, float y0, float r0, float x1, float y1, float r1, PdfColor startColor, PdfColor endColor, bool extendStart, bool extendEnd)
 {
     if (startColor == null)
     {
         throw new PdfArgumentNullException("startColor");
     }
     if (endColor == null)
     {
         throw new PdfArgumentNullException("endColor");
     }
     float[] domain = new float[2];
     domain[1] = 1f;
     return(new PdfRadialShading(new float[] { x0, y0, r0, x1, y1, r1 }, PdfFunction.Type2(domain, null, 1f, startColor.ToArray(), endColor.ToArray()))
     {
         ExtendStart = extendStart, ExtendEnd = extendEnd
     });
 }
示例#2
0
 /// <summary>
 /// Creates the specified x0.
 /// </summary>
 /// <param name="x0">The x0.</param>
 /// <param name="y0">The y0.</param>
 /// <param name="r0">The r0.</param>
 /// <param name="x1">The x1.</param>
 /// <param name="y1">The y1.</param>
 /// <param name="r1">The r1.</param>
 /// <param name="colors">The colors.</param>
 /// <param name="offsets">The offsets.</param>
 /// <param name="extendStart">if set to <c>true</c> [extend start].</param>
 /// <param name="extendEnd">if set to <c>true</c> [extend end].</param>
 /// <returns></returns>
 public static PdfRadialShading Create(float x0, float y0, float r0, float x1, float y1, float r1, List <PdfColor> colors, List <float> offsets, bool extendStart, bool extendEnd)
 {
     if ((colors == null) || (colors.Count <= 0))
     {
         throw new PdfArgumentNullException("colors");
     }
     if ((offsets == null) || (offsets.Count <= 0))
     {
         throw new PdfArgumentNullException("offsets");
     }
     float[] domain = new float[2];
     domain[1] = 1f;
     return(new PdfRadialShading(new float[] { x0, y0, r0, x1, y1, r1 }, PdfFunction.Type4(domain, new float[] { 0f, 1f, 0f, 1f, 0f, 1f }, PdfShading.GetPostScriptCode(colors, offsets)))
     {
         ExtendStart = extendStart, ExtendEnd = extendEnd
     });
 }