code: protected boolean fill(final Context2D context, final Attributes attr, double alpha)
      {
          final boolean filled = attr.hasFill();
  
          if ((filled) || (attr.isFillShapeForSelection()))
          {
              alpha = alpha * attr.getFillAlpha();
  
              if (alpha <= 0)
              {
                  return false;
              }
              if (context.isSelection())
              {
                  final String color = getColorKey();
  
                  if (null == color)
                  {
                      return false;
                  }
                  context.save();
  
                  context.setFillColor(color);
  
                  context.fill();
  
                  context.restore();
  
                  return true;
              }
              if (false == filled)
              {
                  return false;
              }
              context.save();
  
              if (attr.hasShadow())
              {
                  doApplyShadow(context, attr);
              }
              context.setGlobalAlpha(alpha);
  
              final String fill = attr.getFillColor();
  
              if (null != fill)
              {
                  context.setFillColor(fill);
  
                  context.fill();
  
                  context.restore();
  
                  return true;
              }
              final FillGradient grad = attr.getFillGradient();
  
              if (null != grad)
              {
                  final String type = grad.getType();
  
                  if (LinearGradient.TYPE.equals(type))
                  {
                      context.setFillGradient(grad.asLinearGradient());
  
                      context.fill();
  
                      context.restore();
  
                      return true;
                  }
                  else if (RadialGradient.TYPE.equals(type))
                  {
                      context.setFillGradient(grad.asRadialGradient());
  
                      context.fill();
  
                      context.restore();
  
                      return true;
                  }
                  else if (PatternGradient.TYPE.equals(type))
                  {
                      context.setFillGradient(grad.asPatternGradient());
  
                      context.fill();
  
                      context.restore();
  
                      return true;
                  }
              }
              context.restore();
          }
          return false;
      }
docs: Fills the Shape using the passed attributes.
  This method will silently also fill the Shape to its unique rgb color if the context is a buffer.
  
  @param context
  @param attr